diff --git a/research/paired-extension-normal45/.gitattributes b/research/paired-extension-normal45/.gitattributes new file mode 100644 index 0000000000..e1d75a2b2d --- /dev/null +++ b/research/paired-extension-normal45/.gitattributes @@ -0,0 +1,2 @@ +# Keep vendored, data, allocation and evidence bytes exact (the repository default normalizes text). +* -text diff --git a/research/paired-extension-normal45/ALLOCATION-PINS.json b/research/paired-extension-normal45/ALLOCATION-PINS.json new file mode 100644 index 0000000000..b849393399 --- /dev/null +++ b/research/paired-extension-normal45/ALLOCATION-PINS.json @@ -0,0 +1,14 @@ +{ + "allocation/DISPATCH.json": "65e435bd68e97243c003677271b88485a29d4d0fae2dff1354100404a145e74c", + "allocation/FILL.json.gz": "1880caffbea87cf9e946be60528fbc68c119e8e2ff56df9370b6cc373fc50e66", + "allocation/ORDER.json": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1", + "allocation/PROFILE.json": "c462213fe141f04bdcd680f040bb7f746717265894395b845204f1115e1f904e", + "allocation/PROVIDERS.json": "c20af31dd673bd1f731d4e78b4d2320c3ea6179267f574c170efc4e9c4ef5955", + "allocation/SEARCH.json": "c8d6a39f7f7ea027aac8cd5c68407446b70c142281b460fe354b031188466eb3", + "allocation/baseline/CLAIM.json": "9c2c14158780a677b3661623d7476acc4f535ac9e0481addfa1d6c4c7633b74b", + "allocation/baseline/ORDER.json": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1", + "allocation/baseline/PROFILE.json": "8b6f825a93cb1fa94047b062f1b1b8d489b2c397ec0c8114d0e53737f56c065e", + "allocation/vendor/PLAN.json.gz": "d566cfb87b71639d4138e1f89b543e2dd6a7772070226a2a14c799a6835bf21e", + "allocation/vendor/TEMPLATE.json.gz": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e", + "allocation/vendor/independent_owners.py": "77a848729159e271ba64f403dfd59dddb13044b17b2950fa56700f442e2fe461" +} diff --git a/research/paired-extension-normal45/CLAIM.json b/research/paired-extension-normal45/CLAIM.json new file mode 100644 index 0000000000..53d9edee7e --- /dev/null +++ b/research/paired-extension-normal45/CLAIM.json @@ -0,0 +1,80 @@ +{ + "admitted_package_manifest_sha256": "86513bcfac5c9554a03a6ba7c00dae7b856a6197007c923205d23c7abba6ec0c", + "baseline_head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "baseline_kappa": "17224999064432745643569999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "baseline_pr": 2930, + "calls": 666, + "complex_lower": "430704079965803581999/250000000000000000000000", + "extractions": [ + { + "helper": 249, + "normal": 45, + "step": 1 + }, + { + "helper": 267, + "normal": 45, + "step": 2 + }, + { + "helper": 251, + "normal": 45, + "step": 3 + }, + { + "helper": 265, + "normal": 45, + "step": 4 + } + ], + "fill_sha256": "1880caffbea87cf9e946be60528fbc68c119e8e2ff56df9370b6cc373fc50e66", + "fixed_inventory_cap": { + "cap_lower": "17228172707428495209099/10000000000000000000000000", + "cap_upper": "172281727074284952091/100000000000000000000000", + "realized": "below the fractional optimum by the recorded gap (check_cap.py); the cap basis is fractional at T74" + }, + "gain": "316413419939763639/1000000000000000000000000", + "helpers": 408, + "independent_inputs": 632, + "kappa": "17228163198632143279959999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "kappa_decimal": "0.0017228163198632143279959999999999999999999998999999999999999999999999", + "live_families": 66304, + "local_profile": { + "1": 2434, + "2": 632, + "3": 286, + "4": 104, + "5": 26, + "8": 8 + }, + "native_receipt_sha256": "0261d8834cfa6de1b654d9539c19fce9c762bf94de97d6d055cee06f85859909", + "physical_families": 66808, + "previous_open_claim": { + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "kappa": "17215886471978018806049999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "pr": 2917 + }, + "profile": { + "1": 1638360, + "14": 1, + "2": 420912, + "3": 196337, + "4": 69264, + "48": 27291, + "5": 23531, + "8": 5328 + }, + "release_receipt_sha256": "c2f14611d571c3b2f3482d480d4f91f698fa73568a3af7b7b7db632a9c369a48", + "replicas": 74, + "scope": "Conditional finite supplier/outer certificate for PR2917's words plus four paired extractions at hyperplane normal 45 with a new literal T74 allocation. Inherited all-size/compiler/theorem hypotheses remain. No selected-frontier change or independent-human-review claim.", + "source_manifest_sha256": "79956f19c5c3d4d1ad3578e4b3d6844bc54c1f3680825fc87c80cc04f069dae8", + "status": "CONDITIONAL_CANDIDATE_COMPLETE_FINITE_RELEASE", + "width_inventory": { + "4": 26, + "5": 2, + "7": 62, + "8": 100, + "9": 218 + }, + "zero_buffers": 86 +} diff --git a/research/paired-extension-normal45/CREDITS.md b/research/paired-extension-normal45/CREDITS.md new file mode 100644 index 0000000000..2e5cdf9469 --- /dev/null +++ b/research/paired-extension-normal45/CREDITS.md @@ -0,0 +1,11 @@ +# Credits + +- **PR #2908, Jeremy Diviney**: the paired input/output extraction, its compensation rule `C*S`, the exact two-sided certificate (`structure.py`, vendored unchanged) and the closed-adapter admission chain. +- **PR #2917, Mason Hale**: the nine further extractions and the final 82-endpoint words that are this package's parents, the refit/compose producer model that `producer.py` follows, the declared frame-edit records, the T74 chronology (ORDER/DISPATCH), the allocation checker, moment auditor, extension stage and adapter derivation reused here. +- **PR #2894 / #2833, Jeremy Kothe**: the preload re-synthesis supplier, the frame accounting and inverse-reverse cleanup (`vendor/preload_move.py`), the source materializer and the inherited supplier lineage. +- **PR #2857 / #2848, Yiyang Lu (Lyy-iiis)**: the shared-kernel words, the staged native/overlay tooling and the chronological flow model and realization (edge colouring) used to construct the allocation; PR2843 (Marius-Paul Dumitrean) is that flow model's starting point. +- **PR #2863 / #2839, Dugongue**: the packing lineage and the PR2839 owner engine. +- **Tekalign**: the independent owner/chronology checker (`allocation/vendor/independent_owners.py`) and admission tooling. +- **icekylinx**: the exact free-operator auditor retained as `vendor/audit_local.py` (PR2833). +- **PR #2930, Marius-Paul Dumitrean**: the cap allocation of PR2917's words, its relaxation tools and the comparator headline. +- **New here (Marius-Paul Dumitrean, with substantial AI assistance from Anthropic Claude via Claude Code)**: the census of further paired extractions on PR2917's final words, the joint four-step composition at hyperplane normal 45 with its declared frame edits, the producer and local verification for it, the overlay stage `normal45-paired-extractions`, the literal T74 allocation of the changed inventory, its relaxation certificate and recorded gap, and the complete fresh replay. diff --git a/research/paired-extension-normal45/MANIFEST.json b/research/paired-extension-normal45/MANIFEST.json new file mode 100644 index 0000000000..996de2b6c9 --- /dev/null +++ b/research/paired-extension-normal45/MANIFEST.json @@ -0,0 +1,87 @@ +{ + ".gitattributes": "056f4f66161e333f3a8d4c20de323ca05599a7deac1aa02d47ba6f6b96335573", + "ALLOCATION-PINS.json": "86cd9416e65c2dfe6d8ecb5eff796cb4b2a3409b22077fee5ae982596f77c17e", + "CLAIM.json": "011aaac80ad79f7f29dc429a672441bb6b3c21a68bbcb34c7a0d5f943c3c3c2e", + "CREDITS.md": "bdfe2596f523fa2b0f1928e5c0eb4f59df5ef5f5be0aa900ed447bce038370e2", + "NOTICE": "b255cf7444e518ce4d769b54c2279a150b4f658f7c497c686927f756de25db9e", + "PINS.json": "729c5b642863a11f864210203222fd599802d1985efdd44a976fa249edc532eb", + "README.md": "d5389ef968acb5d72c889939cb6f8617520ff8c0589cb953d1cecd66fc3c715d", + "SOURCES.json": "7c9ca2d169203fd352ad22b7fdaa533fcb4178fcc0a094264c9e665a6396c354", + "TASK.json": "6d120a39c053dba8e5264396d00f96543790d6ee325a116f76bd41057059b3d7", + "VERIFY.json": "cbce24d0cabfb584c7efbd79ff117f7b8e251ed488e33cb91015bf145e86365f", + "allocation/DISPATCH.json": "65e435bd68e97243c003677271b88485a29d4d0fae2dff1354100404a145e74c", + "allocation/FILL.json.gz": "1880caffbea87cf9e946be60528fbc68c119e8e2ff56df9370b6cc373fc50e66", + "allocation/ORDER.json": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1", + "allocation/PROFILE.json": "c462213fe141f04bdcd680f040bb7f746717265894395b845204f1115e1f904e", + "allocation/PROVIDERS.json": "c20af31dd673bd1f731d4e78b4d2320c3ea6179267f574c170efc4e9c4ef5955", + "allocation/SEARCH.json": "c8d6a39f7f7ea027aac8cd5c68407446b70c142281b460fe354b031188466eb3", + "allocation/baseline/CLAIM.json": "9c2c14158780a677b3661623d7476acc4f535ac9e0481addfa1d6c4c7633b74b", + "allocation/baseline/ORDER.json": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1", + "allocation/baseline/PROFILE.json": "8b6f825a93cb1fa94047b062f1b1b8d489b2c397ec0c8114d0e53737f56c065e", + "allocation/vendor/PLAN.json.gz": "d566cfb87b71639d4138e1f89b543e2dd6a7772070226a2a14c799a6835bf21e", + "allocation/vendor/TEMPLATE.json.gz": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e", + "allocation/vendor/independent_owners.py": "77a848729159e271ba64f403dfd59dddb13044b17b2950fa56700f442e2fe461", + "certificates/RELAX-CAP.json": "908c93990547d3de54b6497153b3d15c9e001a7354d55007a2479273a5f0fcf0", + "check_allocation.py": "0ea33c8b669e9715ebc8ecc84b574888e407bd5cfdc688d5b4117aabd2a80c5c", + "check_cap.py": "8864928dc7df5325bb2d1049b3405a912346580488ee63ec60e33e162fad7fac", + "construction/EXTRACTION-STEPS.json": "002944d5b03df4fcdc4aba73213b28eaf3eb7a0c1f75417cd0b7e1fcfd7da99d", + "construction/T74-FLOW.json.gz": "b0ac5dae33e3cff8d041ae0d5c7468e1c5b09067c65cdbc5f2e4ac7c07dc79e6", + "construction/T74-MODEL.json": "bb2134708bcff12a53ca0ed23e2cd3f2405da08075ff793b4f509b5e5b76e9f4", + "construction/T74-PATTERNS.json": "76120b5e39028ba910271e0630c837159c525f61232499567882d2fc7855643e", + "construction/T74-SOLVER.json": "98ea3344c6f58691a66ae5c2d4b7640e331bcc035952b5673df237997931b655", + "construction/controls.py": "4fb88a31e9778a9d105604e3093cc6d6bc3c1d422b75bf11e6258758eb0fb0fa", + "construction/fill17.py": "cbb33bd147f3a5502ec4458bcb52599cec17265d5c950b035fb5f42dacaa0e13", + "construction/providers_from_words.py": "8cf55c2859a626d86f21b447460321c19db92fec8e1f893b3cd37267f3b145fd", + "data/PARENT-base.json.gz": "fec3c120db1a35022944628d34b56a36f2456248c274c2eaba1a325cdc690ce8", + "data/PARENT-extra.json.gz": "e4d0c617df85bf8a824ff68310ca3373dc017c1ebf9ea733056a3ee4a784b36f", + "data/TRANSFORM-249.json": "fb8cae03c69e868e3d6f2caa56a45cdeb78e2a8f0289465c75bf2bb40a6c8979", + "data/TRANSFORM-251.json": "8b3fea5c113ef82c78c33c809b282fa781be234299672cd1c987604929a34dc0", + "data/TRANSFORM-265.json": "3ae3261cc35ab19c799d5d6d632e8e79e3b588e3c342be2b5ef1b3085ab61af4", + "data/TRANSFORM-267.json": "afa89055509f87febd8879fda8e308d1c9f98f914bc36b5b49604caf11a5ff0c", + "data/WORD-base.json.gz": "54ca34c749e3228d7e2df3d8dbf7aa1568c2872490166997c5962f12fd03da35", + "data/WORD-extra.json.gz": "eded756dfe8f411c3d1f80a3ac16516f0ea5dd6f9866728b2179b157630fa7b6", + "evidence/ADAPTER-DERIVATION.json": "8ecf30b47a56e2f34d15e3123b19559c61bdd2261b0be4e9cb83c6c271ee0ffb", + "evidence/ADMISSION-RESULT.json": "0bd0baa290c765da5914d73e7d223bed7dc778bc7d17a8d372565f44be47e527", + "evidence/ADMISSION-STAGES.json": "5e5e11fb1463fc05a86d4624d15e1abdcac75985f4e423206cc261c9f87baac7", + "evidence/ENVIRONMENT.json": "c6faaaa9b538ddbf0ea3c624bbe2f1c7e4074f8cb504d4bee0f3353f1e7f32a1", + "evidence/FULL-NATIVE-RECEIPT.json": "0261d8834cfa6de1b654d9539c19fce9c762bf94de97d6d055cee06f85859909", + "evidence/FULL-NATIVE-RESULT.json": "faf8f9308316eb8cadb996c813035a103b73c4e07048954eb9b2498616addbdf", + "evidence/FULL-REPLAY-RESULT.json": "d920c67171b6548ae2b293cd92c0d0958b2291d9fc6170f765684302d4a9424f", + "evidence/FULL-REPLAY-STAGES.json": "9f3e515223306746fecc70454faa565faed41057f2fbedc0d106745d10b7677f", + "evidence/OVERLAY-DERIVATION.json": "7fed4e34f643bfefc9003ae81326ff5b308a630b91d5bf5ebd9fb76dba98c43c", + "evidence/RELEASE-RECEIPT.json": "c2f14611d571c3b2f3482d480d4f91f698fa73568a3af7b7b7db632a9c369a48", + "evidence/RETAINED-BOOTSTRAP-RECEIPT.json": "9ac73e7c36ccbfb8ab8b295365142047c03d8ba0b3a7a1c59c556eb5226c2099", + "evidence/RUNTIME-PATCHES.json": "99dfc984d49eacd6fc8ccdb2229e6c25d9d98e037bf62e5bd4764de26154cf43", + "evidence/logs/admission-discovery.log.txt": "c0251387c2c4c2eabb3a7ce8ef60e82ba800745a28a16c28ad4e6df107a5411a", + "evidence/logs/admission-outer-check_ledger.py.log.txt": "6ffba6479986e7fa6a0e45ae99b17ba75431dc2f542a93eab11e15d6d692f4c6", + "evidence/logs/admission-outer-independent_check.py.log.txt": "70219f3edd456c144f75bf4893fe02e1f07f490e17b825770e62a6a046b6a589", + "evidence/logs/admission-owners.log.txt": "ef1d5a98b4cd95cef84f8d3ec270163e855db3e2fec61a249766578a55f74e5b", + "evidence/logs/admission-parent-lift.log.txt": "7b6249a123ca39fae7b7a6339dd9e8ae8777b081f4336418f2cc101704b70644", + "evidence/logs/admission-rebind.log.txt": "7076fee2da9bdbd5194761424aea1a5f14833d8e79d3c204c271e9635603ed7c", + "evidence/logs/admission-release.log.txt": "13c31a94bb108cfe96dd28b33716e25d9fce08c5f48804d9ca7e2f1d480fe3e6", + "evidence/logs/complete-admission.log.txt": "c987f23febfc32e8a7cf775be81fddb6cb1ee52c24063e047352e0bac8009d24", + "evidence/logs/derive-closed-adapters.log.txt": "f84c13f3cc174ac3f4ec774805c5ed69bfa9b6973f398f243b11ffb96b7340ec", + "evidence/logs/export-pr2833.log.txt": "a0df4e80479d51fcbc6dcc7ca765ae7040f0d04f7e6859157aa7ee5c8d6fda36", + "evidence/logs/export-pr2894.log.txt": "6bd8df30779863897e48441608240db6a7e3fcbd0754511e44f854f3a5c462a6", + "evidence/logs/four-kernel-stage.log.txt": "f2bbb6462b3f5bb8a6415bb33c0c35355353b13343ddb90961660f7473caa5a2", + "evidence/logs/fresh-current-native.log.txt": "d7581123b0f3330f2598e7758ccbca466018d2599124fc6ceb1b678a9ee27dec", + "evidence/logs/fresh-retained-bootstrap.log.txt": "4a1625fdd9a947187583e67492c492f309e28669082f2e6f2aa97b5da345ea29", + "evidence/logs/normal45-overlay-stage.log.txt": "095610f039831f152c5b675406cc9a2df347d87d395f2cf7973c554f56bb86e3", + "evidence/logs/paired-extension-stage.log.txt": "61cc77beeae833d7473b5c5338b176b150f95f6652a888c0307f080674cfde35", + "evidence/logs/parent-paired-stage.log.txt": "d80d8494c48816e3acf662db00cc0077a888b82392d736826f73beb1c4248299", + "evidence/logs/preload-stage.log.txt": "2eb7601c48840a39c58eb838886aed00a531349b259f0bbc3ea6421376b8ea3c", + "producer.py": "d1f47e5cd747b4bec056a7e348c4ad5f64b4ee334e553bb804425293e1e61dae", + "reproduce.py": "a8bf45f02265470de65f45e0138fd52f7489773c170092f4736b9bc1dcd93948", + "run_registered.py": "475f162d03127706142f0d1bd646ea1bf49c2c42675738809f204eda69f865a0", + "structure.py": "83f63b6d9a1a543ecfa2c98d479dbe4e7a1c3caf6fd1c3566123308efbc32e96", + "tools/audit_allocation_moment.py": "e1e86aa9f5aeedb048d421e9c42fb6f05cda6216c492efefb834114821fd80dd", + "tools/build_overlay.py": "58f5af9fe996d377825fe214c113cc71b9ba3e40c737b45c7e0164a0f27ba4ee", + "tools/derive_adapters.py": "98490c99718a6978f66229923173888d7c58d119166fe318ef620ade76963169", + "tools/relax.py": "0fed1c56b50a2e6d44deeeb6db0f1c7e1f71b86d1747130e1a9202216249a728", + "tools/relax_exact.py": "baf1855d6095c951a90d19a0d8094bd33290519940b732e2b758c5647830f044", + "tools/root.py": "55f5aca39b5ee2fe4687ac8863e6c24569010f27a332883c069b8e14b8fe09e3", + "tools/wordedit.py": "cae8ae0f5d7fb3387ec6922fe966068aae05e3a6d3586830d4361b650cfb3617", + "vendor/audit_local.py": "a38940094f7d19cd6376aafdd4734fa68eabc9aff4c98c3c4a3e9540328b1c90", + "vendor/preload_move.py": "c8fda4674644fcd5cbf39b6645ce148a21daa90a998b678cbe51f970b78b0044", + "verify.py": "cbe977ee84987236323b01a7f64714b66a62919cb153094b022b80881277b3ff" +} diff --git a/research/paired-extension-normal45/NOTICE b/research/paired-extension-normal45/NOTICE new file mode 100644 index 0000000000..e8da1babce --- /dev/null +++ b/research/paired-extension-normal45/NOTICE @@ -0,0 +1,20 @@ +research/paired-extension-normal45 +Copyright 2026 Marius-Paul Dumitrean. Licensed under the Apache License, Version 2.0. +Prepared with substantial AI assistance (Anthropic Claude, via Claude Code). + +This package retains, byte-identical, Apache-2.0 files from PR #2917 (Mason Hale, head +224bd5e56041c40078ff6b5fa7393733a215de5c, research/paired-helper-extension): data/PARENT-base.json.gz and +data/PARENT-extra.json.gz (PR2917's data/WORD-*.json.gz), structure.py (Jeremy Diviney's PR2908 two-sided +certificate checker), vendor/audit_local.py (PR2833's independent exact auditor, icekylinx attribution), +vendor/preload_move.py (Jeremy Kothe's PR2894 frame accounting and cleanup), allocation/ORDER.json, +allocation/DISPATCH.json and allocation/vendor/ (independent_owners.py: Tekalign's independent owner checker as +vendored by PR2839/PR2917; PLAN.json.gz, TEMPLATE.json.gz); and from PR #2930 (head +81f3b5d12977eba09e06fbff729167d59faabe90, research/paired-extension-cap-fill): allocation/baseline/ (its CLAIM.json, +ORDER.json, PROFILE.json) and tools/relax.py, tools/root.py, tools/relax_exact.py. +producer.py follows PR2917's producer.py (Mason Hale) with this package's four helpers; verify.py, +check_allocation.py, run_registered.py and reproduce.py adapt PR2917's/PR2930's; tools/audit_allocation_moment.py is +PR2917's exact moment auditor with only its authenticated baseline changed (to the PR2930 headline); +tools/derive_adapters.py generalizes PR2917's adapter derivation (PR2908, Jeremy Diviney); tools/build_overlay.py +follows the overlay conventions of PR2908's and PR2917's builders. construction/ retains the flow model of +PR2857/PR2843 (Yiyang Lu, Marius-Paul Dumitrean) as adapted for this allocation. All original notices of the +exported predecessor packages remain in force. diff --git a/research/paired-extension-normal45/PINS.json b/research/paired-extension-normal45/PINS.json new file mode 100644 index 0000000000..8cef44fe17 --- /dev/null +++ b/research/paired-extension-normal45/PINS.json @@ -0,0 +1,21 @@ +{ + "data/PARENT-base.json.gz": "fec3c120db1a35022944628d34b56a36f2456248c274c2eaba1a325cdc690ce8", + "data/PARENT-extra.json.gz": "e4d0c617df85bf8a824ff68310ca3373dc017c1ebf9ea733056a3ee4a784b36f", + "data/TRANSFORM-249.json": "fb8cae03c69e868e3d6f2caa56a45cdeb78e2a8f0289465c75bf2bb40a6c8979", + "data/TRANSFORM-251.json": "8b3fea5c113ef82c78c33c809b282fa781be234299672cd1c987604929a34dc0", + "data/TRANSFORM-265.json": "3ae3261cc35ab19c799d5d6d632e8e79e3b588e3c342be2b5ef1b3085ab61af4", + "data/TRANSFORM-267.json": "afa89055509f87febd8879fda8e308d1c9f98f914bc36b5b49604caf11a5ff0c", + "data/WORD-base.json.gz": "54ca34c749e3228d7e2df3d8dbf7aa1568c2872490166997c5962f12fd03da35", + "data/WORD-extra.json.gz": "eded756dfe8f411c3d1f80a3ac16516f0ea5dd6f9866728b2179b157630fa7b6", + "producer.py": "d1f47e5cd747b4bec056a7e348c4ad5f64b4ee334e553bb804425293e1e61dae", + "structure.py": "83f63b6d9a1a543ecfa2c98d479dbe4e7a1c3caf6fd1c3566123308efbc32e96", + "tools/audit_allocation_moment.py": "e1e86aa9f5aeedb048d421e9c42fb6f05cda6216c492efefb834114821fd80dd", + "tools/build_overlay.py": "58f5af9fe996d377825fe214c113cc71b9ba3e40c737b45c7e0164a0f27ba4ee", + "tools/derive_adapters.py": "98490c99718a6978f66229923173888d7c58d119166fe318ef620ade76963169", + "tools/relax.py": "0fed1c56b50a2e6d44deeeb6db0f1c7e1f71b86d1747130e1a9202216249a728", + "tools/relax_exact.py": "baf1855d6095c951a90d19a0d8094bd33290519940b732e2b758c5647830f044", + "tools/root.py": "55f5aca39b5ee2fe4687ac8863e6c24569010f27a332883c069b8e14b8fe09e3", + "tools/wordedit.py": "cae8ae0f5d7fb3387ec6922fe966068aae05e3a6d3586830d4361b650cfb3617", + "vendor/audit_local.py": "a38940094f7d19cd6376aafdd4734fa68eabc9aff4c98c3c4a3e9540328b1c90", + "vendor/preload_move.py": "c8fda4674644fcd5cbf39b6645ce148a21daa90a998b678cbe51f970b78b0044" +} diff --git a/research/paired-extension-normal45/README.md b/research/paired-extension-normal45/README.md new file mode 100644 index 0000000000..818f614cd9 --- /dev/null +++ b/research/paired-extension-normal45/README.md @@ -0,0 +1,190 @@ +# Four paired extractions at one hyperplane on PR #2917's words: conditional κ = 0.001722816319863214327996 − 10⁻⁴⁶ − 10⁻⁷⁰ + +```text +Status / UTC update / priority revision: DONE (conditional candidate) · 2026-10-16 · priority revision 5 · base main 914cd73f +Concrete question and changed premise: PR #2930 showed that the fill layer of PR #2917's words is exhausted (its allocation + attains their exact packing cap), so a further gain must change the words. Every single further paired extraction on + PR2917's final word is below break-even. Do several extractions sharing one hyperplane clear it jointly? +Established result and evidence status: yes. Four sequential paired input/output extractions at hyperplane normal 45 (helpers + 249, 267, 251, 265 restored at E_45, ten declared frame edits, 86 private buffers) clear four break-evens by 12,928 units. + With a new literal T74 allocation of the changed inventory, the complete fresh-native admission and modern outer release + pass: κ = 0.001722816319863214327996 − 10⁻⁴⁶ − 10⁻⁷⁰, exactly 316413419939763639/10²⁴ ≈ 3.1641e-7 above PR2930 + (head 81f3b5d1) and ≈ 1.2277e-6 above PR2917. Author-checked (AI-assisted); not maintainer-reviewed. +Public artifact URL + exact commit: this package (see the PR). +Next useful task: edits outside the paired-extraction lever (gate re-timing, earlier output gates, entering pivots). +Active claim / expiry: released. +``` + +## Result + +| | κ (headline) | local profile per call | width inventory | private buffers | complete paid profile (T74) | +|---|---|---|---|---:|---| +| PR #2917 (Mason Hale) | 0.001721588647197801880605 − 10⁻⁴⁶ − 10⁻⁷⁰ | {1:2416, 2:640, 3:280, 4:110, 5:26, 8:8} | {4:26, 5:2, 7:62, 8:96, 9:222} | 82 | {1:1625724, 2:426240, 3:191980, 4:73260, 5:24951, 6:167, 7:45, 8:5328, 24:1, 32:207, 48:26958} | +| PR #2930 (cap fill) | 0.001722499906443274564357 − 10⁻⁴⁶ − 10⁻⁷⁰ | same words | same | 82 | {1:1626372, 2:426240, 3:192474, 4:73260, 5:24198, 8:5328, 48:27158} | +| **this package** | **0.001722816319863214327996 − 10⁻⁴⁶ − 10⁻⁷⁰** | **{1:2434, 2:632, 3:286, 4:104, 5:26, 8:8}** | **{4:26, 5:2, 7:62, 8:100, 9:218}** | **86** | **{1:1638360, 2:420912, 3:196337, 4:69264, 5:23531, 8:5328, 14:1, 48:27291}** | + +The gain over PR2930 is exactly `316413419939763639/1000000000000000000000000` ≈ **3.1641e-7** (about 0.018%); over PR2917 +it is `1227672665412447391/10²⁴` ≈ 1.2277e-6. Physical stock 66,304 + 408 + 8 + 86 + 2 = **66,808**; 632 independent inputs, +408 live helpers, 271,728 helper roles, PR2917's T74 chronology (ORDER/DISPATCH byte-identical). + +## Why one extraction is not enough and four are + +A paired extraction (PR2908's mechanism, `CONSTRUCTION.md` of PR2908/PR2917) restores one dirty helper `h` at a rank-8 hyperplane +`E_n` instead of rank 9: an input change `S` (dyadic gates at frame zero right after the prelude) and an output change `T` +(gates at frame `E_n` appended to restore) with `S e_h = v, u S = e_h^T, T y = e_h, e_h^T T = alpha`, where `alpha M = u`, +`M v = y`, `alpha y = 1` and `C v = 0`. Then the whole row and column of `h` in `T M S` are the identity, `h` ends at `E_n` +(width 9 → 8), compensation becomes `C S`, cleanup is regenerated and one more private zero buffer is charged. The support +of `alpha` and `y` must lie in registers whose terminal frames are inside `E_n`; registers outside must first be lowered +into `E_n` by frame edits, and every touched register pays. + +Prices are the certified frame solver's integer local costs (units of 2⁻⁴⁰ at the base saving b ≈ 0.0017037; +c1 = 2,116,671, c2 = 4,228,346, c3 = 6,338,140, c4 = 8,446,713). An extraction whose pivot ends at rank 8 saves c1, but it +must also force every other register its output gates touch into E_n. It raises the fixed-capacity cap only if the local +bill falls by at least about 2,091,300 units (break-even), i.e. it may spend at most **25,371 units of overhead**. + +**Exact cost identity.** The output gates sit at the end of restore at E_n and the input gates are free (frame zero on +zero-entry helpers), so the certified optimum of a composition at one hyperplane depends only on the set U of registers its +output gates touch and the pivot set P: + + total(U, P) = Δ_end(U ∪ P) + c1 · |U \ P|, + +where Δ_end(X) is the certified frame-solver change when every register of X ends at E_n (non-pivots then climb back to +FULL, +c1 each). For the shipped composition U = U12 = {2, 61, 62, 63, 70, 71, 72, 94, 249, 251, 265, 267} and +P = {249, 251, 265, 267}: Δ_end(U12) = −25,311,496, plus 8 c1, gives −8,378,128, its certified cumulative change exactly. +The overhead of U12 is 88,556 units, so the margin is 4 × 25,371 − 88,556 = **+12,928**. + +* **One extraction is not enough.** On PR2917's final word the best single direction (normals 7/42, U = {76, 233}) has + margin −4,579; on existing terminal frames only normals 486/504 pair, at −29,645 (the seven-partner 459-block). +* **Four at normal 45 are.** Normal 45's admissible pairing has rank 4, and its 12-register support universe U12 has no free + registers: a complete rank-4 composition must touch all of U12, whose only helpers are the four pivots. So every order, + pivot assignment and first-step support gives a total of −8,378,128 or worse; three other orders run through the composer + (certificate and audit at every step) all end at exactly −8,378,128. The first step alone is 20,801 short; the four + pivots share one overhead. +* **No other normal helps.** With the same identity, the best unions of up to four minimal supports and each normal's full + support universe were priced for every normal with a nonzero pairing, on PR2917's word and on the four-step word: no + other normal has a positive margin (best −4,579 before, −29,645 after), and mixing hyperplanes cannot help (a register + touched at E_7 and E_45 must lie in their intersection; the cheap 7/42 support uses normal 45's pivots). Within this + cost model (output gates at the end of restore, the fixed gate order with exactly re-solved frames, zero-entry + pivots), the four-step composition is the optimum of the paired-extraction lever on these words. + +| step | pivot h | inputs / outputs | frame edits | alpha (support) | y | step Δ | cumulative | cumulative − k × (−2,091,300) (negative = above break-even) | local profile after | {8, 9} widths | buffers | fixed-capacity cap | +|---:|---:|---|---:|---|---|---:|---:|---:|---|---|---:|---| +| 1 | 249 | 28 / 10 | 1 | 249, 62, 70, 71, 72, 251, 267 | e62 | −2,070,499 | −2,070,499 | +20,801 | {1:2429, 2:634, 3:282, 4:108} | 97 / 221 | 83 | 0.0017220208645 | +| 2 | 267 | 29 / 11 | 5 | 267, 62, 63, 70, 71, 72, 251 | e63 | −2,100,475 | −4,170,974 | +11,626 | {1:2430, 2:634, 3:284, 4:106} | 98 / 220 | 84 | 0.0017222381993 | +| 3 | 251 | 28 / 11 | 1 | 251, 2, 61, 62, 70, 72, 265 | e61 | −2,098,581 | −6,269,555 | +4,345 | {1:2434, 2:632, 3:285, 4:105} | 99 / 219 | 85 | 0.0017224115901 | +| 4 | 265 | 37 / 9 | 3 | 265, 2, 61, 62, 94 | e94 | −2,108,573 | **−8,378,128** | **−12,928** | {1:2434, 2:632, 3:286, 4:104} | 100 / 218 | 86 | **0.0017228172707** | + +(`5:26, 8:8` are unchanged throughout; PR2930's cap of PR2917's words is 0.0017224999064.) The cumulative local change is +`18H1 − 8H2 + 6H3 − 6H4` per call: 18c1 − 8c2 + 6c3 − 6c4 = −8,378,128. Only after the fourth step does the cap of the +changed inventory exceed PR2930's. These prices, the orders and the per-normal census are search-time evidence +(`construction/EXTRACTION-STEPS.json`); the claim rests on the checks below. + +The ten declared frame edits are all inherited A gates after the prelude. In each step the last A touch of the step's `y` +register (step 1: `add 57 62`; 2: `add 92 63`; 3: `add 92 61`; 4: `add 57 94`) moves from a rank-8 frame outside E_45 to +the rank-7 frame F7 = ⟨256, 128, 64, 35, 16, 11, 5⟩ ⊂ E_45, which puts that register's terminal frame inside the +hyperplane. Six earlier gates in steps 2 and 4 (`scale 57`, `add 57 92`, `scale 62`, `add 62 63`, `scale 94`, +`add 94 61`) move from rank-4 frames to F7, which contains them, so that the frame chain stays monotone; three of them (the +scales) are individually cost-neutral. Each edit is recorded with its exact old and new frame and its index in that +step's parent word in `data/TRANSFORM-.json`; `producer.refit` (PR2917's rule) checks the exact preimage. + +## Packing the changed inventory + +The fixed-capacity fractional relaxation of inventory {4:26, 5:2, 7:62, 8:100, 9:218} with local profile +{1:2434, 2:632, 3:286, 4:104, 5:26, 8:8} has the same nine optimal patterns as PR2930's, with moved counts per replica: +[8]×672, [7,9]×334, [8,8]×114, [7,7,9,9]×112, [5,9,9,9]×18, [9,9,9]×84, [4,9,9,9]×234, **[9⁵]×396/5, []×1844/5**; +cap ∈ [0.0017228172707428495209099, 0.00172281727074284952091]. Unlike PR2930's, this basic solution is fractional at T74 +(74 × 396/5 = 29304/5), so it cannot be realized literally. The allocation in `allocation/` realizes the integer pattern mix +that a MILP over all 1,163 patterns at T74 reported as best (one [9,9] bin in cap 32, i.e. one idle rank-14 child; solver +optimality, not certified here), built with PR2857's chronological flow model directly on PR2917's T74 chronology (CP-SAT, +one worker, no hint, `construction/`) and edge colouring. Its root is **9.5088e-10 below the cap** (`check_cap.py` +records the exact gap). The coverage-law ceiling of `research/complex-local-word-ceiling` for the new local +profile is about 0.0017572465 (slightly below PR2917's 0.0017580218: the extra rank-1/3 local children cost more than the +idealized idle mass; the gain comes from the width inventory, which that relaxation does not see); the headline realizes +about 98.04% of it and is far above the selected word's ceiling 0.001690054. + +## Verification + +**Registered, bounded** (`run_registered.py`, standard library, about 20 s): +- complete package pins; +- `verify.py`: `producer.py` rebuilds both WORD files from PARENT (PR2917's words, byte-identical) and the four TRANSFORMs + (complete decoded content); at every step and for both providers, PR2908/PR2917's unchanged `structure.py` checks the + seven two-sided identities over the exact free operator algebra; PR2833's unchanged auditor replays both final words + forward and dual over all 632 inputs (`PASS_INDEPENDENT_EXACT_BORROWING_WORD`, 86 restored endpoints and buffers, the + profile and inventory above); `frame_report` equals each word's report; 40 semantic mutants are rejected (per step and + provider: drop an input gate and flip an output coefficient, rejected by the auditor and by the certificate; the output + change on the wrong hyperplane E_46, a stale cleanup without the new private buffer, and the step's frame edits omitted, + rejected by the auditor); the overlay producer `tools/wordedit.py` round-trips PARENT → WORD; +- `check_allocation.py`: the vendored PR2839 owner engine on the new allocation (271,728 roles, windows, same-call families, + capacities, complete profile, physical 66,808) with five rejection controls, and PR2917's exact dyadic moment auditor + with its authenticated baseline re-pinned to the PR2930 headline (strict gain); +- `check_cap.py`: the Fractions-only cap certificate of the changed inventory (1,163 patterns, primal feasibility, dual + signs), the literal profile's completeness and its exact gap to the cap, three controls; +- binding of the stored overlay, native, admission and release receipts in `evidence/` to the exact words, allocation and claim. + +**Complete replay** (`reproduce.py`): exact Git exports of PR2908 (51309592), PR2917 (224bd5e5) and PR2930 (81f3b5d1), and +through them PR2894 (18d03c44) and PR2833 (e9307b48); fresh retained bootstrap by PR2894's `prepare_retained.py`; PR2857's +four-kernel stage, PR2894's preload stage, PR2908's paired stage and PR2917's extension stage, giving PR2917's derived source +(manifest 98d57c82, 632 files); then `tools/build_overlay.py` appends the stage `normal45-paired-extractions`: the exact edit +spec PR2917 word → this word (`tools/wordedit.py`, cleanup re-derived) is replayed by the source's own `rebuild_borrow.py` +after PR2917's `nine-additional-paired-extractions` stage, so every previous state stays in the audit chain (manifest +79956f19, 637 files); closed adapters for 86 buffers with the PR2917 and PR2930 headlines as pinned comparators; fresh +five-stage native chains for both providers; complete admission (owners, parent lift, rebind, discovery, block norm, +physical/prefix invoice, independent outer checks, and the release, which reruns the admitted source's own verify.py +and its 17-stage rebuild chain for both providers, ending with `normal45-paired-extractions`). + +The recorded run (`evidence/`) is a single invocation of this package's `reproduce.py --jobs 2` on macOS arm64, CPython +3.12.13 (numpy 2.4.5, scipy 1.16.1, sympy 1.14.0, mpmath 1.3.0, gmpy2 2.3.2, psutil 7.2.1): fresh retained bootstrap 279 s, +source stages including the overlay 3 s, fresh native chains for both providers 25 s, complete admission 255 s (release 200 +s), 562 s wall, ending `PASS_NORMAL45_COMPLETE_REPLAY`. The native receipt's "reused retained" fields refer to the retained +cache that the same run had just bootstrapped (`evidence/FULL-REPLAY-RESULT.json`: `fresh_retained_bootstrap: true`). +Hash-bound receipts are stored verbatim (they contain the run's absolute paths); logs under `evidence/logs/` have paths +replaced by placeholders. + +```sh +# exact predecessor commits must be present locally (no network access during the replay) +git fetch https://github.com/CrocSwap/integer-mult-bounds.git \ + 81f3b5d12977eba09e06fbff729167d59faabe90 224bd5e56041c40078ff6b5fa7393733a215de5c \ + 51309592971e3b5be935599eed2a95404dc7781e 18d03c447886895ef9abf888398178e0428533ca \ + e9307b48d7d1b690939935ecef0f8e524e6d92f4 +python3.12 scripts/research_package.py --package research/paired-extension-normal45 +OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 \ + python3.12 -B research/paired-extension-normal45/reproduce.py --repo . --work /tmp/normal45-complete --jobs 2 +``` + +The complete replay needs Python 3.12 with numpy, scipy, sympy, mpmath, gmpy2 and psutil (versions of the recorded run in +`evidence/ENVIRONMENT.json`). `--retained DIR` reuses an authenticated retained cache instead of the fresh bootstrap. +For the local checks alone: `python3.12 -B research/paired-extension-normal45/verify.py --work /tmp/n45-local`. + +## Scope + +Conditional finite supplier and modern outer certificate, exactly as inherited by PR2917/PR2930; all inherited all-size, +compiler, hosting, precision and analytic hypotheses remain. No selected-frontier change, no unconditional multiplication +theorem and no independent human review is claimed. The search and optimality statements are relative to the stated cost +model and census (511 normals; existing and exactly lowered terminal frames; exact at normal 45; at other normals the best +unions of up to four minimal supports and the full support universe), not impossibility results beyond it. No optimality of +the literal fill among integral allocations is claimed. + +## Open next questions + +1. **Lower the overhead of U12 by edits outside this lever.** The 88,556 units are the certified optimum for forcing U12 + into E_45 with the present gate order. Gate re-timing so that registers 62, 63, 2 and 94 reach E_45 more cheaply, + output gates placed before the end of restore, or entering-helper (start_extra) pivots are not covered by the + identity above and could raise the margin or make other normals profitable. +2. **Integral packing at the cap.** The cap basis of the changed inventory is fractional at T74; other chronologies or + PR2863-style lockstep copies might close the remaining 9.5e-10. +3. **The same joint test on other words.** The identity prices a whole composition with one solver call per (normal, + support universe); applied to other frontier words it finds every hyperplane whose shared overhead fits under + k × 25,371 without synthesizing any gates first. + +Details are in `TASK.json`. + +## Credit + +Jeremy Diviney (PR #2908) for the paired input/output extraction method, its compensation rule and `structure.py` (vendored +unchanged); Mason Hale (PR #2917) for the parent words, the refit/compose producer model this `producer.py` follows, the T74 +chronology, owner/moment checks, extension stage and adapter derivation; Jeremy Kothe (PR #2894/#2833) for the supplier, +frame accounting and inverse cleanup (`vendor/preload_move.py`) and the source tools; Yiyang Lu (PR #2857/#2848) for the +flow model and realization used to build the allocation; Dugongue (PR #2863/#2839) for the owner-engine lineage; Tekalign +for the independent owner checker; icekylinx for the exact auditor (`vendor/audit_local.py`). See `CREDITS.md` and +`NOTICE`. New work by Marius-Paul Dumitrean, prepared with substantial AI assistance (Anthropic Claude, via Claude Code). +Apache-2.0. diff --git a/research/paired-extension-normal45/SOURCES.json b/research/paired-extension-normal45/SOURCES.json new file mode 100644 index 0000000000..84ea54b3e4 --- /dev/null +++ b/research/paired-extension-normal45/SOURCES.json @@ -0,0 +1,313 @@ +{ + "schema_version": 1, + "base_commit": "914cd73f563acaaa682d733a9fbfcc07272336a3", + "upstream_repository": "https://github.com/CrocSwap/integer-mult-bounds", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "889b95d936746df124872133ae1e7cc339adcb92", + "sha256": "7d185cd8c2af35988d638d969748ad7b670f902606444dbfc748e4402c340df6" + } + ], + "retained_sources": [ + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/data/WORD-base.json.gz", + "package_path": "data/PARENT-base.json.gz", + "git_blob": "9be0aa5349dbc8c928a46089a7695e224d0e4d16", + "sha256": "fec3c120db1a35022944628d34b56a36f2456248c274c2eaba1a325cdc690ce8", + "bytes": 69818, + "role": "PR2917 final base provider word (82 restored endpoints): the parent of the four extractions" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/data/WORD-extra.json.gz", + "package_path": "data/PARENT-extra.json.gz", + "git_blob": "40b38365ea4b841101405ebd2c4fdcadcb8b9808", + "sha256": "e4d0c617df85bf8a824ff68310ca3373dc017c1ebf9ea733056a3ee4a784b36f", + "bytes": 69814, + "role": "PR2917 final extra provider word: the parent of the four extractions" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/structure.py", + "package_path": "structure.py", + "git_blob": "8d5bd544ee7cad4309edad3d2a256bf48b810f90", + "sha256": "83f63b6d9a1a543ecfa2c98d479dbe4e7a1c3caf6fd1c3566123308efbc32e96", + "bytes": 2565, + "role": "Jeremy Diviney's PR2908 exact two-sided certificate checker, unchanged by PR2917" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/vendor/audit_local.py", + "package_path": "vendor/audit_local.py", + "git_blob": "8224873d0497cf0b4c202f31b145fa273553d978", + "sha256": "a38940094f7d19cd6376aafdd4734fa68eabc9aff4c98c3c4a3e9540328b1c90", + "bytes": 29363, + "role": "PR2833's independent exact auditor (icekylinx attribution) as vendored by PR2917" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/vendor/preload_move.py", + "package_path": "vendor/preload_move.py", + "git_blob": "55b435035bbc439a9d55e8abd125993208cef8d9", + "sha256": "c8fda4674644fcd5cbf39b6645ce148a21daa90a998b678cbe51f970b78b0044", + "bytes": 7243, + "role": "Jeremy Kothe's PR2894 frame accounting (frame_report) and inverse-reverse cleanup" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/allocation/ORDER.json", + "package_path": "allocation/ORDER.json", + "git_blob": "7409c4df1092241729739596c7648bda504e6aad", + "sha256": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1", + "bytes": 4573, + "role": "PR2917 T74 call order (unchanged chronology)" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/allocation/DISPATCH.json", + "package_path": "allocation/DISPATCH.json", + "git_blob": "9544fee4e6ee1f202cee22bfaeaf229ee3b2515e", + "sha256": "65e435bd68e97243c003677271b88485a29d4d0fae2dff1354100404a145e74c", + "bytes": 10401, + "role": "PR2917 provider dispatch (unchanged)" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/allocation/vendor/independent_owners.py", + "package_path": "allocation/vendor/independent_owners.py", + "git_blob": "16013201b19054f7e45398ecf10af74c9c6a9114", + "sha256": "77a848729159e271ba64f403dfd59dddb13044b17b2950fa56700f442e2fe461", + "bytes": 10057, + "role": "independent owner/chronology engine (Tekalign; PR2839 lineage)" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/allocation/vendor/PLAN.json.gz", + "package_path": "allocation/vendor/PLAN.json.gz", + "git_blob": "7a1db55a4d53ee99280be4f3ab7d29f7b2033adf", + "sha256": "d566cfb87b71639d4138e1f89b543e2dd6a7772070226a2a14c799a6835bf21e", + "bytes": 29933, + "role": "parent plan for the owner engine" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "author": "Mason Hale (mason-hale)", + "upstream_path": "research/paired-helper-extension/allocation/vendor/TEMPLATE.json.gz", + "package_path": "allocation/vendor/TEMPLATE.json.gz", + "git_blob": "114808c32b1799da53524bdc25cea67efb60009e", + "sha256": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e", + "bytes": 1124331, + "role": "owner template for the owner engine" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "author": "Marius-Paul Dumitrean (PR2930)", + "upstream_path": "research/paired-extension-cap-fill/CLAIM.json", + "package_path": "allocation/baseline/CLAIM.json", + "git_blob": "4f8ea2dbe4f723f9324852ddc8fed63e017ed9f1", + "sha256": "9c2c14158780a677b3661623d7476acc4f535ac9e0481addfa1d6c4c7633b74b", + "bytes": 1957, + "role": "PR2930 complete headline (comparator)" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "author": "Marius-Paul Dumitrean (PR2930)", + "upstream_path": "research/paired-extension-cap-fill/allocation/ORDER.json", + "package_path": "allocation/baseline/ORDER.json", + "git_blob": "7409c4df1092241729739596c7648bda504e6aad", + "sha256": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1", + "bytes": 4573, + "role": "PR2930 order (baseline for the moment auditor)" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "author": "Marius-Paul Dumitrean (PR2930)", + "upstream_path": "research/paired-extension-cap-fill/allocation/PROFILE.json", + "package_path": "allocation/baseline/PROFILE.json", + "git_blob": "968ff38ed21585d8d59980d28a4bc8ad51563eb7", + "sha256": "8b6f825a93cb1fa94047b062f1b1b8d489b2c397ec0c8114d0e53737f56c065e", + "bytes": 104, + "role": "PR2930 complete paid profile (baseline for the moment auditor)" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "author": "Marius-Paul Dumitrean (PR2930)", + "upstream_path": "research/paired-extension-cap-fill/tools/relax.py", + "package_path": "tools/relax.py", + "git_blob": "97dfe35c434283ca6e83818e61aed65740522f50", + "sha256": "0fed1c56b50a2e6d44deeeb6db0f1c7e1f71b86d1747130e1a9202216249a728", + "bytes": 17680, + "role": "exact fixed-capacity relaxation (r12 lineage, as shipped by PR2930)" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "author": "Marius-Paul Dumitrean (PR2930)", + "upstream_path": "research/paired-extension-cap-fill/tools/relax_exact.py", + "package_path": "tools/relax_exact.py", + "git_blob": "0be97756bb9d8b072c962c147d4b4d3b3122f884", + "sha256": "baf1855d6095c951a90d19a0d8094bd33290519940b732e2b758c5647830f044", + "bytes": 5397, + "role": "Fractions-only basis verification" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "author": "Marius-Paul Dumitrean (PR2930)", + "upstream_path": "research/paired-extension-cap-fill/tools/root.py", + "package_path": "tools/root.py", + "git_blob": "bd6dc2eb4e5013625d17cc08461b67622bcfed69", + "sha256": "55f5aca39b5ee2fe4687ac8863e6c24569010f27a332883c069b8e14b8fe09e3", + "bytes": 10888, + "role": "exact complete-profile root bracket" + } + ], + "adapted_sources": [ + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "upstream_path": "research/paired-helper-extension/producer.py", + "package_path": "producer.py", + "change": "same pure composition rule (refit, inputs after the prelude, outputs appended to restore, C*S, frame_report, derive_cleanup); declares the four normal-45 helpers, PR2917 parent constants, an explicit E_45 hyperplane check and the 86-buffer target" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "upstream_path": "research/paired-helper-extension/verify.py", + "package_path": "verify.py", + "change": "four steps; five semantic mutant kinds per step and provider; overlay spec round trip" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "upstream_path": "research/paired-extension-cap-fill/tools/audit_allocation_moment.py", + "package_path": "tools/audit_allocation_moment.py", + "change": "PR2917 moment auditor with the authenticated baseline re-pinned to the PR2930 headline; nothing else" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "upstream_path": "research/paired-extension-cap-fill/tools/derive_adapters.py", + "package_path": "tools/derive_adapters.py", + "change": "comparators pinned by head and CLAIM.json sha256 (pr2908, pr2917, pr2930)" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "upstream_path": "research/paired-extension-cap-fill/check_allocation.py", + "package_path": "check_allocation.py", + "change": "new words and allocation, 86 buffers, physical 66,808, PR2930 comparator" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "upstream_path": "research/paired-extension-cap-fill/check_cap.py", + "package_path": "check_cap.py", + "change": "changed inventory; fractional cap basis, literal root below the cap with the recorded gap" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "upstream_path": "research/paired-extension-cap-fill/reproduce.py", + "package_path": "reproduce.py", + "change": "also exports PR2930; appends the normal45-paired-extractions overlay stage; 86-buffer adapters; PR2930 comparator" + }, + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "upstream_path": "research/paired-extension-cap-fill/run_registered.py", + "package_path": "run_registered.py", + "change": "adds verify.py and the overlay receipt binding" + } + ], + "new_sources": [ + "data/WORD-base.json.gz", + "data/WORD-extra.json.gz", + "data/TRANSFORM-249.json", + "data/TRANSFORM-267.json", + "data/TRANSFORM-251.json", + "data/TRANSFORM-265.json", + "allocation/FILL.json.gz", + "allocation/PROFILE.json", + "allocation/PROVIDERS.json", + "allocation/SEARCH.json", + "certificates/RELAX-CAP.json", + "tools/build_overlay.py", + "tools/wordedit.py", + "construction/" + ], + "upstream_exports": [ + { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "package": "research/paired-extension-cap-fill", + "manifest_sha256": "0380ef12f271dbd3cb3ecd274ada74a303512a066be55169219ffee3ab990765", + "role": "comparator CLAIM.json" + }, + { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "package": "research/paired-helper-extension", + "manifest_sha256": "55c46ddf2e3edc87dfe1ba3320947466d36980d457eb37f6cd6fba341dae0192", + "role": "parent words, extension stage" + }, + { + "pr": 2908, + "head": "51309592971e3b5be935599eed2a95404dc7781e", + "package": "research/two-sided-helper-extraction", + "manifest_sha256": "9dba3fe371602ec023a54e26c0fd66f69eb7a74be86aab89923529083c14b36f", + "role": "paired stage, adapter templates" + }, + { + "pr": 2894, + "head": "18d03c447886895ef9abf888398178e0428533ca", + "package": "research/shared-kernel-packing", + "role": "exported by PR2908 reproduce.py --dry-run" + }, + { + "pr": 2833, + "head": "e9307b48d7d1b690939935ecef0f8e524e6d92f4", + "role": "source materialized and authenticated by PR2894 tools/materialize_source.py" + } + ], + "derived_source": { + "pr2917_manifest_sha256": "98d57c82a1c7318be3c330c3b66897844d57232f0aaeaea88fb4bebd0a1bedf1", + "pr2917_files": 632, + "manifest_sha256": "79956f19c5c3d4d1ad3578e4b3d6844bc54c1f3680825fc87c80cc04f069dae8", + "files": 637, + "builder": "tools/build_overlay.py (stage normal45-paired-extractions) on PR2917 tools/build_extension.py output" + }, + "source_boundary": "Only this new package is submitted. The parent words are PR2917s, byte-identical; exact frozen ancestor exports remain unchanged. Full replay performs no network fetch." +} diff --git a/research/paired-extension-normal45/TASK.json b/research/paired-extension-normal45/TASK.json new file mode 100644 index 0000000000..9d60c13e37 --- /dev/null +++ b/research/paired-extension-normal45/TASK.json @@ -0,0 +1,78 @@ +{ + "schema_version": 1, + "task_id": "complex-new-helper-inventory", + "priority_revision": 5, + "base_commit": "914cd73f563acaaa682d733a9fbfcc07272336a3", + "original_card": { + "id": "complex-new-helper-inventory", + "question": "Can a new local cost interface change the deficit-to-recursive-cost ratio beyond current packing?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/heterogeneous-owner-assembly/README.md", + "certificates/selected-result.json", + "research/selected-k8-unrestricted-ends/README.md" + ], + "methods": [ + "Propose a changed helper inventory and derive an optimistic exact moment.", + "Design a small completed instance and independently verify its endpoint and rank bill." + ], + "acceptance_gate": "A new physically realizable contract outside the frozen catalogue whose per-call profile, screened with ceiling.ceiling(), beats the selected word's packing ceiling; a lower cap does not establish identical circuitry or order attainable optima, and is insufficient to pass the stronger-budget target under this model. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Before any synthesis, write the candidate per-call local profile (and centre charge / unpaid coordinates if changed) and screen it with ceiling.ceiling(); reject it if even the ideal ceiling does not beat the selected word's by your stated margin.", + "bottleneck_link": "Packing of the selected word is capped at +0.87% (ceiling model); only a lower local excess spend or a changed coverage law raises the cap.", + "allowed_variations": [ + "Narrow to one changed boundary or helper type with explicit counts.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Mixing only providers already inside the pinned catalogue.", + "Only changing helper terminal subspaces and monotone frames within the fixed scalar word, entrances and cleanup contract already covered by #1995/#2013.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "helper inventory", + "heterogeneous-owner", + "mutable leaver" + ] + }, + "scope_status": "refined", + "actual_scope": "Four further paired input/output extractions on PR2917's final words, all at hyperplane normal 45 (helpers 249, 267, 251, 265 restored at E_45, ten declared inherited-frame edits, 86 private buffers), a literal T74 allocation of the changed inventory, and complete fresh-native admission and modern outer release against the PR2930 headline.", + "scope_change_reason": "The card asks whether a changed helper inventory beats current packing. PR2930 showed that the fill layer of PR2917's words is exhausted (its allocation attains their exact packing cap), so further gains must change the words. A census of single further extractions on PR2917's final word finds none at break-even; the joint composition of four extractions sharing one hyperplane lowers the paid local profile enough to raise the packing cap above PR2930's. As in PR2917, the paired basis change alters the scalar word and endpoint contract; finite exact identities and a fully charged literal allocation are required.", + "bottleneck_link": "Four helpers change width 9 to 8 and four private buffers are added; the local profile changes by 18H1 - 8H2 + 6H3 - 6H4 per call. The fixed-capacity cap of the changed inventory rises from PR2930's 0.0017224999064 to 0.0017228172707; the literal allocation realizes all but 9.5e-10 of it, charging every unused owner remainder.", + "budget_minutes": 240, + "stop_rule": "Freeze the four-step composition after exact local checks; publish a higher conditional kappa only if both native providers, literal owner geometry, physical stock, prefix and complete outer admission pass strictly above the PR2930 headline.", + "outcome": "completed", + "evidence": "Search (construction/EXTRACTION-STEPS.json): the exact cost identity total(U,P) = Delta_end(U u P) + c1|U - P| reproduces the composition (-25,311,496 + 8 c1 = -8,378,128); every complete rank-4 composition at normal 45 touches the same 12 registers whose only helpers are the four pivots (three other orders end at exactly -8,378,128); no other normal has a positive margin before or after. Checks: run_registered.py (stdlib): package pins; verify.py (producer reconstruction, four structure certificates per provider, PR2833 auditor forward/dual on both words, frame accounting, 40 semantic controls, overlay spec round trip); check_allocation.py (owner engine, five controls, physical 66,808, exact moment vs PR2930); check_cap.py (Fractions-only cap certificate of the changed inventory, recorded literal gap); stored receipts binding. reproduce.py: exact Git exports of PR2908/PR2917/PR2930 (and through them PR2894/PR2833), fresh retained bootstrap, PR2917 derived source plus the normal45-paired-extractions stage, 86-buffer adapters, fresh native chains for both providers and complete admission: PASS_REPLICA_ORDER_FILL_DERIVATIVE_COMPLETE_RELEASE and PASS_RELEASE at the claimed kappa.", + "author": "Marius-Paul Dumitrean", + "ai_assistance": "Substantial AI assistance (Anthropic Claude via Claude Code) for search, implementation, exact computation and checks; no independent human review is claimed.", + "open_questions": [ + { + "question": "Can edits outside the paired-extraction lever lower the 88,556-unit overhead of the 12-register universe at normal 45, or make other normals profitable?", + "why_it_matters": "Within the present cost model (output gates at the end of restore, the fixed gate order with exactly re-solved frames, zero-entry pivots) the four-step composition is the optimum of the lever: its certified cost depends only on the touched set and the pivots, every complete rank-4 composition at normal 45 touches the same 12 registers, and no other normal has a positive margin before or after it.", + "first_step": "Price gate re-timings that let registers 62, 63, 2 and 94 reach E_45 more cheaply, output gates placed before the end of restore, and entering-helper (start_extra) pivots with the certified frame solver, then re-run the per-normal census with the cost identity.", + "blocked_by": "These edits change the gate order or the entrance contract and need their own exact local, owner and complete admission chain." + }, + { + "question": "Can the changed inventory be packed closer to its cap?", + "why_it_matters": "Its fractional optimum is fractional at T74 ([9^5] 396/5 per replica); the literal fill is 9.5e-10 below the cap.", + "first_step": "Try other chronologies (e.g. a T148 doubling of the T74 flow) or PR2863-style lockstep copies with vacancy relays, and price with root.py.", + "blocked_by": "Integrality of the basic solution at T74." + }, + { + "question": "Do other frontier words admit profitable joint compositions?", + "why_it_matters": "The cost identity total(U,P) = Delta_end(U u P) + c1 |U \\ P| prices a whole composition with one certified solver call per (normal, support universe), so the joint test is cheap on any word.", + "first_step": "For each candidate word, compute the admissible pairing rank and support universe per normal, price the universes with the identity, and synthesize gates only where the shared overhead fits under k x 25,371.", + "blocked_by": "None." + } + ] +} diff --git a/research/paired-extension-normal45/VERIFY.json b/research/paired-extension-normal45/VERIFY.json new file mode 100644 index 0000000000..b6d6e2206e --- /dev/null +++ b/research/paired-extension-normal45/VERIFY.json @@ -0,0 +1,14 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": ["{python}", "-B", "{package}/run_registered.py"], + "timeout_seconds": 480, + "checks": "Complete package pins; producer reconstruction of both new words from PR2917's words and the four declared normal-45 transforms; PR2908/PR2917's exact two-sided structure certificate at every step; PR2833's auditor forward and dual over all 632 inputs on both final words (86 buffers); frame accounting; 40 semantic rejection controls; literal T74 owner geometry of the new allocation with PR2917's vendored PR2839 engine (271,728 roles, 86-buffer physical stock 66,808) and five rejection controls; PR2917's exact dyadic moment auditor re-pinned to PR2930's headline (strict gain); Fractions-only fixed-capacity relaxation certificate of the changed inventory and the recorded literal gap; binding of the stored complete overlay/native/admission/release receipts to the exact words, allocation and claim. Native and integrated admission are rerun separately by reproduce.py from exact Git sources." + } + ] +} diff --git a/research/paired-extension-normal45/allocation/DISPATCH.json b/research/paired-extension-normal45/allocation/DISPATCH.json new file mode 100644 index 0000000000..9544fee4e6 --- /dev/null +++ b/research/paired-extension-normal45/allocation/DISPATCH.json @@ -0,0 +1 @@ +[[0,0,"extra"],[0,37,"extra"],[0,1,"extra"],[0,38,"extra"],[0,2,"extra"],[0,39,"extra"],[0,3,"extra"],[0,40,"extra"],[0,4,"extra"],[0,41,"extra"],[1,0,"extra"],[1,37,"extra"],[0,5,"extra"],[0,42,"extra"],[1,1,"extra"],[1,38,"extra"],[0,6,"extra"],[0,43,"extra"],[1,2,"extra"],[1,39,"extra"],[0,7,"extra"],[0,44,"extra"],[1,3,"extra"],[1,40,"extra"],[0,8,"extra"],[0,45,"extra"],[1,4,"extra"],[1,41,"extra"],[0,9,"extra"],[0,46,"extra"],[2,0,"extra"],[2,37,"extra"],[1,5,"extra"],[1,42,"extra"],[0,10,"extra"],[0,47,"extra"],[2,1,"extra"],[2,38,"extra"],[1,6,"extra"],[1,43,"extra"],[0,11,"extra"],[0,48,"extra"],[2,2,"extra"],[2,39,"extra"],[1,7,"extra"],[1,44,"extra"],[0,12,"extra"],[0,49,"extra"],[2,3,"extra"],[2,40,"extra"],[1,8,"extra"],[1,45,"extra"],[0,13,"extra"],[0,50,"extra"],[2,4,"extra"],[2,41,"extra"],[1,9,"extra"],[1,46,"extra"],[3,0,"extra"],[3,37,"extra"],[0,14,"extra"],[0,51,"extra"],[2,5,"extra"],[2,42,"extra"],[1,10,"extra"],[1,47,"extra"],[3,1,"extra"],[3,38,"extra"],[0,15,"extra"],[0,52,"extra"],[2,6,"extra"],[2,43,"extra"],[1,11,"extra"],[1,48,"extra"],[3,2,"extra"],[3,39,"extra"],[0,16,"extra"],[0,53,"extra"],[2,7,"extra"],[2,44,"extra"],[1,12,"extra"],[1,49,"extra"],[3,3,"extra"],[3,40,"extra"],[0,17,"extra"],[0,54,"extra"],[2,8,"extra"],[2,45,"extra"],[1,13,"extra"],[1,50,"extra"],[3,4,"extra"],[3,41,"extra"],[0,18,"extra"],[0,55,"extra"],[2,9,"extra"],[2,46,"extra"],[4,0,"extra"],[4,37,"extra"],[1,14,"extra"],[1,51,"extra"],[3,5,"extra"],[3,42,"extra"],[0,19,"extra"],[0,56,"extra"],[2,10,"extra"],[2,47,"extra"],[4,1,"extra"],[4,38,"extra"],[1,15,"extra"],[1,52,"extra"],[3,6,"extra"],[3,43,"extra"],[0,20,"extra"],[0,57,"extra"],[2,11,"extra"],[2,48,"extra"],[4,2,"extra"],[4,39,"extra"],[1,16,"extra"],[1,53,"extra"],[3,7,"extra"],[3,44,"extra"],[0,21,"extra"],[0,58,"extra"],[2,12,"extra"],[2,49,"extra"],[4,3,"extra"],[4,40,"extra"],[1,17,"extra"],[1,54,"extra"],[3,8,"extra"],[3,45,"extra"],[0,22,"extra"],[0,59,"extra"],[2,13,"extra"],[2,50,"extra"],[4,4,"extra"],[4,41,"extra"],[1,18,"extra"],[1,55,"extra"],[3,9,"extra"],[3,46,"extra"],[0,23,"extra"],[0,60,"extra"],[5,0,"extra"],[5,37,"extra"],[2,14,"extra"],[2,51,"extra"],[4,5,"extra"],[4,42,"extra"],[1,19,"extra"],[1,56,"extra"],[3,10,"extra"],[3,47,"extra"],[0,24,"extra"],[0,61,"extra"],[5,1,"extra"],[5,38,"extra"],[2,15,"extra"],[2,52,"extra"],[4,6,"extra"],[4,43,"extra"],[1,20,"extra"],[1,57,"extra"],[3,11,"extra"],[3,48,"extra"],[0,25,"extra"],[0,62,"extra"],[5,2,"extra"],[5,39,"extra"],[2,16,"extra"],[2,53,"extra"],[4,7,"extra"],[4,44,"extra"],[1,21,"extra"],[1,58,"extra"],[3,12,"extra"],[3,49,"extra"],[0,26,"extra"],[0,63,"extra"],[5,3,"extra"],[5,40,"extra"],[2,17,"extra"],[2,54,"extra"],[4,8,"extra"],[4,45,"extra"],[1,22,"extra"],[1,59,"extra"],[3,13,"extra"],[3,50,"extra"],[0,27,"extra"],[0,64,"extra"],[5,4,"extra"],[5,41,"extra"],[2,18,"extra"],[2,55,"extra"],[4,9,"extra"],[4,46,"extra"],[1,23,"extra"],[1,60,"extra"],[6,0,"extra"],[6,37,"extra"],[3,14,"extra"],[3,51,"extra"],[0,28,"extra"],[0,65,"extra"],[5,5,"extra"],[5,42,"extra"],[2,19,"extra"],[2,56,"extra"],[4,10,"extra"],[4,47,"extra"],[1,24,"extra"],[1,61,"extra"],[6,1,"extra"],[6,38,"extra"],[3,15,"extra"],[3,52,"extra"],[0,29,"extra"],[0,66,"extra"],[5,6,"extra"],[5,43,"extra"],[2,20,"extra"],[2,57,"extra"],[4,11,"extra"],[4,48,"extra"],[1,25,"extra"],[1,62,"extra"],[6,2,"extra"],[6,39,"extra"],[3,16,"extra"],[3,53,"extra"],[0,30,"extra"],[0,67,"extra"],[5,7,"extra"],[5,44,"extra"],[2,21,"extra"],[2,58,"extra"],[4,12,"extra"],[4,49,"extra"],[1,26,"extra"],[1,63,"extra"],[6,3,"extra"],[6,40,"extra"],[3,17,"extra"],[3,54,"extra"],[0,31,"extra"],[0,68,"extra"],[5,8,"extra"],[5,45,"extra"],[2,22,"extra"],[2,59,"extra"],[4,13,"extra"],[4,50,"extra"],[1,27,"extra"],[1,64,"extra"],[6,4,"extra"],[6,41,"extra"],[3,18,"extra"],[3,55,"extra"],[0,32,"extra"],[0,69,"extra"],[5,9,"extra"],[5,46,"extra"],[2,23,"extra"],[2,60,"extra"],[7,0,"extra"],[7,37,"extra"],[4,14,"extra"],[4,51,"extra"],[1,28,"extra"],[1,65,"extra"],[6,5,"extra"],[6,42,"extra"],[3,19,"extra"],[3,56,"extra"],[0,33,"extra"],[0,70,"extra"],[5,10,"extra"],[5,47,"extra"],[2,24,"extra"],[2,61,"extra"],[7,1,"extra"],[7,38,"extra"],[4,15,"extra"],[4,52,"extra"],[1,29,"extra"],[1,66,"extra"],[6,6,"extra"],[6,43,"extra"],[3,20,"extra"],[3,57,"extra"],[0,34,"extra"],[0,71,"extra"],[5,11,"extra"],[5,48,"extra"],[2,25,"extra"],[2,62,"extra"],[7,2,"extra"],[7,39,"extra"],[4,16,"extra"],[4,53,"extra"],[1,30,"extra"],[1,67,"extra"],[6,7,"extra"],[6,44,"extra"],[3,21,"extra"],[3,58,"extra"],[0,35,"extra"],[0,72,"extra"],[5,12,"extra"],[5,49,"extra"],[2,26,"extra"],[2,63,"extra"],[7,3,"extra"],[7,40,"extra"],[4,17,"extra"],[4,54,"extra"],[1,31,"extra"],[1,68,"extra"],[6,8,"extra"],[6,45,"extra"],[3,22,"extra"],[3,59,"extra"],[0,36,"extra"],[0,73,"extra"],[5,13,"extra"],[5,50,"extra"],[2,27,"extra"],[2,64,"extra"],[7,4,"extra"],[7,41,"extra"],[4,18,"extra"],[4,55,"extra"],[1,32,"extra"],[1,69,"extra"],[6,9,"extra"],[6,46,"extra"],[3,23,"extra"],[3,60,"extra"],[8,0,"extra"],[8,37,"extra"],[5,14,"extra"],[5,51,"extra"],[2,28,"extra"],[2,65,"extra"],[7,5,"extra"],[7,42,"extra"],[4,19,"extra"],[4,56,"extra"],[1,33,"extra"],[1,70,"extra"],[6,10,"extra"],[6,47,"extra"],[3,24,"extra"],[3,61,"extra"],[8,1,"extra"],[8,38,"extra"],[5,15,"extra"],[5,52,"extra"],[2,29,"extra"],[2,66,"extra"],[7,6,"extra"],[7,43,"extra"],[4,20,"extra"],[4,57,"extra"],[1,34,"extra"],[1,71,"extra"],[6,11,"extra"],[6,48,"extra"],[3,25,"extra"],[3,62,"extra"],[8,2,"extra"],[8,39,"extra"],[5,16,"extra"],[5,53,"extra"],[2,30,"extra"],[2,67,"extra"],[7,7,"extra"],[7,44,"extra"],[4,21,"extra"],[4,58,"extra"],[1,35,"extra"],[1,72,"extra"],[6,12,"extra"],[6,49,"extra"],[3,26,"extra"],[3,63,"extra"],[8,3,"extra"],[8,40,"extra"],[5,17,"extra"],[5,54,"extra"],[2,31,"extra"],[2,68,"extra"],[7,8,"extra"],[7,45,"extra"],[4,22,"extra"],[4,59,"extra"],[1,36,"extra"],[1,73,"extra"],[6,13,"extra"],[6,50,"extra"],[3,27,"extra"],[3,64,"extra"],[8,4,"extra"],[8,41,"extra"],[5,18,"extra"],[5,55,"extra"],[2,32,"extra"],[2,69,"extra"],[7,9,"extra"],[7,46,"extra"],[4,23,"extra"],[4,60,"extra"],[6,14,"extra"],[6,51,"extra"],[3,28,"gauge44"],[3,65,"gauge44"],[8,5,"gauge44"],[8,42,"gauge44"],[5,19,"gauge44"],[5,56,"gauge44"],[2,33,"gauge44"],[2,70,"gauge44"],[7,10,"gauge44"],[7,47,"gauge44"],[4,24,"gauge44"],[4,61,"gauge44"],[6,15,"gauge44"],[6,52,"gauge44"],[3,29,"gauge44"],[3,66,"gauge44"],[8,6,"gauge44"],[8,43,"gauge44"],[5,20,"gauge44"],[5,57,"gauge44"],[2,34,"gauge44"],[2,71,"gauge44"],[7,11,"gauge44"],[7,48,"gauge44"],[4,25,"gauge44"],[4,62,"gauge44"],[6,16,"gauge44"],[6,53,"gauge44"],[3,30,"gauge44"],[3,67,"gauge44"],[8,7,"gauge44"],[8,44,"gauge44"],[5,21,"gauge44"],[5,58,"gauge44"],[2,35,"gauge44"],[2,72,"gauge44"],[7,12,"gauge44"],[7,49,"gauge44"],[4,26,"gauge44"],[4,63,"gauge44"],[6,17,"gauge44"],[6,54,"gauge44"],[3,31,"gauge44"],[3,68,"gauge44"],[8,8,"gauge44"],[8,45,"gauge44"],[5,22,"gauge44"],[5,59,"gauge44"],[2,36,"gauge44"],[2,73,"gauge44"],[7,13,"gauge44"],[7,50,"gauge44"],[4,27,"gauge44"],[4,64,"gauge44"],[6,18,"gauge44"],[6,55,"gauge44"],[3,32,"gauge44"],[3,69,"gauge44"],[8,9,"gauge44"],[8,46,"gauge44"],[5,23,"gauge44"],[5,60,"gauge44"],[7,14,"gauge44"],[7,51,"gauge44"],[4,28,"gauge44"],[4,65,"gauge44"],[6,19,"gauge44"],[6,56,"gauge44"],[3,33,"gauge44"],[3,70,"gauge44"],[8,10,"gauge44"],[8,47,"gauge44"],[5,24,"gauge44"],[5,61,"gauge44"],[7,15,"gauge44"],[7,52,"gauge44"],[4,29,"gauge44"],[4,66,"gauge44"],[6,20,"gauge44"],[6,57,"gauge44"],[3,34,"gauge44"],[3,71,"gauge44"],[8,11,"gauge44"],[8,48,"gauge44"],[5,25,"gauge44"],[5,62,"gauge44"],[7,16,"gauge44"],[7,53,"gauge44"],[4,30,"gauge44"],[4,67,"gauge44"],[6,21,"gauge44"],[6,58,"gauge44"],[3,35,"gauge44"],[3,72,"gauge44"],[8,12,"gauge44"],[8,49,"gauge44"],[5,26,"gauge44"],[5,63,"gauge44"],[7,17,"gauge44"],[7,54,"gauge44"],[4,31,"gauge44"],[4,68,"gauge44"],[6,22,"gauge44"],[6,59,"gauge44"],[3,36,"gauge44"],[3,73,"gauge44"],[8,13,"gauge44"],[8,50,"gauge44"],[5,27,"gauge44"],[5,64,"gauge44"],[7,18,"gauge44"],[7,55,"gauge44"],[4,32,"gauge44"],[4,69,"gauge44"],[6,23,"gauge44"],[6,60,"gauge44"],[8,14,"gauge44"],[8,51,"gauge44"],[5,28,"gauge44"],[5,65,"gauge44"],[7,19,"gauge44"],[7,56,"gauge44"],[4,33,"gauge44"],[4,70,"gauge44"],[6,24,"gauge44"],[6,61,"gauge44"],[8,15,"gauge44"],[8,52,"gauge44"],[5,29,"gauge44"],[5,66,"gauge44"],[7,20,"gauge44"],[7,57,"gauge44"],[4,34,"gauge44"],[4,71,"gauge44"],[6,25,"gauge44"],[6,62,"gauge44"],[8,16,"gauge44"],[8,53,"gauge44"],[5,30,"gauge44"],[5,67,"gauge44"],[7,21,"gauge44"],[7,58,"gauge44"],[4,35,"gauge44"],[4,72,"gauge44"],[6,26,"gauge44"],[6,63,"gauge44"],[8,17,"gauge44"],[8,54,"gauge44"],[5,31,"gauge44"],[5,68,"gauge44"],[7,22,"gauge44"],[7,59,"gauge44"],[4,36,"gauge44"],[4,73,"gauge44"],[6,27,"gauge44"],[6,64,"gauge44"],[8,18,"gauge44"],[8,55,"gauge44"],[5,32,"gauge44"],[5,69,"gauge44"],[7,23,"gauge44"],[7,60,"gauge44"],[6,28,"gauge44"],[6,65,"gauge44"],[8,19,"gauge44"],[8,56,"gauge44"],[5,33,"gauge44"],[5,70,"gauge44"],[7,24,"gauge44"],[7,61,"gauge44"],[6,29,"gauge44"],[6,66,"gauge44"],[8,20,"gauge44"],[8,57,"gauge44"],[5,34,"gauge44"],[5,71,"gauge44"],[7,25,"gauge44"],[7,62,"gauge44"],[6,30,"gauge44"],[6,67,"gauge44"],[8,21,"gauge44"],[8,58,"gauge44"],[5,35,"gauge44"],[5,72,"gauge44"],[7,26,"gauge44"],[7,63,"gauge44"],[6,31,"gauge44"],[6,68,"gauge44"],[8,22,"gauge44"],[8,59,"gauge44"],[5,36,"gauge44"],[5,73,"gauge44"],[7,27,"gauge44"],[7,64,"gauge44"],[6,32,"gauge44"],[6,69,"gauge44"],[8,23,"gauge44"],[8,60,"gauge44"],[7,28,"gauge44"],[7,65,"gauge44"],[6,33,"gauge44"],[6,70,"gauge44"],[8,24,"gauge44"],[8,61,"gauge44"],[7,29,"gauge44"],[7,66,"gauge44"],[6,34,"gauge44"],[6,71,"gauge44"],[8,25,"gauge44"],[8,62,"gauge44"],[7,30,"gauge44"],[7,67,"gauge44"],[6,35,"gauge44"],[6,72,"gauge44"],[8,26,"gauge44"],[8,63,"gauge44"],[7,31,"gauge44"],[7,68,"gauge44"],[6,36,"gauge44"],[6,73,"gauge44"],[8,27,"gauge44"],[8,64,"gauge44"],[7,32,"gauge44"],[7,69,"gauge44"],[8,28,"gauge44"],[8,65,"gauge44"],[7,33,"gauge44"],[7,70,"gauge44"],[8,29,"gauge44"],[8,66,"gauge44"],[7,34,"gauge44"],[7,71,"gauge44"],[8,30,"gauge44"],[8,67,"gauge44"],[7,35,"gauge44"],[7,72,"gauge44"],[8,31,"gauge44"],[8,68,"gauge44"],[7,36,"gauge44"],[7,73,"gauge44"],[8,32,"gauge44"],[8,69,"gauge44"],[8,33,"gauge44"],[8,70,"gauge44"],[8,34,"gauge44"],[8,71,"gauge44"],[8,35,"gauge44"],[8,72,"gauge44"],[8,36,"gauge44"],[8,73,"gauge44"]] \ No newline at end of file diff --git a/research/paired-extension-normal45/allocation/FILL.json.gz b/research/paired-extension-normal45/allocation/FILL.json.gz new file mode 100644 index 0000000000..0bbabf43b2 Binary files /dev/null and b/research/paired-extension-normal45/allocation/FILL.json.gz differ diff --git a/research/paired-extension-normal45/allocation/ORDER.json b/research/paired-extension-normal45/allocation/ORDER.json new file mode 100644 index 0000000000..7409c4df10 --- /dev/null +++ b/research/paired-extension-normal45/allocation/ORDER.json @@ -0,0 +1 @@ +[[0,0],[0,37],[0,1],[0,38],[0,2],[0,39],[0,3],[0,40],[0,4],[0,41],[1,0],[1,37],[0,5],[0,42],[1,1],[1,38],[0,6],[0,43],[1,2],[1,39],[0,7],[0,44],[1,3],[1,40],[0,8],[0,45],[1,4],[1,41],[0,9],[0,46],[2,0],[2,37],[1,5],[1,42],[0,10],[0,47],[2,1],[2,38],[1,6],[1,43],[0,11],[0,48],[2,2],[2,39],[1,7],[1,44],[0,12],[0,49],[2,3],[2,40],[1,8],[1,45],[0,13],[0,50],[2,4],[2,41],[1,9],[1,46],[3,0],[3,37],[0,14],[0,51],[2,5],[2,42],[1,10],[1,47],[3,1],[3,38],[0,15],[0,52],[2,6],[2,43],[1,11],[1,48],[3,2],[3,39],[0,16],[0,53],[2,7],[2,44],[1,12],[1,49],[3,3],[3,40],[0,17],[0,54],[2,8],[2,45],[1,13],[1,50],[3,4],[3,41],[0,18],[0,55],[2,9],[2,46],[4,0],[4,37],[1,14],[1,51],[3,5],[3,42],[0,19],[0,56],[2,10],[2,47],[4,1],[4,38],[1,15],[1,52],[3,6],[3,43],[0,20],[0,57],[2,11],[2,48],[4,2],[4,39],[1,16],[1,53],[3,7],[3,44],[0,21],[0,58],[2,12],[2,49],[4,3],[4,40],[1,17],[1,54],[3,8],[3,45],[0,22],[0,59],[2,13],[2,50],[4,4],[4,41],[1,18],[1,55],[3,9],[3,46],[0,23],[0,60],[5,0],[5,37],[2,14],[2,51],[4,5],[4,42],[1,19],[1,56],[3,10],[3,47],[0,24],[0,61],[5,1],[5,38],[2,15],[2,52],[4,6],[4,43],[1,20],[1,57],[3,11],[3,48],[0,25],[0,62],[5,2],[5,39],[2,16],[2,53],[4,7],[4,44],[1,21],[1,58],[3,12],[3,49],[0,26],[0,63],[5,3],[5,40],[2,17],[2,54],[4,8],[4,45],[1,22],[1,59],[3,13],[3,50],[0,27],[0,64],[5,4],[5,41],[2,18],[2,55],[4,9],[4,46],[1,23],[1,60],[6,0],[6,37],[3,14],[3,51],[0,28],[0,65],[5,5],[5,42],[2,19],[2,56],[4,10],[4,47],[1,24],[1,61],[6,1],[6,38],[3,15],[3,52],[0,29],[0,66],[5,6],[5,43],[2,20],[2,57],[4,11],[4,48],[1,25],[1,62],[6,2],[6,39],[3,16],[3,53],[0,30],[0,67],[5,7],[5,44],[2,21],[2,58],[4,12],[4,49],[1,26],[1,63],[6,3],[6,40],[3,17],[3,54],[0,31],[0,68],[5,8],[5,45],[2,22],[2,59],[4,13],[4,50],[1,27],[1,64],[6,4],[6,41],[3,18],[3,55],[0,32],[0,69],[5,9],[5,46],[2,23],[2,60],[7,0],[7,37],[4,14],[4,51],[1,28],[1,65],[6,5],[6,42],[3,19],[3,56],[0,33],[0,70],[5,10],[5,47],[2,24],[2,61],[7,1],[7,38],[4,15],[4,52],[1,29],[1,66],[6,6],[6,43],[3,20],[3,57],[0,34],[0,71],[5,11],[5,48],[2,25],[2,62],[7,2],[7,39],[4,16],[4,53],[1,30],[1,67],[6,7],[6,44],[3,21],[3,58],[0,35],[0,72],[5,12],[5,49],[2,26],[2,63],[7,3],[7,40],[4,17],[4,54],[1,31],[1,68],[6,8],[6,45],[3,22],[3,59],[0,36],[0,73],[5,13],[5,50],[2,27],[2,64],[7,4],[7,41],[4,18],[4,55],[1,32],[1,69],[6,9],[6,46],[3,23],[3,60],[8,0],[8,37],[5,14],[5,51],[2,28],[2,65],[7,5],[7,42],[4,19],[4,56],[1,33],[1,70],[6,10],[6,47],[3,24],[3,61],[8,1],[8,38],[5,15],[5,52],[2,29],[2,66],[7,6],[7,43],[4,20],[4,57],[1,34],[1,71],[6,11],[6,48],[3,25],[3,62],[8,2],[8,39],[5,16],[5,53],[2,30],[2,67],[7,7],[7,44],[4,21],[4,58],[1,35],[1,72],[6,12],[6,49],[3,26],[3,63],[8,3],[8,40],[5,17],[5,54],[2,31],[2,68],[7,8],[7,45],[4,22],[4,59],[1,36],[1,73],[6,13],[6,50],[3,27],[3,64],[8,4],[8,41],[5,18],[5,55],[2,32],[2,69],[7,9],[7,46],[4,23],[4,60],[6,14],[6,51],[3,28],[3,65],[8,5],[8,42],[5,19],[5,56],[2,33],[2,70],[7,10],[7,47],[4,24],[4,61],[6,15],[6,52],[3,29],[3,66],[8,6],[8,43],[5,20],[5,57],[2,34],[2,71],[7,11],[7,48],[4,25],[4,62],[6,16],[6,53],[3,30],[3,67],[8,7],[8,44],[5,21],[5,58],[2,35],[2,72],[7,12],[7,49],[4,26],[4,63],[6,17],[6,54],[3,31],[3,68],[8,8],[8,45],[5,22],[5,59],[2,36],[2,73],[7,13],[7,50],[4,27],[4,64],[6,18],[6,55],[3,32],[3,69],[8,9],[8,46],[5,23],[5,60],[7,14],[7,51],[4,28],[4,65],[6,19],[6,56],[3,33],[3,70],[8,10],[8,47],[5,24],[5,61],[7,15],[7,52],[4,29],[4,66],[6,20],[6,57],[3,34],[3,71],[8,11],[8,48],[5,25],[5,62],[7,16],[7,53],[4,30],[4,67],[6,21],[6,58],[3,35],[3,72],[8,12],[8,49],[5,26],[5,63],[7,17],[7,54],[4,31],[4,68],[6,22],[6,59],[3,36],[3,73],[8,13],[8,50],[5,27],[5,64],[7,18],[7,55],[4,32],[4,69],[6,23],[6,60],[8,14],[8,51],[5,28],[5,65],[7,19],[7,56],[4,33],[4,70],[6,24],[6,61],[8,15],[8,52],[5,29],[5,66],[7,20],[7,57],[4,34],[4,71],[6,25],[6,62],[8,16],[8,53],[5,30],[5,67],[7,21],[7,58],[4,35],[4,72],[6,26],[6,63],[8,17],[8,54],[5,31],[5,68],[7,22],[7,59],[4,36],[4,73],[6,27],[6,64],[8,18],[8,55],[5,32],[5,69],[7,23],[7,60],[6,28],[6,65],[8,19],[8,56],[5,33],[5,70],[7,24],[7,61],[6,29],[6,66],[8,20],[8,57],[5,34],[5,71],[7,25],[7,62],[6,30],[6,67],[8,21],[8,58],[5,35],[5,72],[7,26],[7,63],[6,31],[6,68],[8,22],[8,59],[5,36],[5,73],[7,27],[7,64],[6,32],[6,69],[8,23],[8,60],[7,28],[7,65],[6,33],[6,70],[8,24],[8,61],[7,29],[7,66],[6,34],[6,71],[8,25],[8,62],[7,30],[7,67],[6,35],[6,72],[8,26],[8,63],[7,31],[7,68],[6,36],[6,73],[8,27],[8,64],[7,32],[7,69],[8,28],[8,65],[7,33],[7,70],[8,29],[8,66],[7,34],[7,71],[8,30],[8,67],[7,35],[7,72],[8,31],[8,68],[7,36],[7,73],[8,32],[8,69],[8,33],[8,70],[8,34],[8,71],[8,35],[8,72],[8,36],[8,73]] \ No newline at end of file diff --git a/research/paired-extension-normal45/allocation/PROFILE.json b/research/paired-extension-normal45/allocation/PROFILE.json new file mode 100644 index 0000000000..fb42d6d616 --- /dev/null +++ b/research/paired-extension-normal45/allocation/PROFILE.json @@ -0,0 +1,10 @@ +{ + "1": 1638360, + "2": 420912, + "3": 196337, + "4": 69264, + "5": 23531, + "8": 5328, + "14": 1, + "48": 27291 +} \ No newline at end of file diff --git a/research/paired-extension-normal45/allocation/PROVIDERS.json b/research/paired-extension-normal45/allocation/PROVIDERS.json new file mode 100644 index 0000000000..5b60ab9c76 --- /dev/null +++ b/research/paired-extension-normal45/allocation/PROVIDERS.json @@ -0,0 +1,842 @@ +{ + "extra": { + "actual_paid_profile": { + "1": 2434, + "2": 632, + "3": 286, + "4": 104, + "5": 26, + "8": 8 + }, + "widths": [ + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 8, + 9, + 9, + 9, + 9, + 8, + 9, + 9, + 4, + 9, + 4, + 9, + 8, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 9, + 4, + 9, + 4, + 9, + 8, + 9, + 9, + 4, + 8, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 9, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 9, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 9, + 8, + 8, + 9, + 8, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 8, + 7, + 7, + 7, + 7, + 8, + 9, + 8, + 9, + 7, + 7, + 7, + 7, + 7, + 7, + 9, + 9, + 9, + 9, + 8, + 8, + 8, + 8, + 8, + 8, + 9, + 9, + 9, + 9, + 8, + 7, + 7, + 8, + 8, + 8, + 8, + 9, + 9, + 9, + 9, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 8, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 8, + 7, + 8, + 8, + 9, + 9, + 9, + 9, + 8, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 9, + 8, + 9, + 8, + 8, + 8, + 8, + 8, + 7, + 7, + 9, + 8, + 9, + 8, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 5, + 5, + 8, + 8, + 8, + 8 + ] + }, + "gauge44": { + "actual_paid_profile": { + "1": 2434, + "2": 632, + "3": 286, + "4": 104, + "5": 26, + "8": 8 + }, + "widths": [ + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 8, + 9, + 9, + 9, + 9, + 8, + 9, + 9, + 4, + 9, + 4, + 9, + 8, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 9, + 4, + 9, + 4, + 9, + 8, + 9, + 9, + 4, + 8, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 4, + 9, + 4, + 9, + 4, + 9, + 9, + 9, + 9, + 4, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 9, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 9, + 9, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 9, + 8, + 8, + 9, + 8, + 9, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 8, + 8, + 7, + 7, + 7, + 7, + 8, + 9, + 8, + 9, + 7, + 7, + 7, + 7, + 7, + 7, + 9, + 9, + 9, + 9, + 8, + 8, + 8, + 8, + 8, + 8, + 9, + 9, + 9, + 9, + 8, + 7, + 7, + 8, + 8, + 8, + 8, + 9, + 9, + 9, + 9, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 8, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 8, + 7, + 8, + 8, + 9, + 9, + 9, + 9, + 8, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 9, + 8, + 9, + 8, + 8, + 8, + 8, + 8, + 7, + 7, + 9, + 8, + 9, + 8, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 8, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 5, + 5, + 8, + 8, + 8, + 8 + ] + } +} \ No newline at end of file diff --git a/research/paired-extension-normal45/allocation/SEARCH.json b/research/paired-extension-normal45/allocation/SEARCH.json new file mode 100644 index 0000000000..947cc229e6 --- /dev/null +++ b/research/paired-extension-normal45/allocation/SEARCH.json @@ -0,0 +1,52 @@ +{ + "calls": 666, + "gain_vs_PR2917_claim_float": 1.2276726654124474e-06, + "gain_vs_PR2930_claim": "316413419939763639/1000000000000000000000000", + "gain_vs_PR2930_claim_float": 3.1641341993976365e-07, + "gap_to_relaxation_cap_float": 9.50879635192914e-10, + "headline_floor24_minus_1e-46_minus_1e-70": "0.0017228163198632143279959999999999999999999998999999999999999999999999", + "idle_histogram": { + "1": 17316, + "14": 1, + "3": 5861, + "48": 27291, + "5": 6215 + }, + "kappa_root_bracket": [ + "430704079965803581999/250000000000000000000000", + "17228163198632143279961/10000000000000000000000000" + ], + "kappa_root_lower_decimal": "0.001722816319863214327996", + "lineage": "PR2917 (mason-hale) words/chronology/engine; PR2930 (cap fill); r13 lane A n45x4 extractions; PR2857 flow model and realization; PR2839 owner engine; lane C r12 relax/root/fill tools; r13 lane C1.", + "method": [ + "providers_from_words.py: PROVIDERS.json derived from the two words exactly as PR2917 check_allocation.py does (helpers = sorted(range(224,704) - removed); width = dim(helper_final or FULL9) - dim(start_extra); profile = preload_move.frame_report = report.local_profile; 86 cleanup buffers = helper_final ids); the same code reproduces PR2917's PROVIDERS.json byte-for-byte.", + "relax.py: inventory {4:26,5:2,7:62,8:100,9:218}, local {1:2434,2:632,3:286,4:104,5:26,8:8}: cap [17228172707428495209099/1e25, 172281727074284952091/1e23]; basis fractional per replica ([9^5] 396/5, [] 1844/5).", + "fill17.py: PR2857-style chronological flow DIRECTLY under PR2917's T74 ORDER/DISPATCH (666 calls) with the milp integer mix over ALL 1163 patterns at T74 (8:[8] 49728, 16:[8,8] 8436, 16:[7,9] 24716, 32:[9,9] 1, 32:[9,9,9] 6215, 32:[7,7,9,9] 8288, 32:[5,9,9,9] 1332, 32:[4,9,9,9] 17316, 48:[] 27291, 48:[9^5] 5861; the best integer mix at T74, gap 9.51e-10); CP-SAT 9.15.6755, num_search_workers=1, random_seed=1, no hint; first feasible flow at 334.7 s; edge-colouring realization.", + "No doubling: the T74 flow is solved directly on PR2917's chronology (ORDER/DISPATCH unchanged).", + "Checks: vendored PR2839 owner engine check() PASS; five check_allocation.py rejection controls; PR2917's tools/audit_allocation_moment.py re-pinned to PR2930's CLAIM (sha 9c2c1415...) with baseline = PR2930 CLAIM/ORDER/PROFILE; root.py exact bracket." + ], + "order_and_dispatch_unchanged_vs_PR2917": true, + "physical": 66808, + "profile": { + "1": 1638360, + "14": 1, + "2": 420912, + "3": 196337, + "4": 69264, + "48": 27291, + "5": 23531, + "8": 5328 + }, + "relaxation_cap_bracket": [ + "17228172707428495209099/10000000000000000000000000", + "172281727074284952091/100000000000000000000000" + ], + "replicas": 74, + "roles": 271728, + "scope": "Literal T74 owner allocation for the n45x4 words (PR2917/PR2930 words + four paired extractions at normal 45: helpers 249/251/265/267 restored at E_45, 86 private buffers), on PR2917's unchanged ORDER/DISPATCH chronology. Local/native/global/outer admission remains separate.", + "status": "C1_FLOW_ROUTE_LITERAL_FILL_N45X4_V2_DIRECT_T74", + "words_sha256": { + "base": "54ca34c749e3228d7e2df3d8dbf7aa1568c2872490166997c5962f12fd03da35", + "extra": "eded756dfe8f411c3d1f80a3ac16516f0ea5dd6f9866728b2179b157630fa7b6" + } +} diff --git a/research/paired-extension-normal45/allocation/baseline/CLAIM.json b/research/paired-extension-normal45/allocation/baseline/CLAIM.json new file mode 100644 index 0000000000..4f8ea2dbe4 --- /dev/null +++ b/research/paired-extension-normal45/allocation/baseline/CLAIM.json @@ -0,0 +1,38 @@ +{ + "admitted_package_manifest_sha256": "b690eab49b010091973a4e7d1b8d58306200fd09f4c2281bbeeec57aa1b077d5", + "baseline_head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "baseline_kappa": "17215886471978018806049999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "baseline_pr": 2917, + "calls": 666, + "complex_lower": "1722499906443274564357/1000000000000000000000000", + "coverage_law_ceiling_approx": "0.0017580218062580484", + "fill_sha256": "e045aa613f8fba06d81313f5e1c2cbec9ee94552163b8d1eb9205bf2fa7f2285", + "fixed_inventory_cap": { + "cap_lower": "1722499906443274564357/1000000000000000000000000", + "cap_upper": "17224999064432745643571/10000000000000000000000000", + "realized": "attained (profile equals the fractional optimum)" + }, + "gain": "113907405684085469/125000000000000000000000", + "helpers": 408, + "independent_inputs": 632, + "kappa": "17224999064432745643569999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "kappa_decimal": "0.0017224999064432745643569999999999999999999998999999999999999999999999", + "live_families": 66304, + "native_receipt_sha256": "9a2e23c80436cf257c6f21fa4bd3f796fdb569bf30005ca2c2bb16d8f2094969", + "physical_families": 66804, + "profile": { + "1": 1626372, + "2": 426240, + "3": 192474, + "4": 73260, + "48": 27158, + "5": 24198, + "8": 5328 + }, + "release_receipt_sha256": "efc5eebdc42e976b0500cd032e1b6f4b8755fa33d9a23ac27415e27922e85b75", + "replicas": 74, + "scope": "Conditional finite supplier/outer certificate for PR2917's unchanged words with a new literal T74 allocation. Inherited all-size/compiler/theorem hypotheses remain. No selected-frontier change or independent-human-review claim.", + "source_manifest_sha256": "98d57c82a1c7318be3c330c3b66897844d57232f0aaeaea88fb4bebd0a1bedf1", + "status": "CONDITIONAL_CANDIDATE_COMPLETE_FINITE_RELEASE", + "zero_buffers": 82 +} diff --git a/research/paired-extension-normal45/allocation/baseline/ORDER.json b/research/paired-extension-normal45/allocation/baseline/ORDER.json new file mode 100644 index 0000000000..7409c4df10 --- /dev/null +++ b/research/paired-extension-normal45/allocation/baseline/ORDER.json @@ -0,0 +1 @@ +[[0,0],[0,37],[0,1],[0,38],[0,2],[0,39],[0,3],[0,40],[0,4],[0,41],[1,0],[1,37],[0,5],[0,42],[1,1],[1,38],[0,6],[0,43],[1,2],[1,39],[0,7],[0,44],[1,3],[1,40],[0,8],[0,45],[1,4],[1,41],[0,9],[0,46],[2,0],[2,37],[1,5],[1,42],[0,10],[0,47],[2,1],[2,38],[1,6],[1,43],[0,11],[0,48],[2,2],[2,39],[1,7],[1,44],[0,12],[0,49],[2,3],[2,40],[1,8],[1,45],[0,13],[0,50],[2,4],[2,41],[1,9],[1,46],[3,0],[3,37],[0,14],[0,51],[2,5],[2,42],[1,10],[1,47],[3,1],[3,38],[0,15],[0,52],[2,6],[2,43],[1,11],[1,48],[3,2],[3,39],[0,16],[0,53],[2,7],[2,44],[1,12],[1,49],[3,3],[3,40],[0,17],[0,54],[2,8],[2,45],[1,13],[1,50],[3,4],[3,41],[0,18],[0,55],[2,9],[2,46],[4,0],[4,37],[1,14],[1,51],[3,5],[3,42],[0,19],[0,56],[2,10],[2,47],[4,1],[4,38],[1,15],[1,52],[3,6],[3,43],[0,20],[0,57],[2,11],[2,48],[4,2],[4,39],[1,16],[1,53],[3,7],[3,44],[0,21],[0,58],[2,12],[2,49],[4,3],[4,40],[1,17],[1,54],[3,8],[3,45],[0,22],[0,59],[2,13],[2,50],[4,4],[4,41],[1,18],[1,55],[3,9],[3,46],[0,23],[0,60],[5,0],[5,37],[2,14],[2,51],[4,5],[4,42],[1,19],[1,56],[3,10],[3,47],[0,24],[0,61],[5,1],[5,38],[2,15],[2,52],[4,6],[4,43],[1,20],[1,57],[3,11],[3,48],[0,25],[0,62],[5,2],[5,39],[2,16],[2,53],[4,7],[4,44],[1,21],[1,58],[3,12],[3,49],[0,26],[0,63],[5,3],[5,40],[2,17],[2,54],[4,8],[4,45],[1,22],[1,59],[3,13],[3,50],[0,27],[0,64],[5,4],[5,41],[2,18],[2,55],[4,9],[4,46],[1,23],[1,60],[6,0],[6,37],[3,14],[3,51],[0,28],[0,65],[5,5],[5,42],[2,19],[2,56],[4,10],[4,47],[1,24],[1,61],[6,1],[6,38],[3,15],[3,52],[0,29],[0,66],[5,6],[5,43],[2,20],[2,57],[4,11],[4,48],[1,25],[1,62],[6,2],[6,39],[3,16],[3,53],[0,30],[0,67],[5,7],[5,44],[2,21],[2,58],[4,12],[4,49],[1,26],[1,63],[6,3],[6,40],[3,17],[3,54],[0,31],[0,68],[5,8],[5,45],[2,22],[2,59],[4,13],[4,50],[1,27],[1,64],[6,4],[6,41],[3,18],[3,55],[0,32],[0,69],[5,9],[5,46],[2,23],[2,60],[7,0],[7,37],[4,14],[4,51],[1,28],[1,65],[6,5],[6,42],[3,19],[3,56],[0,33],[0,70],[5,10],[5,47],[2,24],[2,61],[7,1],[7,38],[4,15],[4,52],[1,29],[1,66],[6,6],[6,43],[3,20],[3,57],[0,34],[0,71],[5,11],[5,48],[2,25],[2,62],[7,2],[7,39],[4,16],[4,53],[1,30],[1,67],[6,7],[6,44],[3,21],[3,58],[0,35],[0,72],[5,12],[5,49],[2,26],[2,63],[7,3],[7,40],[4,17],[4,54],[1,31],[1,68],[6,8],[6,45],[3,22],[3,59],[0,36],[0,73],[5,13],[5,50],[2,27],[2,64],[7,4],[7,41],[4,18],[4,55],[1,32],[1,69],[6,9],[6,46],[3,23],[3,60],[8,0],[8,37],[5,14],[5,51],[2,28],[2,65],[7,5],[7,42],[4,19],[4,56],[1,33],[1,70],[6,10],[6,47],[3,24],[3,61],[8,1],[8,38],[5,15],[5,52],[2,29],[2,66],[7,6],[7,43],[4,20],[4,57],[1,34],[1,71],[6,11],[6,48],[3,25],[3,62],[8,2],[8,39],[5,16],[5,53],[2,30],[2,67],[7,7],[7,44],[4,21],[4,58],[1,35],[1,72],[6,12],[6,49],[3,26],[3,63],[8,3],[8,40],[5,17],[5,54],[2,31],[2,68],[7,8],[7,45],[4,22],[4,59],[1,36],[1,73],[6,13],[6,50],[3,27],[3,64],[8,4],[8,41],[5,18],[5,55],[2,32],[2,69],[7,9],[7,46],[4,23],[4,60],[6,14],[6,51],[3,28],[3,65],[8,5],[8,42],[5,19],[5,56],[2,33],[2,70],[7,10],[7,47],[4,24],[4,61],[6,15],[6,52],[3,29],[3,66],[8,6],[8,43],[5,20],[5,57],[2,34],[2,71],[7,11],[7,48],[4,25],[4,62],[6,16],[6,53],[3,30],[3,67],[8,7],[8,44],[5,21],[5,58],[2,35],[2,72],[7,12],[7,49],[4,26],[4,63],[6,17],[6,54],[3,31],[3,68],[8,8],[8,45],[5,22],[5,59],[2,36],[2,73],[7,13],[7,50],[4,27],[4,64],[6,18],[6,55],[3,32],[3,69],[8,9],[8,46],[5,23],[5,60],[7,14],[7,51],[4,28],[4,65],[6,19],[6,56],[3,33],[3,70],[8,10],[8,47],[5,24],[5,61],[7,15],[7,52],[4,29],[4,66],[6,20],[6,57],[3,34],[3,71],[8,11],[8,48],[5,25],[5,62],[7,16],[7,53],[4,30],[4,67],[6,21],[6,58],[3,35],[3,72],[8,12],[8,49],[5,26],[5,63],[7,17],[7,54],[4,31],[4,68],[6,22],[6,59],[3,36],[3,73],[8,13],[8,50],[5,27],[5,64],[7,18],[7,55],[4,32],[4,69],[6,23],[6,60],[8,14],[8,51],[5,28],[5,65],[7,19],[7,56],[4,33],[4,70],[6,24],[6,61],[8,15],[8,52],[5,29],[5,66],[7,20],[7,57],[4,34],[4,71],[6,25],[6,62],[8,16],[8,53],[5,30],[5,67],[7,21],[7,58],[4,35],[4,72],[6,26],[6,63],[8,17],[8,54],[5,31],[5,68],[7,22],[7,59],[4,36],[4,73],[6,27],[6,64],[8,18],[8,55],[5,32],[5,69],[7,23],[7,60],[6,28],[6,65],[8,19],[8,56],[5,33],[5,70],[7,24],[7,61],[6,29],[6,66],[8,20],[8,57],[5,34],[5,71],[7,25],[7,62],[6,30],[6,67],[8,21],[8,58],[5,35],[5,72],[7,26],[7,63],[6,31],[6,68],[8,22],[8,59],[5,36],[5,73],[7,27],[7,64],[6,32],[6,69],[8,23],[8,60],[7,28],[7,65],[6,33],[6,70],[8,24],[8,61],[7,29],[7,66],[6,34],[6,71],[8,25],[8,62],[7,30],[7,67],[6,35],[6,72],[8,26],[8,63],[7,31],[7,68],[6,36],[6,73],[8,27],[8,64],[7,32],[7,69],[8,28],[8,65],[7,33],[7,70],[8,29],[8,66],[7,34],[7,71],[8,30],[8,67],[7,35],[7,72],[8,31],[8,68],[7,36],[7,73],[8,32],[8,69],[8,33],[8,70],[8,34],[8,71],[8,35],[8,72],[8,36],[8,73]] \ No newline at end of file diff --git a/research/paired-extension-normal45/allocation/baseline/PROFILE.json b/research/paired-extension-normal45/allocation/baseline/PROFILE.json new file mode 100644 index 0000000000..968ff38ed2 --- /dev/null +++ b/research/paired-extension-normal45/allocation/baseline/PROFILE.json @@ -0,0 +1,9 @@ +{ + "1": 1626372, + "2": 426240, + "3": 192474, + "4": 73260, + "5": 24198, + "8": 5328, + "48": 27158 +} \ No newline at end of file diff --git a/research/paired-extension-normal45/allocation/vendor/PLAN.json.gz b/research/paired-extension-normal45/allocation/vendor/PLAN.json.gz new file mode 100644 index 0000000000..7a1db55a4d Binary files /dev/null and b/research/paired-extension-normal45/allocation/vendor/PLAN.json.gz differ diff --git a/research/paired-extension-normal45/allocation/vendor/TEMPLATE.json.gz b/research/paired-extension-normal45/allocation/vendor/TEMPLATE.json.gz new file mode 100644 index 0000000000..114808c32b Binary files /dev/null and b/research/paired-extension-normal45/allocation/vendor/TEMPLATE.json.gz differ diff --git a/research/paired-extension-normal45/allocation/vendor/independent_owners.py b/research/paired-extension-normal45/allocation/vendor/independent_owners.py new file mode 100644 index 0000000000..16013201b1 --- /dev/null +++ b/research/paired-extension-normal45/allocation/vendor/independent_owners.py @@ -0,0 +1,111 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Independent integer-time and mask check of the actual parameterized-replica owner allocation with PR2802 retired7 providers. + +Chronology/mask method derives from Tekalign's PR2751 independent_owners.py; +Marius-Paul Dumitrean's PR2802 retired7 native construction and the retained +provider frame checker keep their +upstream attribution. No solver, producer, emitter or floating arithmetic is +imported. This checks finite geometry, not global native/outer admission. +""" +from pathlib import Path +from collections import Counter,defaultdict +import argparse,hashlib,gzip,json,sys,types +sys.dont_write_bytecode=True +def need(v,msg): + if not v:raise ValueError(msg) +def sha(p):return hashlib.sha256(p.read_bytes()).hexdigest() +def read(p): + b=Path(p).read_bytes();return json.loads(gzip.decompress(b)if str(p).endswith('.gz')else b) +def inputs(PROVIDER): + provider_pins={'inputs/PLAN.json.gz':'afb3c5c8134fc2cfce0b50a21758490c225574994b2c3c5161e53e2355acc6fa','inputs/GLOBAL-TEMPLATE.json.gz':'21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e','independent_local.py':'ee1faab70095fa312fc61d375ddf015b76104cb1a542ae7876a149e7999faa20','inputs/PROVIDERS.json':'391075b1411a3976850c633f92f58c35ed3f046f09d55bd435d7545124543fd4','inputs/WORD-base.json.gz':'dca8becca633ffc5e998985631bcbcab1123b27ca7f10ac6a96b1ec21ce69a66','inputs/WORD-extra.json.gz':'6bcb3c2c73eaf7558ddc6ef6b484334f8d96b9d2b227e265483b657de00f4bb7'} + hashes={} + for n,pin in provider_pins.items(): + p=PROVIDER/n;need(sha(p)==pin,'pinned PR2802 provider source '+n);hashes[str(p)]=pin + L=types.ModuleType('retained_independent_frames');exec(compile((PROVIDER/'independent_local.py').read_bytes(),'pinned_PR2802_independent_local.py','exec'),L.__dict__);providers=read(PROVIDER/'inputs/PROVIDERS.json') + for tag,pid in [('base','gauge44'),('extra','extra')]: + word=read(PROVIDER/f'inputs/WORD-{tag}.json.gz');report,start,ends=L.check_frames(word);L.check_cleanup(word);L.algebra(word) + widths=[L.dm(ends[k])-L.dm(start[k])for k in sorted(start)if k>=224] + need(widths==providers[pid]['widths']and len(widths)==408,'actual ordered provider frame widths');need(len(word['centers'])==8,'eight centres');providers[pid]['actual_paid_profile']={int(k):v for k,v in report['profile'].items()} + return read(PROVIDER/'inputs/PLAN.json.gz'),read(PROVIDER/'inputs/GLOBAL-TEMPLATE.json.gz'),providers,hashes + +def windows(template,order,T): + ranks={c['child']:c['rank']for c in template['idle_children']};pairs={e['stage']:e['pair']for e in template['recipe']if e['kind']=='local'} + blocks={};stage=None + for event in template['execution_schedule']: + if event['kind']in('bank_padding_cover_sweep','translate_every_live_family'):continue + if event['kind']=='local_cover_sweep':stage=event['stage'];blocks[stage]=[] + need(stage is not None,'source event before local call');blocks[stage].append(event) + need(set(blocks)==set(range(9)),'nine source stages') + progress=[0]*T;last={};result={} + for t,(stage,replica)in enumerate(order): + need(0<=replica0,'idle source position');start=last.get((replica,event['pair']),-1) + for child in event['child_indices']: + if child in ranks:result[replica,child]=(ranks[child],start,t) + elif kind in ('terminal_Y_translations','terminal'):pass # inherited terminal phase; no pending-window endpoints + else:raise ValueError('unknown source event kind') + need(progress==[9]*T,'complete replica source progression');return result + +def check(T,order,fill,dispatch,claimed,plan,template,providers): + need(type(T)is int and T>0,'positive T');N=9*T + need(len(order)==N and set(map(tuple,order))=={(s,r)for s in range(9)for r in range(T)},'complete T call coverage') + win=windows(template,order,T) + need(set(dispatch)==set(map(tuple,order))and all(p in providers for p in dispatch.values()),'provider dispatch coverage') + for s,r,pid in fill.get('dispatch_overrides',[]):need(dispatch.get((s,r))==pid,'final dispatch override binding') + need(fill['columns']==['time','helper','owner_replica','child','port','offset'],'literal role columns') + need(len(fill['rows'])==N*408,'complete role count');helpers=[0]*N;families=[0]*N;occupied={};lastrow={} + for idx,row in enumerate(fill['rows']): + need(len(row)==6 and all(type(x)is int for x in row),'integer role shape');t,h,o,c,p,z=row + need(0<=tlastrow[key][0]:lastrow[key]=(z,idx,w) + need(helpers==[(1<<408)-1]*N,'all helper identities');idle=Counter() + for(o,c),(cap,_,_)in win.items(): + for p in range(112): + key=(o,c,p);mask=occupied.get(key,0);used=mask.bit_count();need(mask==(1<= 704} + assert buffers == {704 + int(h) for h in word['helper_final']}, 'actual cleanup buffer/end-point bijection' + assert len(buffers) == BUFFERS, 'all 86 private buffers charged' + private_counts.add(len(buffers)) + providers[provider] = {'widths': widths, 'actual_paid_profile': {int(k): v for k, v in profile.items()}} + word_records[tag] = {'sha256': sha(path), 'local_profile': profile, 'width_inventory': inventory, 'private_buffers': len(buffers)} + assert len(private_counts) == 1 + registry = read(P / 'allocation/PROVIDERS.json') + assert {k: {'widths': v['widths'], 'actual_paid_profile': {int(r): n for r, n in v['actual_paid_profile'].items()}} for k, v in registry.items()} == providers + base = P / 'allocation' + order, fill = read(base / 'ORDER.json'), read(base / 'FILL.json.gz') + raw_dispatch = read(base / 'DISPATCH.json') + dispatch = {(s, r): provider for s, r, provider in raw_dispatch} + assert len(dispatch) == len(raw_dispatch), 'unique actual call/provider binding' + profile = read(base / 'PROFILE.json') + plan, template = read(base / 'vendor/PLAN.json.gz'), read(base / 'vendor/TEMPLATE.json.gz') + T = len(order) // 9 + def check(candidate=fill, claimed=profile): + return owners.check(T, order, candidate, dispatch, claimed, plan, template, providers) + result, _, _ = check() + assert T == 74 and result['roles'] == 271728 + result['physical'] = result['live'] + len(helpers) + len(word['centers']) + next(iter(private_counts)) + 2 + assert result['physical'] == PHYSICAL + result['physical_source'] = 'Actual 86-register private cleanup namespace, 408 live helpers, eight centres and two guards; global stock checked separately.' + controls = {} + def reject(name, candidate=fill, claimed=profile): + try: + check(candidate, claimed) + except ValueError as error: + controls[name] = str(error) + else: + raise AssertionError('owner corruption accepted: ' + name) + reject('missing_role', {**fill, 'rows': fill['rows'][:-1]}) + first = fill['rows'][0] + j = next(i for i, r in enumerate(fill['rows'][1:], 1) if r[0] == first[0]) + def mutate(index, row): + rows = list(fill['rows']); rows[index] = row + return {**fill, 'rows': rows} + duplicate = list(fill['rows'][j]); duplicate[1] = first[1] + reject('duplicate_helper', mutate(j, duplicate)) + collision = list(fill['rows'][j]); collision[2:5] = first[2:5] + reject('same_call_family_collision', mutate(j, collision)) + overflow = list(first); overflow[5] = 49 + reject('capacity_overflow', mutate(0, overflow)) + wrong = dict(profile); wrong['1'] = wrong.get('1', 0) + 1 + reject('changed_paid_profile', claimed=wrong) + exact = moment.run(base, base / 'baseline') + claim = read(P / 'CLAIM.json') + assert {str(k): v for k, v in profile.items()} == {str(k): v for k, v in claim['profile'].items()}, 'claimed complete profile' + assert all(sha(P / name) == digest for name, digest in {**word_pins, **allocation_pins}.items()), 'input drift' + result.update(status='PASS_NORMAL45_LITERAL_OWNERS_AND_EXACT_MOMENT', providers=word_records, + controls=controls, moment=exact, allocation_sha256=allocation_pins, + scope='Recounted local frames, exact whole-owner geometry and directed moment; algebra/native/global/outer admission remains separately required.') + (out / 'RESULT.json').write_text(json.dumps(result, sort_keys=True, indent=2) + '\n') + print(result['status'], exact['target_decimal'], exact['gain_decimal']) + +if __name__ == '__main__': + main() diff --git a/research/paired-extension-normal45/check_cap.py b/research/paired-extension-normal45/check_cap.py new file mode 100644 index 0000000000..9d1caa58c0 --- /dev/null +++ b/research/paired-extension-normal45/check_cap.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Fractions-only certificate of the fixed-capacity packing cap of the new words, and the literal gap to it. + +certificates/RELAX-CAP.json stores the 9-pattern optimal basis of the fractional relaxation of this package's +inventory {4:26,5:2,7:62,8:100,9:218} with local profile {1:2434,2:632,3:286,4:104,5:26,8:8} (bins 672/448/448/448 +per replica of capacity 8/16/32/48, all 1,163 count-vector patterns, one idle child per bin, the complete per-call +local profile paid). tools/relax_exact.py checks, with exact rationals only, the basis' primal feasibility (the cap +is at least its root) and the sign of every pattern's reduced cost at the upper end of the root bracket (weak +duality: the cap is at most that end). Unlike PR2930's cap of PR2917's words, this optimum is FRACTIONAL per +replica ([9^5] x 396/5 and [] x 1844/5 at cap 48; 74 x 396/5 is not an integer), so no allocation can realize this +basic solution literally. This script checks that the literal profile allocation/PROFILE.json is a complete +profile of these words (666 calls x local + idle children, rank mass 74 x 65,088), that its exact root bracket lies +below the cap (as weak duality requires), and records the exact gap. No optimality of the literal fill among +integral allocations is claimed. Marius-Paul Dumitrean, with substantial AI assistance (Claude Code). The +relaxation model and root arithmetic are ours (research/t37-word-level-census-r12 lineage, as shipped by PR2930). +""" +import gzip, json, sys +from fractions import Fraction as Q +from pathlib import Path +P = Path(__file__).resolve().parent +sys.path.insert(0, str(P / 'tools')) +import relax_exact as RE +import root as R + +# PR2930's certificate for PR2917's inventory {8:96,9:222}: the SAME nine optimal patterns, with that inventory's basic +# counts. The changed inventory keeps the pattern set and moves the counts ([9^5] 81 -> 396/5, [] 367 -> 1844/5, ...), +# so the old stored counts must be rejected (control). +STALE_BASIS = [(8, [8], '672'), (16, [7, 9], '352'), (32, [7, 7, 9, 9], '103'), (16, [8, 8], '96'), (48, [9] * 5, '81'), + (32, [5, 9, 9, 9], '18'), (32, [9, 9, 9], '93'), (32, [4, 9, 9, 9], '234'), (48, [], '367')] + +def read(path): + raw = path.read_bytes() + return json.loads(gzip.decompress(raw) if raw[:2] == b'\x1f\x8b' else raw) + +def main(): + if not __debug__: + raise SystemExit('refusing python -O') + cert = read(P / 'certificates/RELAX-CAP.json') + words = [read(P / f'data/WORD-{t}.json.gz') for t in ('base', 'extra')] + for w in words: + assert dict(w['report']['local_profile']) == cert['local_per_call'], 'certificate local profile = actual words' + assert dict(w['report']['width_inventory']) == cert['inventory_per_call'], 'certificate inventory = actual words' + r = RE.verify_basis(cert['local_per_call'], cert['inventory_per_call'], cert['basis_patterns']) + assert r['status'] == 'PASS_EXACT_RELAXATION_CAP' and r['patterns'] == 1163 + cap_lo, cap_hi = Q(r['cap_lower']), Q(r['cap_upper']) + assert (cap_lo, cap_hi) == (Q(cert['cap_lower']), Q(cert['cap_upper'])) + T, calls = 74, 666 + fractional = {k: str(T * Q(v)) for k, v in r['idle_per_replica'].items() if (T * Q(v)).denominator != 1} + assert fractional, 'the optimal basic solution is fractional at T74' + profile = {int(k): v for k, v in read(P / 'allocation/PROFILE.json').items()} + assert sum(r_ * n for r_, n in profile.items()) == T * R.MASS_PER_REPLICA, 'complete rank mass 74 x 65088' + idle = dict(profile) + for k, v in cert['local_per_call'].items(): + idle[int(k)] = idle.get(int(k), 0) - calls * v + assert all(v >= 0 for v in idle.values()), 'literal profile pays the complete local profile of every call' + idle = {k: v for k, v in sorted(idle.items()) if v} + lo, hi = R.kappa_from_profile(profile, T) + assert lo < hi <= cap_hi and hi <= cap_lo + Q(1, 10 ** 25), 'literal root at most the cap (weak duality)' + gap = (cap_lo - hi, cap_hi - lo) + assert 0 < gap[0] <= gap[1] < Q(1, 10 ** 9), 'recorded gap below 1e-9' + controls = {} + try: + bad = [dict(e) for e in cert['basis_patterns']]; bad[0] = dict(bad[0]); bad[0]['widths'] = list(bad[0]['widths']) + [4] + RE.verify_basis(cert['local_per_call'], cert['inventory_per_call'], bad) + except Exception as error: + controls['perturbed_basis_pattern'] = str(error)[:160] + else: + raise AssertionError('perturbed basis accepted') + try: + RE.verify_basis(cert['local_per_call'], cert['inventory_per_call'], [{'capacity': c, 'widths': w, 'count_per_replica': n} for c, w, n in STALE_BASIS]) + except Exception as error: + controls['stale_pr2930_counts_for_changed_inventory'] = str(error)[:160] + else: + raise AssertionError('the old-inventory basic counts must not certify the changed inventory') + assert sorted((c, tuple(w)) for c, w, n in STALE_BASIS) == sorted((e['capacity'], tuple(e['widths'])) for e in cert['basis_patterns']), 'same optimal pattern set as PR2930' + over = dict(profile); over[48] -= 1; over[24] = over.get(24, 0) + 2 # a finer idle split of the same rank mass + if not R.kappa_from_profile(over, T)[1] < lo: + raise AssertionError('a finer idle split must lower the literal root (concavity)') + controls['finer_idle_split_lowers_root'] = 'PASS' + out = dict(status='PASS_LITERAL_ALLOCATION_BELOW_FIXED_INVENTORY_CAP_WITH_RECORDED_GAP', cap_lower=str(cap_lo), cap_upper=str(cap_hi), + literal_lower=str(lo), literal_upper=str(hi), gap_lower=str(gap[0]), gap_upper=str(gap[1]), gap_float=float(gap[0]), + tight_patterns=r['tight_patterns'], strict_patterns=r['strict_patterns'], idle_per_replica=r['idle_per_replica'], + fractional_at_T74=fractional, literal_idle=idle, profile={str(k): v for k, v in sorted(profile.items())}, controls=controls) + print(json.dumps(out, sort_keys=True)) + +if __name__ == '__main__': + main() diff --git a/research/paired-extension-normal45/construction/EXTRACTION-STEPS.json b/research/paired-extension-normal45/construction/EXTRACTION-STEPS.json new file mode 100644 index 0000000000..f759c5145d --- /dev/null +++ b/research/paired-extension-normal45/construction/EXTRACTION-STEPS.json @@ -0,0 +1,440 @@ +{ + "note": "Search-time pricing (certified frame solver integer units, 2^-40 at the base saving; c1 = 2,116,671; break-even 2,091,300 per extraction, i.e. 25,371 units of overhead). Provenance only: the claim rests on verify.py, check_allocation.py, check_cap.py and the complete admission.", + "steps": [ + { + "step": 1, + "normal": 45, + "helper": 249, + "structure": "PASS_EXACT_TWO_SIDED_SUBSPACE_CERTIFICATE", + "delta_units": -2070499, + "cumulative_units": -2070499, + "cumulative_vs_breakeven": 20801, + "profile": { + "1": 2429, + "2": 634, + "3": 282, + "4": 108, + "5": 26, + "8": 8 + }, + "cumulative_profile_delta": { + "1": 13, + "2": -6, + "3": 2, + "4": -2 + }, + "inventory": { + "4": 26, + "5": 2, + "7": 62, + "8": 97, + "9": 221 + }, + "buffers": 83, + "n_before": 28, + "n_after": 10, + "relax_cap_lower_decimal": "0.0017220208644894766936347" + }, + { + "step": 2, + "normal": 45, + "helper": 267, + "structure": "PASS_EXACT_TWO_SIDED_SUBSPACE_CERTIFICATE", + "delta_units": -2100475, + "cumulative_units": -4170974, + "cumulative_vs_breakeven": 11626, + "profile": { + "1": 2430, + "2": 634, + "3": 284, + "4": 106, + "5": 26, + "8": 8 + }, + "cumulative_profile_delta": { + "1": 14, + "2": -6, + "3": 4, + "4": -4 + }, + "inventory": { + "4": 26, + "5": 2, + "7": 62, + "8": 98, + "9": 220 + }, + "buffers": 84, + "n_before": 29, + "n_after": 11, + "relax_cap_lower_decimal": "0.00172223819934208033902" + }, + { + "step": 3, + "normal": 45, + "helper": 251, + "structure": "PASS_EXACT_TWO_SIDED_SUBSPACE_CERTIFICATE", + "delta_units": -2098581, + "cumulative_units": -6269555, + "cumulative_vs_breakeven": 4345, + "profile": { + "1": 2434, + "2": 632, + "3": 285, + "4": 105, + "5": 26, + "8": 8 + }, + "cumulative_profile_delta": { + "1": 18, + "2": -8, + "3": 5, + "4": -5 + }, + "inventory": { + "4": 26, + "5": 2, + "7": 62, + "8": 99, + "9": 219 + }, + "buffers": 85, + "n_before": 28, + "n_after": 11, + "relax_cap_lower_decimal": "0.0017224115901393111687126" + }, + { + "step": 4, + "normal": 45, + "helper": 265, + "structure": "PASS_EXACT_TWO_SIDED_SUBSPACE_CERTIFICATE", + "delta_units": -2108573, + "cumulative_units": -8378128, + "cumulative_vs_breakeven": -12928, + "profile": { + "1": 2434, + "2": 632, + "3": 286, + "4": 104, + "5": 26, + "8": 8 + }, + "cumulative_profile_delta": { + "1": 18, + "2": -8, + "3": 6, + "4": -6 + }, + "inventory": { + "4": 26, + "5": 2, + "7": 62, + "8": 100, + "9": 218 + }, + "buffers": 86, + "n_before": 37, + "n_after": 9, + "relax_cap_lower_decimal": "0.0017228172707428495209099" + } + ], + "cost_identity": { + "formula": "total(U, P) = Delta_end(U | P) + c1 * |U - P|; Delta_end(X) = certified frame-solver cost change with every register of X ending at E_n", + "U12": [ + 2, + 61, + 62, + 63, + 70, + 71, + 72, + 94, + 249, + 251, + 265, + 267 + ], + "P": [ + 249, + 251, + 265, + 267 + ], + "c1": 2116671, + "Delta_end_U12": -25311496, + "total": -8378128, + "overhead_U12": 88556, + "per_extraction_slack": 25371, + "margin": 12928 + }, + "other_orders_at_45": [ + { + "order": [ + 265, + 251, + 267, + 249 + ], + "step_deltas": [ + -2072393, + -2090483, + -2108573, + -2106679 + ], + "cumulative": [ + -2072393, + -4162876, + -6271449, + -8378128 + ], + "touched": [ + [ + 2, + 62, + 71, + 94, + 249, + 265 + ], + [ + 62, + 63, + 249, + 251, + 267 + ], + [ + 2, + 61, + 62, + 94, + 267 + ], + [ + 2, + 61, + 62, + 63, + 70, + 71, + 72, + 94, + 249 + ] + ], + "final": -8378128, + "profile": { + "1": 2434, + "2": 632, + "3": 286, + "4": 104, + "5": 26, + "8": 8 + } + }, + { + "order": [ + 267, + 249, + 265, + 251 + ], + "step_deltas": [ + -2069291, + -2093585, + -2108573, + -2106679 + ], + "cumulative": [ + -2069291, + -4162876, + -6271449, + -8378128 + ], + "touched": [ + [ + 62, + 63, + 249, + 251, + 267 + ], + [ + 2, + 61, + 63, + 71, + 249, + 265 + ], + [ + 61, + 62, + 94, + 251, + 265 + ], + [ + 2, + 62, + 63, + 70, + 71, + 72, + 94, + 251 + ] + ], + "final": -8378128, + "profile": { + "1": 2434, + "2": 632, + "3": 286, + "4": 104, + "5": 26, + "8": 8 + } + }, + { + "order": [ + 251, + 265, + 249, + 267 + ], + "step_deltas": [ + -2069291, + -2093585, + -2098581, + -2116671 + ], + "cumulative": [ + -2069291, + -4162876, + -6261457, + -8378128 + ], + "touched": [ + [ + 62, + 63, + 249, + 251, + 267 + ], + [ + 2, + 61, + 63, + 71, + 249, + 265 + ], + [ + 2, + 61, + 63, + 70, + 71, + 72, + 94, + 249 + ], + [ + 2, + 61, + 62, + 63, + 70, + 71, + 72, + 94, + 267 + ] + ], + "final": -8378128, + "profile": { + "1": 2434, + "2": 632, + "3": 286, + "4": 104, + "5": 26, + "8": 8 + } + } + ], + "normals_census": { + "scope": "exact total(U,P) for the best unions of up to four minimal supports (40 best per normal) and for the full support universe of every normal with a nonzero lowered-frame pairing; margin = 25,371 k - overhead", + "original_word": { + "45": { + "best_union": "U12 (k=4)", + "margin": 12928 + }, + "7": { + "best_union": "{76,233} (k=1)", + "margin": -4579, + "full_universe_margin": -197519 + }, + "42": { + "best_union": "{76,233} (k=1)", + "margin": -4579, + "full_universe_margin": -227495 + }, + "25": { + "margin": -34529, + "full_universe_margin": -249338 + }, + "52": { + "margin": null, + "full_universe_margin": -300080 + }, + "76/127": { + "margin": -34529, + "full_universe_margin": -98105 + }, + "82/97": { + "margin": -34529, + "full_universe_margin": -72734 + }, + "486/504": { + "margin": -29645 + } + }, + "after_four_step_word": { + "45": "pairing rank 0", + "7": { + "margin": -68935, + "full_universe_margin": -259721 + }, + "42": { + "margin": -86879, + "full_universe_margin": -274709 + }, + "25": { + "margin": -34529 + }, + "52": { + "margin": -68935 + }, + "76/127": { + "margin": -34529 + }, + "82/97": { + "margin": -34529 + }, + "486/504": { + "margin": -29645 + } + }, + "next_best_at_45_original": [ + { + "k": 3, + "margin": -2451 + }, + { + "k": 3, + "margin": -4345 + } + ] + } +} diff --git a/research/paired-extension-normal45/construction/T74-FLOW.json.gz b/research/paired-extension-normal45/construction/T74-FLOW.json.gz new file mode 100644 index 0000000000..6d37e8c24b Binary files /dev/null and b/research/paired-extension-normal45/construction/T74-FLOW.json.gz differ diff --git a/research/paired-extension-normal45/construction/T74-MODEL.json b/research/paired-extension-normal45/construction/T74-MODEL.json new file mode 100644 index 0000000000..5662e7f470 --- /dev/null +++ b/research/paired-extension-normal45/construction/T74-MODEL.json @@ -0,0 +1 @@ +{"T":74,"catalogue":"all","chronology":"pr2917-t74","constraints":345459,"flow_variables":413720,"groups":666,"nonzeros":1585721,"pattern_variables":1554,"patterns_per_cap":{"16":2,"32":5,"48":2,"8":1},"variables":415274,"workers":1} \ No newline at end of file diff --git a/research/paired-extension-normal45/construction/T74-PATTERNS.json b/research/paired-extension-normal45/construction/T74-PATTERNS.json new file mode 100644 index 0000000000..7eea14d320 --- /dev/null +++ b/research/paired-extension-normal45/construction/T74-PATTERNS.json @@ -0,0 +1 @@ +{"T":74,"catalogue":"all","chronology":"pr2917-t74","gain_vs_PR2917_claim_exact_lower":"12276726654124473910000000000000000000001000000000000000000000001/10000000000000000000000000000000000000000000000000000000000000000000000","gain_vs_PR2917_claim_float":1.2276726654124474e-06,"gain_vs_PR2917_root_lower_float":1.2276726654124474e-06,"gain_vs_PR2930_claim_exact_lower":"3164134199397636390000000000000000000001000000000000000000000001/10000000000000000000000000000000000000000000000000000000000000000000000","gain_vs_PR2930_claim_float":3.1641341993976365e-07,"gap_to_relaxation_cap":9.50879635192914e-10,"headline_floor24_minus":"17228163198632143279959999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000","idle":{"1":17316,"3":5861,"5":6215,"14":1,"48":27291},"kappa_lower":"430704079965803581999/250000000000000000000000","kappa_lower_decimal":"0.001722816319863214327996","kappa_upper":"17228163198632143279961/10000000000000000000000000","kappa_upper_decimal":"0.0017228163198632143279961","mode":"milp","profile":{"1":1638360,"2":420912,"3":196337,"4":69264,"5":23531,"8":5328,"14":1,"48":27291},"relaxation_cap_lower":"17228172707428495209099/10000000000000000000000000","relaxation_cap_upper":"172281727074284952091/100000000000000000000000","relaxation_cap_upper_decimal":"0.00172281727074284952091","target":[[8,[0,0,0,1,0],49728],[16,[0,0,0,2,0],8436],[16,[0,0,1,0,1],24716],[32,[0,0,0,0,2],1],[32,[0,0,0,0,3],6215],[32,[0,0,2,0,2],8288],[32,[0,1,0,0,3],1332],[32,[1,0,0,0,3],17316],[48,[0,0,0,0,0],27291],[48,[0,0,0,0,5],5861]],"widths":[4,5,7,8,9]} \ No newline at end of file diff --git a/research/paired-extension-normal45/construction/T74-SOLVER.json b/research/paired-extension-normal45/construction/T74-SOLVER.json new file mode 100644 index 0000000000..e4a91bfd8c --- /dev/null +++ b/research/paired-extension-normal45/construction/T74-SOLVER.json @@ -0,0 +1 @@ +{"T":74,"candidate":true,"catalogue":"all","chronology":"pr2917-t74","hint_fill":null,"hint_flow":null,"hint_zeros":false,"max_time_seconds":900,"seconds":337.1957709789276,"seed":1,"status":"OPTIMAL","workers":1} \ No newline at end of file diff --git a/research/paired-extension-normal45/construction/controls.py b/research/paired-extension-normal45/construction/controls.py new file mode 100644 index 0000000000..799e7c148f --- /dev/null +++ b/research/paired-extension-normal45/construction/controls.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""controls.py -- independent re-verification of a produced allocation directory exactly the way #2917's check_allocation.py does: +fresh load of the vendored PR2839 engine from #2917's package, owner.check(T, ORDER, FILL, DISPATCH, PROFILE(claimed), PLAN, TEMPLATE, PROVIDERS), +the five semantic rejection controls (missing role, duplicate helper, same-call family collision, capacity overflow, changed paid profile), +the 82-buffer physical display (live + 408 + 8 + 82 + 2), and #2917's own exact dyadic moment auditor tools/audit_allocation_moment.run +(candidate = the directory, source = #2917's allocation/baseline = PR2908's pinned claim), plus root.py's bracket. +Usage: python controls.py OUT_DIR [--chronology pr2833-t37|pr2917-t74|pr2833-t74] (writes OUT_DIR/CONTROLS.json)""" +import os, sys +os.environ['PYTHONDONTWRITEBYTECODE'] = '1' +sys.dont_write_bytecode = True +import argparse, gzip, hashlib, json, pathlib, types, collections +from fractions import Fraction as Q +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import root as R +import relax as X +import fill17 as F + +def load(name, path): + m = types.ModuleType(name); m.__file__ = str(path); sys.modules[name] = m + exec(compile(path.read_bytes(), str(path), 'exec'), m.__dict__); return m + +ap = argparse.ArgumentParser(); ap.add_argument('out', type=pathlib.Path); ap.add_argument('--chronology', default=None) +ap.add_argument('--registry', type=pathlib.Path, default=F.PKG17 / 'allocation/PROVIDERS.json', help='PROVIDERS registry the fill must match (content)') +ap.add_argument('--buffers', type=int, default=82) +ap.add_argument('--auditor', type=pathlib.Path, default=F.PKG17 / 'tools/audit_allocation_moment.py') +ap.add_argument('--baseline', type=pathlib.Path, default=F.PKG17 / 'allocation/baseline') +a = ap.parse_args() +out = a.out.resolve() +assert hashlib.sha256(F.ENGINE.read_bytes()).hexdigest() == F.ENGINE_SHA +owners = load('c1_owners', F.ENGINE) +moment = load('c1_moment', a.auditor) +order, fill, raw_dispatch = F.read(out / 'ORDER.json'), F.read(out / 'FILL.json.gz'), F.read(out / 'DISPATCH.json') +profile = F.read(out / 'PROFILE.json'); providers_raw = F.read(out / 'PROVIDERS.json') +providers = {k: {'widths': v['widths'], 'actual_paid_profile': {int(r): n for r, n in v['actual_paid_profile'].items()}} for k, v in providers_raw.items()} +# the provider registry must be exactly #2917's (same widths per id, same local profile) +reg = F.read(a.registry) +assert {k: (v['widths'], {int(r): n for r, n in v['actual_paid_profile'].items()}) for k, v in reg.items()} == {k: (v['widths'], v['actual_paid_profile']) for k, v in providers.items()}, 'PROVIDERS differ from the registry' +dispatch = {(s, r): p for s, r, p in raw_dispatch}; assert len(dispatch) == len(raw_dispatch) +chron = a.chronology or json.load(open(out / 'OWNER-CHECK.json'))['chronology'] +template, plan, c_order, c_dispatch, T = F.load_chronology(chron) +assert order == c_order and raw_dispatch == c_dispatch, 'ORDER/DISPATCH are not the %s chronology' % chron +assert len(order) // 9 == T +def check(candidate=fill, claimed=profile): + return owners.check(T, order, candidate, dispatch, claimed, plan, template, providers) +result, _, _ = check() +assert result['roles'] == 9 * T * 408 +physical = result['live'] + 408 + 8 + a.buffers + 2 +controls = {} +def reject(name, candidate=fill, claimed=profile): + try: + check(candidate, claimed) + except ValueError as e: + controls[name] = str(e) + else: + raise AssertionError('owner corruption accepted: ' + name) +reject('missing_role', {**fill, 'rows': fill['rows'][:-1]}) +first = fill['rows'][0] +j = next(i for i, r in enumerate(fill['rows'][1:], 1) if r[0] == first[0]) +def mutate(index, row): + rows = list(fill['rows']); rows[index] = row; return {**fill, 'rows': rows} +duplicate = list(fill['rows'][j]); duplicate[1] = first[1]; reject('duplicate_helper', mutate(j, duplicate)) +collision = list(fill['rows'][j]); collision[2:5] = first[2:5]; reject('same_call_family_collision', mutate(j, collision)) +overflow = list(first); overflow[5] = 49; reject('capacity_overflow', mutate(0, overflow)) +wrong = dict(profile); wrong['1'] = wrong.get('1', 0) + 1; reject('changed_paid_profile', claimed=wrong) +# #2917's own exact dyadic moment auditor (source = its allocation/baseline = PR2908's pinned claim/profile/order) +exact = moment.run(out, a.baseline) +prof = {int(k): v for k, v in profile.items()} +k_lo, k_hi = R.kappa_from_profile(prof, T) +inv = collections.Counter(providers['gauge44']['widths']) +rel = X.relax(providers['gauge44']['actual_paid_profile'], dict(inv)) +res = dict(status='PASS_C1_INDEPENDENT_RECHECK', chronology=chron, T=T, engine=result, physical=physical, controls=controls, moment=exact, + root_bracket=[str(k_lo), str(k_hi)], root_lower_decimal=R.mpmath_str(k_lo, 25), relaxation_cap=[rel['cap_lower'], rel['cap_upper']], + gain_vs_PR2917_claim=str(Q(exact['target']) - F.PR2917_KAPPA), gain_vs_PR2917_claim_float=float(Q(exact['target']) - F.PR2917_KAPPA), + target_vs_PR2917_claim_decimal=str(Q(exact['target']) - F.PR2917_KAPPA), headline_target=exact['target_decimal'], + gain_vs_PR2930_claim=str(Q(exact['target']) - F.PR2930_KAPPA), gain_vs_PR2930_claim_float=float(Q(exact['target']) - F.PR2930_KAPPA), + registry=str(a.registry), buffers=a.buffers, auditor=str(a.auditor), auditor_sha256=hashlib.sha256(a.auditor.read_bytes()).hexdigest(), baseline=str(a.baseline), + fill_sha256=hashlib.sha256((out / 'FILL.json.gz').read_bytes()).hexdigest(), files_sha256={p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(out.iterdir()) if p.is_file()}) +(out / 'CONTROLS.json').write_text(json.dumps(res, sort_keys=True, indent=1, default=str) + '\n') +print(json.dumps({k: res[k] for k in ['status', 'chronology', 'T', 'physical', 'root_lower_decimal', 'gain_vs_PR2917_claim_float', 'gain_vs_PR2930_claim_float', 'gain_vs_PR2930_claim', 'headline_target']}, indent=1)) +print('engine', result['roles'], result['idle'], 'rank_mass', result['rank_mass']) +print('controls', {k: v for k, v in controls.items()}) +print('moment auditor', exact['status'], 'lower', exact['lower'], 'upper', exact['upper'], 'target', exact['target_decimal'][:40], 'gain vs baseline claim', exact['gain_decimal'][:30], 'previous', exact['previous'][:30]) diff --git a/research/paired-extension-normal45/construction/fill17.py b/research/paired-extension-normal45/construction/fill17.py new file mode 100644 index 0000000000..871b3d37c7 --- /dev/null +++ b/research/paired-extension-normal45/construction/fill17.py @@ -0,0 +1,555 @@ +#!/usr/bin/env python3 +"""fill17.py -- lane C's fill.py (r12) adapted to PR #2917's words: literal owner allocation for #2917's exact +per-provider widths (allocation/PROVIDERS.json) under a chosen chronology, with the integer pattern mix of relax.py, +CP-SAT (single thread), edge-colouring realization, the vendored PR2839 owner engine (sha 77a84872..., the same file +#2917 ships in allocation/vendor/) and root.py's exact bracket. Also replays/prices any literal fill (--check-fill). + +Chronologies: + pr2833-t37 : PR2833 T37 owners chronology (333 calls) as used by PR2857/lane C (template/plan from PR2857 sources) + pr2833-t74 : PR2833 borrow-fill chronology (666 calls) + pr2917-t74 : #2917's own allocation/ORDER.json + DISPATCH.json (666 calls; = PR2908's, 'inherited chronology') +Template and plan payloads are byte-identical across the packages (decompressed sha 514e5931..., 163431bf...). + +Usage (AGI venv = OR-Tools 9.15; num_search_workers MUST be 1 on this machine): + $AGI -B fill17.py --work OUT/x --chronology pr2833-t37 --catalogue tight --hint-flow PR2857/FLOW.json.gz --hint-zeros --seed 7 --seconds 900 + $AGI -B fill17.py --work OUT/x --chronology pr2917-t74 --catalogue tight --hint-fill PR2917/allocation/FILL.json.gz --hint-zeros + $AGI -B fill17.py --work OUT/x --chronology pr2917-t74 --check-fill PR2917/allocation/FILL.json.gz (replay + price) + --mix-only : stop after the pattern mix and its exact kappa (fill-independent) + --mix-file PATTERNS.json : use a given target mix (list of [cap, counts, n]) instead of the milp +Outputs: PATTERNS.json, MODEL.json, SOLVER.json, FLOW.json.gz, ORDER.json, FILL.json.gz, DISPATCH.json, PROFILE.json, + PROVIDERS.json (= #2917's allocation format), OWNER-CHECK.json (engine result, physical stock, exact bracket, cap, gains). +""" +import os, sys +os.environ['PYTHONDONTWRITEBYTECODE'] = '1' +sys.dont_write_bytecode = True +import argparse, collections, gzip, hashlib, json, pathlib, time, types +from fractions import Fraction as Q +import numpy as np +from scipy.sparse import coo_matrix, csr_matrix +from scipy.sparse.csgraph import maximum_bipartite_matching +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import root as R +import relax as X + +SCR = pathlib.Path('S') +PKG17 = SCR / 'r13/vendor/pr2917/research/paired-helper-extension' +PKG57 = SCR / 'r12/vendor/pr2857/research/shared-kernel-repacking' +P33 = SCR / 'r12/vendor/pr2833/research/gmx-t74-borrow43-handoff' +ENGINE = PKG17 / 'allocation/vendor/independent_owners.py' +ENGINE_SHA = '77a848729159e271ba64f403dfd59dddb13044b17b2950fa56700f442e2fe461' +PR2917_KAPPA = Q('17215886471978018806049999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000') +PR2917_ROOT_LOWER = Q('1721588647197801880605/1000000000000000000000000') # floor of its root at 24 digits (CLAIM complex_lower = 344317729439560376121/2e23) +PRIVATE_BUFFERS = 82 # default; --buffers overrides (n45x4 words: 86) +PR2930_KAPPA = Q(17224999064432745643569999999999999999999998999999999999999999999999, 10 ** 70) # PR2930 CLAIM (= our PR2917 cap fill) +HELPERS = 408 +CENTRES = 8 +GUARDS = 2 + + +def read(p): + b = pathlib.Path(p).read_bytes() + return json.loads(gzip.decompress(b) if b[:2] == b'\x1f\x8b' else b) + + +def save(p, x): + b = json.dumps(x, sort_keys=True, separators=(',', ':')).encode() + if str(p).endswith('.gz'): + b = bytearray(gzip.compress(b, mtime=0)) + b[9] = 255 + b = bytes(b) + pathlib.Path(p).write_bytes(b) + + +def log(*a): + print(*a, flush=True) + + +def load_chronology(name): + if name == 'pr2833-t37': + template = read(PKG57 / 'sources/PR2833-T37-TEMPLATE.json.gz') + plan = read(PKG57 / 'sources/PR2833-PLAN.json.gz') + owners = read(PKG57 / 'sources/PR2833-T37-OWNERS.json.gz') + T = 37 + timecalls = {} + for r in owners: + key, call = r['time'], (r['stage'], r['replica']) + assert key not in timecalls or timecalls[key] == call + timecalls[key] = call + assert set(timecalls) == set(range(9 * T)) + order = [list(timecalls[t]) for t in range(9 * T)] + dispatch = read(PKG57 / 'sources/PR2833-T37-DISPATCH.json') + elif name == 'pr2833-t74': + template = read(PKG57 / 'sources/PR2833-T37-TEMPLATE.json.gz') + plan = read(PKG57 / 'sources/PR2833-PLAN.json.gz') + order = read(P33 / 'new/borrow-fill/ORDER.json') + dispatch = read(P33 / 'new/borrow-fill/DISPATCH.json') + T = 74 + elif name == 'pr2917-t74': + template = read(PKG17 / 'allocation/vendor/TEMPLATE.json.gz') + plan = read(PKG17 / 'allocation/vendor/PLAN.json.gz') + order = read(PKG17 / 'allocation/ORDER.json') + dispatch = read(PKG17 / 'allocation/DISPATCH.json') + T = 74 + else: + raise SystemExit('unknown chronology ' + name) + assert {(s, r) for s, r, p in dispatch} == set(map(tuple, order)) and len(order) == 9 * T and len(dispatch) == 9 * T + return template, plan, order, dispatch, T + + +def load_providers(path, local_override=None): + providers = read(path) + out = {} + for pid, v in providers.items(): + widths = [int(w) for w in v['widths']] + assert len(widths) == HELPERS + local = {int(k): int(n) for k, n in v['actual_paid_profile'].items()} + if local_override is not None: + local = dict(local_override) + local = {k: n for k, n in sorted(local.items()) if n} + assert sum(r * n for r, n in local.items()) - sum(widths) == 1856, 'local mass - width mass != 1856 for ' + pid + out[pid] = {'widths': widths, 'actual_paid_profile': local} + return out + + +def integer_pattern_mix(inv_by_call, T, bins_per_replica, cap_root, catalogue, tight): + widths = sorted({w for inv in inv_by_call for w in inv}) + bins = {c: n * T for c, n in bins_per_replica.items()} + demand = collections.Counter() + for inv in inv_by_call: + for w, n in inv.items(): + demand[w] += n + from scipy.optimize import milp, Bounds, LinearConstraint + pats = X.patterns(bins_per_replica, widths) + if catalogue == 'tight': + keep = {(t['capacity'], tuple(t['widths'].count(w) for w in widths)) for t in tight} + for cap in bins: + for i, w in enumerate(widths): + if w <= cap: + keep.add((cap, tuple(int(j == i) for j in range(len(widths))))) + keep.add((cap, tuple(0 for _ in widths))) + pats = [p for p in pats if (p[0], p[1]) in keep] + elif catalogue == 'tightonly': + keep = {(t['capacity'], tuple(t['widths'].count(w) for w in widths)) for t in tight} + pats = [p for p in pats if (p[0], p[1]) in keep] + caps = sorted(bins) + b = float(cap_root) + c = np.array([X.Hfloat(r, b) for cap, counts, r in pats]) + A = np.zeros((len(caps) + len(widths), len(pats))) + for j, (cap, counts, r) in enumerate(pats): + A[caps.index(cap), j] = 1.0 + for i, n in enumerate(counts): + A[len(caps) + i, j] = n + rhs = np.array([float(bins[cap]) for cap in caps] + [float(demand[w]) for w in widths]) + res = milp(c, integrality=np.ones(len(pats)), bounds=Bounds(0, np.inf), constraints=LinearConstraint(A, rhs, rhs), options={'time_limit': 120, 'mip_rel_gap': 0}) + assert res.x is not None, 'integer pattern mix infeasible: ' + str(res.message) + xi = np.rint(res.x).astype(np.int64) + assert np.max(np.abs(xi - res.x)) < 1e-6 and np.all(A @ xi == rhs) + target = {(pats[j][0], pats[j][1]): int(xi[j]) for j in range(len(pats)) if xi[j]} + return target, widths + + +def color_pattern(n, q, counts, WID): + slots = [w for j, w in enumerate(WID) for _ in range(q[j])] + if not slots: + assert not counts + return [[] for _ in range(n)] + times = sorted({t for t, w in counts}) + K = len(times) + assert K >= len(slots) + ti = {t: j for j, t in enumerate(times)} + A = np.zeros((K, K), dtype=np.int64) + slot_by_w = collections.defaultdict(list) + for j, w in enumerate(slots): + slot_by_w[w].append(j) + for w, js in slot_by_w.items(): + atslot = 0 + remaining = n + for t in times: + needed = counts.get((t, w), 0) + while needed: + take = min(needed, remaining) + A[ti[t], js[atslot]] += take + needed -= take + remaining -= take + if remaining == 0: + atslot += 1 + remaining = n + assert atslot == len(js) + assert all(v <= n for v in A.sum(axis=1)) + j = len(slots) + remaining = n + for r in range(K): + needed = n - int(A[r].sum()) + while needed: + assert j < K + take = min(needed, remaining) + A[r, j] += take + needed -= take + remaining -= take + if remaining == 0: + j += 1 + remaining = n + assert np.all(A.sum(axis=0) == n) and np.all(A.sum(axis=1) == n) + output = [] + for color in range(n): + matching = maximum_bipartite_matching(csr_matrix(A > 0), perm_type='column') + assert len(matching) == K and min(matching) >= 0 and len(set(map(int, matching))) == K + output.append([(times[r], slots[int(c)]) for r, c in enumerate(matching) if c < len(slots)]) + A[np.arange(K), matching] -= 1 + assert not A.any() + return output + + +def pattern_name(WID, counts): + return '+'.join(str(w) for w, k in zip(WID, counts) for _ in range(k)) or 'empty' + + +def fill_to_bins(fill, order, disp, providers): + """literal fill rows -> {bin: [(t, w)]} using the provider widths (helper column = 0-based index, as the engine reads it).""" + bybin = collections.defaultdict(list) + for t, h, o, c, p, z in fill['rows']: + w = providers[disp[tuple(order[t])]]['widths'][h] + bybin[o, c, p].append((t, w)) + return bybin + + +def price(profile, T, rel): + k_lo, k_hi = R.kappa_from_profile(profile, T) + cap_hi = Q(rel['cap_upper']) + return k_lo, k_hi, dict(kappa_lower=str(k_lo), kappa_upper=str(k_hi), kappa_lower_decimal=R.mpmath_str(k_lo, 25), kappa_upper_decimal=R.mpmath_str(k_hi, 25), + headline_floor24_minus=str(Q(int(k_lo * 10 ** 24), 10 ** 24) - Q(1, 10 ** 46) - Q(1, 10 ** 70)), + relaxation_cap_lower=rel['cap_lower'], relaxation_cap_upper=rel['cap_upper'], relaxation_cap_upper_decimal=rel['cap_upper_decimal'], + gap_to_relaxation_cap=float(cap_hi - k_lo), gain_vs_PR2917_claim_float=float(k_lo - PR2917_KAPPA), gain_vs_PR2917_root_lower_float=float(k_lo - PR2917_ROOT_LOWER), + gain_vs_PR2917_claim_exact_lower=str(k_lo - PR2917_KAPPA), + gain_vs_PR2930_claim_float=float(k_lo - PR2930_KAPPA), gain_vs_PR2930_claim_exact_lower=str(k_lo - PR2930_KAPPA)) + + +def main(): + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument('--work', type=pathlib.Path, required=True) + ap.add_argument('--chronology', choices=['pr2833-t37', 'pr2833-t74', 'pr2917-t74'], default='pr2833-t37') + ap.add_argument('--providers', type=pathlib.Path, default=PKG17 / 'allocation/PROVIDERS.json') + ap.add_argument('--local', help='JSON per-call local profile overriding PROVIDERS (both providers)') + ap.add_argument('--catalogue', choices=['all', 'tight', 'tightonly'], default='tight') + ap.add_argument('--mix-file', type=pathlib.Path, help='PATTERNS.json-style target list [[cap, counts, n], ...] to use instead of the milp') + ap.add_argument('--mix-only', action='store_true') + ap.add_argument('--seconds', type=int, default=600) + ap.add_argument('--workers', type=int, default=1) + ap.add_argument('--seed', type=int, default=124) + ap.add_argument('--hint-flow', type=pathlib.Path, help='FLOW.json.gz of the same chronology/T (e.g. PR2857 allocation/construction/FLOW.json.gz for pr2833-t37)') + ap.add_argument('--hint-fill', type=pathlib.Path, help='literal FILL.json.gz of the same chronology (e.g. #2917 allocation/FILL.json.gz for pr2917-t74); converted to X/Z hints') + ap.add_argument('--hint-zeros', action='store_true') + ap.add_argument('--reuse-flow', type=pathlib.Path) + ap.add_argument('--solver', choices=['cp', 'highs-lp', 'highs-mip'], default='cp', help='cp = CP-SAT; highs-lp = LP relaxation feasibility only (fractional flow); highs-mip = scipy milp') + ap.add_argument('--check-fill', type=pathlib.Path, help='replay: owner-check and price this literal fill under the chronology (no solve)') + ap.add_argument('--buffers', type=int, default=PRIVATE_BUFFERS, help='private zero buffers for the physical display (PR2917 82, n45x4 86)') + ap.add_argument('--method', default='r13 lane C1: relax.py integer pattern mix + CP-SAT chronological flow + edge-colouring realization (fill17.py)') + a = ap.parse_args() + assert a.workers == 1, 'num_search_workers must be 1 on this machine (3 deadlocks)' + out = a.work.resolve() + out.mkdir(parents=True, exist_ok=False) + t0 = time.time() + assert hashlib.sha256(ENGINE.read_bytes()).hexdigest() == ENGINE_SHA, 'owner engine pin' + owner = types.ModuleType('frozen_owner') + exec(compile(ENGINE.read_bytes(), 'frozen_owner', 'exec'), owner.__dict__) + template, plan, order, dispatch, T = load_chronology(a.chronology) + local_override = {int(k): int(v) for k, v in json.loads(a.local).items()} if a.local else None + providers = load_providers(a.providers, local_override) + disp = {(s, r): p for s, r, p in dispatch} + inv_by_call = [collections.Counter(providers[disp[tuple(sr)]]['widths']) for sr in order] + calls_by_pid = collections.Counter(disp[tuple(sr)] for sr in order) + locals_ = {pid: providers[pid]['actual_paid_profile'] for pid in providers} + # relaxation cap (call-weighted average inventory; the local profile is the same for both providers here) + avg_inv = collections.Counter() + for inv in inv_by_call: + for w, n in inv.items(): + avg_inv[w] += Q(n, len(order)) + loc0 = next(iter(locals_.values())) + assert all(l == loc0 for l in locals_.values()), 'providers differ in local profile; relax.py needs one profile' + rel = X.relax(loc0, avg_inv) + cap_lo, cap_hi = Q(rel['cap_lower']), Q(rel['cap_upper']) + log('CHRONOLOGY', a.chronology, 'T', T, 'calls', len(order), 'calls per provider', dict(calls_by_pid)) + log('INVENTORY', {pid: dict(sorted(collections.Counter(providers[pid]['widths']).items())) for pid in providers}, 'LOCAL', loc0) + log('RELAX cap', rel['cap_lower_decimal'], rel['cap_upper_decimal'], 'tight', rel['tight_patterns'], 'idle/replica', rel['idle_per_replica']) + live = 896 * T + physical = live + HELPERS + CENTRES + a.buffers + GUARDS + + if a.check_fill: + fill = read(a.check_fill) + result, _, _ = owner.check(T, order, fill, disp, None, plan, template, providers) + profile = {int(k): v for k, v in result['profile'].items()} + k_lo, k_hi, pr = price(profile, T, rel) + bybin = fill_to_bins(fill, order, disp, providers) + pat_hist = collections.Counter() + win = owner.windows(template, order, T) + for (o, c), (cap, lo, hi) in win.items(): + for port in range(112): + rs = bybin.get((o, c, port), []) + pat_hist['%d:%s' % (cap, '+'.join(str(w) for w in sorted(w for t, w in rs)) or 'empty')] += 1 + assert result['live'] == live + check = dict(result, status='PASS_VENDORED_PR2839_OWNER_ENGINE_CHECK', mode='check-fill', fill=str(a.check_fill), chronology=a.chronology, T=T, + physical=result['live'] + HELPERS + CENTRES + a.buffers + GUARDS, physical_expected=physical, pattern_histogram=dict(sorted(pat_hist.items())), **pr) + save(out / 'OWNER-CHECK.json', check) + save(out / 'PROFILE.json', dict(sorted(profile.items()))) + log('CHECK-FILL PASS roles', result['roles'], 'idle', result['idle'], 'physical', check['physical']) + log('PATTERNS', dict(sorted(pat_hist.items()))) + log('KAPPA', pr['kappa_lower_decimal'], '..', pr['kappa_upper_decimal'], 'cap', rel['cap_upper_decimal'], 'gap %.3e' % pr['gap_to_relaxation_cap'], 'gain vs PR2917 claim %.4e' % pr['gain_vs_PR2917_claim_float'], 'gain vs PR2930 claim %.4e' % pr['gain_vs_PR2930_claim_float']) + return + + bins_per_replica = X.BINS + if a.mix_file: + mf = read(a.mix_file) + WID = [int(w) for w in mf['widths']] + target = {(int(cap), tuple(int(k) for k in counts)): int(n) for cap, counts, n in mf['target']} + else: + target, WID = integer_pattern_mix(inv_by_call, T, bins_per_replica, (cap_lo + cap_hi) / 2, a.catalogue, rel['tight_pattern_list']) + idle_mix = collections.Counter() + for (cap, counts), n in target.items(): + r = cap - sum(w * k for w, k in zip(WID, counts)) + assert r >= 0 + if r: + idle_mix[r] += n + profile_mix = collections.Counter(idle_mix) + for pid, ncalls in calls_by_pid.items(): + for r, n in locals_[pid].items(): + profile_mix[r] += n * ncalls + mix_lo, mix_hi, mix_pr = price(dict(profile_mix), T, rel) + log('PATTERN MIX', {('%d:%s' % (cap, pattern_name(WID, counts))): n for (cap, counts), n in sorted(target.items())}) + log('MIX kappa bracket', mix_pr['kappa_lower_decimal'], mix_pr['kappa_upper_decimal'], 'idle', dict(sorted(idle_mix.items())), 'gap to cap %.3e' % mix_pr['gap_to_relaxation_cap'], 'gain vs PR2917 %.4e' % mix_pr['gain_vs_PR2917_claim_float'], 'gain vs PR2930 %.4e' % mix_pr['gain_vs_PR2930_claim_float']) + save(out / 'PATTERNS.json', dict(mode='milp' if not a.mix_file else 'file', catalogue=a.catalogue, T=T, chronology=a.chronology, widths=WID, + target=[[cap, list(counts), n] for (cap, counts), n in sorted(target.items())], idle=dict(sorted(idle_mix.items())), + profile=dict(sorted(profile_mix.items())), **mix_pr)) + if a.mix_only: + return + + # ---- chronology windows and the flow model (PR2857 discover_original.py, all bins active) + win = owner.windows(template, order, T) + family = lambda b: b[0] * 896 + (2 * plan['pairs'][str(b[1])] + plan['sides'][str(b[1])]) * 112 + b[2] + fw = collections.defaultdict(list) + for (o, c), (cap, lo, hi) in win.items(): + fw[family((o, c, 0))].append((lo, hi, c)) + for ww in fw.values(): + for i, (lo, hi, c) in enumerate(ww): + assert all(max(lo, l) >= min(hi, h) for l, h, d in ww[i + 1:]), 'overlapping same-family windows' + need = {t: collections.Counter(inv_by_call[t]) for t in range(len(order))} + pats = collections.defaultdict(list) + for (cap, counts) in target: + pats[cap].append(counts) + groups = collections.defaultdict(list) + for (o, c), (cap, lo, hi) in win.items(): + for port in range(112): + groups[cap, tuple(range(max(0, lo + 1), min(len(order), hi + 1)))].append((o, c, port)) + G = sorted(groups) + groupof = {b: gi for gi, g in enumerate(G) for b in groups[g]} + edge, lb, ub, rl, ru = [], [], [], [], [] + Xv, Zv = {}, {} + + def cr(l, u=None): + j = len(rl) + rl.append(l) + ru.append(l if u is None else u) + return j + + def cv(u): + j = len(lb) + lb.append(0) + ub.append(u) + return j + + def put(r, v, n): + if n: + edge.append((r, v, n)) + callrow = {(t, w): cr(n) for t, cnt in need.items() for w, n in cnt.items() if n} + globalrow = {key: cr(n) for key, n in target.items()} + for gi, (cap, ts) in enumerate(G): + nb = len(groups[G[gi]]) + br = cr(nb) + for q in pats[cap]: + xv = cv(nb) + Xv[gi, q] = xv + put(br, xv, 1) + put(globalrow[cap, q], xv, 1) + residual = {w: q[j] for j, w in enumerate(WID) if q[j]} + wr = {w: cr(0) for w in residual} + for w, n in residual.items(): + put(wr[w], xv, -n) + for t in ts: + tr = cr(-nb, 0) + put(tr, xv, -1) + for w in residual: + if (t, w) not in callrow: + continue + zv = cv(min(nb, need[t][w])) + Zv[gi, q, t, w] = zv + put(tr, zv, 1) + put(wr[w], zv, 1) + put(callrow[t, w], zv, 1) + modelinfo = dict(T=T, chronology=a.chronology, groups=len(G), variables=len(lb), pattern_variables=len(Xv), flow_variables=len(Zv), constraints=len(rl), nonzeros=len(edge), workers=a.workers, + catalogue=a.catalogue, patterns_per_cap={str(cap): len(ps) for cap, ps in pats.items()}) + save(out / 'MODEL.json', modelinfo) + log('MODEL', modelinfo) + rr = np.fromiter((e[0] for e in edge), np.int32) + cc = np.fromiter((e[1] for e in edge), np.int32) + vv = np.fromiter((e[2] for e in edge), np.float64) + mat = coo_matrix((vv, (rr, cc)), shape=(len(rl), len(lb))).tocsr() + del edge + t1 = time.time() + if a.reuse_flow: + saved = read(a.reuse_flow) + value = np.zeros(len(lb), dtype=np.int64) + for gi, q, n in saved['x']: + value[Xv[gi, tuple(q)]] = n + for gi, q, t, w, n in saved['z']: + value[Zv[gi, tuple(q), t, w]] = n + status = 'EXACT_FLOW_REPLAY' + elif a.solver == 'highs-lp': + from scipy.optimize import milp, Bounds, LinearConstraint + r = milp(np.zeros(len(lb)), integrality=np.zeros(len(lb)), bounds=Bounds(np.array(lb, dtype=float), np.array(ub, dtype=float)), constraints=LinearConstraint(mat, np.array(rl, dtype=float), np.array(ru, dtype=float)), options={'time_limit': a.seconds, 'disp': True}) + status = 'LP_RELAXATION_' + ('FEASIBLE' if r.x is not None else 'INFEASIBLE_OR_FAILED') + ': ' + str(r.message) + log('LP RELAXATION', status, '%.1f s' % (time.time() - t1)) + save(out / 'SOLVER.json', dict(status=status, solver='highs-lp', seconds=time.time() - t1, chronology=a.chronology, T=T, catalogue=a.catalogue, mix_file=str(a.mix_file) if a.mix_file else None)) + return + elif a.solver == 'highs-mip': + from scipy.optimize import milp, Bounds, LinearConstraint + r = milp(np.zeros(len(lb)), integrality=np.ones(len(lb)), bounds=Bounds(np.array(lb, dtype=float), np.array(ub, dtype=float)), constraints=LinearConstraint(mat, np.array(rl, dtype=float), np.array(ru, dtype=float)), options={'time_limit': a.seconds, 'mip_rel_gap': 0, 'disp': True}) + status = str(r.message) + value = None if r.x is None else np.rint(r.x).astype(np.int64) + else: + from ortools.sat.python import cp_model + model = cp_model.CpModel() + vs = [model.NewIntVar(int(l), int(u), '') for l, u in zip(lb, ub)] + for j, (l, u) in enumerate(zip(rl, ru)): + b, e = mat.indptr[j:j + 2] + ind = mat.indices[b:e] + co = mat.data[b:e] + model.AddLinearConstraint(cp_model.LinearExpr.WeightedSum([vs[int(k)] for k in ind], [int(k) for k in co]), int(l), int(u)) + hinted = {} + if a.hint_flow: + saved = read(a.hint_flow) + for gi, q, n in saved['x']: + if (gi, tuple(q)) in Xv: + hinted[Xv[gi, tuple(q)]] = min(int(n), int(ub[Xv[gi, tuple(q)]])) + for gi, q, t, w, n in saved['z']: + if (gi, tuple(q), t, w) in Zv: + hinted[Zv[gi, tuple(q), t, w]] = min(int(n), int(ub[Zv[gi, tuple(q), t, w]])) + log('HINT from flow', a.hint_flow, 'variables', len(hinted), 'of', len(vs)) + if a.hint_fill: + hf = read(a.hint_fill) + bybin = fill_to_bins(hf, order, disp, providers) + hx = collections.Counter() + hz = collections.Counter() + missing = collections.Counter() + for gi_, g_ in enumerate(G): + for b in groups[g_]: + rs = bybin.get(b, []) + q = tuple(sum(1 for t, w in rs if w == ww) for ww in WID) + if (gi_, q) not in Xv: + missing['%d:%s' % (G[gi_][0], pattern_name(WID, q))] += 1 + continue + hx[gi_, q] += 1 + for t, w in rs: + hz[gi_, q, t, w] += 1 + for k, n in hx.items(): + hinted[Xv[k]] = min(n, int(ub[Xv[k]])) + for k, n in hz.items(): + if k in Zv: + hinted[Zv[k]] = min(n, int(ub[Zv[k]])) + log('HINT from fill', a.hint_fill, 'bins hinted', sum(hx.values()), 'bins with non-catalogue patterns (unhinted)', sum(missing.values()), dict(missing.most_common(12)), 'variables', len(hinted)) + if hinted: + for j, v in hinted.items(): + model.AddHint(vs[j], v) + if a.hint_zeros: + for j in range(len(vs)): + if j not in hinted: + model.AddHint(vs[j], 0) + log('HINT total', len(hinted), '(+ zeros for the rest)' if a.hint_zeros else '') + solver = cp_model.CpSolver() + solver.parameters.num_search_workers = a.workers + solver.parameters.max_time_in_seconds = a.seconds + solver.parameters.random_seed = a.seed + solver.parameters.log_search_progress = True + result = solver.Solve(model) + status = solver.StatusName(result) + value = np.array([solver.Value(v) for v in vs], dtype=np.int64) if result in (cp_model.OPTIMAL, cp_model.FEASIBLE) else None + log(solver.ResponseStats()) + solve_seconds = time.time() - t1 + log('SOLVER', status, '%.1f s' % solve_seconds) + save(out / 'SOLVER.json', dict(status=status, seconds=solve_seconds, workers=a.workers, seed=a.seed, max_time_seconds=a.seconds, candidate=value is not None, chronology=a.chronology, T=T, catalogue=a.catalogue, + hint_flow=str(a.hint_flow) if a.hint_flow else None, hint_fill=str(a.hint_fill) if a.hint_fill else None, hint_zeros=a.hint_zeros)) + if value is None: + log('NO FEASIBLE FLOW (status %s)' % status) + raise SystemExit(2) + assert not (np.any(value < lb) or np.any(value > ub) or np.any(mat @ value < rl) or np.any(mat @ value > ru)) + xc = collections.defaultdict(collections.Counter) + zc = collections.defaultdict(collections.Counter) + for (gi, q), v in Xv.items(): + if value[v]: + xc[gi][q] = int(value[v]) + for (gi, q, t, w), v in Zv.items(): + if value[v]: + zc[gi, q][t, w] = int(value[v]) + save(out / 'FLOW.json.gz', {'x': [[gi, list(q), n] for gi, c in xc.items() for q, n in c.items()], 'z': [[gi, list(q), t, w, n] for (gi, q), c in zc.items() for (t, w), n in c.items()]}) + gc = collections.Counter() + for gi, c in xc.items(): + for q, n in c.items(): + gc[G[gi][0], q] += n + assert dict(gc) == target, 'global integer pattern counts differ' + for gi in range(len(G)): + assert sum(xc[gi].values()) == len(groups[G[gi]]), 'window class bin count' + call_count = collections.defaultdict(collections.Counter) + for (gi, q), c in zc.items(): + by_w = collections.Counter() + by_t = collections.Counter() + for (t, w), n in c.items(): + assert t in G[gi][1] and q[WID.index(w)] > 0, 'ineligible time/width flow' + by_w[w] += n + by_t[t] += n + call_count[t][w] += n + assert all(by_w[w] == q[j] * xc[gi][q] for j, w in enumerate(WID)), 'pattern-width supply' + assert all(n <= xc[gi][q] for n in by_t.values()), 'more than one role per bin/time' + assert all(call_count[t] == need[t] for t in range(len(order))), 'flow call width demand' + slots = [] + for gi, (cap, ts) in enumerate(G): + bins = groups[G[gi]] + offset = 0 + for q, n in sorted(xc[gi].items()): + res = color_pattern(n, q, zc[gi, q], WID) + assert len(res) == n + for b, it in zip(bins[offset:offset + n], res): + z = 0 + for t, w in sorted(it): + slots.append((t, w, *b, z)) + z += w + assert z <= cap + offset += n + assert offset == len(bins) + available = {t: collections.defaultdict(list) for t in range(len(order))} + for t in available: + for h, w in enumerate(providers[disp[tuple(order[t])]]['widths']): + available[t][w].append(h) + final = [] + for t, w, o, c, p, z in sorted(slots): + final.append([t, available[t][w].pop(), o, c, p, z]) + assert not any(v for d in available.values() for v in d.values()) + fill = {'columns': ['time', 'helper', 'owner_replica', 'child', 'port', 'offset'], 'dispatch_overrides': [], 'method': a.method, 'rows': sorted(final)} + result, _, _ = owner.check(T, order, fill, disp, None, plan, template, providers) + profile = {int(k): v for k, v in result['profile'].items()} + assert collections.Counter(profile) == profile_mix, 'realized profile differs from the pattern-mix profile' + assert result['live'] == live + k_lo, k_hi, pr = price(profile, T, rel) + payload_sha = {} + prov_out = {pid: {'actual_paid_profile': {str(r): n for r, n in providers[pid]['actual_paid_profile'].items()}, 'widths': providers[pid]['widths']} for pid in providers} + for n, obj in [('ORDER.json', order), ('FILL.json.gz', fill), ('DISPATCH.json', dispatch), ('PROFILE.json', {str(k): v for k, v in sorted(profile.items())}), ('PROVIDERS.json', prov_out)]: + save(out / n, obj) + payload_sha[n] = hashlib.sha256(json.dumps(obj, sort_keys=True, separators=(',', ':')).encode()).hexdigest() + check = dict(result, status='PASS_VENDORED_PR2839_OWNER_ENGINE_CHECK', solver=status, solve_seconds=solve_seconds, total_seconds=time.time() - t0, chronology=a.chronology, T=T, calls=len(order), + physical=result['live'] + HELPERS + CENTRES + a.buffers + GUARDS, physical_formula='live + 408 helpers + 8 centres + %d private buffers + 2 guards' % a.buffers, + inventory={pid: dict(sorted(collections.Counter(providers[pid]['widths']).items())) for pid in providers}, local=loc0, engine_sha256=ENGINE_SHA, catalogue=a.catalogue, + pattern_mix={('%d:%s' % (cap, pattern_name(WID, counts))): n for (cap, counts), n in sorted(target.items())}, payload_sha256=payload_sha, seed=a.seed, **pr) + save(out / 'OWNER-CHECK.json', check) + log('OWNER_CHECK_PASS', out, 'roles', result['roles'], 'idle', result['idle'], 'physical', check['physical']) + log('KAPPA', pr['kappa_lower_decimal'], '..', pr['kappa_upper_decimal'], 'cap', rel['cap_upper_decimal'], 'gap %.3e' % pr['gap_to_relaxation_cap'], 'gain vs PR2917 claim %.4e' % pr['gain_vs_PR2917_claim_float'], 'gain vs PR2930 claim %.4e' % pr['gain_vs_PR2930_claim_float']) + + +if __name__ == '__main__': + main() diff --git a/research/paired-extension-normal45/construction/providers_from_words.py b/research/paired-extension-normal45/construction/providers_from_words.py new file mode 100644 index 0000000000..bab1d7139a --- /dev/null +++ b/research/paired-extension-normal45/construction/providers_from_words.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +"""providers_from_words.py -- derive PROVIDERS.json from the two provider words exactly as PR2917's check_allocation.py does: +helpers = sorted(range(224,704) - removed); width = len(helper_final.get(h, [0]*9)) - len(start_extra.get(h, [])); +actual_paid_profile = frame_report(word) profile (= report.local_profile, asserted, via PR2917's vendored preload_move.py); +cleanup buffers {r >= 704} == {704 + h : h in helper_final}, count = --buffers. Output: json.dumps(indent=2, sort_keys=True), no newline +(PR2917's byte format). Usage: python -I -B providers_from_words.py BASE.json.gz EXTRA.json.gz OUT.json --buffers 86 [--compare REF]""" +import sys, json, gzip, hashlib, types, pathlib, argparse +from collections import Counter +PKG17 = pathlib.Path('S/r13/vendor/pr2917/research/paired-helper-extension') +ap = argparse.ArgumentParser(); ap.add_argument('base'); ap.add_argument('extra'); ap.add_argument('out'); ap.add_argument('--buffers', type=int, required=True); ap.add_argument('--compare') +a = ap.parse_args() +def read(p): + b = pathlib.Path(p).read_bytes(); return json.loads(gzip.decompress(b) if b[:2] == b'\x1f\x8b' else b) +frames = types.ModuleType('frames'); frames.__file__ = str(PKG17 / 'vendor/preload_move.py'); sys.modules['frames'] = frames +exec(compile((PKG17 / 'vendor/preload_move.py').read_bytes(), str(PKG17 / 'vendor/preload_move.py'), 'exec'), frames.__dict__) +providers, info = {}, {} +for path, pid in [(a.base, 'gauge44'), (a.extra, 'extra')]: + word = read(path) + profile, inventory = frames.frame_report(word) + assert profile == word['report']['local_profile'] and inventory == word['report']['width_inventory'], 'frame_report != report' + helpers = sorted(set(range(224, 704)) - set(word['removed'])) + widths = [len(word['helper_final'].get(str(h), [0] * 9)) - len(word['start_extra'].get(str(h), [])) for h in helpers] + assert len(helpers) == 408 and len(word['centers']) == 8, 'helpers/centres' + buffers = {r for gate in word['cleanup'] for r in (gate[1:3] if gate[0] == 'add' else gate[1:2]) if r >= 704} + assert buffers == {704 + int(h) for h in word['helper_final']}, 'cleanup buffer / end-point bijection' + assert len(buffers) == a.buffers, 'buffer count %d != %d' % (len(buffers), a.buffers) + prof = {int(k): v for k, v in profile.items()} + assert sum(r * n for r, n in prof.items()) - sum(widths) == 1856, 'local mass - width mass != 1856' + assert dict(Counter(widths)) == {int(k): v for k, v in inventory.items()}, 'width list vs inventory' + providers[pid] = {'actual_paid_profile': {str(k): prof[k] for k in sorted(prof)}, 'widths': widths} + info[pid] = dict(word_sha256=hashlib.sha256(pathlib.Path(path).read_bytes()).hexdigest(), local=prof, inventory=dict(sorted(Counter(widths).items())), buffers=len(buffers), + narrowed_vs_9=[h for h, w in zip(helpers, widths) if w == 8 and str(h) in word['helper_final']][:200]) +text = json.dumps(providers, indent=2, sort_keys=True) +pathlib.Path(a.out).write_text(text) +print('wrote', a.out, 'sha256', hashlib.sha256(text.encode()).hexdigest()) +for pid, d in info.items(): + print(pid, 'word', d['word_sha256'][:16], 'local', d['local'], 'inventory', d['inventory'], 'buffers', d['buffers']) +print('identical widths/profile across providers:', providers['gauge44'] == providers['extra']) +if a.compare: + ref = pathlib.Path(a.compare).read_bytes() + print('byte-identical to', a.compare, ':', ref == text.encode(), '| content-equal:', json.loads(ref) == providers) diff --git a/research/paired-extension-normal45/data/PARENT-base.json.gz b/research/paired-extension-normal45/data/PARENT-base.json.gz new file mode 100644 index 0000000000..9be0aa5349 Binary files /dev/null and b/research/paired-extension-normal45/data/PARENT-base.json.gz differ diff --git a/research/paired-extension-normal45/data/PARENT-extra.json.gz b/research/paired-extension-normal45/data/PARENT-extra.json.gz new file mode 100644 index 0000000000..40b38365ea Binary files /dev/null and b/research/paired-extension-normal45/data/PARENT-extra.json.gz differ diff --git a/research/paired-extension-normal45/data/TRANSFORM-249.json b/research/paired-extension-normal45/data/TRANSFORM-249.json new file mode 100644 index 0000000000..958d901b2b --- /dev/null +++ b/research/paired-extension-normal45/data/TRANSFORM-249.json @@ -0,0 +1,434 @@ +{ + "helper": 249, + "normal": 45, + "step": 1, + "before": [ + [ + "add", + 249, + 225, + 1, + 4, + [] + ], + [ + "add", + 249, + 240, + 1, + 4, + [] + ], + [ + "add", + 249, + 241, + -1, + 4, + [] + ], + [ + "add", + 249, + 242, + 1, + 4, + [] + ], + [ + "add", + 249, + 245, + 1, + 4, + [] + ], + [ + "add", + 249, + 246, + 1, + 4, + [] + ], + [ + "add", + 249, + 250, + -1, + 4, + [] + ], + [ + "add", + 249, + 253, + -1, + 4, + [] + ], + [ + "add", + 249, + 254, + 1, + 4, + [] + ], + [ + "add", + 249, + 255, + -1, + 2, + [] + ], + [ + "add", + 249, + 225, + -1, + 1, + [] + ], + [ + "add", + 225, + 249, + 1, + 1, + [] + ], + [ + "add", + 249, + 225, + -1, + 1, + [] + ], + [ + "scale", + 225, + 1, + -1, + [] + ], + [ + "add", + 254, + 225, + 1, + 1, + [] + ], + [ + "add", + 251, + 225, + -1, + 1, + [] + ], + [ + "add", + 250, + 225, + -1, + 1, + [] + ], + [ + "add", + 248, + 225, + 1, + 1, + [] + ], + [ + "add", + 247, + 225, + -1, + 1, + [] + ], + [ + "add", + 242, + 225, + 1, + 1, + [] + ], + [ + "add", + 241, + 225, + -1, + 1, + [] + ], + [ + "add", + 238, + 225, + -1, + 1, + [] + ], + [ + "add", + 235, + 225, + 1, + 1, + [] + ], + [ + "add", + 234, + 225, + 1, + 1, + [] + ], + [ + "add", + 232, + 225, + -1, + 1, + [] + ], + [ + "add", + 231, + 225, + 1, + 1, + [] + ], + [ + "add", + 227, + 225, + -1, + 1, + [] + ], + [ + "add", + 226, + 225, + -1, + 1, + [] + ] + ], + "after": [ + [ + "add", + 62, + 70, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 71, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 72, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 249, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 251, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 267, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "scale", + 62, + 1, + -4, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 249, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 249, + 62, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 249, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ] + ], + "frame_changes": [ + { + "section": "A", + "parent_index": 3743, + "candidate_index": 3771, + "gate": [ + "add", + 57, + 62, + 1, + 1 + ], + "old_frame": [ + 256, + 128, + 64, + 32, + 16, + 8, + 5, + 3 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + } + ] +} diff --git a/research/paired-extension-normal45/data/TRANSFORM-251.json b/research/paired-extension-normal45/data/TRANSFORM-251.json new file mode 100644 index 0000000000..e7fe4eb22e --- /dev/null +++ b/research/paired-extension-normal45/data/TRANSFORM-251.json @@ -0,0 +1,452 @@ +{ + "helper": 251, + "normal": 45, + "step": 3, + "before": [ + [ + "add", + 251, + 256, + 1, + 4, + [] + ], + [ + "add", + 251, + 257, + 1, + 4, + [] + ], + [ + "add", + 251, + 258, + 1, + 4, + [] + ], + [ + "add", + 251, + 259, + 1, + 2, + [] + ], + [ + "add", + 251, + 261, + 1, + 4, + [] + ], + [ + "add", + 251, + 262, + 1, + 4, + [] + ], + [ + "add", + 251, + 265, + 1, + 4, + [] + ], + [ + "add", + 251, + 266, + -1, + 4, + [] + ], + [ + "add", + 251, + 269, + 1, + 4, + [] + ], + [ + "add", + 251, + 270, + 1, + 4, + [] + ], + [ + "add", + 251, + 225, + -1, + 1, + [] + ], + [ + "add", + 225, + 251, + 1, + 1, + [] + ], + [ + "add", + 251, + 225, + -1, + 1, + [] + ], + [ + "add", + 269, + 225, + -1, + 1, + [] + ], + [ + "add", + 265, + 225, + 1, + 1, + [] + ], + [ + "add", + 264, + 225, + 1, + 1, + [] + ], + [ + "add", + 263, + 225, + 1, + 1, + [] + ], + [ + "add", + 262, + 225, + 1, + 1, + [] + ], + [ + "add", + 261, + 225, + -1, + 1, + [] + ], + [ + "add", + 259, + 225, + -1, + 1, + [] + ], + [ + "add", + 237, + 225, + 1, + 1, + [] + ], + [ + "add", + 235, + 225, + 1, + 1, + [] + ], + [ + "add", + 233, + 225, + -1, + 1, + [] + ], + [ + "add", + 232, + 225, + -1, + 1, + [] + ], + [ + "add", + 231, + 225, + -1, + 1, + [] + ], + [ + "add", + 230, + 225, + -1, + 1, + [] + ], + [ + "add", + 229, + 225, + 1, + 1, + [] + ], + [ + "add", + 227, + 225, + 1, + 1, + [] + ] + ], + "after": [ + [ + "add", + 2, + 61, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 62, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 70, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 72, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 251, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 265, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "scale", + 2, + 1, + 4, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 251, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 251, + 2, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 251, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 61, + 251, + 4, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ] + ], + "frame_changes": [ + { + "section": "A", + "parent_index": 3795, + "candidate_index": 3823, + "gate": [ + "add", + 92, + 61, + 1, + 1 + ], + "old_frame": [ + 256, + 128, + 64, + 34, + 16, + 10, + 4, + 1 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + } + ] +} diff --git a/research/paired-extension-normal45/data/TRANSFORM-265.json b/research/paired-extension-normal45/data/TRANSFORM-265.json new file mode 100644 index 0000000000..69cdf11cf6 --- /dev/null +++ b/research/paired-extension-normal45/data/TRANSFORM-265.json @@ -0,0 +1,543 @@ +{ + "helper": 265, + "normal": 45, + "step": 4, + "before": [ + [ + "add", + 265, + 225, + 1, + 4, + [] + ], + [ + "add", + 265, + 256, + 1, + 4, + [] + ], + [ + "add", + 265, + 257, + -1, + 4, + [] + ], + [ + "add", + 265, + 258, + 1, + 4, + [] + ], + [ + "add", + 265, + 261, + 1, + 4, + [] + ], + [ + "add", + 265, + 262, + 1, + 4, + [] + ], + [ + "add", + 265, + 266, + -1, + 4, + [] + ], + [ + "add", + 265, + 269, + -1, + 4, + [] + ], + [ + "add", + 265, + 270, + 1, + 4, + [] + ], + [ + "add", + 265, + 271, + -1, + 2, + [] + ], + [ + "add", + 265, + 225, + -1, + 1, + [] + ], + [ + "add", + 225, + 265, + 1, + 1, + [] + ], + [ + "add", + 265, + 225, + -1, + 1, + [] + ], + [ + "add", + 270, + 225, + -1, + 1, + [] + ], + [ + "add", + 269, + 225, + -1, + 1, + [] + ], + [ + "add", + 266, + 225, + 1, + 1, + [] + ], + [ + "add", + 265, + 225, + 1, + 1, + [] + ], + [ + "add", + 263, + 225, + 2, + 1, + [] + ], + [ + "add", + 262, + 225, + 1, + 1, + [] + ], + [ + "add", + 261, + 225, + -1, + 1, + [] + ], + [ + "add", + 259, + 225, + -1, + 1, + [] + ], + [ + "add", + 258, + 225, + -1, + 1, + [] + ], + [ + "add", + 257, + 225, + 1, + 1, + [] + ], + [ + "add", + 254, + 225, + 1, + 1, + [] + ], + [ + "add", + 250, + 225, + -1, + 1, + [] + ], + [ + "add", + 248, + 225, + 1, + 1, + [] + ], + [ + "add", + 247, + 225, + -1, + 1, + [] + ], + [ + "add", + 242, + 225, + 1, + 1, + [] + ], + [ + "add", + 241, + 225, + -1, + 1, + [] + ], + [ + "add", + 237, + 225, + 1, + 1, + [] + ], + [ + "add", + 235, + 225, + 1, + 1, + [] + ], + [ + "add", + 233, + 225, + -1, + 1, + [] + ], + [ + "add", + 232, + 225, + -1, + 1, + [] + ], + [ + "add", + 231, + 225, + -1, + 1, + [] + ], + [ + "add", + 230, + 225, + -1, + 1, + [] + ], + [ + "add", + 229, + 225, + 1, + 1, + [] + ], + [ + "add", + 227, + 225, + 1, + 1, + [] + ] + ], + "after": [ + [ + "add", + 2, + 61, + -1, + 2, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 62, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 94, + 1, + 2, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 265, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "scale", + 2, + 1, + -2, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 265, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 265, + 2, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 2, + 265, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 94, + 265, + 4, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ] + ], + "frame_changes": [ + { + "section": "A", + "parent_index": 2122, + "candidate_index": 2159, + "gate": [ + "scale", + 94, + -1, + 1 + ], + "old_frame": [ + 400, + 69, + 35, + 14 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + }, + { + "section": "A", + "parent_index": 2127, + "candidate_index": 2164, + "gate": [ + "add", + 94, + 61, + 1, + 1 + ], + "old_frame": [ + 400, + 69, + 35, + 14 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + }, + { + "section": "A", + "parent_index": 3829, + "candidate_index": 3866, + "gate": [ + "add", + 57, + 94, + 1, + 1 + ], + "old_frame": [ + 256, + 128, + 64, + 32, + 16, + 8, + 5, + 3 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + } + ] +} diff --git a/research/paired-extension-normal45/data/TRANSFORM-267.json b/research/paired-extension-normal45/data/TRANSFORM-267.json new file mode 100644 index 0000000000..8ee384083b --- /dev/null +++ b/research/paired-extension-normal45/data/TRANSFORM-267.json @@ -0,0 +1,565 @@ +{ + "helper": 267, + "normal": 45, + "step": 2, + "before": [ + [ + "add", + 267, + 240, + 1, + 4, + [] + ], + [ + "add", + 267, + 241, + 1, + 4, + [] + ], + [ + "add", + 267, + 242, + 1, + 4, + [] + ], + [ + "add", + 267, + 243, + 1, + 2, + [] + ], + [ + "add", + 267, + 245, + 1, + 4, + [] + ], + [ + "add", + 267, + 246, + 1, + 4, + [] + ], + [ + "add", + 267, + 250, + -1, + 4, + [] + ], + [ + "add", + 267, + 251, + 1, + 2, + [] + ], + [ + "add", + 267, + 253, + 1, + 4, + [] + ], + [ + "add", + 267, + 254, + 1, + 4, + [] + ], + [ + "add", + 267, + 225, + -1, + 1, + [] + ], + [ + "add", + 225, + 267, + 1, + 1, + [] + ], + [ + "add", + 267, + 225, + -1, + 1, + [] + ], + [ + "scale", + 225, + 1, + -1, + [] + ], + [ + "add", + 253, + 225, + 1, + 1, + [] + ], + [ + "add", + 251, + 225, + 1, + 1, + [] + ], + [ + "add", + 248, + 225, + -1, + 1, + [] + ], + [ + "add", + 247, + 225, + -1, + 1, + [] + ], + [ + "add", + 246, + 225, + -1, + 1, + [] + ], + [ + "add", + 245, + 225, + 1, + 1, + [] + ], + [ + "add", + 243, + 225, + 1, + 1, + [] + ], + [ + "add", + 237, + 225, + -1, + 1, + [] + ], + [ + "add", + 235, + 225, + -1, + 1, + [] + ], + [ + "add", + 233, + 225, + 1, + 1, + [] + ], + [ + "add", + 232, + 225, + 1, + 1, + [] + ], + [ + "add", + 231, + 225, + 1, + 1, + [] + ], + [ + "add", + 230, + 225, + 1, + 1, + [] + ], + [ + "add", + 229, + 225, + -1, + 1, + [] + ], + [ + "add", + 227, + 225, + -1, + 1, + [] + ] + ], + "after": [ + [ + "add", + 62, + 63, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 70, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 71, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 72, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 251, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 267, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "scale", + 62, + 1, + -4, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 267, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 267, + 62, + 1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 62, + 267, + -1, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ], + [ + "add", + 63, + 267, + 4, + 1, + [ + 256, + 128, + 64, + 33, + 16, + 9, + 5, + 2 + ] + ] + ], + "frame_changes": [ + { + "section": "A", + "parent_index": 1757, + "candidate_index": 1786, + "gate": [ + "scale", + 57, + -1, + 1 + ], + "old_frame": [ + 448, + 38, + 21, + 11 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + }, + { + "section": "A", + "parent_index": 1762, + "candidate_index": 1791, + "gate": [ + "add", + 57, + 92, + 1, + 1 + ], + "old_frame": [ + 448, + 38, + 21, + 11 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + }, + { + "section": "A", + "parent_index": 1911, + "candidate_index": 1940, + "gate": [ + "scale", + 62, + -1, + 1 + ], + "old_frame": [ + 261, + 133, + 85, + 45 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + }, + { + "section": "A", + "parent_index": 1916, + "candidate_index": 1945, + "gate": [ + "add", + 62, + 63, + 1, + 1 + ], + "old_frame": [ + 261, + 133, + 85, + 45 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + }, + { + "section": "A", + "parent_index": 3765, + "candidate_index": 3794, + "gate": [ + "add", + 92, + 63, + 1, + 1 + ], + "old_frame": [ + 256, + 128, + 64, + 34, + 16, + 10, + 4, + 1 + ], + "new_frame": [ + 256, + 128, + 64, + 35, + 16, + 11, + 5 + ] + } + ] +} diff --git a/research/paired-extension-normal45/data/WORD-base.json.gz b/research/paired-extension-normal45/data/WORD-base.json.gz new file mode 100644 index 0000000000..1ca8287d6a Binary files /dev/null and b/research/paired-extension-normal45/data/WORD-base.json.gz differ diff --git a/research/paired-extension-normal45/data/WORD-extra.json.gz b/research/paired-extension-normal45/data/WORD-extra.json.gz new file mode 100644 index 0000000000..c39913ce24 Binary files /dev/null and b/research/paired-extension-normal45/data/WORD-extra.json.gz differ diff --git a/research/paired-extension-normal45/evidence/ADAPTER-DERIVATION.json b/research/paired-extension-normal45/evidence/ADAPTER-DERIVATION.json new file mode 100644 index 0000000000..cea5672188 --- /dev/null +++ b/research/paired-extension-normal45/evidence/ADAPTER-DERIVATION.json @@ -0,0 +1,129 @@ +{ + "status": "PASS_CHECKED_86_BUFFER_ADAPTER_DERIVATION_R13", + "parent_head": "51309592971e3b5be935599eed2a95404dc7781e", + "parent_manifest_sha256": "9dba3fe371602ec023a54e26c0fd66f69eb7a74be86aab89923529083c14b36f", + "source_commit": "normal45-paired-extractions-pr2917", + "source_profile": "paired-extension-normal45", + "upstream_head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "source_manifest_sha256": "79956f19c5c3d4d1ad3578e4b3d6844bc54c1f3680825fc87c80cc04f069dae8", + "source_files": 637, + "comparisons": { + "pr2908": { + "pr": 2908, + "head": "51309592971e3b5be935599eed2a95404dc7781e", + "sha256": "2406680a07b43a69b0f12f8462cc43f3616f3c8cb0a46bc767541b45945cd2bf" + }, + "pr2917": { + "pr": 2917, + "head": "224bd5e56041c40078ff6b5fa7393733a215de5c", + "sha256": "e6c836c0178661a53a69cd91f29d83585e876f2511ff40c6b6204cd270fbdeac" + }, + "pr2930": { + "pr": 2930, + "head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "sha256": "9c2c14158780a677b3661623d7476acc4f535ac9e0481addfa1d6c4c7633b74b" + } + }, + "retained_receipt_sha256": "9ac73e7c36ccbfb8ab8b295365142047c03d8ba0b3a7a1c59c556eb5226c2099", + "buffer_count": 86, + "physical_overhead": 504, + "changes": { + "prepare_extension_native.py": { + "source": "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/r13pub2-build/runs/fresh1/pr2908/tools/prepare_channel_native.py", + "before_sha256": "4d207b9bbe3e0b8a86d10ad5d5f329a81da0cf56dce6c03e6fdd5b78e581ce91", + "after_sha256": "2319587786f9faac724fd55322dac783aea6aac9ff505deb8e3d5a7333412a96", + "replacements": [ + { + "old": "SOURCE_SHA='56cf455752722051d598a7da1e5ee700637fbaef09189f534413dbe6e0525a83'", + "new": "SOURCE_SHA='79956f19c5c3d4d1ad3578e4b3d6844bc54c1f3680825fc87c80cc04f069dae8'" + }, + { + "old": "SOURCE_FILES=610", + "new": "SOURCE_FILES=637" + }, + { + "old": "SOURCE_COMMIT='two-sided-helper408-pr2894'", + "new": "SOURCE_COMMIT='normal45-paired-extractions-pr2917'" + }, + { + "old": "OLD_RECEIPT_SHA='dd36443f2789ffa6deca7210c76ada781e2b9b7e622a546b366f51a475faff3e'", + "new": "OLD_RECEIPT_SHA='9ac73e7c36ccbfb8ab8b295365142047c03d8ba0b3a7a1c59c556eb5226c2099'" + }, + { + "old": "len(can['zero_buffers'])==73", + "new": "len(can['zero_buffers'])==86" + } + ] + }, + "admit_extension.py": { + "source": "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/r13pub2-build/runs/fresh1/pr2908/tools/admit_channel408.py", + "before_sha256": "a62c21eac4e0df502cbfb78c88b19a763fd351cde3c11c0588874f84db6992bf", + "after_sha256": "ef216626d3658f4a419f210dcc8708d028de3422094fe6e3beb62e46468c3e25", + "replacements": [ + { + "old": " 'channel408': dict(commit='two-sided-helper408-pr2894',manifest='56cf455752722051d598a7da1e5ee700637fbaef09189f534413dbe6e0525a83',helpers=408,source_file_count=610,upstream_head='18d03c447886895ef9abf888398178e0428533ca'),", + "new": " 'paired-extension-normal45': dict(commit='normal45-paired-extractions-pr2917',manifest='79956f19c5c3d4d1ad3578e4b3d6844bc54c1f3680825fc87c80cc04f069dae8',helpers=408,source_file_count=637,upstream_head='224bd5e56041c40078ff6b5fa7393733a215de5c')," + }, + { + "old": "COMPARISONS = {", + "new": "COMPARISONS = {\n 'pr2908': dict(pr=2908,head='51309592971e3b5be935599eed2a95404dc7781e',sha256='2406680a07b43a69b0f12f8462cc43f3616f3c8cb0a46bc767541b45945cd2bf',field='kappa'),\n 'pr2917': dict(pr=2917,head='224bd5e56041c40078ff6b5fa7393733a215de5c',sha256='e6c836c0178661a53a69cd91f29d83585e876f2511ff40c6b6204cd270fbdeac',field='kappa'),\n 'pr2930': dict(pr=2930,head='81f3b5d12977eba09e06fbff729167d59faabe90',sha256='9c2c14158780a677b3661623d7476acc4f535ac9e0481addfa1d6c4c7633b74b',field='kappa')," + }, + { + "old": "ap.add_argument('--source-profile', choices=['channel408'], default='channel408')", + "new": "ap.add_argument('--source-profile', choices=['paired-extension-normal45'], default='paired-extension-normal45')" + }, + { + "old": "ap.add_argument('--comparison-profile', choices=['pr2894'], default='pr2894')", + "new": "ap.add_argument('--comparison-profile', choices=['pr2908','pr2917','pr2930'], default='pr2908')" + }, + { + "old": "zero_buffers_allocated_and_cleared=73", + "new": "zero_buffers_allocated_and_cleared=86" + }, + { + "old": "len(c.get('zero_buffers',[]))==73, 'helper408 physical ABI including all 73 private buffers'", + "new": "len(c.get('zero_buffers',[]))==86, 'paired extension physical ABI including all 86 private buffers'" + }, + { + "old": "896*T+expected_helpers+8+73+2, 'complete physical cost including all actual helpers and 73 buffers'", + "new": "896*T+expected_helpers+8+86+2, 'complete physical cost including all actual helpers and 86 buffers'" + } + ] + }, + "extension_blocknorm.py": { + "source": "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/r13pub2-build/runs/fresh1/pr2908/tools/channel_blocknorm.py", + "before_sha256": "b53ebd53e3948f658c6da4f487a9ea10c9cb0a6acf2435750a32d6efeb9869c0", + "after_sha256": "7c49a2f5d8b0b1715a49ed7f5e11f95bd693e73ae4de4ad9e0a422fe43218035", + "replacements": [ + { + "old": "len(allocated)==73, 'all73 private zero buffers released'", + "new": "len(allocated)==86, 'all86 private zero buffers released'" + }, + { + "old": "'zero_buffers_allocated_and_cleared':73", + "new": "'zero_buffers_allocated_and_cleared':86" + }, + { + "old": "r['zero_buffers_returned_to_zero']==73", + "new": "r['zero_buffers_returned_to_zero']==86" + }, + { + "old": "physical==live+8+408+73+2", + "new": "physical==live+8+408+86+2" + }, + { + "old": "'zero_buffers':[live+416,live+489], 'coefficient':[live+489,live+491]", + "new": "'zero_buffers':[live+416,live+502], 'coefficient':[live+502,live+504]" + }, + { + "old": "len(mp)==73 and set(mp.values())==set(range(*ns['zero_buffers'])), '73distinct private Z slots'", + "new": "len(mp)==86 and set(mp.values())==set(range(*ns['zero_buffers'])), '86distinct private Z slots'" + }, + { + "old": "T=len(order)//9; live=896*T; physical=live+490", + "new": "T=len(order)//9; live=896*T; physical=live+504" + } + ] + } + } +} diff --git a/research/paired-extension-normal45/evidence/ADMISSION-RESULT.json b/research/paired-extension-normal45/evidence/ADMISSION-RESULT.json new file mode 100644 index 0000000000..d5f4425a9d --- /dev/null +++ b/research/paired-extension-normal45/evidence/ADMISSION-RESULT.json @@ -0,0 +1,383 @@ +{ + "actual_expected_helpers": 408, + "comparison_claim_sha256": "9c2c14158780a677b3661623d7476acc4f535ac9e0481addfa1d6c4c7633b74b", + "comparison_head": "81f3b5d12977eba09e06fbff729167d59faabe90", + "comparison_kappa": "17224999064432745643569999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "comparison_pr": 2930, + "complex_lower": "430704079965803581999/250000000000000000000000", + "dispatch_sha256": "65e435bd68e97243c003677271b88485a29d4d0fae2dff1354100404a145e74c", + "external_input_sha256": { + "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/r13pub2-build/runs/fresh1/adapters/extension_blocknorm.py": "7c49a2f5d8b0b1715a49ed7f5e11f95bd693e73ae4de4ad9e0a422fe43218035", + "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/r13pub2-build/runs/fresh1/parent-export/pr2894/vendor/pr2857/vendor/pr2839/lift_parent.py": "9a1edd7d4ab4a2f2ac8d15b42b7e40f93653d65026bac59e4c1ce80b486bd60e", + "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/r13pub2-build/runs/fresh1/parent-export/pr2894/vendor/pr2857/vendor/pr2839/reconstruct_replica.py": "5472811c24aef3852dc7e189dff5060076a6c0b25bfde928da50dcfe9b5bdc15", + "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/r13pub2-build/runs/fresh1/parent-export/pr2894/vendor/pr2857/vendor/pr2839/replica_parent.py": "48bdbf28f59d80edb266803ec61bf5e22e8fb5e5a0e2b88004b6039147589bd4", + "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/r13pub2-build/runs/fresh1/pr2930/CLAIM.json": "9c2c14158780a677b3661623d7476acc4f535ac9e0481addfa1d6c4c7633b74b", + "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/wt-r13pub2/research/paired-extension-normal45/allocation/DISPATCH.json": "65e435bd68e97243c003677271b88485a29d4d0fae2dff1354100404a145e74c", + "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/wt-r13pub2/research/paired-extension-normal45/allocation/FILL.json.gz": "1880caffbea87cf9e946be60528fbc68c119e8e2ff56df9370b6cc373fc50e66", + "/private/tmp/claude-501/-Users-mdumitrean-Desktop-dev-aigent-math-prime/c80ebb8e-fc28-4d1d-b7ef-b214d4660f98/scratchpad/wt-r13pub2/research/paired-extension-normal45/allocation/ORDER.json": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1" + }, + "fill_sha256": "1880caffbea87cf9e946be60528fbc68c119e8e2ff56df9370b6cc373fc50e66", + "gain": "316413419939763639/1000000000000000000000000", + "kappa": "17228163198632143279959999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "kappa_decimal": "0.0017228163198632143279959999999999999999999998999999999999999999999999", + "native_receipt_sha256": "0261d8834cfa6de1b654d9539c19fce9c762bf94de97d6d055cee06f85859909", + "order_sha256": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1", + "package_manifest_sha256": "86513bcfac5c9554a03a6ba7c00dae7b856a6197007c923205d23c7abba6ec0c", + "patches": [ + { + "after_sha256": "52f8b4cec2dab69cbe590e1fd0f7a68e1b35de5a540bd22fd2adfce07a92b46b", + "before_sha256": "faf283eb4edd2e6a1ccb40b3cb3ba30ae54338eaf5ea0a10d84d11d7939502af", + "path": "new/rebind.py", + "replacements": [ + [ + "physical=spec['expected']['live'] + 8 + R + 2)", + "physical=spec['expected']['live'] + 8 + R + 2 + max(len(rd(d / 'CANONICAL-WORD.json.gz').get('zero_buffers', [])) for d in locs.values()))" + ] + ] + }, + { + "after_sha256": "99bef04f24a99088e5c0c9b8f6bbc8386669d8315b8f572d6bbfb932c5d51145", + "before_sha256": "7edb4732b34e5814b27650a55c938626cb50d68f06397744dd4fe451437e90e0", + "path": "geometry_controls.py", + "replacements": [ + [ + " i['complete_invocation_sweeps']=i['bridge_sweeps']=333", + " i['complete_invocation_sweeps']-=1;i['bridge_sweeps']-=1" + ], + [ + " o,i=copy.deepcopy(owner),copy.deepcopy(invoice);fn(o,i);oh=digest(o);i['owner_audit_sha256']=oh", + " o,i=copy.deepcopy(owner),copy.deepcopy(invoice);fn(o,i);assert (o,i)!=(owner,invoice), 'geometry mutant must change actual receipts';oh=digest(o);i['owner_audit_sha256']=oh" + ] + ] + }, + { + "after_sha256": "6cfefe80c02a6c0f243f50ca9e146e1ab1440b84a033d8a71d42be5a5fa27f6b", + "before_sha256": "c43680a2da390f79925547a5ee1919d8a76637cccf98e2c8164b6f667fbc3183", + "path": "verify_release.py", + "replacements": [ + [ + "Fraction(1, 10 ** 3046) - Fraction(1, 10 ** 3022)", + "Fraction(1, 10 ** (spec['outer_refinement']['endpoint_digits'] + 46)) - Fraction(1, 10 ** (spec['outer_refinement']['endpoint_digits'] + 22))" + ], + [ + "epsilon=1-(1025/1024)e-3080", + "epsilon=1-(1025/1024)e-{spec['outer_refinement']['endpoint_digits']+80}" + ], + [ + "at the one 3000-digit rejection call", + "at the one {spec['outer_refinement']['endpoint_digits']}-digit rejection call" + ] + ] + }, + { + "after_sha256": "1dd56009986eb14dd6603c9193c7ad71dd45c7d005bf71c9cd3f916e66f54d98", + "before_sha256": "9e12909c73d3b3a31a45d801ae76c034510d6306400412e474df79bc4f1dc67e", + "path": "outer/check_ledger.py", + "replacements": [ + [ + "assert (m,W)==(73,66304)", + "T=spec['geometry']['replicas']\nassert type(T) is int and T>0\nassert m==73 and W==896*T and W==BJ['live']" + ] + ] + }, + { + "after_sha256": "ebaf637f1f818dac9c0fce0ee3f18df300873105818cea29a8ae9e8b737b5c7d", + "before_sha256": "08ca58abff11bdfba721dc56ab8acf06ec1b7c48a8699a0955cf35324680aca7", + "path": "code/witness.py", + "replacements": [ + [ + " with open(os.environ['WITNESS_RECORD'],'a')as f:f.write(json.dumps([key,got],default=str)+chr(10))", + " import time as _wr_time\n _wr_path=Path(os.environ['WITNESS_RECORD'])\n _wr_lock=_wr_path.with_name(_wr_path.name+'.append.lock')\n _wr_deadline=_wr_time.monotonic()+60\n _wr_fd=None\n while _wr_fd is None:\n try:_wr_fd=os.open(_wr_lock,os.O_CREAT|os.O_EXCL|os.O_WRONLY)\n except FileExistsError:\n if _wr_time.monotonic()>=_wr_deadline:raise TimeoutError('discovery record lock timeout; existing lock preserved')\n _wr_time.sleep(.005)\n try:\n with _wr_path.open('a',encoding='utf-8',newline='\\n')as _wr_out:\n _wr_out.write(json.dumps([key,got],default=str)+chr(10))\n _wr_out.flush()\n finally:\n os.close(_wr_fd)\n _wr_lock.unlink()" + ] + ] + }, + { + "after_sha256": "680b6de474a8226777c5a17191470b21cd5cc524cc22921d12dff6cef25c43ee", + "before_sha256": "b0d5f4217b4699c37609dc7c3633d570acbccd205840777d38f891846b4b918c", + "path": "verify.py", + "replacements": [ + [ + "run('lift-parent',P/'lift_parent.py','--owners',work/'rebuilt-owners','--out',work/'rebuilt-parent')", + "run('lift-parent',P/'lift_parent.py','--package',P,'--owners',work/'rebuilt-owners','--out',work/'rebuilt-parent')" + ] + ] + }, + { + "after_sha256": "0d8cc021d2401d047aaec79060ec2ea28ba06f12eca8dbf4c60c78bb31975c4e", + "before_sha256": "ebaf637f1f818dac9c0fce0ee3f18df300873105818cea29a8ae9e8b737b5c7d", + "path": "code/witness.py", + "replacements": [ + [ + "PAYLOAD==1<<(192+(GEO['dimension']+1)//2+2*CALLS+4).bit_length()", + "PAYLOAD==1<<(128+(GEO['dimension']+1)//2+18+1330+1+4).bit_length()" + ] + ] + }, + { + "after_sha256": "c5106e0d7a97382677fa228fbade989262347968a0e54acfcf6712aa37e02f47", + "before_sha256": "bb213d0af12218ff7c9c572717e522d8bbeeb2856b87a253f4a7f44e0fd71f15", + "path": "code/invoice_allcold.py", + "replacements": [ + [ + " required_prefix=localbits+input_l2_bits+call_count+bridge_sweeps+4", + " from blocknorm_certificate import certify\n blocknorm=certify(template, {pid:base/'providers'/pid for pid in template['local_providers']})\n assert blocknorm['status'] == 'PASS_TENSOR_BLOCK_NORM_CERTIFICATE'\n assert localbits <= 128, 'actual native scalar/Horner prefix exceeds charged local reserve'\n required_prefix=localbits+input_l2_bits+blocknorm['max_active_depth']+blocknorm['stock_l2_bits']+1+4" + ] + ] + }, + { + "after_sha256": "0d522b09c7fe6a5e62fe80c28f3eefe733557a82d77c6212e5d4b91ffb7e3421", + "before_sha256": "02502a217fe8c9e10229075b50745518beac512c48db20e64c3e06514a4da5b5", + "path": "independent_core.py", + "replacements": [ + [ + " payload = 1 << (192 + (M+1)//2 + 2*len(c['order']) + 4).bit_length()", + " require(localbits <= 128, 'measured native prefix exceeds local reserve')\n payload = 1 << (128 + (M+1)//2 + 18 + 1330 + 1 + 4).bit_length()" + ] + ] + }, + { + "after_sha256": "d598a2ac1e2e8eaee14a8c285e0277a7ae44ca6a15bd2b5cfc67fb40844fb387", + "before_sha256": "c5106e0d7a97382677fa228fbade989262347968a0e54acfcf6712aa37e02f47", + "path": "code/invoice_allcold.py", + "replacements": [ + [ + " complete_invocation_sweeps=call_count,bridge_sweeps=bridge_sweeps,row_prefix_extra=2*payload,", + " complete_invocation_sweeps=call_count,bridge_sweeps=bridge_sweeps,row_prefix_extra=2*payload,blocknorm=blocknorm," + ], + [ + " primitive_arithmetic_margin_bits=4,controller_audit_sha256=", + " tensor_block_norm=blocknorm,partial_cover_margin_bits=1,physical_stock_l2_bits=blocknorm['stock_l2_bits'],primitive_arithmetic_margin_bits=4,controller_audit_sha256=" + ], + [ + "Sum every actual invocation and bridge sweep and take the maximum local scalar/Horner prefix over both orientations of the fixed provider.", + "All invocations and bridge sweeps remain charged. Bound completed-boundary energy by at most eighteen active steps per owner replica, using exact tensor-isomorphic whole-family helper unitaries. Add the full group-indexed physical-stock sup-to-l2 factor and one partial-cover margin, then the maximum local scalar/Horner prefix." + ] + ] + }, + { + "after_sha256": "e051aaa166e01263780d5ae03699690670b597fed6593af4c37a7e978825eb85", + "before_sha256": "0d522b09c7fe6a5e62fe80c28f3eefe733557a82d77c6212e5d4b91ffb7e3421", + "path": "independent_core.py", + "replacements": [ + [ + " prefix = localbits + (M + 1) // 2 + len(c['order']) + c['bridges'] + 4", + " bn=c['blocknorm']\n require(bn['status']=='PASS_TENSOR_BLOCK_NORM_CERTIFICATE' and bn['max_active_depth']==18 and bn['stock_l2_bits']<=1330, 'independent tensor block certificate')\n prefix = localbits + (M + 1) // 2 + bn['max_active_depth'] + bn['stock_l2_bits'] + 1 + 4" + ], + [ + "prefix_formula=dict(local_scalar=localbits, input_l2=(M + 1) // 2, invocations=len(c['order']), bridges=c['bridges'], margin=4)", + "prefix_formula=dict(local_scalar=localbits, input_l2=(M + 1) // 2, invocations=len(c['order']), bridges=c['bridges'], active_block_depth=18,stock_l2=bn['stock_l2_bits'],partial_cover=1,margin=4),blocknorm=bn" + ] + ] + }, + { + "after_sha256": "393323f150d0bb686419804d51cf43d0f58450d2a1e7929725acdd26fdbb3640", + "before_sha256": "2286f00e462ff28abbb3f396095463482a1e063213b9526a7225275980c77eaf", + "path": "audit_mixed.py", + "replacements": [ + [ + "pending=A.check_pending_axes(ctx);receipt=A.check_roles(ctx,roles)", + "import blocknorm_certificate as BN;ctx['blocknorm']=BN.certify_context(ctx,roles,dirs,source_parent=parent);pending=A.check_pending_axes(ctx);receipt=A.check_roles(ctx,roles)" + ] + ] + }, + { + "after_sha256": "e1f9f479eca12e513fc7694cd283070bcc6f2050903583535f690fc8aba60467", + "before_sha256": "f25e1e870df5d5a16a1e367b3df8843cb01644ab4b75895d7939af81e4fcb833", + "path": "code/assemble.py", + "replacements": [ + [ + " assert invoice['global_prefix_bits']==max(z['prefix_bits']for p in invoice['providers'].values()for z in p['local'].values())+37+CALLS+CALLS+4", + " bn=invoice['blocknorm']\n assert bn['status']=='PASS_TENSOR_BLOCK_NORM_CERTIFICATE' and bn['replicas']==REPLICAS\n assert bn['max_active_depth']==bn['boundary_depth_bits']==18 and bn['active_calls_per_block']==bn['bridges_per_block']==9\n assert bn['block_width_families']==896 and bn['physical_families']==invoice['physical'] and bn['live_families']==invoice['live']\n assert bn['partial_cover_bits']==1 and bn['input_l2_bits']==37 and bn['local_reserve_bits']==128 and bn['retained_payload_bits']==PAYLOAD\n localbits=max(z['prefix_bits']for p in invoice['providers'].values()for z in p['local'].values())\n assert bn['local_actual_prefix_bits']==localbits and localbits<=128\n assert invoice['global_prefix_bits']==bn['actual_prefix_bits']==localbits+37+18+bn['stock_l2_bits']+1+4\n assert bn['required_reserve_bits']==128+37+18+bn['stock_l2_bits']+1+40\nassert m==73 and W==896*T and W==BJ['live']" + ] + ] + }, + { + "after_sha256": "ebaf637f1f818dac9c0fce0ee3f18df300873105818cea29a8ae9e8b737b5c7d", + "before_sha256": "08ca58abff11bdfba721dc56ab8acf06ec1b7c48a8699a0955cf35324680aca7", + "path": "code/witness.py", + "replacements": [ + [ + " with open(os.environ['WITNESS_RECORD'],'a')as f:f.write(json.dumps([key,got],default=str)+chr(10))", + " import time as _wr_time\n _wr_path=Path(os.environ['WITNESS_RECORD'])\n _wr_lock=_wr_path.with_name(_wr_path.name+'.append.lock')\n _wr_deadline=_wr_time.monotonic()+60\n _wr_fd=None\n while _wr_fd is None:\n try:_wr_fd=os.open(_wr_lock,os.O_CREAT|os.O_EXCL|os.O_WRONLY)\n except FileExistsError:\n if _wr_time.monotonic()>=_wr_deadline:raise TimeoutError('discovery record lock timeout; existing lock preserved')\n _wr_time.sleep(.005)\n try:\n with _wr_path.open('a',encoding='utf-8',newline='\\n')as _wr_out:\n _wr_out.write(json.dumps([key,got],default=str)+chr(10))\n _wr_out.flush()\n finally:\n os.close(_wr_fd)\n _wr_lock.unlink()" + ] + ] + }, + { + "after_sha256": "680b6de474a8226777c5a17191470b21cd5cc524cc22921d12dff6cef25c43ee", + "before_sha256": "b0d5f4217b4699c37609dc7c3633d570acbccd205840777d38f891846b4b918c", + "path": "verify.py", + "replacements": [ + [ + "run('lift-parent',P/'lift_parent.py','--owners',work/'rebuilt-owners','--out',work/'rebuilt-parent')", + "run('lift-parent',P/'lift_parent.py','--package',P,'--owners',work/'rebuilt-owners','--out',work/'rebuilt-parent')" + ] + ] + }, + { + "after_sha256": "0d8cc021d2401d047aaec79060ec2ea28ba06f12eca8dbf4c60c78bb31975c4e", + "before_sha256": "ebaf637f1f818dac9c0fce0ee3f18df300873105818cea29a8ae9e8b737b5c7d", + "path": "code/witness.py", + "replacements": [ + [ + "PAYLOAD==1<<(192+(GEO['dimension']+1)//2+2*CALLS+4).bit_length()", + "PAYLOAD==1<<(128+(GEO['dimension']+1)//2+18+1330+1+4).bit_length()" + ] + ] + }, + { + "after_sha256": "c5106e0d7a97382677fa228fbade989262347968a0e54acfcf6712aa37e02f47", + "before_sha256": "bb213d0af12218ff7c9c572717e522d8bbeeb2856b87a253f4a7f44e0fd71f15", + "path": "code/invoice_allcold.py", + "replacements": [ + [ + " required_prefix=localbits+input_l2_bits+call_count+bridge_sweeps+4", + " from blocknorm_certificate import certify\n blocknorm=certify(template, {pid:base/'providers'/pid for pid in template['local_providers']})\n assert blocknorm['status'] == 'PASS_TENSOR_BLOCK_NORM_CERTIFICATE'\n assert localbits <= 128, 'actual native scalar/Horner prefix exceeds charged local reserve'\n required_prefix=localbits+input_l2_bits+blocknorm['max_active_depth']+blocknorm['stock_l2_bits']+1+4" + ] + ] + }, + { + "after_sha256": "0d522b09c7fe6a5e62fe80c28f3eefe733557a82d77c6212e5d4b91ffb7e3421", + "before_sha256": "02502a217fe8c9e10229075b50745518beac512c48db20e64c3e06514a4da5b5", + "path": "independent_core.py", + "replacements": [ + [ + " payload = 1 << (192 + (M+1)//2 + 2*len(c['order']) + 4).bit_length()", + " require(localbits <= 128, 'measured native prefix exceeds local reserve')\n payload = 1 << (128 + (M+1)//2 + 18 + 1330 + 1 + 4).bit_length()" + ] + ] + }, + { + "after_sha256": "d598a2ac1e2e8eaee14a8c285e0277a7ae44ca6a15bd2b5cfc67fb40844fb387", + "before_sha256": "c5106e0d7a97382677fa228fbade989262347968a0e54acfcf6712aa37e02f47", + "path": "code/invoice_allcold.py", + "replacements": [ + [ + " complete_invocation_sweeps=call_count,bridge_sweeps=bridge_sweeps,row_prefix_extra=2*payload,", + " complete_invocation_sweeps=call_count,bridge_sweeps=bridge_sweeps,row_prefix_extra=2*payload,blocknorm=blocknorm," + ], + [ + " primitive_arithmetic_margin_bits=4,controller_audit_sha256=", + " tensor_block_norm=blocknorm,partial_cover_margin_bits=1,physical_stock_l2_bits=blocknorm['stock_l2_bits'],primitive_arithmetic_margin_bits=4,controller_audit_sha256=" + ], + [ + "Sum every actual invocation and bridge sweep and take the maximum local scalar/Horner prefix over both orientations of the fixed provider.", + "All invocations and bridge sweeps remain charged. Bound completed-boundary energy by at most eighteen active steps per owner replica, using exact tensor-isomorphic whole-family helper unitaries. Add the full group-indexed physical-stock sup-to-l2 factor and one partial-cover margin, then the maximum local scalar/Horner prefix." + ] + ] + }, + { + "after_sha256": "e051aaa166e01263780d5ae03699690670b597fed6593af4c37a7e978825eb85", + "before_sha256": "0d522b09c7fe6a5e62fe80c28f3eefe733557a82d77c6212e5d4b91ffb7e3421", + "path": "independent_core.py", + "replacements": [ + [ + " prefix = localbits + (M + 1) // 2 + len(c['order']) + c['bridges'] + 4", + " bn=c['blocknorm']\n require(bn['status']=='PASS_TENSOR_BLOCK_NORM_CERTIFICATE' and bn['max_active_depth']==18 and bn['stock_l2_bits']<=1330, 'independent tensor block certificate')\n prefix = localbits + (M + 1) // 2 + bn['max_active_depth'] + bn['stock_l2_bits'] + 1 + 4" + ], + [ + "prefix_formula=dict(local_scalar=localbits, input_l2=(M + 1) // 2, invocations=len(c['order']), bridges=c['bridges'], margin=4)", + "prefix_formula=dict(local_scalar=localbits, input_l2=(M + 1) // 2, invocations=len(c['order']), bridges=c['bridges'], active_block_depth=18,stock_l2=bn['stock_l2_bits'],partial_cover=1,margin=4),blocknorm=bn" + ] + ] + }, + { + "after_sha256": "393323f150d0bb686419804d51cf43d0f58450d2a1e7929725acdd26fdbb3640", + "before_sha256": "2286f00e462ff28abbb3f396095463482a1e063213b9526a7225275980c77eaf", + "path": "audit_mixed.py", + "replacements": [ + [ + "pending=A.check_pending_axes(ctx);receipt=A.check_roles(ctx,roles)", + "import blocknorm_certificate as BN;ctx['blocknorm']=BN.certify_context(ctx,roles,dirs,source_parent=parent);pending=A.check_pending_axes(ctx);receipt=A.check_roles(ctx,roles)" + ] + ] + }, + { + "after_sha256": "e1f9f479eca12e513fc7694cd283070bcc6f2050903583535f690fc8aba60467", + "before_sha256": "f25e1e870df5d5a16a1e367b3df8843cb01644ab4b75895d7939af81e4fcb833", + "path": "code/assemble.py", + "replacements": [ + [ + " assert invoice['global_prefix_bits']==max(z['prefix_bits']for p in invoice['providers'].values()for z in p['local'].values())+37+CALLS+CALLS+4", + " bn=invoice['blocknorm']\n assert bn['status']=='PASS_TENSOR_BLOCK_NORM_CERTIFICATE' and bn['replicas']==REPLICAS\n assert bn['max_active_depth']==bn['boundary_depth_bits']==18 and bn['active_calls_per_block']==bn['bridges_per_block']==9\n assert bn['block_width_families']==896 and bn['physical_families']==invoice['physical'] and bn['live_families']==invoice['live']\n assert bn['partial_cover_bits']==1 and bn['input_l2_bits']==37 and bn['local_reserve_bits']==128 and bn['retained_payload_bits']==PAYLOAD\n localbits=max(z['prefix_bits']for p in invoice['providers'].values()for z in p['local'].values())\n assert bn['local_actual_prefix_bits']==localbits and localbits<=128\n assert invoice['global_prefix_bits']==bn['actual_prefix_bits']==localbits+37+18+bn['stock_l2_bits']+1+4\n assert bn['required_reserve_bits']==128+37+18+bn['stock_l2_bits']+1+4 WORD, modelled on PR2917's producer.py (Mason Hale), which hard-codes its +own nine helpers; this module declares the four new ones. The paired input/output construction, its +two-sided certificate and the compensation rule C*S are Jeremy Diviney's PR2908 method; the frame +accounting (frame_report) and inverse-reverse cleanup (derive_cleanup) are Jeremy Kothe's PR2894 code, +vendored byte-identical by PR2917 (vendor/preload_move.py). Marius-Paul Dumitrean, with substantial AI +assistance (Anthropic Claude via Claude Code). This module is pure: no file, process or output access. +""" +import collections +import copy +from fractions import Fraction as Q +import preload_move as pm + +HELPERS = (249, 267, 251, 265) +NORMAL = 45 +FRAME = [256, 128, 64, 33, 16, 9, 5, 2] # E_45 = {x in F_2^9 : x . 45 = 0}, canonical basis +PARENT_PROFILE = {'1': 2416, '2': 640, '3': 280, '4': 110, '5': 26, '8': 8} # PR2917 +PARENT_INVENTORY = {'4': 26, '5': 2, '7': 62, '8': 96, '9': 222} +PARENT_BUFFERS = 82 +PROFILE = {'1': 2434, '2': 632, '3': 286, '4': 104, '5': 26, '8': 8} +INVENTORY = {'4': 26, '5': 2, '7': 62, '8': 100, '9': 218} +BUFFERS = 86 +ALLOWED = {'A', 'restore', 'helper_final', 'compensation', 'report', 'cleanup'} + + +def hyperplane(normal): + """Canonical basis of the rank-8 hyperplane E_n of F_2^9 with the given nonzero normal.""" + pm.require(0 < normal < 512, 'nonzero nine-bit normal') + return list(pm.basis([x for x in range(1, 512) if (x & normal).bit_count() % 2 == 0])) + + +def refit(word, transform): + """Apply only the declared literal old-frame to new-frame substitutions (PR2917's rule).""" + x = copy.deepcopy(word) + seen = set() + for edit in transform.get('frame_changes', []): + section, index = edit['section'], edit['parent_index'] + pm.require(section in ('A', 'restore') and index >= 0 and + (section != 'A' or index >= x['prelude_events']) and + (section, index) not in seen, 'unique declared non-prelude frame edit') + seen.add((section, index)) + gate = x[section][index] + pm.require(gate[:-1] == edit['gate'] and gate[-1] == edit['old_frame'], + 'exact frame edit preimage') + pm.require(gate[0] in ('add', 'scale') and not 112 <= gate[1] < 224 and + list(pm.basis(edit['new_frame'])) == edit['new_frame'], 'canonical nontarget frame') + gate[-1] = list(edit['new_frame']) + return x + + +def apply_stage(word, transform): + h = transform['helper'] + before, after = transform['before'], transform['after'] + pm.require(h in HELPERS and str(h) not in word['helper_final'], 'fresh declared helper') + pm.require(str(h) not in word['start_extra'], 'zero entrance') + protected = set(map(int, word['helper_final'])) | set(map(int, word['start_extra'])) + protected |= {c['source'] for c in word['initial_corrections']} + for g in before: + pm.require(g[0] in ('add', 'scale') and g[-1] == [], 'scalar zero-frame input change') + roles = g[1:3] if g[0] == 'add' else g[1:2] + pm.require(all(224 <= r < 704 and r not in protected and r not in word['removed'] + for r in roles), 'unprotected live helpers only') + frame = list(pm.basis(after[0][-1])) + pm.require(transform['normal'] == NORMAL and frame == hyperplane(NORMAL) == FRAME, 'declared hyperplane E_45') + pm.require(len(frame) == 8 and all(g[0] in ('add', 'scale') and g[-1] == frame + for g in after), 'common terminal hyperplane') + x = refit(word, transform) + n = x['prelude_events'] + x['A'] = x['A'][:n] + copy.deepcopy(before) + x['A'][n:] + x['restore'] += copy.deepcopy(after) + x['helper_final'][str(h)] = frame + C = collections.defaultdict(dict) + for g in x['compensation']: + C[g[2]][g[1]] = C[g[2]].get(g[1], Q(0)) + Q(g[3], g[4]) + # Right multiplication C*S uses the reverse order of the literal input gates. + for g in reversed(before): + if g[0] == 'scale': + C[g[1]] = {t: a * Q(g[2], g[3]) for t, a in C[g[1]].items()} + else: + t, s = g[1:3] + for target, a in C[t].items(): + C[s][target] = C[s].get(target, Q(0)) + Q(g[3], g[4]) * a + x['compensation'] = [['add', t, r, a.numerator, a.denominator, []] + for r, col in sorted(C.items()) for t, a in sorted(col.items()) if a] + pm.require(not any(g[2] == h for g in x['compensation']), 'new cold column has no compensation') + profile, inventory = pm.frame_report(x) + x['report']['local_profile'], x['report']['width_inventory'] = profile, inventory + z = copy.deepcopy(x) + z['A'] = z['A'][n:] + x['cleanup'] = pm.derive_cleanup(z, set(map(int, x['helper_final']))) + pm.require({k for k in word if word[k] != x[k]} == ALLOWED, 'exact changed sections') + return x + + +def apply(word, transforms): + pm.require(tuple(t['helper'] for t in transforms) == HELPERS, 'declared composition order') + pm.require([t.get('step') for t in transforms] == [1, 2, 3, 4], 'declared step numbers') + pm.require(len(word['helper_final']) == PARENT_BUFFERS, 'PR2917 cold endpoint count') + pm.require(word['report']['local_profile'] == PARENT_PROFILE and + word['report']['width_inventory'] == PARENT_INVENTORY, 'PR2917 local profile and inventory') + x = word + for transform in transforms: + x = apply_stage(x, transform) + pm.require(all(x['helper_final'].get(r) == U for r, U in word['helper_final'].items()), 'inherited endpoints retained') + pm.require(len(x['helper_final']) == BUFFERS, 'all four added buffers charged') + pm.require(x['report']['local_profile'] == PROFILE and + x['report']['width_inventory'] == INVENTORY, 'complete local profile and inventory') + return x diff --git a/research/paired-extension-normal45/reproduce.py b/research/paired-extension-normal45/reproduce.py new file mode 100644 index 0000000000..f0b3925341 --- /dev/null +++ b/research/paired-extension-normal45/reproduce.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Exact Git exports, PR2917's declared source stages, the normal-45 extraction overlay, fresh native chains and +complete admission of PR2917's words plus four paired extractions at normal 45 with a new literal T74 allocation. + +The recipe is PR2917's reproduce.py (Mason Hale; PR2908 stage/native/release mechanisms of Jeremy Diviney and the +credited upstream lineage) as generalized by PR2930, with three further changes: (1) after PR2917's +paired-extension stage, tools/build_overlay.py appends the stage 'normal45-paired-extractions' to PR2917's derived +source: the exact edit spec PR2917 word -> this package's word (tools/wordedit.py, cleanup re-derived), replayed +by the source's own rebuild chain, so every previous state stays in the audit chain; (2) the closed adapters are +derived for 86 private buffers with the PR2917 and PR2930 headlines as comparators (tools/derive_adapters.py); +(3) the admission uses this package's allocation/ and compares against PR2930, whose package is itself exported +from its exact commit. No network fetch is performed: the five commits below must be present in --repo (see +README). Fresh retained bootstrap is the default; --retained explicitly reuses a completely authenticated cache. +Marius-Paul Dumitrean, with substantial AI assistance (Claude Code). +""" +import argparse, hashlib, io, json, os, shutil, subprocess, sys, tarfile, time +from fractions import Fraction as Q +from pathlib import Path, PurePosixPath + +P = Path(__file__).resolve().parent +PR2908 = ('51309592971e3b5be935599eed2a95404dc7781e', 'research/two-sided-helper-extraction', + '9dba3fe371602ec023a54e26c0fd66f69eb7a74be86aab89923529083c14b36f') +PR2917 = ('224bd5e56041c40078ff6b5fa7393733a215de5c', 'research/paired-helper-extension', + '55c46ddf2e3edc87dfe1ba3320947466d36980d457eb37f6cd6fba341dae0192') +PR2930 = ('81f3b5d12977eba09e06fbff729167d59faabe90', 'research/paired-extension-cap-fill', + '0380ef12f271dbd3cb3ecd274ada74a303512a066be55169219ffee3ab990765') +PR2917_SOURCE = '98d57c82a1c7318be3c330c3b66897844d57232f0aaeaea88fb4bebd0a1bedf1' # PR2917 derived source, 632 files +# PR2917's derived source plus the stage normal45-paired-extractions (637 files), deterministic from this package +OVERLAY_SOURCE = '79956f19c5c3d4d1ad3578e4b3d6844bc54c1f3680825fc87c80cc04f069dae8' +STAGE, PROFILE, COMMIT = 'normal45-paired-extractions', 'paired-extension-normal45', 'normal45-paired-extractions-pr2917' + +def sha(p): + return hashlib.sha256(p.read_bytes()).hexdigest() + +def read(p): + return json.loads(p.read_bytes()) + +def save(p, value): + p.write_text(json.dumps(value, indent=2, sort_keys=True) + '\n') + +def tree(p): + assert not any(f.is_symlink() for f in p.rglob('*')) + return {f.relative_to(p).as_posix(): sha(f) for f in p.rglob('*') if f.is_file() and f != p / 'MANIFEST.json'} + +def export(repo, head, package, manifest, out): + prefix = PurePosixPath(package) + raw = subprocess.run(['git', '-C', str(repo), 'archive', '--format=tar', head, str(prefix)], + check=True, capture_output=True).stdout + out.mkdir() + with tarfile.open(fileobj=io.BytesIO(raw), mode='r:') as archive: + for member in archive.getmembers(): + path = PurePosixPath(member.name) + assert not path.is_absolute() and '..' not in path.parts and '\\' not in member.name + if member.isdir() and (path == prefix or path in prefix.parents): + continue + assert path.is_relative_to(prefix) and (member.isfile() or member.isdir()) + dest = out / path.relative_to(prefix) + if member.isdir(): + dest.mkdir(parents=True, exist_ok=True) + else: + dest.parent.mkdir(parents=True, exist_ok=True) + dest.write_bytes(archive.extractfile(member).read()) + assert sha(out / 'MANIFEST.json') == manifest, 'exact exported package manifest ' + package + assert tree(out) == read(out / 'MANIFEST.json'), 'complete exported inventory ' + package + +def main(): + ap = argparse.ArgumentParser(description=__doc__) + for name in ('repo', 'work'): + ap.add_argument('--' + name, type=Path, required=True) + ap.add_argument('--retained', type=Path) + ap.add_argument('--jobs', type=int, default=1, choices=(1, 2, 3)) + ap.add_argument('--dry-run', action='store_true') + args = ap.parse_args() + if not __debug__: + raise SystemExit('refusing python -O: the inherited validators rely on assertions') + work, repo = args.work.resolve(), args.repo.resolve() + assert not work.exists() and not work.is_relative_to(P) and not P.is_relative_to(work) + pins = read(P / 'MANIFEST.json') + assert tree(P) == pins, 'complete public package inventory' + work.mkdir(parents=True) + parent, extension, capfill = work / 'pr2908', work / 'pr2917', work / 'pr2930' + export(repo, *PR2908, parent) + export(repo, *PR2917, extension) + export(repo, *PR2930, capfill) + for tag in ('base', 'extra'): + assert sha(P / f'data/PARENT-{tag}.json.gz') == sha(extension / f'data/WORD-{tag}.json.gz'), 'parents are PR2917s words' + assert sha(P / 'allocation/baseline/CLAIM.json') == sha(capfill / 'CLAIM.json'), 'comparator is PR2930s headline' + words = work / 'candidate-words' + words.mkdir() + for tag in ('base', 'extra'): + shutil.copy2(P / f'data/WORD-{tag}.json.gz', words / f'WORD-{tag}.json.gz') + upstream = work / 'parent-export/pr2894' + core = upstream / 'vendor/pr2857' + source = work / 'pr2833' + four, preload, channel, final, overlay = [work / n for n in ('source4', 'source-pm', 'source2908', 'source', 'source-normal45')] + native, candidate, adapters = [work / n for n in ('native', 'candidate', 'adapters')] + retained = args.retained.resolve() if args.retained else work / 'retained' + if args.retained: + assert not retained.is_relative_to(work) and not work.is_relative_to(retained) + py = [sys.executable, '-B'] + recipe = [ + ('export-pr2894', py + [parent / 'reproduce.py', '--repo', repo, '--work', work / 'parent-export', '--dry-run']), + ('export-pr2833', py + [upstream / 'tools/materialize_source.py', '--repo', repo, '--out', source]), + ] + if not args.retained: + recipe.append(('fresh-retained-bootstrap', py + [upstream / 'tools/prepare_retained.py', '--source', source, '--out', retained, '--jobs', '1'])) + recipe += [ + ('four-kernel-stage', py + [core / 'build_overlay.py', '--source', source, '--generator', core / 'shared_kernel.py', '--review', core / 'review_four_groups.py', '--candidate-dir', core / 'words', '--out', four]), + ('preload-stage', py + [upstream / 'vendor/pm/build_pm_overlay.py', '--overlay', four, '--pm-dir', upstream / 'vendor/pm', '--out', preload]), + ('parent-paired-stage', py + [parent / 'tools/build_channel_overlay.py', '--source', preload, '--local-package', parent, '--out', channel]), + ('paired-extension-stage', py + [extension / 'tools/build_extension.py', '--source', channel, '--local-package', extension, '--out', final]), + ('normal45-overlay-stage', py + [P / 'tools/build_overlay.py', '--source', final, '--candidate-dir', words, '--out', overlay, '--stage-name', STAGE]), + ('derive-closed-adapters', py + [P / 'tools/derive_adapters.py', '--parent-package', parent, '--source', overlay, '--retained-receipt', retained / 'NATIVE-RECEIPT.json', '--out', adapters, + '--buffers', '86', '--source-commit', COMMIT, '--source-profile', PROFILE, '--upstream-head', PR2917[0], + '--comparison', 'pr2917=' + str(extension / 'CLAIM.json'), '--comparison', 'pr2930=' + str(capfill / 'CLAIM.json')]), + ('fresh-current-native', py + [adapters / 'prepare_extension_native.py', '--source', overlay, '--retained-cache', retained / 'native-cache', '--retained-receipt', retained / 'NATIVE-RECEIPT.json', '--out', native, '--jobs', str(min(2, args.jobs))]), + ('complete-admission', py + [adapters / 'admit_extension.py', '--source', overlay, '--fill', P / 'allocation/FILL.json.gz', '--order', P / 'allocation/ORDER.json', '--dispatch', P / 'allocation/DISPATCH.json', + '--native-cache', native / 'native-cache', '--native-receipt', native / 'NATIVE-RECEIPT.json', '--work', candidate, '--replica-helper-dir', core / 'vendor/pr2839', + '--reconstructor', core / 'vendor/pr2839/reconstruct_replica.py', '--blocknorm-checker', adapters / 'extension_blocknorm.py', + '--comparison-claim', capfill / 'CLAIM.json', '--source-profile', PROFILE, '--comparison-profile', 'pr2930', '--jobs', str(args.jobs)]), + ] + if args.dry_run: + save(work / 'PREFLIGHT.json', {'status': 'EXACT_EXPORTS_AND_RECIPE_ONLY_NOT_A_REPLAY', 'commands': [[n, list(map(str, c))] for n, c in recipe]}) + print('PASS_PINNED_PR2908_PR2917_PR2930_EXPORT_RECIPE_ONLY') + return + env = dict(os.environ, PYTHONDONTWRITEBYTECODE='1', PYTHONPYCACHEPREFIX=str(work / 'bytecode'), + OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1', PYTHONINTMAXSTRDIGITS='0') + for name in ('PYTHONOPTIMIZE', 'PYTHONPATH', 'WITNESS_SPEC', 'WITNESS_RECORD', 'WITNESS_DISCOVER'): + env.pop(name, None) + stages = [] + for name, command in recipe: + if name == 'normal45-overlay-stage': + assert sha(final / 'MANIFEST.json') == PR2917_SOURCE, 'derived source equals PR2917s' + log, start = work / (name + '.log'), time.monotonic() + with log.open('w') as stream: + result = subprocess.run(list(map(str, command)), env=env, cwd=work, stdin=subprocess.DEVNULL, + stdout=stream, stderr=subprocess.STDOUT) + stages.append({'stage': name, 'exit_code': result.returncode, 'seconds': time.monotonic() - start, 'log_sha256': sha(log)}) + save(work / 'STAGES.json', stages) + assert result.returncode == 0, 'failed ' + name + '; see ' + str(log) + if name == 'normal45-overlay-stage': + derivation = read(work / 'source-normal45-DERIVATION.json') + assert derivation['stage'] == STAGE and derivation['buffers'] == 86 and derivation['upstream_manifest_sha256'] == PR2917_SOURCE + assert sha(overlay / 'MANIFEST.json') == derivation['derived_manifest_sha256'] == OVERLAY_SOURCE, 'derived normal-45 overlay' + print('PASS', name, flush=True) + admission = read(candidate / 'RESULT.json') + receipt = read(candidate / 'release/RELEASE-RECEIPT.json') + claim = read(P / 'CLAIM.json') + assert admission['status'] == 'PASS_REPLICA_ORDER_FILL_DERIVATIVE_COMPLETE_RELEASE' + assert receipt['status'] == 'PASS_RELEASE' + assert Q(admission['kappa']) == Q(receipt['kappa_decimal']) == Q(claim['kappa']) + assert Q(admission['comparison_kappa']) == Q(read(capfill / 'CLAIM.json')['kappa']) == Q(claim['baseline_kappa']) < Q(admission['kappa']) + assert admission['release_receipt_sha256'] == sha(candidate / 'release/RELEASE-RECEIPT.json') + assert admission['package_manifest_sha256'] == receipt['manifest_sha256'] + assert admission['source_manifest_sha256'] == OVERLAY_SOURCE + assert admission['fill_sha256'] == sha(P / 'allocation/FILL.json.gz') + assert tree(P) == pins and all(tree(x) == read(x / 'MANIFEST.json') for x in (parent, extension, capfill)) + save(work / 'RESULT.json', {'status': 'PASS_NORMAL45_COMPLETE_REPLAY', 'kappa': admission['kappa'], 'gain': admission['gain'], + 'comparison_pr': 2930, 'pr2917_source_manifest_sha256': sha(final / 'MANIFEST.json'), + 'source_manifest_sha256': sha(overlay / 'MANIFEST.json'), + 'native_receipt_sha256': sha(native / 'NATIVE-RECEIPT.json'), + 'admission_result_sha256': sha(candidate / 'RESULT.json'), + 'explicit_retained_reuse': bool(args.retained), 'fresh_retained_bootstrap': not bool(args.retained), + 'stages': stages, 'scope': 'Conditional finite supplier/outer result; inherited all-size theorem obligations remain.'}) + print('PASS_NORMAL45_COMPLETE_REPLAY', admission['kappa'], flush=True) + +if __name__ == '__main__': + main() diff --git a/research/paired-extension-normal45/run_registered.py b/research/paired-extension-normal45/run_registered.py new file mode 100644 index 0000000000..1e9e973df2 --- /dev/null +++ b/research/paired-extension-normal45/run_registered.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Bounded registered check: package pins; the exact local replay of the four normal-45 paired extractions +(verify.py); literal owners, private stock, controls and exact moment (check_allocation.py); the Fractions-only +cap certificate and the literal gap (check_cap.py); and binding of the stored complete native/admission/release +receipts to the exact words, overlay, allocation and claim. It does not rerun the native or integrated outer +replay (reproduce.py does). Structure adapted from Mason Hale's PR2917 run_registered.py. Marius-Paul Dumitrean, +with substantial AI assistance (Claude Code). +""" +import hashlib, json, os, subprocess, sys, tempfile +from fractions import Fraction as Q +from pathlib import Path + +P = Path(__file__).resolve().parent +PR2930_HEAD = '81f3b5d12977eba09e06fbff729167d59faabe90' +PR2917_DERIVED_SOURCE = '98d57c82a1c7318be3c330c3b66897844d57232f0aaeaea88fb4bebd0a1bedf1' +STAGE = 'normal45-paired-extractions' + +def read(p): + return json.loads(p.read_bytes()) + +def sha(p): + return hashlib.sha256(p.read_bytes()).hexdigest() + +def tree(): + assert not any(f.is_symlink() for f in P.rglob('*')) + return {f.relative_to(P).as_posix(): sha(f) for f in P.rglob('*') if f.is_file() and f != P / 'MANIFEST.json'} + +def main(): + if not __debug__: + raise SystemExit('refusing python -O: this check relies on assertions') + pins = read(P / 'MANIFEST.json') + assert tree() == pins, 'complete package inventory' + with tempfile.TemporaryDirectory(prefix='normal45-replay-') as tmp: + out = Path(tmp) + env = dict(os.environ, PYTHONDONTWRITEBYTECODE='1', OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') + for key in ('PYTHONOPTIMIZE', 'PYTHONPATH', 'WITNESS_SPEC', 'WITNESS_RECORD', 'WITNESS_DISCOVER'): + env.pop(key, None) + for script, name in [('verify.py', 'local'), ('check_allocation.py', 'owners')]: + log = out / (name + '.log') + with log.open('w') as stream: + r = subprocess.run([sys.executable, '-B', str(P / script), '--work', str(out / name)], + env=env, stdin=subprocess.DEVNULL, stdout=stream, stderr=subprocess.STDOUT) + if r.returncode: + print(log.read_text()[-8000:]); raise SystemExit(r.returncode) + print('PASS', script, log.read_text().strip().splitlines()[-1][:160], flush=True) + r = subprocess.run([sys.executable, '-B', str(P / 'check_cap.py')], env=env, stdin=subprocess.DEVNULL, + capture_output=True, text=True) + if r.returncode: + print(r.stdout[-4000:], r.stderr[-4000:]); raise SystemExit(r.returncode) + cap = json.loads(r.stdout.strip().splitlines()[-1]) + print('PASS check_cap.py', cap['status'], 'gap', cap['gap_float'], flush=True) + local = read(out / 'local/RESULT.json') + owner = read(out / 'owners/RESULT.json') + claim = read(P / 'CLAIM.json') + admit = read(P / 'evidence/ADMISSION-RESULT.json') + release = read(P / 'evidence/RELEASE-RECEIPT.json') + native = read(P / 'evidence/FULL-NATIVE-RECEIPT.json') + overlay = read(P / 'evidence/OVERLAY-DERIVATION.json') + adapters = read(P / 'evidence/ADAPTER-DERIVATION.json') + replay = read(P / 'evidence/FULL-REPLAY-RESULT.json') + baseline = read(P / 'allocation/baseline/CLAIM.json') + assert claim['status'] == 'CONDITIONAL_CANDIDATE_COMPLETE_FINITE_RELEASE' + assert local['status'] == 'PASS_FOUR_NORMAL45_PAIRED_EXTRACTIONS' and len(local['semantic_controls']) == 40 + assert owner['status'] == 'PASS_NORMAL45_LITERAL_OWNERS_AND_EXACT_MOMENT' and len(owner['controls']) == 5 + assert cap['status'] == 'PASS_LITERAL_ALLOCATION_BELOW_FIXED_INVENTORY_CAP_WITH_RECORDED_GAP' + assert admit['status'] == 'PASS_REPLICA_ORDER_FILL_DERIVATIVE_COMPLETE_RELEASE' + assert release['status'] == 'PASS_RELEASE' and replay['status'] == 'PASS_NORMAL45_COMPLETE_REPLAY' + k = Q(claim['kappa']) + assert Q(owner['moment']['target']) == k == Q(admit['kappa']) == Q(release['kappa_decimal']) == Q(replay['kappa']) + assert Q(claim['complex_lower']) == Q(admit['complex_lower']) <= Q(cap['literal_lower']) + assert k == Q(claim['complex_lower']) - Q(1, 10 ** 46) - Q(1, 10 ** 70) + assert Q(cap['cap_lower']) == Q(claim['fixed_inventory_cap']['cap_lower']) and Q(cap['gap_lower']) > 0 + assert owner['profile'] == claim['profile'] == admit['profile'] == cap['profile'] + assert owner['physical'] == claim['physical_families'] == 66808 and claim['zero_buffers'] == 86 + assert release['manifest_sha256'] == admit['package_manifest_sha256'] == claim['admitted_package_manifest_sha256'] + assert native['status'] == 'PASS_COMPOSED_FRESH_NATIVE_PROVIDERS_AND_AUTHENTICATED_CACHE' + assert native['fresh_current_provider_count'] == 2 and set(native['providers']) == {'base', 'extra'} + assert claim['release_receipt_sha256'] == admit['release_receipt_sha256'] == sha(P / 'evidence/RELEASE-RECEIPT.json') + assert claim['native_receipt_sha256'] == admit['native_receipt_sha256'] == sha(P / 'evidence/FULL-NATIVE-RECEIPT.json') + assert overlay['stage'] == STAGE and overlay['upstream_manifest_sha256'] == PR2917_DERIVED_SOURCE and overlay['buffers'] == 86 + assert claim['source_manifest_sha256'] == overlay['derived_manifest_sha256'] == native['manifest_sha256'] == admit['source_manifest_sha256'] == adapters['source_manifest_sha256'] + assert adapters['buffer_count'] == 86 and 'pr2930' in adapters['comparisons'] + assert admit['comparison_pr'] == 2930 and admit['comparison_head'] == PR2930_HEAD == claim['baseline_head'] + assert admit['comparison_claim_sha256'] == sha(P / 'allocation/baseline/CLAIM.json') + assert Q(claim['baseline_kappa']) == Q(admit['comparison_kappa']) == Q(baseline['kappa']) == Q(owner['moment']['previous']) + assert Q(claim['gain']) == Q(admit['gain']) == k - Q(baseline['kappa']) > 0 + for tag in ('base', 'extra'): + word = sha(P / f'data/WORD-{tag}.json.gz') + assert native['providers'][tag]['word_sha256'] == word == overlay['words'][tag]['candidate_word_sha256'] + assert overlay['words'][tag]['source_word_sha256'] == sha(P / f'data/PARENT-{tag}.json.gz') + assert admit['fill_sha256'] == sha(P / 'allocation/FILL.json.gz') == claim['fill_sha256'] + assert admit['order_sha256'] == sha(P / 'allocation/ORDER.json') + assert admit['dispatch_sha256'] == sha(P / 'allocation/DISPATCH.json') + assert tree() == pins + print('PASS_NORMAL45_LOCAL_OWNER_MOMENT_CAP_AND_STORED_RELEASE', claim['kappa_decimal'][:40], 'gain', float(Q(claim['gain']))) + print('Native and full integrated admission are authenticated stored evidence here; reproduce.py reruns them.') + +if __name__ == '__main__': + main() diff --git a/research/paired-extension-normal45/structure.py b/research/paired-extension-normal45/structure.py new file mode 100644 index 0000000000..8d5bd544ee --- /dev/null +++ b/research/paired-extension-normal45/structure.py @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Exact two-sided subspace certificate, independent of the word producer.""" +from collections import defaultdict +from fractions import Fraction as Q + +def check(parent,transform,aud): + h=transform['helper'];live=sorted(set(range(704))-set(parent['removed'])-set(range(112,224))) + S={r:{r:Q(1)} for r in live};T={r:{r:Q(1)} for r in live} + for g in transform['before']:aud.apply(g,S) + for g in transform['after']:aud.apply(g,T) + v={r:row[h] for r,row in S.items() if h in row};alpha=T[h] + J={r:{r:Q(1)} for r in live} + for g in reversed(transform['after']):aud.apply(aud.invert(g),J) + y={r:row[h] for r,row in J.items() if h in row} + M={r:{(r,()):Q(1)} for r in live};program=list(parent['A'][parent['prelude_events']:]);bypos=defaultdict(list) + for op,rec in enumerate(parent['warps'],1):bypos[rec[0]].append(['warp',rec[1],op]) + for p in range(len(parent['B'])+1): + program+=bypos[p] + if p=224 and r not in protected} + assert set(v)<=H and all(r in H and not ops for r,ops in u) + u={r:c for (r,ops),c in u.items()} + for r,row in M.items(): + mv=defaultdict(Q) + for (c,ops),a in row.items():mv[ops]+=a*v.get(c,Q(0)) + assert {ops:a for ops,a in mv.items() if a}==({():y[r]} if r in y else {}) + assert sum(alpha.get(r,Q(0))*c for r,c in y.items())==1 + us=defaultdict(Q) + for r,a in u.items(): + for c,b in S[r].items():us[c]+=a*b + assert {r:c for r,c in us.items() if c}=={h:Q(1)} + assert all(sum(row.get(c,Q(0))*a for c,a in y.items())==(1 if r==h else 0) for r,row in T.items()) + return {'status':'PASS_EXACT_TWO_SIDED_SUBSPACE_CERTIFICATE','helper':h,'v':{str(r):str(c) for r,c in v.items()},'u':{str(r):str(c) for r,c in u.items()},'alpha':{str(r):str(c) for r,c in alpha.items()},'y':{str(r):str(c) for r,c in y.items()},'identities':['S e_h = v','u S = e_h^T','M v = y','alpha M = u','alpha y = 1','T y = e_h','e_h^T T = alpha'],'scope':'Exact free-operator identities before target writes; full target correctness checked separately.'} diff --git a/research/paired-extension-normal45/tools/audit_allocation_moment.py b/research/paired-extension-normal45/tools/audit_allocation_moment.py new file mode 100644 index 0000000000..6341b42094 --- /dev/null +++ b/research/paired-extension-normal45/tools/audit_allocation_moment.py @@ -0,0 +1,83 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Independent dyadic interval moment auditor, atlas D020. +Retained PR2908 arithmetic by Jeremy Diviney and its credited upstream authors; +Mason Hale with OpenAI Codex assistance changes only the authenticated baseline. +Marius-Paul Dumitrean (Claude Code assisted) changes only the authenticated baseline, to the PR2917 headline (PR2930) +and here to the PR2930 headline. +Uses only Python integers/Fraction; imports no inherited numerical implementation. +This authenticates a paid histogram and its root, not a physical realization. +""" +from fractions import Fraction as F +from pathlib import Path +from functools import lru_cache +from collections import Counter +import argparse,json,hashlib + +BITS=192 +SCALE=1<=1,'log domain');k=0 + while q>2:q/=2;k+=1 + def unit(y): + z=(y-1)/(y+1);z2=z*z;term=z;value=F(0) + for j in range(128): + value+=term/(2*j+1);term*=z2 + remainder=2*term/(257*(1-z2)) + return 2*value,2*value+remainder + l,u=unit(q);l2,u2=unit(F(2));return down(l+k*l2),up(u+k*u2) +def exp_bounds(y): + need(0<=y0,'profile domain');l,u=log_bounds(F(73,rank));a=exp_bounds(b*l)[0];z=exp_bounds(b*u)[1];weight=F(rank*count,73*W);lo+=weight*a;hi+=weight*z + return down(lo),up(hi) +def run(candidate,source): + import sys + if hasattr(sys,'set_int_max_str_digits'):sys.set_int_max_str_digits(0) + need(hashlib.sha256((source/'CLAIM.json').read_bytes()).hexdigest()=='9c2c14158780a677b3661623d7476acc4f535ac9e0481addfa1d6c4c7633b74b','exact pinned PR2930 full headline') + prof={int(k):v for k,v in json.loads((candidate/'PROFILE.json').read_bytes()).items()} + old={int(k):v for k,v in json.loads((source/'PROFILE.json').read_bytes()).items()} + W=896*(1+max(r for s,r in json.loads((candidate/'ORDER.json').read_bytes()))) + oldW=896*(1+max(r for s,r in json.loads((source/'ORDER.json').read_bytes()))) + need(sum(r*n for r,n in prof.items())==W*73-W*320//896,'new rank mass') + need(sum(r*n for r,n in old.items())==oldW*73-oldW*320//896,'old rank mass') + # No floating endpoint or inherited numerical implementation is used. + q=10**26;lo=0;hi=q//200 + need(moment(prof,F(lo,q),W)[1]<1 and moment(prof,F(hi,q),W)[0]>1,'global root bracket') + while hi-lo>1: + mid=(lo+hi)//2;l,u=moment(prof,F(mid,q),W) + if u<1:lo=mid + elif l>1:hi=mid + else:raise ValueError('interval precision insufficient') + endpoint=F((lo//100),10**24) + target=endpoint-F(1,10**46)-F(1,10**70) + prior=F(json.loads((source/'CLAIM.json').read_bytes())['kappa']) + need(target>prior and target1,'overstated endpoint rejected') + wrong=dict(prof);wrong[32]=wrong.get(32,0)+1 + need(moment(wrong,F(lo,q),W)[0]>1,'omitted rank charge rejected') + import decimal + with decimal.localcontext() as c: + c.prec=80 + todec=lambda x:str(decimal.Decimal(x.numerator)/decimal.Decimal(x.denominator)) + texttarget=todec(target);textgain=todec(target-prior) + return dict(status='PASS_SEPARATE_EXACT_RATIONAL_FRONTIER_MOMENT',lower=str(F(lo,q)),upper=str(F(hi,q)),outer_endpoint=str(endpoint),target=str(target),target_decimal=texttarget,previous=str(prior),gain=str(target-prior),gain_decimal=textgain,W=W,oldW=oldW,normalized_profile_delta=normalized_delta,new_moment_at_full_prior=[str(x)for x in at_old],profile_sha256=hashlib.sha256((candidate/'PROFILE.json').read_bytes()).hexdigest(),baseline_profile_sha256=hashlib.sha256((source/'PROFILE.json').read_bytes()).hexdigest(),baseline_claim_sha256=hashlib.sha256((source/'CLAIM.json').read_bytes()).hexdigest(),method='Independent 128-term atanh / degree24 exponential with explicit positive tails and outward 192-bit dyadic rounding',controls=['zero log/exp identities','overstated endpoint','added rank32 charge'],scope='Complete paid histogram and exact moment only; full native/physical/outer release is separate.') +if __name__=='__main__': + p=argparse.ArgumentParser();p.add_argument('--candidate',type=Path,required=True);p.add_argument('--source',type=Path,required=True);p.add_argument('--out',type=Path,required=True);a=p.parse_args() + need(not a.out.exists(),'fresh output required');d=run(a.candidate,a.source);a.out.write_text(json.dumps(d,sort_keys=True,indent=2)+'\n',encoding='utf-8',newline='\n');print(json.dumps({k:d[k]for k in ['status','target_decimal','gain_decimal','lower','upper']})) diff --git a/research/paired-extension-normal45/tools/build_overlay.py b/research/paired-extension-normal45/tools/build_overlay.py new file mode 100644 index 0000000000..6414fe737c --- /dev/null +++ b/research/paired-extension-normal45/tools/build_overlay.py @@ -0,0 +1,106 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Build a source-bound overlay for a literal word edit on top of PR2917's derived source (manifest 98d57c82..., 632 files). +Stage '' (default normal45-paired-extractions): new/borrow/inputs/wordedit_43{base,extra}.json (exact spec) applied by +new/borrow/wordedit.py (pure producer, re-derives cleanup from helper_final). The shipped words must equal apply_spec(previous, spec) +exactly. Allowed changed sections: A, B, restore, compensation, start_extra, report, cleanup, initial_corrections, helper_final (new +restored endpoints = extra private buffers; inherited endpoints must be retained); removed and the warp count are fixed (408 live helpers). +Overlay/rebuild conventions follow Jeremy Diviney's PR2908 builder and Mason Hale's PR2917 build_extension.py. Marius-Paul Dumitrean, +with substantial AI assistance (Claude Code). +Usage: build_overlay.py --source PR2917_DERIVED_SOURCE --candidate-dir DIR_WITH_WORD-{base,extra}.json.gz --out OUT [--stage-name NAME] +""" +import sys +sys.dont_write_bytecode = True +from pathlib import Path +from collections import Counter +import argparse, gzip, hashlib, json, shutil, types +UPSTREAM_MANIFEST = '98d57c82a1c7318be3c330c3b66897844d57232f0aaeaea88fb4bebd0a1bedf1' # PR2917 derived overlay (632 files) +UPSTREAM_FILES = 632 +ALLOWED = {'A', 'B', 'restore', 'compensation', 'start_extra', 'report', 'cleanup', 'initial_corrections', 'helper_final'} +def need(ok, why): + if not ok: raise ValueError(why) +def sha(p): return hashlib.sha256(Path(p).read_bytes()).hexdigest() +def sem(v): return hashlib.sha256(json.dumps(v, sort_keys=True, separators=(',', ':')).encode()).hexdigest() +def read(p): + p = Path(p); b = p.read_bytes(); return json.loads(gzip.decompress(b) if p.suffix == '.gz' else b) +def write(p, v): p.write_text(json.dumps(v, sort_keys=True, indent=2) + '\n') +def tree(p): + need(not list(p.rglob('__pycache__')) and not list(p.rglob('*.pyc')), 'no source bytecode or cache folders') + out = {} + for f in sorted(p.rglob('*')): + need(not f.is_symlink(), 'no source symlinks') + if f.is_file() and f != p / 'MANIFEST.json': out[f.relative_to(p).as_posix()] = sha(f) + return out +def find_word(d, tag): + c = [p for p in sorted(Path(d).glob('*.json.gz')) if p.name.endswith('-' + tag + '.json.gz') or p.name == f'WORD-{tag}.json.gz'] + need(len(c) == 1, f'exactly one candidate word for {tag} in {d}: {c}'); return c[0] +def main(): + ap = argparse.ArgumentParser(); ap.add_argument('--source', type=Path, required=True); ap.add_argument('--candidate-dir', type=Path, required=True) + ap.add_argument('--out', type=Path, required=True); ap.add_argument('--producer', type=Path, default=Path(__file__).resolve().parent / 'wordedit.py') + ap.add_argument('--stage-name', default='normal45-paired-extractions'); a = ap.parse_args() + need(not sys.flags.optimize, 'assertions required'); source = a.source.resolve(); out = a.out.resolve() + need(sha(source / 'MANIFEST.json') == UPSTREAM_MANIFEST and tree(source) == read(source / 'MANIFEST.json') and len(read(source / 'MANIFEST.json')) == UPSTREAM_FILES, 'exact PR2917 derived overlay inventory') + need(not out.exists() and not out.is_relative_to(source), 'fresh external overlay'); shutil.copytree(source, out) + # producer module inside the overlay: plain import of word_patch from its own directory (new/borrow); no scratchpad paths + prod = a.producer.read_text() + head, sep, tail = prod.partition('try:\n import word_patch as WP') + need(sep, 'producer import block'); tail = tail.split(' import word_patch as WP\n', 1)[1] + prod = head + 'import word_patch as WP # PR2833 helpers (derive_cleanup), found next to this file inside the overlay\n' + tail + need('/scratchpad/' not in prod and 'import word_patch as WP' in prod, 'producer path relocation'); compile(prod, 'wordedit.py', 'exec') + (out / 'new/borrow/wordedit.py').write_text(prod); PRODUCER_SHA = sha(out / 'new/borrow/wordedit.py') + sys.path.insert(0, str(out / 'new/borrow')) + gen = types.ModuleType('wordedit'); gen.__file__ = str(out / 'new/borrow/wordedit.py'); exec(compile(prod, str(out / 'new/borrow/wordedit.py'), 'exec'), gen.__dict__) + providers = read(source / 'new/BORROW-PROVIDERS.json'); records = {}; buffers = set() + for tag, pid in [('base', 'gauge44'), ('extra', 'extra')]: + src = source / ('new/borrow/words/BORROW-WORD-43' + tag + '.json.gz'); target = find_word(a.candidate_dir, tag); old = read(src); new = read(target) + need(old != new, 'candidate word differs from the PR2917 word ' + tag) + spec = gen.make_spec(old, new); derived = gen.apply_spec(old, spec) + need(derived == new, 'complete producer reconstruction ' + tag) + changed = set(k for k in old if old[k] != new[k]); need(changed <= ALLOWED, 'exact changed sections ' + str(changed)) + need(new['removed'] == old['removed'] and len(new['warps']) == len(old['warps']), 'removed set and warp count unchanged') + need(all(new['helper_final'].get(h) == U for h, U in old['helper_final'].items()), 'all inherited restored endpoints retained') + need(new['cleanup'] == gen.derive_cleanup(new), 'cleanup is the derived inverse of the word with buffers for every endpoint') + live = sorted(set(range(224, 704)) - set(new['removed'])); need(len(live) == 408, 'unchanged helper identities') + widths = [len(new['helper_final'].get(str(h), [0] * 9)) - len(new['start_extra'].get(str(h), [])) for h in live] + need({str(k): v for k, v in Counter(widths).items()} == new['report']['width_inventory'], 'report inventory equals derived widths') + buffers.add(len(new['helper_final'])) + providers[pid] = {'widths': widths, 'actual_paid_profile': new['report']['local_profile']} + shutil.copy2(target, out / ('new/borrow/words/BORROW-WORD-43' + tag + '.json.gz')) + shutil.copy2(src, out / ('new/borrow/inputs/PR2917-WORD-' + tag + '.json.gz')) + rec = dict(stage=a.stage_name, source_word_sha256=sha(src), source_canonical_sha256=sem(old), candidate_word_sha256=sha(target), candidate_canonical_sha256=sem(new), + producer_sha256=PRODUCER_SHA, changed_sections=sorted(changed), buffers=len(new['helper_final']), spec=spec) + write(out / ('new/borrow/inputs/wordedit_43' + tag + '.json'), rec); records[tag] = dict(rec, spec='(see file)') + need(len(buffers) == 1, 'both providers charge the same private buffer count'); B = buffers.pop() + write(out / 'new/BORROW-PROVIDERS.json', providers) + patches = [] + def patch(name, old, new): + p = out / name; before = sha(p); body = p.read_text(); need(body.count(old) == 1, 'exact overlay preimage ' + name); p.write_text(body.replace(old, new)) + patches.append(dict(path=name, before_sha256=before, after_sha256=sha(p), old=old, new=new)) + anchor = ' final=json.loads(gzip.decompress(shipped.read_bytes()))' + block = ''' # Recorded exact word edit (here: four normal-45 paired extractions); pure producer, cleanup re-derived from helper_final. Every previous state stays in the audit chain. + we_=D/'inputs'/f'wordedit_43{wt}.json' + if we_.exists(): + import wordedit + we_patch=json.loads(we_.read_text());previous_we=chain[-1] + canonical=lambda z:hashlib.sha256(json.dumps(z,sort_keys=True,separators=(',',':')).encode()).hexdigest() + assert canonical(previous_we)==we_patch['source_canonical_sha256'] + we_word=wordedit.apply_spec(previous_we,we_patch['spec']) + assert canonical(we_word)==we_patch['candidate_canonical_sha256'] + assert set(k_ for k_ in previous_we if previous_we[k_]!=we_word[k_])<={'A','B','restore','compensation','start_extra','report','cleanup','initial_corrections','helper_final'} + assert we_word['cleanup']==wordedit.derive_cleanup(we_word) + assert we_word['removed']==previous_we['removed'] and len(we_word['warps'])==len(previous_we['warps']) + assert all(we_word['helper_final'].get(h_)==U_ for h_,U_ in previous_we['helper_final'].items()) + assert len(we_word['helper_final'])==we_patch['buffers'] + chain.append(we_word);steps.append(we_patch['stage']) +''' + anchor + patch('new/rebuild_borrow.py', anchor, block) + # PR2917's and PR2908's independent reviews read their own data/ copies; the shared-kernel and preload-move reviews read inputs/ copies: no redirect needed. + before = read(source / 'MANIFEST.json'); after = tree(out); write(out / 'MANIFEST.json', after) + change = {p: dict(before_sha256=before.get(p), after_sha256=after.get(p)) for p in sorted(set(before) | set(after)) if before.get(p) != after.get(p)} + expected = {'new/borrow/words/BORROW-WORD-43base.json.gz', 'new/borrow/words/BORROW-WORD-43extra.json.gz', 'new/borrow/inputs/PR2917-WORD-base.json.gz', 'new/borrow/inputs/PR2917-WORD-extra.json.gz', + 'new/borrow/inputs/wordedit_43base.json', 'new/borrow/inputs/wordedit_43extra.json', 'new/borrow/wordedit.py', 'new/rebuild_borrow.py'} + optional = {'new/BORROW-PROVIDERS.json'} # unchanged when the edit keeps every width and the local profile (same-cost word edit) + need(expected <= set(change) <= expected | optional, 'exact overlay change allowlist ' + str(set(change) ^ expected)); need(tree(source) == before, 'original source remained byte-exact') + receipt = dict(status='PASS_SOURCE_BOUND_WORDEDIT_OVERLAY_DERIVATION', stage=a.stage_name, upstream_manifest_sha256=UPSTREAM_MANIFEST, derived_manifest_sha256=sha(out / 'MANIFEST.json'), + source_file_count=len(after), buffers=B, builder_sha256=sha(Path(__file__)), producer_sha256=PRODUCER_SHA, changes=change, patches=patches, words=records) + write(out.parent / (out.name + '-DERIVATION.json'), receipt); print(json.dumps({k: receipt[k] for k in ['status', 'derived_manifest_sha256', 'source_file_count', 'buffers']}, sort_keys=True)) +if __name__ == '__main__': main() diff --git a/research/paired-extension-normal45/tools/derive_adapters.py b/research/paired-extension-normal45/tools/derive_adapters.py new file mode 100644 index 0000000000..ae1ab9c141 --- /dev/null +++ b/research/paired-extension-normal45/tools/derive_adapters.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Generalized PR2917 adapter derivation (Marius-Paul Dumitrean, Claude Code assisted; PR2917/PR2908 derivations by Mason Hale and Jeremy Diviney): PR2908's exact tools -> closed-profile adapters for an +arbitrary derived overlay, buffer count B, source profile and comparator set. With B=82, commit +'paired-helper-extension-pr2908', profile 'paired-extension' and comparisons=pr2908 the output is byte-identical to +PR2917's tools/derive_adapters.py output (checked against its evidence/ADAPTER-DERIVATION.json), except the retained +receipt binding, which is always sha256(--retained-receipt). +usage: derive_adapters_r13.py --parent-package PR2908_PKG --source OVERLAY --retained-receipt FILE --out DIR + --buffers B --source-commit NAME --source-profile NAME --upstream-head HEX + [--comparison pr2917=/path/CLAIM.json --comparison pr2930=/path/CLAIM.json ...] (pr2908 always from the parent package) +""" +from pathlib import Path +import argparse, gzip, hashlib, json, sys +PARENT_HEAD = '51309592971e3b5be935599eed2a95404dc7781e' +PARENT_MANIFEST = '9dba3fe371602ec023a54e26c0fd66f69eb7a74be86aab89923529083c14b36f' +OLD_SOURCE = '56cf455752722051d598a7da1e5ee700637fbaef09189f534413dbe6e0525a83' +OLD_RETAINED = 'dd36443f2789ffa6deca7210c76ada781e2b9b7e622a546b366f51a475faff3e' +# Known full-headline comparators: name -> (head, sha256 of its CLAIM.json). A comparator file must match its pin exactly. +KNOWN = {'pr2908': (PARENT_HEAD, '2406680a07b43a69b0f12f8462cc43f3616f3c8cb0a46bc767541b45945cd2bf'), + 'pr2917': ('224bd5e56041c40078ff6b5fa7393733a215de5c', 'e6c836c0178661a53a69cd91f29d83585e876f2511ff40c6b6204cd270fbdeac'), + 'pr2930': ('81f3b5d12977eba09e06fbff729167d59faabe90', '9c2c14158780a677b3661623d7476acc4f535ac9e0481addfa1d6c4c7633b74b')} +HEADS = {k: v[0] for k, v in KNOWN.items()} +sha = lambda b: hashlib.sha256(b).hexdigest() + +def need(p, msg): + if not p: raise ValueError(msg) + +def tree(p): + need(not any(f.is_symlink() for f in p.rglob('*')), 'no symlinks') + return {f.relative_to(p).as_posix(): sha(f.read_bytes()) for f in p.rglob('*') if f.is_file() and f != p / 'MANIFEST.json'} + +def derive(parent, source, out, retained_sha, B, commit, profile, upstream_head, claims): + manifest = json.loads((parent / 'MANIFEST.json').read_bytes()); need(tree(parent) == manifest, 'complete exact parent manifest inventory') + need(sha((parent / 'MANIFEST.json').read_bytes()) == PARENT_MANIFEST, 'exact PR2908 package manifest') + newsha = sha((source / 'MANIFEST.json').read_bytes()) + files = json.loads((source / 'MANIFEST.json').read_bytes()); need(tree(source) == files, 'complete derived source inventory') + nfiles = len(files) + for tag in ('base', 'extra'): + w = json.loads(gzip.decompress((source / f'new/borrow/words/BORROW-WORD-43{tag}.json.gz').read_bytes())) + need(len(w['helper_final']) == B, f'declared {B}-buffer word ({tag}: {len(w["helper_final"])})') + need(len(set(range(224, 704)) - set(w['removed'])) == 408, '408 live helpers') + need(type(B) is int and 73 <= B <= 200, 'buffer count range') + need(len(retained_sha) == 64 and all(c in '0123456789abcdef' for c in retained_sha), 'retained receipt SHA256') + comps = [('pr2908', parent / 'CLAIM.json')] + [(k, Path(v)) for k, v in claims] + comp_entries = [] + for name, path in comps: + claim = json.loads(path.read_bytes()); need('headline_kappa_source' not in claim and 'kappa' in claim, 'headline outer comparison ' + name) + need(name in KNOWN and sha(path.read_bytes()) == KNOWN[name][1], 'known comparator head and exact CLAIM.json pin ' + name) + comp_entries.append((name, int(name[2:]), HEADS[name], sha(path.read_bytes()))) + out.mkdir(parents=True, exist_ok=False); changes = {} + def adapt(oldname, newname, pairs): + p = parent / 'tools' / oldname; body = p.read_text(); oldhash = sha(p.read_bytes()); applied = [] + for old, new in pairs: + need(body.count(old) == 1, f'exact preimage occurrence {oldname}: {old[:120]}') + body = body.replace(old, new); applied.append({'old': old, 'new': new}) + q = out / newname; q.write_text(body); compile(body, str(q), 'exec') + changes[newname] = {'source': str(p), 'before_sha256': oldhash, 'after_sha256': sha(q.read_bytes()), 'replacements': applied} + adapt('prepare_channel_native.py', 'prepare_extension_native.py', [ + ("SOURCE_SHA='" + OLD_SOURCE + "'", "SOURCE_SHA='" + newsha + "'"), + ('SOURCE_FILES=610', 'SOURCE_FILES=' + str(nfiles)), + ("SOURCE_COMMIT='two-sided-helper408-pr2894'", "SOURCE_COMMIT='" + commit + "'"), + ("OLD_RECEIPT_SHA='" + OLD_RETAINED + "'", "OLD_RECEIPT_SHA='" + retained_sha + "'"), + ("len(can['zero_buffers'])==73", f"len(can['zero_buffers'])=={B}"), + ]) + oldprofile = " 'channel408': dict(commit='two-sided-helper408-pr2894',manifest='" + OLD_SOURCE + "',helpers=408,source_file_count=610,upstream_head='18d03c447886895ef9abf888398178e0428533ca')," + newprofile = " '" + profile + "': dict(commit='" + commit + "',manifest='" + newsha + "',helpers=408,source_file_count=" + str(nfiles) + ",upstream_head='" + upstream_head + "')," + comp_text = "COMPARISONS = {" + ''.join("\n '" + n + "': dict(pr=" + str(pr) + ",head='" + h + "',sha256='" + s + "',field='kappa')," for n, pr, h, s in comp_entries) + choices = "['" + "','".join(n for n, *_ in comp_entries) + "']" + adapt('admit_channel408.py', 'admit_extension.py', [ + (oldprofile, newprofile), + ("COMPARISONS = {", comp_text), + ("ap.add_argument('--source-profile', choices=['channel408'], default='channel408')", "ap.add_argument('--source-profile', choices=['" + profile + "'], default='" + profile + "')"), + ("ap.add_argument('--comparison-profile', choices=['pr2894'], default='pr2894')", "ap.add_argument('--comparison-profile', choices=" + choices + ", default='pr2908')"), + ('zero_buffers_allocated_and_cleared=73', f'zero_buffers_allocated_and_cleared={B}'), + ("len(c.get('zero_buffers',[]))==73, 'helper408 physical ABI including all 73 private buffers'", f"len(c.get('zero_buffers',[]))=={B}, 'paired extension physical ABI including all {B} private buffers'"), + ("896*T+expected_helpers+8+73+2, 'complete physical cost including all actual helpers and 73 buffers'", f"896*T+expected_helpers+8+{B}+2, 'complete physical cost including all actual helpers and {B} buffers'"), + ]) + adapt('channel_blocknorm.py', 'extension_blocknorm.py', [ + ("len(allocated)==73, 'all73 private zero buffers released'", f"len(allocated)=={B}, 'all{B} private zero buffers released'"), + ("'zero_buffers_allocated_and_cleared':73", f"'zero_buffers_allocated_and_cleared':{B}"), + ("r['zero_buffers_returned_to_zero']==73", f"r['zero_buffers_returned_to_zero']=={B}"), + ('physical==live+8+408+73+2', f'physical==live+8+408+{B}+2'), + ("'zero_buffers':[live+416,live+489], 'coefficient':[live+489,live+491]", f"'zero_buffers':[live+416,live+{416 + B}], 'coefficient':[live+{416 + B},live+{418 + B}]"), + ("len(mp)==73 and set(mp.values())==set(range(*ns['zero_buffers'])), '73distinct private Z slots'", f"len(mp)=={B} and set(mp.values())==set(range(*ns['zero_buffers'])), '{B}distinct private Z slots'"), + ('T=len(order)//9; live=896*T; physical=live+490', f'T=len(order)//9; live=896*T; physical=live+{418 + B}'), + ]) + # The native address dimension and symplectic stock factor are deliberately retained (as in PR2917). + b = (out / 'extension_blocknorm.py').read_text(); a = (out / 'admit_extension.py').read_text() + need("require(d['m']==73" in b and 'Sp(72,2)' in b and 'range(1,37)' in b, 'retained native dimension and symplectic group') + need('assert m==73' in a, 'retained outer dimension') + receipt = {'status': f'PASS_CHECKED_{B}_BUFFER_ADAPTER_DERIVATION_R13', 'parent_head': PARENT_HEAD, 'parent_manifest_sha256': PARENT_MANIFEST, + 'source_commit': commit, 'source_profile': profile, 'upstream_head': upstream_head, 'source_manifest_sha256': newsha, 'source_files': nfiles, + 'comparisons': {n: dict(pr=pr, head=h, sha256=s) for n, pr, h, s in comp_entries}, 'retained_receipt_sha256': retained_sha, + 'buffer_count': B, 'physical_overhead': 418 + B, 'changes': changes} + (out / 'ADAPTER-DERIVATION.json').write_text(json.dumps(receipt, indent=2) + '\n'); return receipt + +if __name__ == '__main__': + ap = argparse.ArgumentParser(); ap.add_argument('--parent-package', type=Path, required=True); ap.add_argument('--source', type=Path, required=True) + ap.add_argument('--retained-receipt', type=Path, required=True); ap.add_argument('--out', type=Path, required=True); ap.add_argument('--buffers', type=int, required=True) + ap.add_argument('--source-commit', required=True); ap.add_argument('--source-profile', required=True); ap.add_argument('--upstream-head', required=True) + ap.add_argument('--comparison', action='append', default=[], help='name=path/to/CLAIM.json (pr2917=...)'); a = ap.parse_args() + claims = [tuple(c.split('=', 1)) for c in a.comparison] + r = derive(a.parent_package.resolve(), a.source.resolve(), a.out.resolve(), sha(a.retained_receipt.read_bytes()), a.buffers, a.source_commit, a.source_profile, a.upstream_head, claims) + print(r['status'], r['source_manifest_sha256'], r['source_files'], {k: v['after_sha256'][:16] for k, v in r['changes'].items()}) diff --git a/research/paired-extension-normal45/tools/relax.py b/research/paired-extension-normal45/tools/relax.py new file mode 100644 index 0000000000..97dfe35c43 --- /dev/null +++ b/research/paired-extension-normal45/tools/relax.py @@ -0,0 +1,329 @@ +#!/usr/bin/env python3 +"""relax.py -- changed-inventory, fixed-capacity fractional relaxation (upper bound on the complex endpoint) +for an ARBITRARY per-call local profile and per-call helper-width inventory, with exact rational verification. + +Model (everything per replica; the fractional cap is independent of T): + * bins: every replica has 112 ports x 18 idle children; the child capacities (ranks) come from the + T37 template: 6 children of capacity 8, 4 of 16, 4 of 32, 4 of 48 -> bins {8:672, 16:448, 32:448, 48:448}. + * roles: every call hosts all its helpers; a helper of width w occupies w consecutive units of ONE bin; + the 9 calls of a replica supply 9*inventory[w] roles of width w per replica (the inventory is per call; + with two providers of different widths pass the call-weighted average, a Fraction is fine). + * pattern catalogue: every multiset of widths with sum <= capacity ("bounded count-vector enumeration"); + the bin then pays ONE idle child of rank cap - used (rank 0 = nothing). + * CHRONOLOGY IS IGNORED: no source windows, no per-call family collisions, no "one role per bin per call", + no integrality. A bin pattern count may be fractional. Hence this is an UPPER bound on what any + actual fill of the same inventory can reach, and the bound is NOT a chronological witness. + * local profile is fixed and fully paid: 9 * local[r] children of rank r per replica. + Moment: M_x(b) = (9*sum_r local_r H_r(b) + sum_p x_p H_{r_p}(b)) / (73*896), H_r(b) = r*(73/r)^b, + LP(b): min_x sum_p x_p H_{r_p}(b) s.t. sum_{p in cap c} x_p = bins[c], sum_p n_w(p) x_p = 9*inv[w], x>=0. + cap = the root b of min_x M_x(b) = 1 (g(b) = min_x M_x(b) is increasing). + +Exact verification (same technique as PR2857's audit_relaxation.py, re-implemented): + 1. float bisection with scipy/HiGHS locates b*; the optimal basis B (9 columns) is read off; + 2. x_B = B^-1 rhs exactly (Fractions) -> the primal profile; root bracketed at 10^-25 with the package's + rational interval arithmetic (root.py): M(lo) < 1 < M(hi) -> cap >= lo (x_B is feasible); + 3. dual y(b) = B^-T c_B(b) is an exact rational combination of the H_k(b): the Y matrix of the receipt; + every pattern's reduced cost at b = hi is bracketed with the H enclosures and must be > 0 (or identically 0 + for the tight patterns) -> by weak duality every feasible x has M_x(hi) >= M_{x_B}(hi) > 1 -> cap <= hi. + Reproduces PR2857: cap in [0.001720100805416885927944, 0.001720100805416885927945], 1163 patterns, 11 tight. + +Usage: + python -B relax.py --calibrate + python -B relax.py --inventory '{"4":26,"5":2,"7":62,"8":85,"9":233}' --local '{"1":2397,"2":640,"3":266,"4":128,"5":26,"8":8}' + python -B relax.py --delta-inventory '{"8":1,"9":-1}' --delta-local '{"1":3,"2":-2}' # relative to PR2857 + python -B relax.py --scenarios # the hypothetical table of ROUND.md (one/two 9->8, 8->7, removal) +API: relax(local, inventory, bins=BINS) -> dict (cap_lower, cap_upper, active patterns, idle histogram, dual check, ...) +""" +from fractions import Fraction as Q +from itertools import product +import argparse, json, sys, os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import root as R + +BINS = {8: 672, 16: 448, 32: 448, 48: 448} # bins per replica (112 ports x children per capacity) +LIVE = R.LIVE_PER_REPLICA # 896 +CALLS = R.CALLS_PER_REPLICA # 9 +PR2857_LOCAL = {1: 2394, 2: 642, 3: 266, 4: 128, 5: 26, 8: 8} +PR2857_INV = {4: 26, 5: 2, 7: 62, 8: 84, 9: 234} +PR2857_REALIZED_LOWER = Q('17200966286848326009728/10000000000000000000000000') +PR2857_REALIZED_UPPER = Q('17200966286848326009729/10000000000000000000000000') +PR2857_CAP_UPPER = Q('344020161083377185589/200000000000000000000000') # 0.001720100805416885927945 +PR2848_KAPPA = Q('17186585083049300/10000000000000000000') # 0.0017186585083049300 (incumbent of PR2857's gain) + + +def need(c, m): + if not c: + raise ValueError(m) + + +def patterns(bins, widths): + out = [] + for cap in sorted(bins): + for counts in product(*(range(cap // w + 1) for w in widths)): + used = sum(w * n for w, n in zip(widths, counts)) + if used <= cap: + out.append((cap, counts, cap - used)) + return out + + +def Hfloat(r, b): + import math + return 0.0 if r == 0 else r * (73.0 / r) ** b + + +def lp_min(pats, caps, widths, rhs, b): + """float LP at saving b: returns (optimal value, x, duals y).""" + import numpy as np + from scipy.optimize import linprog + c = np.array([Hfloat(r, b) for cap, counts, r in pats]) + A = np.zeros((len(caps) + len(widths), len(pats))) + for j, (cap, counts, r) in enumerate(pats): + A[caps.index(cap), j] = 1.0 + for i, n in enumerate(counts): + if n: + A[len(caps) + i, j] = n + res = linprog(c, A_eq=A, b_eq=np.array([float(v) for v in rhs]), bounds=(0, None), method='highs') + need(res.status == 0, 'LP infeasible or failed: ' + res.message) + return res.fun, res.x, res.eqlin.marginals, A + + +def rat_inverse(Bm): + n = len(Bm) + M = [row[:] + [Q(int(i == j)) for j in range(n)] for i, row in enumerate(Bm)] + for col in range(n): + piv = next((r for r in range(col, n) if M[r][col] != 0), None) + need(piv is not None, 'singular basis') + M[col], M[piv] = M[piv], M[col] + f = M[col][col] + M[col] = [v / f for v in M[col]] + for r in range(n): + if r != col and M[r][col] != 0: + g = M[r][col] + M[r] = [a - g * bb for a, bb in zip(M[r], M[col])] + return [row[n:] for row in M] + + +def rat_rank(cols): + """rank of a list of rational column vectors""" + rows = [list(c) for c in cols] + rank = 0 + ncol = len(rows[0]) if rows else 0 + for col in range(ncol): + piv = next((r for r in range(rank, len(rows)) if rows[r][col] != 0), None) + if piv is None: + continue + rows[rank], rows[piv] = rows[piv], rows[rank] + for r in range(len(rows)): + if r != rank and rows[r][col] != 0: + g = rows[r][col] / rows[rank][col] + rows[r] = [a - g * bb for a, bb in zip(rows[r], rows[rank])] + rank += 1 + return rank + + +def column(pat, caps, widths): + cap, counts, r = pat + return [Q(int(cap == c)) for c in caps] + [Q(n) for n in counts] + + +def relax(local, inventory, bins=BINS, digits=25, verbose=False): + local = {int(r): Q(n) for r, n in local.items() if Q(n) != 0} + inventory = {int(w): Q(n) for w, n in inventory.items() if Q(n) != 0} + need(all(n > 0 for n in local.values()) and all(n > 0 for n in inventory.values()), 'positive local/inventory') + widths = sorted(inventory) + caps = sorted(bins) + pats = patterns(bins, widths) + rhs = [Q(bins[c]) for c in caps] + [CALLS * inventory[w] for w in widths] + local_rep = {r: CALLS * n for r, n in local.items()} + total_cap = sum(c * bins[c] for c in caps) + inv_mass = sum(w * inventory[w] for w in widths) * CALLS + local_mass = sum(r * n for r, n in local_rep.items()) + idle_mass = total_cap - inv_mass + need(idle_mass >= 0, 'inventory exceeds bin capacity') + mass_ok = (local_mass + idle_mass == R.MASS_PER_REPLICA) + + # --- 1. float bisection on b + import numpy as np + def gfloat(b): + val, x, y, A = lp_min(pats, caps, widths, rhs, b) + loc = sum(float(n) * Hfloat(r, b) for r, n in local_rep.items()) + return (loc + val) / (73 * LIVE) - 1.0, x, y + lo, hi = 0.0, 0.01 + g_lo, _, _ = gfloat(lo) + g_hi, _, _ = gfloat(hi) + need(g_lo < 0 < g_hi, 'root window [0, 0.01] does not bracket the cap') + for _ in range(64): + mid = (lo + hi) / 2 + g, x, y = gfloat(mid) + if g < 0: + lo = mid + else: + hi = mid + b_star = (lo + hi) / 2 + g, x, y, = gfloat(b_star) + val, x, y, A = lp_min(pats, caps, widths, rhs, b_star) + + # --- 2. basis: support of x, completed by tight (zero reduced cost) columns to full rank + c = np.array([Hfloat(r, b_star) for cap, counts, r in pats]) + rc = c - A.T @ y + order = sorted(range(len(pats)), key=lambda j: (0 if x[j] > 1e-9 else 1, abs(float(rc[j])), -float(x[j]))) + basis = [] + cols = [] + for j in order: + if len(basis) == len(rhs): + break + if x[j] <= 1e-9 and abs(rc[j]) > 1e-7: + continue + col = column(pats[j], caps, widths) + if rat_rank(cols + [col]) > len(cols): + basis.append(j) + cols.append(col) + need(len(basis) == len(rhs), 'could not complete an optimal basis (degenerate LP); %d of %d' % (len(basis), len(rhs))) + Bm = [[cols[k][i] for k in range(len(basis))] for i in range(len(rhs))] # rows = constraints + Binv = rat_inverse(Bm) + xB = [sum(Binv[k][i] * rhs[i] for i in range(len(rhs))) for k in range(len(basis))] + need(all(v >= 0 for v in xB), 'basis not primal feasible') + active = [(pats[j], xB[k]) for k, j in enumerate(basis) if xB[k] > 0] + idle = {} + for (cap, counts, r), n in active: + if r: + idle[r] = idle.get(r, 0) + n + full = dict(local_rep) + for r, n in idle.items(): + full[r] = full.get(r, 0) + n + cap_lo, cap_hi = R.root_bracket(full, LIVE, digits, check_mass_T=1 if mass_ok else None) + + # --- 3. exact dual in the H basis: y_j(b) = sum_k (B^-T)_{j,k} H_{r_k}(b) + ranks = sorted({r for cap, counts, r in pats if r}) + # (B^-T)_{j,k} = Binv[k][j] + Y = {j: {} for j in range(len(rhs))} + for j in range(len(rhs)): + for k, pj in enumerate(basis): + r = pats[pj][2] + if r == 0 or Binv[k][j] == 0: + continue + Y[j][r] = Y[j].get(r, 0) + Binv[k][j] + Hhi = {r: R.H(r, cap_hi) for r in ranks} + tight = [] + strict = 0 + min_slack = None + for p in pats: + cap, counts, r = p + a = column(p, caps, widths) + coeff = {} + if r: + coeff[r] = Q(1) + for j in range(len(rhs)): + if a[j] == 0: + continue + for k, v in Y[j].items(): + coeff[k] = coeff.get(k, 0) - a[j] * v + coeff = {k: v for k, v in coeff.items() if v != 0} + if not coeff: + tight.append(p) + continue + lower = sum(v * (Hhi[k][0] if v > 0 else Hhi[k][1]) for k, v in coeff.items()) + need(lower > 0, 'dual sign failure for pattern %s (reduced-cost lower bound %s)' % (str(p), str(lower))) + strict += 1 + min_slack = lower if min_slack is None else min(min_slack, lower) + dual_obj = sum(rhs[j] * sum(v * Hhi[k][0] for k, v in Y[j].items()) for j in range(len(rhs))) # not needed for the proof, informational + dual_rows = ['cap%d' % c for c in caps] + ['w%d' % w for w in widths] + return dict( + status='PASS_EXACT_RELAXATION_CAP' if mass_ok else 'PASS_EXACT_RELAXATION_CAP_MASS_NOT_65088', + cap_lower=str(cap_lo), cap_upper=str(cap_hi), cap_lower_decimal=R.mpmath_str(cap_lo, digits), cap_upper_decimal=R.mpmath_str(cap_hi, digits), + patterns=len(pats), tight_patterns=len(tight), strict_patterns=strict, minimum_slack_lower=str(min_slack), + basis_patterns=[dict(capacity=pats[j][0], widths=[w for w, n in zip(widths, pats[j][1]) for _ in range(n)], count_per_replica=str(xB[k])) for k, j in enumerate(basis)], + tight_pattern_list=[dict(capacity=p[0], widths=[w for w, n in zip(widths, p[1]) for _ in range(n)]) for p in tight], + idle_per_replica={str(r): str(n) for r, n in sorted(idle.items())}, + idle_mass_per_replica=str(idle_mass), local_mass_per_replica=str(local_mass), rank_mass_per_replica=str(local_mass + idle_mass), rank_mass_identity=mass_ok, + dual_Y={dual_rows[j]: {str(k): str(v) for k, v in sorted(Y[j].items())} for j in range(len(rhs))}, + inventory_per_call={str(w): str(inventory[w]) for w in widths}, local_per_call={str(r): str(n) for r, n in sorted(local.items())}, bins_per_replica=bins, + delta_vs_PR2857_realized=dict(lower=str(cap_lo - PR2857_REALIZED_UPPER), upper=str(cap_hi - PR2857_REALIZED_LOWER), float=float(cap_lo - PR2857_REALIZED_LOWER)), + delta_vs_PR2857_cap=dict(float=float(cap_lo - PR2857_CAP_UPPER)), + assumptions='fixed capacities 8/16/32/48 (112 ports x 6/4/4/4 children per replica), all count-vector patterns with sum<=cap, one idle child of rank cap-used per bin, chronology/windows/collisions/integrality ignored, local profile fully paid; upper bound on any actual fill of this inventory, not a witness', + ) + + +def scenarios(): + base_local, base_inv = PR2857_LOCAL, PR2857_INV + def mod(dl, di): + l = {r: base_local.get(r, 0) + dl.get(r, 0) for r in set(base_local) | set(dl)} + i = {w: base_inv.get(w, 0) + di.get(w, 0) for w in set(base_inv) | set(di)} + return {r: n for r, n in l.items() if n}, {w: n for w, n in i.items() if n} + table = [ + ('PR2857 actual (calibration)', {}, {}), + ('one more 9->8 at PR2857 cost {1:+3,2:-2}', {1: 3, 2: -2}, {8: 1, 9: -1}), + ('one more 9->8 at PR2853 cost {1:+5,2:-3}', {1: 5, 2: -3}, {8: 1, 9: -1}), + ('one more 9->8 at minimal cost {1:+1,2:-1}', {1: 1, 2: -1}, {8: 1, 9: -1}), + ('two more 9->8 at PR2857 cost {1:+6,2:-4}', {1: 6, 2: -4}, {8: 2, 9: -2}), + ('four more 9->8 at PR2857 cost {1:+12,2:-8}', {1: 12, 2: -8}, {8: 4, 9: -4}), + ('one 8->7 at PR2857-like cost {1:+3,2:-2}', {1: 3, 2: -2}, {7: 1, 8: -1}), + ('one 8->7 at minimal cost {1:+1,2:-1}', {1: 1, 2: -1}, {7: 1, 8: -1}), + ('one 9->7 (two units) at cost {1:+6,2:-4}', {1: 6, 2: -4}, {7: 1, 9: -1}), + ('remove one width-9 helper, its 9 one-dim climbs vanish {1:-9}', {1: -9}, {9: -1}), + ('remove one width-9 helper paying {1:-7,2:-1}', {1: -7, 2: -1}, {9: -1}), + ('remove one width-8 helper {1:-8}', {1: -8}, {8: -1}), + ('remove one width-4 helper {1:-4}', {1: -4}, {4: -1}), + ('local only: +1 H1 -1 H2 per call (mass -1, inventory unchanged: NOT a legal word, derivative probe)', {1: 1, 2: -1}, {}), + ('local only: -1 H1 per call (mass -1, derivative probe)', {1: -1}, {}), + ('local only: 2 H1 -> 1 H2 per call (mass neutral)', {1: -2, 2: 1}, {}), + ('local only: 1 H3 -> 1 H1 + 1 H2 per call (mass neutral)', {3: -1, 1: 1, 2: 1}, {}), + ] + out = [] + for name, dl, di in table: + l, i = mod(dl, di) + try: + r = relax(l, i) + row = dict(scenario=name, delta_local=dl, delta_inventory=di, cap_lower=r['cap_lower_decimal'], cap_upper=r['cap_upper_decimal'], + gain_vs_PR2857_realized_float=r['delta_vs_PR2857_realized']['float'], gain_vs_PR2857_cap_float=r['delta_vs_PR2857_cap']['float'], + tight=r['tight_patterns'], patterns=r['patterns'], idle_per_replica=r['idle_per_replica'], basis=r['basis_patterns'], rank_mass_identity=r['rank_mass_identity'], status=r['status']) + except Exception as e: # noqa + row = dict(scenario=name, delta_local=dl, delta_inventory=di, error=str(e)) + out.append(row) + print('%-95s cap<= %s gain vs realized %+.4e vs cap %+.4e %s' % (name, row.get('cap_upper', '?'), row.get('gain_vs_PR2857_realized_float', float('nan')), row.get('gain_vs_PR2857_cap_float', float('nan')), row.get('error', '')), file=sys.stderr, flush=True) + return out + + +def main(): + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument('--calibrate', action='store_true') + ap.add_argument('--scenarios', action='store_true') + ap.add_argument('--inventory', help='JSON per-call {width: count}') + ap.add_argument('--local', help='JSON per-call {rank: count}') + ap.add_argument('--delta-inventory', help='JSON {width: +-count} relative to PR2857') + ap.add_argument('--delta-local', help='JSON {rank: +-count} relative to PR2857') + ap.add_argument('--digits', type=int, default=25) + ap.add_argument('--out') + a = ap.parse_args() + if a.calibrate: + r = relax(PR2857_LOCAL, PR2857_INV, digits=a.digits) + r['reproduces_PR2857_cap_lower'] = (Q(r['cap_lower']) == Q('215012600677110740993/125000000000000000000000')) + r['bracket_inside_PR2857_bracket'] = (Q(r['cap_lower']) >= Q('215012600677110740993/125000000000000000000000') and Q(r['cap_upper']) <= PR2857_CAP_UPPER) + r['reproduces_PR2857_cap_upper_at_24_digits'] = (relax(PR2857_LOCAL, PR2857_INV, digits=24)['cap_upper'] == str(PR2857_CAP_UPPER)) + r['reproduces_PR2857_pattern_count_1163'] = (r['patterns'] == 1163) + r['reproduces_PR2857_11_tight_1152_strict'] = (r['tight_patterns'] == 11 and r['strict_patterns'] == 1152) + res = r + elif a.scenarios: + res = scenarios() + else: + local = dict(PR2857_LOCAL) + inv = dict(PR2857_INV) + if a.local: + local = {int(k): Q(v) for k, v in json.loads(a.local).items()} + if a.inventory: + inv = {int(k): Q(v) for k, v in json.loads(a.inventory).items()} + if a.delta_local: + for k, v in json.loads(a.delta_local).items(): + local[int(k)] = local.get(int(k), 0) + Q(v) + if a.delta_inventory: + for k, v in json.loads(a.delta_inventory).items(): + inv[int(k)] = inv.get(int(k), 0) + Q(v) + res = relax({k: v for k, v in local.items() if v}, {k: v for k, v in inv.items() if v}, digits=a.digits) + s = json.dumps(res, indent=1, sort_keys=True, default=str) + if a.out: + open(a.out, 'w').write(s) + print(s) + + +if __name__ == '__main__': + main() diff --git a/research/paired-extension-normal45/tools/relax_exact.py b/research/paired-extension-normal45/tools/relax_exact.py new file mode 100644 index 0000000000..0be97756bb --- /dev/null +++ b/research/paired-extension-normal45/tools/relax_exact.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +"""relax_exact.py -- Fractions-only verification of a stored optimal basis of the changed-inventory +fixed-capacity fractional relaxation (relax.py), without scipy. + +relax.py locates the optimal basis with a float LP (scipy/HiGHS) and then certifies it exactly. This module +performs only the exact part, from a stored list of basis patterns: + 1. x_B = B^-1 rhs (exact rationals), x_B >= 0: the basic solution is feasible, so the cap is at least the + root of its complete profile (root.py bracket at 10^-digits); + 2. the dual y(b) = B^-T c_B(b) is an exact rational combination of the H_k(b); every one of the capacity- + feasible patterns has reduced cost > 0 (or identically 0) at b = hi, so by weak duality every feasible x + has moment >= 1 at hi: the cap is at most hi. +The bins, pattern catalogue, moment model and interval arithmetic are relax.py's / root.py's (imported). + +Marius-Paul Dumitrean, prepared with substantial AI assistance (Anthropic Claude, via Claude Code). Apache-2.0. +""" +from fractions import Fraction as Q +import os, sys +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import root as R +import relax as X + + +def need(c, m): + if not c: + raise ValueError(m) + + +def pattern_of(entry, widths, bins): + cap = int(entry['capacity']) + need(cap in bins, 'basis pattern capacity %r is not a bin capacity' % cap) + counts = tuple(list(entry['widths']).count(w) for w in widths) + need(sum(counts) == len(entry['widths']), 'basis pattern uses a width outside the inventory: %r' % (entry,)) + used = sum(w * n for w, n in zip(widths, counts)) + need(used <= cap, 'basis pattern exceeds its capacity') + return (cap, counts, cap - used) + + +def verify_basis(local, inventory, basis_patterns, bins=X.BINS, digits=25): + local = {int(r): Q(n) for r, n in local.items() if Q(n) != 0} + inventory = {int(w): Q(n) for w, n in inventory.items() if Q(n) != 0} + need(all(n > 0 for n in local.values()) and all(n > 0 for n in inventory.values()), 'positive local/inventory') + widths = sorted(inventory) + caps = sorted(bins) + pats = X.patterns(bins, widths) + patset = set(pats) + rhs = [Q(bins[c]) for c in caps] + [X.CALLS * inventory[w] for w in widths] + local_rep = {r: X.CALLS * n for r, n in local.items()} + total_cap = sum(c * bins[c] for c in caps) + inv_mass = sum(w * inventory[w] for w in widths) * X.CALLS + local_mass = sum(r * n for r, n in local_rep.items()) + idle_mass = total_cap - inv_mass + need(idle_mass >= 0, 'inventory exceeds bin capacity') + mass_ok = (local_mass + idle_mass == R.MASS_PER_REPLICA) + basis = [pattern_of(e, widths, bins) for e in basis_patterns] + need(len(basis) == len(rhs), 'basis must have exactly %d patterns' % len(rhs)) + need(all(p in patset for p in basis), 'basis pattern outside the catalogue') + need(len(set(basis)) == len(basis), 'repeated basis pattern') + cols = [X.column(p, caps, widths) for p in basis] + need(X.rat_rank(cols) == len(rhs), 'basis columns are linearly dependent') + Bm = [[cols[k][i] for k in range(len(basis))] for i in range(len(rhs))] + Binv = X.rat_inverse(Bm) + xB = [sum(Binv[k][i] * rhs[i] for i in range(len(rhs))) for k in range(len(basis))] + need(all(v >= 0 for v in xB), 'basis not primal feasible (negative basic variable)') + for e, v in zip(basis_patterns, xB): + if 'count_per_replica' in e: + need(Q(e['count_per_replica']) == v, 'stored basic count differs from B^-1 rhs: %r' % (e,)) + idle = {} + for p, n in zip(basis, xB): + if p[2] and n: + idle[p[2]] = idle.get(p[2], 0) + n + full = dict(local_rep) + for r, n in idle.items(): + full[r] = full.get(r, 0) + n + cap_lo, cap_hi = R.root_bracket(full, X.LIVE, digits, check_mass_T=1 if mass_ok else None) + ranks = sorted({r for cap, counts, r in pats if r}) + Y = {j: {} for j in range(len(rhs))} + for j in range(len(rhs)): + for k, p in enumerate(basis): + r = p[2] + if r == 0 or Binv[k][j] == 0: + continue + Y[j][r] = Y[j].get(r, 0) + Binv[k][j] + Hhi = {r: R.H(r, cap_hi) for r in ranks} + tight = strict = 0 + min_slack = None + for p in pats: + a = X.column(p, caps, widths) + coeff = {} + if p[2]: + coeff[p[2]] = Q(1) + for j in range(len(rhs)): + if a[j] == 0: + continue + for k, v in Y[j].items(): + coeff[k] = coeff.get(k, 0) - a[j] * v + coeff = {k: v for k, v in coeff.items() if v != 0} + if not coeff: + tight += 1 + continue + lower = sum(v * (Hhi[k][0] if v > 0 else Hhi[k][1]) for k, v in coeff.items()) + need(lower > 0, 'dual sign failure for pattern %s (reduced-cost lower bound %s)' % (str(p), str(lower))) + strict += 1 + min_slack = lower if min_slack is None else min(min_slack, lower) + return dict(status='PASS_EXACT_RELAXATION_CAP' if mass_ok else 'PASS_EXACT_RELAXATION_CAP_MASS_NOT_65088', + cap_lower=str(cap_lo), cap_upper=str(cap_hi), patterns=len(pats), tight_patterns=tight, + strict_patterns=strict, minimum_slack_lower=str(min_slack), rank_mass_identity=mass_ok, + idle_per_replica={str(r): str(n) for r, n in sorted(idle.items())}, + basic_counts=[str(v) for v in xB]) diff --git a/research/paired-extension-normal45/tools/root.py b/research/paired-extension-normal45/tools/root.py new file mode 100644 index 0000000000..bd6dc2eb4e --- /dev/null +++ b/research/paired-extension-normal45/tools/root.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python3 +"""root.py -- exact (rational-bracketed) complex endpoint kappa from a complete global profile. + +The T-replica network has 9*T calls, live width W = 896*T, base m = 73. A complete paid profile +{rank: count} (local jumps of all calls + idle/remainder children of all bins) has the moment + + M(b) = sum_r count_r * r * (73/r)^b / (73 * W) (= audit_owners.moment(profile, b, W)) + +which is increasing in b; the complex endpoint is the root M(b) = 1. PR2857's headline is +floor(root_lower, 24 digits) - 1e-46 - 1e-70; PR2853/PR2833's headlines are their roots - O(1e-3022). +The rational interval arithmetic (log via atanh series, exp via Taylor, outward rounding at 10^-45) +is the package's own, so the brackets coincide exactly with the independent audits. + +Rank-mass identity for a complete profile: sum_r r*count_r = 65088*T (= (73-1)*896*T + 64*9*T). + +Usage: + python -B root.py --calibrate # PR2857 / PR2853 / PR2833 reproduction + python -B root.py --profile '{"1":805860,...}' --T 37 [--delta '{"1":9,"2":-9}'] [--digits 25] + python -B root.py --profile-file PROFILE.json --T 37 --table # per-rank derivative table +API: + kappa_from_profile(profile, T, digits=25) -> (lo, hi) exact Fractions, M(lo)<1 dict with new bracket and exact gain interval + derivatives(profile, T) -> {rank: dkappa/dcount_r} (mpmath, 40 digits) +""" +from fractions import Fraction as Q +from functools import lru_cache +import argparse, json, sys + +M_BASE = 73 +LIVE_PER_REPLICA = 896 +CALLS_PER_REPLICA = 9 +MASS_PER_REPLICA = (M_BASE - 1) * LIVE_PER_REPLICA + 64 * CALLS_PER_REPLICA # 65088 +SCALE = 10 ** 45 + + +def need(c, m): + if not c: + raise ValueError(m) + + +@lru_cache(None) +def logarithm(x): + """Rational enclosure of log(x), x >= 1 (package arithmetic, outward rounding 10^-45).""" + need(x >= 1, 'log argument') + k = 0 + while x >= 2: + x /= 2 + k += 1 + + def unit(y): + z = (y - 1) / (y + 1) + power = z + total = Q(0) + for j in range(100): + total += power / (2 * j + 1) + power *= z * z + total *= 2 + tail = 2 * power / (201 * (1 - z * z)) + return total, total + tail + + lo, hi = unit(x) + l2, h2 = unit(Q(2)) + lo += k * l2 + hi += k * h2 + return Q((lo * SCALE).__floor__(), SCALE), Q((hi * SCALE).__ceil__(), SCALE) + + +def exponential(x): + need(0 <= x < 1, 'exp argument') + term = total = Q(1) + for j in range(1, 19): + term *= x / j + total += term + tail = term * x / 19 / (1 - x / 20) + return total, total + tail + + +def H(rank, b): + """Enclosure of H_r(b) = r*(73/r)^b (the moment of one rank-r child times 73).""" + l, h = logarithm(Q(M_BASE, rank)) + return rank * exponential(b * l)[0], rank * exponential(b * h)[1] + + +def moment(profile, b, W): + """Enclosure of sum_r count_r * r * (73/r)^b / (73*W); counts may be Fractions (>=0).""" + lo = hi = Q(0) + for rank, count in profile.items(): + if count == 0: + continue + need(0 < rank < M_BASE and count > 0, 'child profile') + e0, e1 = H(rank, b) + lo += Q(count) * e0 / (M_BASE * W) + hi += Q(count) * e1 / (M_BASE * W) + return Q((lo * SCALE).__floor__(), SCALE), Q((hi * SCALE).__ceil__(), SCALE) + + +def normalize(profile): + out = {} + for r, n in profile.items(): + r = int(r) + n = Q(n) if not isinstance(n, int) else n + if n: + out[r] = out.get(r, 0) + n + return out + + +def rank_mass(profile): + return sum(r * Q(n) for r, n in normalize(profile).items()) + + +def root_bracket(profile, W, digits=25, check_mass_T=None): + """Bisection on the grid 10^-digits: returns (lo, hi) with M(lo) < 1 < M(hi) certified.""" + profile = normalize(profile) + if check_mass_T is not None: + need(rank_mass(profile) == MASS_PER_REPLICA * check_mass_T, 'rank-mass identity (incomplete profile?)') + G = 10 ** digits + low, high = 0, G // 100 + need(moment(profile, Q(low, G), W)[1] < 1 < moment(profile, Q(high, G), W)[0], 'root initial interval') + while high - low > 1: + mid = (low + high) // 2 + a, b = moment(profile, Q(mid, G), W) + if b < 1: + low = mid + elif a > 1: + high = mid + else: + raise ValueError('root interval precision exhausted at %d digits' % digits) + return Q(low, G), Q(high, G) + + +def kappa_from_profile(profile, T, digits=25, strict_mass=True): + """Exact bracket of the complex endpoint for a complete global profile of a T-replica network.""" + return root_bracket(profile, LIVE_PER_REPLICA * T, digits, T if strict_mass else None) + + +def add_profiles(a, b, scale_b=1): + out = dict(normalize(a)) + for r, n in normalize(b).items(): + out[r] = out.get(r, 0) + scale_b * n + need(out[r] >= 0, 'negative count at rank %d' % r) + if out[r] == 0: + del out[r] + return out + + +def delta_value(profile, T, delta, digits=25, strict_mass=True): + """Value (exact root brackets) of changing the complete profile by delta = {rank: +-count}.""" + base = kappa_from_profile(profile, T, digits, strict_mass) + newp = add_profiles(profile, delta) + mass_ok = rank_mass(newp) == MASS_PER_REPLICA * T + new = kappa_from_profile(newp, T, digits, strict_mass and mass_ok) + return dict(base_lower=str(base[0]), base_upper=str(base[1]), new_lower=str(new[0]), new_upper=str(new[1]), + gain_lower=str(new[0] - base[1]), gain_upper=str(new[1] - base[0]), + gain_float=float((new[0] + new[1] - base[0] - base[1]) / 2), new_profile={str(r): str(n) for r, n in sorted(newp.items())}, + new_rank_mass_identity=mass_ok, note=None if mass_ok else 'delta breaks the rank-mass identity: a derivative probe, not a complete legal profile (a legal word change moves local mass and inventory/idle mass together)') + + +def derivatives(profile, T, b=None): + """dkappa/dcount_r (per single child of rank r) by the implicit function theorem, mpmath 40 digits.""" + import mpmath + mpmath.mp.dps = 40 + profile = normalize(profile) + W = LIVE_PER_REPLICA * T + if b is None: + lo, hi = kappa_from_profile(profile, T, strict_mass=False) + b = (lo + hi) / 2 + b = mpmath.mpf(b.numerator) / b.denominator + dMdb = mpmath.mpf(0) + for r, n in profile.items(): + dMdb += mpmath.mpf(n) * r * mpmath.power(mpmath.mpf(M_BASE) / r, b) * mpmath.log(mpmath.mpf(M_BASE) / r) / (M_BASE * W) + out = {} + for r in range(1, M_BASE): + dMdn = r * mpmath.power(mpmath.mpf(M_BASE) / r, b) / (M_BASE * W) + out[r] = -dMdn / dMdb + return out, b + + +def fmt(x, nd=28): + return mpmath_str(x, nd) + + +def mpmath_str(x, nd): + import mpmath + mpmath.mp.dps = nd + 5 + return mpmath.nstr(mpmath.mpf(x.numerator) / x.denominator if isinstance(x, Q) else x, nd) + + +CALIBRATION = { + 'PR2857': dict(T=37, profile={1: 805860, 2: 213786, 3: 91775, 4: 42624, 5: 13098, 8: 2664, 9: 1, 48: 13379}, + expected_lower='17200966286848326009728/10000000000000000000000000', + expected_upper='17200966286848326009729/10000000000000000000000000', + headline='0.001720096628684832600972 - 1e-46 - 1e-70 (CLAIM.json)'), + 'PR2853': dict(T=74, profile={1: 1616713, 2: 424908, 3: 183207, 4: 85249, 5: 26625, 6: 58, 7: 3, 8: 5328, 32: 47, 48: 26703}, + headline='0.00171937765869758665904733841726077218140089564514 (outer/OUTER-CLAIM.json, = C - 1e-3046 - 1e-3022)'), + 'PR2833': dict(T=74, profile={1: 1603728, 2: 432900, 3: 183683, 4: 85248, 5: 26862, 8: 5328, 9: 1, 48: 26625}, + headline='0.00171865743716685595569345761432428040996497469293 (outer/OUTER-CLAIM.json)'), +} + + +def calibrate(digits=25): + results = {} + for name, c in CALIBRATION.items(): + lo, hi = kappa_from_profile(c['profile'], c['T'], digits) + row = dict(T=c['T'], profile=c['profile'], lower=str(lo), upper=str(hi), lower_decimal=mpmath_str(lo, digits), + upper_decimal=mpmath_str(hi, digits), headline=c['headline'], rank_mass=str(rank_mass(c['profile']))) + if 'expected_lower' in c: + row['reproduces_package_bracket'] = (lo == Q(c['expected_lower']) and hi == Q(c['expected_upper'])) + else: + head = c['headline'].split(' ')[0] + row['headline_inside_bracket'] = (Q(head) >= lo - Q(1, 10 ** 22)) and (Q(head) <= hi) + dec = mpmath_str(lo, digits) + k = 0 + while k < min(len(dec), len(head)) and dec[k] == head[k]: + k += 1 + row['matches_headline_to_digits'] = k - 2 # decimals in common ('0.' excluded) + results[name] = row + return results + + +def main(): + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument('--calibrate', action='store_true') + ap.add_argument('--profile', help='JSON {rank: count}') + ap.add_argument('--profile-file') + ap.add_argument('--T', type=int, default=37) + ap.add_argument('--delta', help='JSON {rank: +-count} (complete-profile change, e.g. 9*T per-call units)') + ap.add_argument('--per-call-delta', help='JSON {rank: +-count per call}; multiplied by 9*T') + ap.add_argument('--digits', type=int, default=25) + ap.add_argument('--table', action='store_true', help='print per-rank derivative table') + ap.add_argument('--no-mass-check', action='store_true') + a = ap.parse_args() + if a.calibrate: + print(json.dumps(calibrate(a.digits), indent=1, sort_keys=True)) + return + profile = json.loads(a.profile) if a.profile else json.load(open(a.profile_file)) + profile = {int(k): (int(v) if str(v).lstrip('-').isdigit() else Q(v)) for k, v in profile.items()} + strict = not a.no_mass_check + lo, hi = kappa_from_profile(profile, a.T, a.digits, strict) + out = dict(T=a.T, W=LIVE_PER_REPLICA * a.T, lower=str(lo), upper=str(hi), lower_decimal=mpmath_str(lo, a.digits), + rank_mass=str(rank_mass(profile))) + if a.delta or a.per_call_delta: + d = {int(k): int(v) for k, v in json.loads(a.delta or a.per_call_delta).items()} + if a.per_call_delta: + d = {k: v * CALLS_PER_REPLICA * a.T for k, v in d.items()} + out['delta'] = delta_value(profile, a.T, d, a.digits, strict) + if a.table: + der, b = derivatives(profile, a.T) + out['derivative_per_child'] = {str(r): mpmath_str(v, 12) for r, v in der.items() if r in profile or r <= 9 or r == 48} + out['derivative_per_call_unit'] = {str(r): mpmath_str(v * CALLS_PER_REPLICA * a.T, 12) for r, v in der.items() if r in profile or r <= 9 or r == 48} + print(json.dumps(out, indent=1, sort_keys=True)) + + +if __name__ == '__main__': + main() diff --git a/research/paired-extension-normal45/tools/wordedit.py b/research/paired-extension-normal45/tools/wordedit.py new file mode 100644 index 0000000000..e5893496cd --- /dev/null +++ b/research/paired-extension-normal45/tools/wordedit.py @@ -0,0 +1,102 @@ +# SPDX-License-Identifier: Apache-2.0 +"""wordedit.py -- generic, pure, reproducible BORROW-WORD edit spec (Marius-Paul Dumitrean, with substantial AI +assistance from Claude Code; supersedes our r12 version). + +make_spec(old, new) -> spec : exact diff of two words (A/B/restore/cut/precondition/compensation gate-level edits with + frames; start_extra / helper_final / removed / warps / initial_corrections / report + replacements; cleanup is NOT stored, it is re-derived). +apply_spec(old, spec) -> word : pure producer; re-derives cleanup with the package's word_patch.derive_cleanup and the + restored set taken from the NEW word's helper_final (r12 used restored_of(old cleanup), + which is stale when an edit adds a restored endpoint, e.g. a paired extraction). +Round trip must give apply_spec(old, make_spec(old, new)) == new (checked by `python wordedit.py OLD NEW [SPEC_OUT]`). +Edit indices: deletes use OLD indices, inserts use NEW indices (apply deletes first, then inserts ascending), +matching lane B's EDITS.json convention. Frames are part of every gate (last element), so a re-solved frame on an +otherwise unchanged gate appears as a 'frame' op (index in NEW coordinates after structural edits). +""" +import gzip, json, sys, copy, difflib +from pathlib import Path +sys.path.insert(0, str(Path(__file__).resolve().parent)) +try: + import word_patch as WP # PR2833's helpers (derive_cleanup); found next to this file inside a derived overlay +except ImportError: # standalone use in this package: PR2894's equal derive_cleanup (vendor/preload_move.py) + sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'vendor')) + import preload_move; sys.modules['word_patch'] = preload_move # noqa: E702 + import word_patch as WP + +GATE_SECTIONS = ('A', 'B', 'restore', 'cut', 'precondition', 'compensation') +FIELD_KEYS = ('warps', 'initial_corrections', 'start_extra', 'helper_final', 'removed', 'report', 'cleanup') + +def load(p): return json.loads(gzip.decompress(Path(p).read_bytes())) +def dump(w, p): Path(p).write_bytes(gzip.compress(json.dumps(w, separators=(',', ':')).encode(), mtime=0)) +def strip(g): return g[:-1] if isinstance(g, list) and g and g[0] in ('add', 'scale') and isinstance(g[-1], list) else g +def key(g): return json.dumps(strip(g)) + +def section_spec(old, new): + sm = difflib.SequenceMatcher(a=[key(g) for g in old], b=[key(g) for g in new], autojunk=False) + deletes, inserts, frames = [], [], [] + for tag, i1, i2, j1, j2 in sm.get_opcodes(): + if tag == 'equal': + for di, (a, b) in enumerate(zip(old[i1:i2], new[j1:j2])): + if a != b: frames.append([j1 + di, b[-1]]) # same gate, new frame (NEW index) + else: + for i in range(i1, i2): deletes.append([i, old[i]]) # OLD indices + for j in range(j1, j2): inserts.append([j, new[j]]) # NEW indices, gate incl. frame + return dict(deletes=deletes, inserts=inserts, frames=frames) + +def apply_section(old, s): + out = [g for i, g in enumerate(old) if i not in {d[0] for d in s['deletes']}] + for j, g in sorted(s['inserts'], key=lambda x: x[0]): out.insert(j, copy.deepcopy(g)) + for j, fr in s['frames']: out[j] = out[j][:-1] + [fr] + return out + +def derive_cleanup(w): + """Inverse-reverse cleanup of w (A without the entry prelude), buffers for every helper_final endpoint.""" + t = copy.deepcopy(w); t['A'] = w['A'][w['prelude_events']:] + return WP.derive_cleanup(t, set(map(int, w['helper_final']))) + +def make_spec(old, new): + spec = {'sections': {}, 'warps': None, 'compensation_removed': [], 'compensation_added': [], + 'initial_corrections': None, 'start_extra': {}, 'start_extra_removed': [], 'helper_final': None, + 'removed': None, 'report': new['report'], 'other': {}} + for sec in GATE_SECTIONS: + if old[sec] != new[sec]: spec['sections'][sec] = section_spec(old[sec], new[sec]) + if old['warps'] != new['warps']: spec['warps'] = new['warps'] + if old['initial_corrections'] != new['initial_corrections']: spec['initial_corrections'] = new['initial_corrections'] + s_ = spec['sections'].get('compensation', {'deletes': [], 'inserts': [], 'frames': []}) + spec['compensation_removed'] = [g for _, g in s_['deletes']]; spec['compensation_added'] = [g for _, g in s_['inserts']] + for k, v in new['start_extra'].items(): + if old['start_extra'].get(k) != v: spec['start_extra'][k] = v + spec['start_extra_removed'] = [k for k in old['start_extra'] if k not in new['start_extra']] + if old['helper_final'] != new['helper_final']: spec['helper_final'] = new['helper_final'] + if old['removed'] != new['removed']: spec['removed'] = new['removed'] + for k in new: + if k not in GATE_SECTIONS + FIELD_KEYS and old.get(k) != new[k]: + spec['other'][k] = new[k] + return spec + +def apply_spec(old, spec): + w = copy.deepcopy(old) + for sec, s in spec['sections'].items(): w[sec] = apply_section(w[sec], s) + if spec.get('warps') is not None: w['warps'] = copy.deepcopy(spec['warps']) + if spec.get('initial_corrections') is not None: w['initial_corrections'] = copy.deepcopy(spec['initial_corrections']) + # compensation is edited positionally through spec['sections']['compensation'] (order-exact) + for k in spec['start_extra_removed']: w['start_extra'].pop(k, None) + for k, v in spec['start_extra'].items(): w['start_extra'][k] = v + if spec.get('helper_final') is not None: w['helper_final'] = copy.deepcopy(spec['helper_final']) + if spec.get('removed') is not None: w['removed'] = copy.deepcopy(spec['removed']) + for k, v in spec['other'].items(): w[k] = copy.deepcopy(v) + w['report'] = copy.deepcopy(spec['report']) + w['cleanup'] = derive_cleanup(w) + return w + +if __name__ == '__main__': + old, new = load(sys.argv[1]), load(sys.argv[2]) + spec = make_spec(old, new) + rebuilt = apply_spec(old, spec) + diff = [k for k in new if rebuilt.get(k) != new[k]] + summary = {sec: {k: len(v) for k, v in s.items()} for sec, s in spec['sections'].items()} + print(json.dumps(dict(roundtrip_exact=(not diff and set(rebuilt) == set(new)), differing_keys=diff, sections=summary, + comp_removed=len(spec['compensation_removed']), comp_added=len(spec['compensation_added']), + start_extra=spec['start_extra'], helper_final_changed=spec['helper_final'] is not None, + buffers=len(new['helper_final']), report=spec['report']))) + if len(sys.argv) > 3: Path(sys.argv[3]).write_text(json.dumps(spec, indent=1)) diff --git a/research/paired-extension-normal45/vendor/audit_local.py b/research/paired-extension-normal45/vendor/audit_local.py new file mode 100644 index 0000000000..8224873d04 --- /dev/null +++ b/research/paired-extension-normal45/vendor/audit_local.py @@ -0,0 +1,501 @@ +"""Independent exact scalar/frame audit of the changed forward supplier. + +This does not import a generator, builder, stored compensation, or price. +All claimed endpoint matrices are derived from the input word's gates. +Optional --main checks the transported boundary against the pinned parent. +Prepared for icekylinx with OpenAI GPT-6 Astra assistance. Apache-2.0. +""" +import argparse,gzip,json,hashlib,time +from pathlib import Path +from fractions import Fraction as F +from collections import Counter + +def require(x,label): + if not x:raise RuntimeError(label) + +def basis(vs): + piv={} + for a in vs: + while a: + bit=a.bit_length()-1 + if bit in piv:a^=piv[bit] + else: + piv[bit]=a;break + for k in sorted(piv): + for j in piv: + if j>k and piv[j]>>k&1:piv[j]^=piv[k] + return tuple(piv[k] for k in sorted(piv,reverse=True)) + +def contained(a,b):return basis(a+b)==b + +def registers(e):return e[1:3] if e[0]=='add' else e[1:2] + +def apply(e,rows,dual=False): + if e[0]=='add': + t,s=e[1:3];q=F(e[3],e[4]);require(t!=s,'self add') + if dual:t,s,q=s,t,-q + dst=rows[t] + for k,x in list(rows[s].items()): + a=dst.get(k,F(0))+q*x + if a:dst[k]=a + else:dst.pop(k,None) + elif e[0]=='scale': + t=e[1];q=F(e[2],e[3]);require(q!=0,'zero scale') + if dual:q=1/q + rows[t]={k:q*x for k,x in rows[t].items()} + else:raise RuntimeError('unknown scalar primitive') + +def invert(e): + r=list(e) + if r[0]=='add':r[3]=-r[3] + else:r[2],r[3]=r[3],r[2] + return r + +def check_parent_interface(word,main): + # Read only the retained boundary data. No builder or local checker is imported. + relative="research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz" + path=main/relative;raw=path.read_bytes() + require(hashlib.sha256(raw).hexdigest()=="66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844",'parent canonical input pin') + parent=json.loads(gzip.decompress(raw)) + tau=lambda x:x^(43 if (x&43).bit_count()%2 else 0) + ports=parent['ports'];v=word['report']['v'] + require(len(ports)==len(set(ports))==v,'parent port count') + require(set(map(tau,word['ports']))==set(ports),'transported source/target ports') + moved={i:ports.index(tau(p)) for i,p in enumerate(word['ports'])} + centers=[moved.get(r,r) for r in word['centers']] + actual=[list(basis([tau(x) for x in frame])) for frame in word['center_frames']] + expected=[parent['frames'][f] for f in parent['center_frames']] + require(len(centers)==len(set(centers))==len(actual)==8,'eight distinct centre carriers') + require(actual==expected and all(len(f)==8 for f in actual),'ordered centre frame interface') + return dict(parent_path=relative,parent_file_sha256=hashlib.sha256(raw).hexdigest(), + transport_tau=43,ordered_frame_bases_match=True,all_ports_match=True, + transported_centers=centers,source_centers=[r for r in centers if r=2*v} + for e in w['precondition']:apply(e,dirt) + compensation=[['add',y,k,-a.numerator,a.denominator,[]] for y in range(v,2*v) for k,a in sorted(dirt[y].items())] + entering=set(map(int,w.get('start_extra',{})));lowends=set(map(int,w.get('helper_final',{}))) + coldends=lowends-entering + require(not any(e[2] in entering for e in compensation),'nonzero entrance response') + require(not any(r in entering|coldends for e in w['precondition']+compensation for r in registers(e)), 'pre-wrapper touch of residual helper') + require(all(e[-1]==[] for e in w['precondition']+compensation),'nonzero frame precondition') + early=w.get('early_cleanup',[]);earlyids={i for i,U in early} + require(len(earlyids)==len(early),'duplicate early cleanup gate') + tail=[w['cleanup'][i][:-1]+[U] for i,U in early] + cleanup=[e for i,e in enumerate(w['cleanup']) if i not in earlyids] + prefix=w['precondition']+compensation+main + program=prefix+tail+cleanup + for dual in (False,True): + actual=ident() + for e in program:apply(e,actual,dual) + expected=ident() + for t in range(v):expected[t if dual else v+t][v+t if dual else t]=F(-1 if dual else 1) + bad=[i for i in range(n) if actual[i]!=expected[i]] + require(not bad,'all-column endpoint failure '+str((dual,bad[:8]))) + print('endpoint', 'dual' if dual else 'forward','PASS',flush=True) + full=basis([1<>=1;i+=1 + return y + +def ginv(cols,h): + # inverse columns over F2 (None if singular), Gauss-Jordan on (G | I) column-wise + piv={}; + for i in range(h): + a=cols[i];b=1<>s&1:a^=piv[s][0];b^=piv[s][1] + if a:return None + pre.append(b) + return pre # pre[t] = G^{-1}(e_t) + +def gtrans(cols,h): + # transpose: column j of G^T = row j of G + return [sum(((cols[i]>>j)&1)< E (used for B-phase warps and for A-phase prelude warps)""" + inv=ginv(cols,h);require(inv is not None,'G not invertible') + require(all(gmul(cols,inv[t])==1<(Gx, (G+G^-T)x + G^-T z) + GiT=gtrans(inv,h) # G^{-T}: columns j = row j of G^{-1} + # G^{-T}(z): via columns GiT + def M(vec): + x=vec&((1<>h + gx=gmul(cols,x);S=gx^gmul(GiT,x) # (G + G^{-T}) x + return gx|((S^gmul(GiT,z))<>h)|((vec&((1<0)-(op<0))*(abs(op)+dsym)) + walg_add(rows[src],row,-c) + return + if e[0]=='warp': + op=e[2];s=(op>0)-(op<0) + if dual:op=s*(abs(op)+dsym) # dual orientation: K_G^{-T} is a distinct free symbol + rows[e[1]]=walg_warp(rows[e[1]],op);return + if e[0]=='add': + t,s=e[1:3];q=F(e[3],e[4]);require(t!=s,'self add') + if dual:t,s,q=s,t,-q + walg_add(rows[t],rows[s],q) + else: + t=e[1];q=F(e[2],e[3]);require(q!=0,'zero scale') + if dual:q=1/q + rows[t]={k:q*x for k,x in rows[t].items()} + +def invert_item(e,full): + if e[0]=='warp':return ['warp',e[1],-e[2]] + r=list(e) + if r[0]=='add':r[3]=-r[3] + else:r[2],r[3]=r[3],r[2] + return r + +def run_borrow(path,out,main,base,w,data,begin): + v,h,R=w['report']['v'],w['report']['h'],w['report']['R'];n=2*v+R + require((v,h)==(112,9),'wrong source geometry') + require(main is None,'--main parent interface is not available for coordinate-changed BORROW-WORD; use --base') + full=basis([1<=2*v,'correction source must be a remaining helper') + require(s not in entering,'correction source has nonzero entrance frame') + require(len(word)>=1 and all(1<=abs(o)<=K for o in word),'correction operator word') + require(c!=0 and c.denominator&(c.denominator-1)==0,'correction coefficient') + # the source is the lender of the operator it is read through + require(all(warps[abs(o)-1][1]==s for o in word),'correction source is not the lender of its operator') + # --- 4. frames: literal chain, monotone, paid profile --------------------------------------- + end=[full]*v+[basis([x for x in range(1,1<0 else list(to_),list(to_) if op_>0 else list(fr_),h) + require(cur[r_]==basis(fr_),'prelude warp frame mismatch '+str((r_,op_))) + cur[r_]=basis(to_) + else: + for q in registers(e):climb(q,e[-1]) + for e in Aord: + for q in registers(e):climb(q,e[-1]) + lev={int(t):basis(U) for t,U in w.get('target_levels',{}).items()} + require(all(cur[v+t]==lev.get(t,()) for t in range(v)),'target centre levels') + for q,U in zip(w['centers'],w['center_frames']): + U=basis(U);require(cur[q]==U,'center frame') + served={lev.get(e[1]-v,()) for e in w['cut'] if e[2]==q} + for T in sorted(served,key=lambda x:-len(x)): + require(contained(T,U),'center path not nested') + if T!=U:paid[len(U)-len(T)]+=1 + U=T + byposition={} + for op,rec in enumerate(warps,1):byposition.setdefault(rec[0],[]).append(op) + B=w['B'];forward=[] # chronological program of the (recorded) non-target word + for e in Aord:forward.append(e) + for p in range(len(B)+1): + for op in byposition.get(p,[]): + _,lender,cols,U,E=warps[op-1] + require(cur[lender]==basis(U),'warp frame mismatch '+str((op,lender,cur[lender],basis(U)))) + cur[lender]=basis(E);forward.append(['warp',lender,op]) + if pk and piv[j]>>k&1:piv[j]^=piv[k] + return tuple(piv[k] for k in sorted(piv,reverse=True)) + +def contained(a,b):return basis(a+b)==b + +def restored_of(w): + n=2*w['report']['v']+w['report']['R'] + return {g[1]-n for g in w['cleanup'] if g[1]>=n}|{g[2]-n for g in w['cleanup'] if g[0]=='add' and g[2]>=n} + +def derive_cleanup(w,restored): + v=w['report']['v'];n=2*v+w['report']['R'];full=list(basis([1<=224) + return {str(k):v for k,v in sorted(paid.items())},{str(k):v for k,v in sorted(inv.items())} + +def apply(word, patch): + """Return (changed word, ledger). Authenticates the decoded source first.""" + require(patch.get('stage')=='preload-move','stage tag') + digest=canon(word);require(digest==patch['source_canonical_sha256'],'source canonical hash differs from the declared source') + require(patch['variant'] in SOURCE_CANONICAL and SOURCE_CANONICAL[patch['variant']]==digest,'unauthorized decoded source SHA256') + x=copy.deepcopy(word) + # A: replacements and insertions, both addressed by index in the SOURCE A (before any edit). + ops=patch['A_edits'];seen=set();byp={};repl={} + for e in ops: + if e['op']=='replace': + i=e['index'];require(i not in seen and i not in repl,('duplicate A replace',i));require(word['A'][i]==e['old'],('A old gate mismatch',i,word['A'][i]));repl[i]=e['new'] + else: + require(e['op']=='insert' and 0<=e['before']<=len(word['A']),'A edit op');byp.setdefault(e['before'],[]).append(e['gate']) + A=[] + for p in range(len(word['A'])+1): + A.extend(copy.deepcopy(g) for g in byp.get(p,[])) + if p WORD exactly (the recorded-spec stage). +Structure adapted from Mason Hale's PR2917 verify.py. Marius-Paul Dumitrean, with substantial AI +assistance (Anthropic Claude via Claude Code). Local only: native, owner and outer admission are separate. +""" +import argparse, contextlib, copy, gzip, hashlib, io, json, sys, time, types +from pathlib import Path + +P = Path(__file__).resolve().parent + + +def read(p): + b = p.read_bytes() + return json.loads(gzip.decompress(b) if b[:2] == b'\x1f\x8b' else b) + + +def sha(p): + return hashlib.sha256(p.read_bytes()).hexdigest() + + +def load(name, p): + m = types.ModuleType(name) + m.__file__ = str(p) + sys.modules[name] = m + exec(compile(p.read_bytes(), str(p), 'exec'), m.__dict__) + return m + + +def save_word(p, w): + p.write_bytes(gzip.compress(json.dumps(w, separators=(',', ':')).encode(), mtime=0)) + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('--work', type=Path, required=True) + a = ap.parse_args() + if not __debug__: + raise SystemExit('refusing python -O: the structural checker relies on assertions') + begin = time.monotonic() + out = a.work.resolve() + assert not out.exists() and not out.is_relative_to(P) + pins = read(P / 'PINS.json') + local = {f.relative_to(P).as_posix() for d in ('vendor', 'data') for f in (P / d).rglob('*') if f.is_file()} + assert local | {'producer.py', 'structure.py', 'tools/wordedit.py'} <= set(pins), 'every local input pinned' + assert all(sha(P / n) == h for n, h in pins.items()), 'pinned bytes' + out.mkdir(parents=True) + pm = load('preload_move', P / 'vendor/preload_move.py') + gen = load('normal45_producer', P / 'producer.py') + aud = load('independent_paired_audit', P / 'vendor/audit_local.py') + structural = load('independent_paired_structure', P / 'structure.py') + we = load('normal45_wordedit', P / 'tools/wordedit.py') + transforms = [read(P / f'data/TRANSFORM-{h}.json') for h in gen.HELPERS] + assert all(t['normal'] == gen.NORMAL and t['after'][0][-1] == gen.FRAME == gen.hyperplane(gen.NORMAL) for t in transforms) + wrong = gen.hyperplane(46) + + def audit(word, name): + path = out / (name + '.json.gz') + save_word(path, word) + with contextlib.redirect_stdout(io.StringIO()): + return aud.run(path, out / (name + '.json')) + + def rejected(word, name): + try: + audit(word, name) + except (AssertionError, RuntimeError, ValueError) as error: + return str(error)[:240] + raise AssertionError('semantic mutant accepted by the auditor: ' + name) + + def cert_rejects(parent, transform, name): + try: + structural.check(gen.refit(parent, transform), transform, aud) + except (AssertionError, KeyError, ValueError) as error: + return type(error).__name__ + ' ' + str(error)[:160] + raise AssertionError('mutant transform accepted by the certificate: ' + name) + + def recut(word, restored): + z = copy.deepcopy(word) + z['A'] = z['A'][z['prelude_events']:] + return pm.derive_cleanup(z, restored) + + def rereport(word): + try: + profile, inventory = pm.frame_report(word) + except ValueError: + return word # an illegal frame chain keeps the claimed report; the auditor recounts it + word['report']['local_profile'], word['report']['width_inventory'] = profile, inventory + return word + + records, controls = {}, {} + for tag in ('base', 'extra'): + parent = read(P / f'data/PARENT-{tag}.json.gz') + assert len(parent['helper_final']) == gen.PARENT_BUFFERS + w, steps = parent, [] + for k, t in enumerate(transforms, 1): + h, n = t['helper'], w['prelude_events'] + cert = structural.check(gen.refit(w, t), t, aud) + assert cert['status'] == 'PASS_EXACT_TWO_SIDED_SUBSPACE_CERTIFICATE' and cert['helper'] == h + child = gen.apply_stage(w, t) + profile, inventory = pm.frame_report(child) + assert (profile, inventory) == (child['report']['local_profile'], child['report']['width_inventory']) + assert child['helper_final'][str(h)] == gen.FRAME and len(child['helper_final']) == gen.PARENT_BUFFERS + k + name = f'{tag}-step{k}-{h}' + # (e1) drop the first literal input gate (the input change S no longer carries v) + bad = copy.deepcopy(child); del bad['A'][n] + bad['cleanup'] = recut(rereport(bad), set(map(int, bad['helper_final']))) + bt = dict(t, before=t['before'][1:]) + controls[name + '-drop-input-gate'] = {'auditor': rejected(bad, name + '-drop-input-gate'), + 'certificate': cert_rejects(w, bt, name + '-drop-input-gate')} + # (e2) flip the sign of the first output addition (T no longer has row alpha / column e_h) + i = next(j for j, g in enumerate(t['after']) if g[0] == 'add') + bad = copy.deepcopy(child); g = bad['restore'][len(w['restore']) + i]; g[3] = -g[3] + bad['cleanup'] = recut(rereport(bad), set(map(int, bad['helper_final']))) + after = copy.deepcopy(t['after']); after[i][3] = -after[i][3] + controls[name + '-flip-output-coefficient'] = {'auditor': rejected(bad, name + '-flip-output-coefficient'), + 'certificate': cert_rejects(w, dict(t, after=after), name + '-flip-output-coefficient')} + # (e3) the whole output change and the endpoint on the wrong hyperplane E_46 + bad = copy.deepcopy(child) + for g in bad['restore'][len(w['restore']):]: + g[-1] = list(wrong) + bad['helper_final'][str(h)] = list(wrong) + bad['cleanup'] = recut(rereport(bad), set(map(int, bad['helper_final']))) + controls[name + '-wrong-hyperplane'] = {'auditor': rejected(bad, name + '-wrong-hyperplane')} + # (e4) stale cleanup: re-derived without the new endpoint's private zero buffer + bad = copy.deepcopy(child) + bad['cleanup'] = recut(bad, set(map(int, w['helper_final']))) + controls[name + '-stale-cleanup'] = {'auditor': rejected(bad, name + '-stale-cleanup')} + # (e5) omit the step's declared frame edits (keep the claimed report and cleanup) + assert t['frame_changes'] + bad = copy.deepcopy(child) + for e in t['frame_changes']: + assert bad[e['section']][e['candidate_index']][:-1] == e['gate'] and bad[e['section']][e['candidate_index']][-1] == e['new_frame'] + bad[e['section']][e['candidate_index']][-1] = list(e['old_frame']) + controls[name + '-omit-frame-edits'] = {'auditor': rejected(bad, name + '-omit-frame-edits')} + steps.append({'step': k, 'helper': h, 'normal': t['normal'], 'hyperplane': gen.FRAME, + 'inputs': len(t['before']), 'outputs': len(t['after']), 'frame_edits': len(t['frame_changes']), + 'certificate': {key: cert[key] for key in ('status', 'helper', 'alpha', 'y', 'u', 'v')}, + 'local_profile': profile, 'width_inventory': inventory, 'buffers': len(child['helper_final'])}) + w = child + word_path = P / f'data/WORD-{tag}.json.gz' + shipped = read(word_path) + assert gen.apply(parent, transforms) == w == shipped, 'complete producer reconstruction' + changed = sorted(key for key in parent if parent[key] != shipped[key]) + assert set(changed) == gen.ALLOWED, 'exact changed sections' + report = audit(shipped, f'AUDIT-{tag}') + assert report['status'] == 'PASS_INDEPENDENT_EXACT_BORROWING_WORD' + assert report['orientations'] == {'forward': 'PASS', 'dual': 'PASS'} + assert report['independent_inputs'] == 632 and report['restored_cold'] == report['zero_buffers'] == gen.BUFFERS + assert {str(r): c for r, c in report['local_profile'].items()} == gen.PROFILE + assert {str(r): c for r, c in report['width_inventory'].items()} == gen.INVENTORY + profile, inventory = pm.frame_report(shipped) + assert profile == shipped['report']['local_profile'] == gen.PROFILE and inventory == shipped['report']['width_inventory'] == gen.INVENTORY + spec = we.make_spec(parent, shipped) + assert we.apply_spec(parent, spec) == shipped and shipped['cleanup'] == we.derive_cleanup(shipped), 'overlay spec round trip' + records[tag] = {'parent_sha256': sha(P / f'data/PARENT-{tag}.json.gz'), 'word_sha256': sha(word_path), + 'changed_sections': changed, 'steps': steps, + 'audit': {key: report[key] for key in ('status', 'independent_inputs', 'restored_cold', 'zero_buffers', + 'local_profile', 'width_inventory', 'local_mass', 'orientations', 'content_sha256')}, + 'frame_report': {'local_profile': profile, 'width_inventory': inventory}, + 'overlay_spec_sections': {sec: {k_: len(v_) for k_, v_ in s.items()} for sec, s in spec['sections'].items()}} + assert len(controls) == 5 * len(transforms) * 2 + assert all(sha(P / n) == h for n, h in pins.items()), 'input drift' + result = {'status': 'PASS_FOUR_NORMAL45_PAIRED_EXTRACTIONS', 'providers': records, 'semantic_controls': controls, + 'local_profile': gen.PROFILE, 'width_inventory': gen.INVENTORY, 'buffers': gen.BUFFERS, + 'seconds': round(time.monotonic() - begin, 1), + 'scope': 'Exact finite local identities, frame invoice and all-input forward/dual replay; native, owner and outer admission are separate.'} + (out / 'RESULT.json').write_text(json.dumps(result, indent=2, sort_keys=True) + '\n') + print(result['status'], 'controls', len(controls), 'seconds', result['seconds'], flush=True) + + +if __name__ == '__main__': + main()