diff --git a/.github/workflows/e8-outer-slack-refinement.yml b/.github/workflows/e8-outer-slack-refinement.yml new file mode 100644 index 0000000000..06a45cf0a7 --- /dev/null +++ b/.github/workflows/e8-outer-slack-refinement.yml @@ -0,0 +1,31 @@ +name: Verify E8 outer slack refinement +on: + pull_request: + paths: + - 'research/e8-outer-slack-refinement/**' + - '.github/workflows/e8-outer-slack-refinement.yml' + push: + paths: + - 'research/e8-outer-slack-refinement/**' + - '.github/workflows/e8-outer-slack-refinement.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python: ['3.11', '3.14'] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 + with: + python-version: ${{ matrix.python }} + - name: Replay source and new certificate + run: python -B research/e8-outer-slack-refinement/verify.py "$RUNNER_TEMP/e8-composed" + - name: Confirm source tree unchanged + run: git diff --exit-code diff --git a/certificates/joint-dual-kappa.json b/certificates/joint-dual-kappa.json index b7f7b89bc2..1f35b89221 100644 --- a/certificates/joint-dual-kappa.json +++ b/certificates/joint-dual-kappa.json @@ -842,7 +842,7 @@ "scripts/experiments/pin_joint_dual_sources.py": "4d31cc0e38b7902709ca5f8f714cba109760d2592346dd7f8dc0b900a2d9fe00", "scripts/experiments/verify_joint_dual.py": "7a31bba1e9c0ded32ae285df2ca9bc91ef20c330f6789fdba361876f3c7a1985" }, - "source_manifest_sha256": "4f3c15b82a2d97335d4fe95fb8bcb96bd2a921087da289d9da16c68213a17f17", + "source_manifest_sha256": "698fe862a620e5b80b85fbc6034c9456fa0fa9aea638dbbbcb3f9edd24c0415e", "sources": [ { "files": { diff --git a/certificates/joint-dual-validation.json b/certificates/joint-dual-validation.json index 194861d3c3..61a8d41622 100644 --- a/certificates/joint-dual-validation.json +++ b/certificates/joint-dual-validation.json @@ -226,7 +226,7 @@ } }, "bit_saving": "2382370177/50000000000000", - "certificate_sha256": "9801147b1502cf1e43d5fa39aa37f5291f03b48c30c4dd4f272e0877894a1c24", + "certificate_sha256": "6f684fa7f747073a132e8d0b5652cf12a8afa389f2a16ff6ade8e080d786dd22", "kappa": "4764513337/100000000000000", "margins": 7, "producer_words_regenerated_and_matched": true, diff --git a/research/e8-outer-slack-refinement/BOOTSTRAP-SOURCES.json b/research/e8-outer-slack-refinement/BOOTSTRAP-SOURCES.json new file mode 100644 index 0000000000..9724a9315d --- /dev/null +++ b/research/e8-outer-slack-refinement/BOOTSTRAP-SOURCES.json @@ -0,0 +1,18 @@ +{ + "repository": "https://github.com/CrocSwap/integer-mult-bounds", + "commit": "12a4934d15006e8c10f9b2264f13f8f341be802b", + "files": [ + { + "path": "docs/research/community-round8-review.md", + "sha256": "47ba1520e251d501396ca7d316c75848a572036caad111060148a30b00ac4ad0" + }, + { + "path": "research/community-round8-audit/pr185-proof-reviewed.md", + "sha256": "bbac6ec77f315dd76324f4595b8c7a9b0ec719f3903d0c56c61f23990326e8fa" + }, + { + "path": "research/five-stage-source527-banks/proof/FINITE_BIT_ACCOUNTING.md", + "sha256": "602923520af184670170bf159fde7b4c72e79a72570eddd7746b7c97bc51fc5b" + } + ] +} diff --git a/research/e8-outer-slack-refinement/EXPECTED-COARSE-PRECISION.json b/research/e8-outer-slack-refinement/EXPECTED-COARSE-PRECISION.json new file mode 100644 index 0000000000..587037bf60 --- /dev/null +++ b/research/e8-outer-slack-refinement/EXPECTED-COARSE-PRECISION.json @@ -0,0 +1,16 @@ +{ + "status": "PASS_TWO_EXACT_MOMENT_ENGINES", + "coarse_lower": "999632926176283805553/1000000000000000000000000", + "coarse_upper": "499816463088141902777/500000000000000000000000", + "original_coarse": "999632926176283/1000000000000000000", + "coarse_gain": "805553/1000000000000000000000000", + "grid": "1/1000000000000000000000000", + "density": "1/10000000000000000", + "fallback_rank_one_calls": 52928992224, + "profile_unchanged": true, + "first_engine_lower_residual_upper": "-28877751866598993727584486978851905569922917/26959946667150639794667015087019630673637144422540572481103610249216", + "first_engine_upper_residual_lower": "33834355060284072147343280309595956481771035/26959946667150639794667015087019630673637144422540572481103610249216", + "second_engine_lower_residual_upper": "-10711348028503837227483/10000000000000000000000000000000000000000000000", + "second_engine_upper_residual_lower": "12549851971708302945039/10000000000000000000000000000000000000000000000", + "next_coarse_grid_rejected": true +} diff --git a/research/e8-outer-slack-refinement/EXPECTED-WITNESS.json b/research/e8-outer-slack-refinement/EXPECTED-WITNESS.json new file mode 100644 index 0000000000..26115313bc --- /dev/null +++ b/research/e8-outer-slack-refinement/EXPECTED-WITNESS.json @@ -0,0 +1,223 @@ +{ + "kappa": "199726931618167/200000000000000000", + "kappa_float": 0.000998634658090835, + "eta": "1/1000000000000000000", + "beta": "1/1000000000000000000", + "saving_backoff": "1/1000000000000000000000000", + "degraded_bit_saving": "999632926176283804552367073823716194447/1000000000000000000000000000000000000000000", + "bit_coarse": "251726760077483/250000000000000000", + "complex_coarse": "999632926176283805553/1000000000000000000000000", + "bootstrap_rounds": 6, + "bootstrap_chain": [ + "384599/10000000000", + "998672105971565492143128511789926371179908436634864383590926715143743752086364191/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "999631965708771032689686466042213412678462118895980701012397204757948633469014114544304883178917116203443795870891013847377/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "999632925216168854262972744637182945416870271556295183887584588018799287840110372446789159077075417742506410434454528167371633781552280252373608740286971962512915519/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "999632926175324042035143689307419031796644938969045109029279684555953652706549664310666809506120453059008024235714745333749494464373509441245337449265433025332908687086421850354191601265580431801397487922993/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "999632926176282845142153547495868542324660835726655625969537595750669761959902584120445606990266509294204867876034603943675127623447919510066120318581274806631193127513064599743356064856539870537469485521379498660564414455068986648457802436150219871/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "999632926176283803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "bootstrap_stages": [ + { + "level": 1, + "ordinary_calls_only_to_level": 0, + "gaps": { + "atom": "960820204718312409238562033789823267091563365135616409073284856256247913635809/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "borrowing": "998001694967852150703304504414386357434373091563365135616409073284856256247913635809/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "remainder": "998001733413634528150561999117968779987115558375540435616409073284856256247913635809/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "stock": "999000367073823716195447632926176283805553/1000000000000000000000000000000000000000000" + }, + "minimum_gap": "960820204718312409238562033789823267091563365135616409073284856256247913635809/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "cutoff_examples_by_constant_bits": { + "1": "38995837014582", + "80": "38995837014582", + "210001": "38995837014582" + } + }, + { + "level": 2, + "ordinary_calls_only_to_level": 1, + "gaps": { + "atom": "960467512771862680607781502781768537881104019298987602795242051366530985885455695116821082883796556204129108986152623/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "borrowing": "998000735108114945162757946460134070392874537881104019298987602795242051366530985885455695116821082883796556204129108986152623/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "remainder": "998001733413634528150561999117968779987115558375540435616409073284856256247913635809/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "stock": "999000367073823716195447632926176283805553/1000000000000000000000000000000000000000000" + }, + "minimum_gap": "960467512771862680607781502781768537881104019298987602795242051366530985885455695116821082883796556204129108986152623/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "cutoff_examples_by_constant_bits": { + "1": "39024481487574852455", + "80": "39024481487574852455", + "210001": "39024481487574852455" + } + }, + { + "level": 3, + "ordinary_calls_only_to_level": 2, + "gaps": { + "atom": "960114950289394329186533249030129728443704816112415411981200712159889627553210840922924582257493589565545471832628366218447719747626391259713028037487084481/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "borrowing": "998000734148607547341184660181539100860136129728443704816112415411981200712159889627553210840922924582257493589565545471832628366218447719747626391259713028037487084481/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "remainder": "998001733413634528150561999117968779987115558375540435616409073284856256247913635809/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "stock": "999000367073823716195447632926176283805553/1000000000000000000000000000000000000000000" + }, + "minimum_gap": "960114950289394329186533249030129728443704816112415411981200712159889627553210840922924582257493589565545471832628366218447719747626391259713028037487084481/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "cutoff_examples_by_constant_bits": { + "1": "39053147001425093149350834", + "80": "39053147001425093149350834", + "210001": "39053147001425093149350834" + } + }, + { + "level": 4, + "ordinary_calls_only_to_level": 3, + "gaps": { + "atom": "959762517223384516297162650355061030954890970720315444046347293450335689333190493879546940991975764285254666250505535626490558754662550734566974667091312913578149645808398734419568198602512077007/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "borrowing": "998000734147648392153412489236868864773756355061030954890970720315444046347293450335689333190493879546940991975764285254666250505535626490558754662550734566974667091312913578149645808398734419568198602512077007/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "remainder": "998001733413634528150561999117968779987115558375540435616409073284856256247913635809/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "stock": "999000367073823716195447632926176283805553/1000000000000000000000000000000000000000000" + }, + "minimum_gap": "959762517223384516297162650355061030954890970720315444046347293450335689333190493879546940991975764285254666250505535626490558754662550734566974667091312913578149645808398734419568198602512077007/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "cutoff_examples_by_constant_bits": { + "1": "39081833571588011822532505980152", + "80": "39081833571588011822532505980152", + "210001": "39081833571588011822532505980152" + } + }, + { + "level": 5, + "ordinary_calls_only_to_level": 4, + "gaps": { + "atom": "959410213526327847652122339164273344374030462404249330238040097415879554393009733490705795132123965396056324872376552080489933879681418725193368806872486935400256643935143460129462530514478620501339435585544931013351542197563849780129/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "borrowing": "998000734147647433350305479378680415263228339164273344374030462404249330238040097415879554393009733490705795132123965396056324872376552080489933879681418725193368806872486935400256643935143460129462530514478620501339435585544931013351542197563849780129/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "remainder": "998001733413634528150561999117968779987115558375540435616409073284856256247913635809/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "stock": "999000367073823716195447632926176283805553/1000000000000000000000000000000000000000000" + }, + "minimum_gap": "959410213526327847652122339164273344374030462404249330238040097415879554393009733490705795132123965396056324872376552080489933879681418725193368806872486935400256643935143460129462530514478620501339435585544931013351542197563849780129/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "cutoff_examples_by_constant_bits": { + "1": "39110541213530566641979748615606297618", + "80": "39110541213530566641979748615606297618", + "210001": "39110541213530566641979748615606297618" + } + }, + { + "level": 6, + "ordinary_calls_only_to_level": 5, + "gaps": { + "atom": "959058039150736366950593223386120004167157193220918372086967646124904266871138857981690301481661995735013379563424350726069181488023713968185967592824418917365639965956352845582681270896779860526943587916511794799845173973079535675951758880333114850353379067603637560743663/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "borrowing": "998000734147647432391854323891503303978056593223386120004167157193220918372086967646124904266871138857981690301481661995735013379563424350726069181488023713968185967592824418917365639965956352845582681270896779860526943587916511794799845173973079535675951758880333114850353379067603637560743663/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "remainder": "998001733413634528150561999117968779987115558375540435616409073284856256247913635809/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "stock": "999000367073823716195447632926176283805553/1000000000000000000000000000000000000000000" + }, + "minimum_gap": "959058039150736366950593223386120004167157193220918372086967646124904266871138857981690301481661995735013379563424350726069181488023713968185967592824418917365639965956352845582681270896779860526943587916511794799845173973079535675951758880333114850353379067603637560743663/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "cutoff_examples_by_constant_bits": { + "1": "39139269942731077062148119183061419031826549", + "80": "39139269942731077062148119183061419031826549", + "210001": "39139269942731077062148119183061419031826549" + } + } + ], + "strict_constraints": { + "bit_positive": "999632926176283803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "complex_above_bit": "1959690965327020172503593223386120004167157193220918372086967646124904266871138857981690301481661995735013379563424350726069181488023713968185967592824418917365639965956352845582681270896779860526943587916511794799845173973079535675951758880333114850353379067603637560743663/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "complex_below_one_over32": "30250367073823716194447/1000000000000000000000000", + "beta_positive": "1/1000000000000000000", + "beta_below_one": "999999999999999999/1000000000000000000", + "leaf_saving_above_bit": "960058039150736366950593223386120004167157193220918372086967646124904266871138857981690301481661995735013379563424350726069181488023713968185967592824418917365639965956352845582681270896779860526943587916511794799845173973079535675951758880333114850353379067603637560743663/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "q_positive": "499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "q_below_internal": "999632926176283803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "q_below_leaf": "1479661945751651987068605646366039829579985373224339181876326629841533761348601782865940883869692139885816388300050179628021211180587506258023802308388495490496852390153757505425700669492037084680790523061476036872978999070027973038130705467087021749224930653468703930018452432396362439256337/500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "c_positive": "499816463088142025797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "c_below_one": "499500183536911857974202978408839793889845105646366039829579985373224339181876326629841533761348601782865940883869692139885816388300050179628021211180587506258023802308388495490496852390153757505425700669492037084680790523061476036872978999070027973038130705467087021749224930653468703930018452432396362439256337/500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "q_below_reservations": "1/4000000000000000000", + "lambda_above_tau": "999632926176283803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "lambda_above_sigma": "2959323891503303976096902258059099831663563969834798367919810452903985894784171211856786034610523137753323078081762354991055801924599363242116786104800704949179672373131933928217041304940427014944262317019731934272901586056567740876106584907253579174401620187270522710390283932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "lambda_above_internal": "999632926176283803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "lambda_prime_above_lambda": "999632926176283803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "compact_leaf": "1479661945751651987068605646366039829579985373224339181876326629841533761348601782865940883869692139885816388300050179628021211180587506258023802308388495490496852390153757505425700669492037084680790523061476036872978999070027973038130705467087021749224930653468703930018452432396362439256337/500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "compact_reservations": "1/4000000000000000000", + "lambda_prime_below_one": "499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "epsilon_positive": "499999999999999999500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663", + "epsilon_below_one": "499816463088142400797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663", + "guard_width": "499816463088142400797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663", + "K_geometry": "375499816463088142025797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663000000000000000000", + "K_dominates_log": "499816463088142025297205128072064084357872762473754060265120273141700647703658743382805420527724846975592877478909642980124495569641960257795177119462673369997408872199010767526949918234737985071151720661720420744910146430561047807811523991448063834848293602940951288905774813618317819206478221072341490762115432396362439256337/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663000000000000000000", + "record_suffix": "499816463088142400797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663", + "phase_local": "3998531704705138705876356266193506980442133237911475253205222660571326374569372334492069091087512366914006690391064663779409777469290702861646698855350129563830792713479542334048983187158435447091247034217460827979376485000228789696958530501252252567933355333331799044331260239337390309077311194297804415967756432396362439256337/4003998531704705135206376172729281648881239154829071681363360117014205286544989386961267729909211185737072472929042462880913468893599598562975830310555299949935809581532892036076025180878769939956594394644063703322553675815508191705016168007439776215694954356263303826006200554772250368559852380540829100485949304000000000000000000", + "phase_boundary": "799706340941027340775418082768187875450809374654130162517129049207097138577862765477885163718563777256028347157094359048634662589611852480982450411110169615183127487165913473228838484142483481815731318966498169936435832593675425684024124549431280011969870322688738239370816421537095461195406761634524027208313232396362439256337/800799706340941027041275234545856329776247830965814336272672023402841057308997877392253545981842237147414494585808492576182693778719919712595166062111059989987161916306578407215205036175753987991318878928812740664510735163101638341003233601487955243138990871252660765201240110954450073711970476108165820097189860800000000000000000", + "gamma_sublinear": "1/2000000000000000000", + "cell_above_band": "999999999999999998499500183536911858099202978408839793889845105646366039829579985373224339181876326629841533761348601782865940883869692139885816388300050179628021211180587506258023802308388495490496852390153757505425700669492037084680790523061476036872978999070027973038130705467087021749224930653468703930018452432396362439256337/2001999265852352567603188086364640824440619577414535840681680058507102643272494693480633864954605592868536236464521231440456734446799799281487915155277649974967904790766446018038012590439384969978297197322031851661276837907754095852508084003719888107847477178131651913003100277386125184279926190270414550242974652000000000000000000", + "prime_interval_packing": "499816463088142400797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663", + "alpha_positive": "999632926176284301094226719232270319512767116107714230685134899917361465827332113541271659179123064109651993609217503094308107269591780629773965938875167111973606563810515277030097528080980479645451051169683336064119623369085010934832524921420090796717588135853929539680844160149613889188025788675979051505778432396362439256337/1000999632926176283801594043182320412220309788707267920340840029253551321636247346740316932477302796434268118232260615720228367223399899640743957577638824987483952395383223009019006295219692484989148598661015925830638418953877047926254042001859944053923738589065825956501550138693062592139963095135207275121487326000000000000000000", + "alpha_below_one": "999999999999999999500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/1000999632926176283801594043182320412220309788707267920340840029253551321636247346740316932477302796434268118232260615720228367223399899640743957577638824987483952395383223009019006295219692484989148598661015925830638418953877047926254042001859944053923738589065825956501550138693062592139963095135207275121487326000000000000000000", + "alpha_below_one_fourth": "249250275305367786649304284076347832735564680060709265854524872413470468943234504571537961460146576044457377564455936426962783698580383129556215428470831079759014492281995236977721476276842140767641698614084298121595485115100176970628677975543565922684217059130602559585706690513116034145802747995125839728866053067603637560743663/1000999632926176283801594043182320412220309788707267920340840029253551321636247346740316932477302796434268118232260615720228367223399899640743957577638824987483952395383223009019006295219692484989148598661015925830638418953877047926254042001859944053923738589065825956501550138693062592139963095135207275121487326000000000000000000", + "delta_positive": "1/8000000000000000000", + "delta_below_one_eighth": "999999999999999999/8000000000000000000", + "short_record_fallback": "499499683903918309718371936821836548797460850837409935695617658303075633947470197208840911070286216683901536934654855611704355711866688094884110090826745054793850557046288374076784085630996982067072940540403775769108896654730623725107318250375401712321425343408561963818251869171858597277245113802794395962556429333890707400520254915943067844697973007767395148063967775670022773699623830704317615815727097484961286817356862456302292478295939286486581292645544601335891643070582226037824881290082498775960311723730209268581631828775725771730795582078796979033754928654905577903740183890160901438117594657569/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "small_field_exposure": "1/1000000000000000000", + "artificial_boundary": "28031988253637641087152508831223517616752304303406054069237345619174544172871175139570468821728060506007055182148293897698709928497187712084149193319542249060602413018721373769834130040104994033181264599982048354064152304515589422386086972490333781614940697852896346688935212321776741883231144252366226692097539074702810912682230989/4003998531704705135206376172729281648881239154829071681363360117014205286544989386961267729909211185737072472929042462880913468893599598562975830310555299949935809581532892036076025180878769939956594394644063703322553675815508191705016168007439776215694954356263303826006200554772250368559852380540829100485949304000000000000000000", + "literal_scalar_guard": "1", + "row_product_gap": "23971789/25", + "balanced_prefix_above_kappa": "140751527815241308064889327454612415373943885854596083121282243853650068013488555937482696347101533183116210015118691432863225138281384615365848968163463309851462223389054167891271000934960691362065461260882055616193848226575591772742431037480371464006325389599308017470444062526100727239279066104291299519074279/100099963292617628380159404318232041222030978870726792034084002925355132163624734674031693247730279643426811823226061572022836722339989964074395757763882498748395239538322300901900629521969248498914859866101592583063841895387704792625404200185994405392373858906582595650155013869306259213996309513520727512148732600000000000000000", + "coordinate_movement_above_kappa": "998268085448803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "compact_phase_layer_above_kappa": "50814455653279599605912403920475467689891133729836613858997801160368669812329776579313753874214066924611747739865787326050485519926743314114316512999476013878833729813414833736712964266239303578938251743475578791412507913984858725146283546617971323267439413365906777275361310820993085031603445738463215008656933/125124954115772035475199255397790051527538723588408490042605003656693915204530918342539616559662849554283514779032576965028545902924987455092994697204853123435494049422902876127375786902461560623643574832626990728829802369234630990781755250232493006740467323633228244562693767336632824017495386891900909390185915750000000000000000", + "bulk_exposure_above_kappa": "998268085448803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "Gaussian_arithmetic_above_kappa": "625512406058842322618317598045739116881396192483134704799837936202424883289784774129703104538160867247795621004819223602791617494551127102554812956488293985069721589420821838620664859869839288401949390756548482014231576335666210218812427298912999685088733822261551161512777430862274521844250981266726758591850569/800799706340941027041275234545856329776247830965814336272672023402841057308997877392253545981842237147414494585808492576182693778719919712595166062111059989987161916306578407215205036175753987991318878928812740664510735163101638341003233601487955243138990871252660765201240110954450073711970476108165820097189860800000000000000000", + "scalar_work_above_kappa": "5129561296146564180694776076593336408847600539830209364680869739519227059721418564129149387645409929107514341488617349454414821919555434794261979937719119900316512737870555211141336889788581411988044151104774261732434719586085146946570220498284886533291146289439407720566987431697497793501181096604048343202227497/4003998531704705135206376172729281648881239154829071681363360117014205286544989386961267729909211185737072472929042462880913468893599598562975830310555299949935809581532892036076025180878769939956594394644063703322553675815508191705016168007439776215694954356263303826006200554772250368559852380540829100485949304000000000000000000", + "dimension_above_kappa": "99900036707382371560592123497009266842858348583885623339859882929240950957657509179618374765758276294055884523875471611093373292778701468788829380517502116617453728625141008949561593867084919392356141068859098779001619365494350823568444026389597367350057178573788868356170375730001758256447753012579999727130333504291299519074279/100099963292617628380159404318232041222030978870726792034084002925355132163624734674031693247730279643426811823226061572022836722339989964074395757763882498748395239538322300901900629521969248498914859866101592583063841895387704792625404200185994405392373858906582595650155013869306259213996309513520727512148732600000000000000000" + }, + "margins": { + "balanced_prefix": "499816463088142400797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663", + "coordinate_movement": "999632926176283803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "compact_phase_layer": "499816463088141900297205128072064209357872762473754060265120273141700647703658743382805420527724846975592877478909642980124495569641960257795177119462673369997408872199010767526949918234737985071151720661720420744910146430561047807811523991448063834848293602940951288905774813618317819206478221072341490762115432396362439256337/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663000000000000000000", + "bulk_exposure": "999632926176283803593309034672979827496406776613879995832842806779081627913032353875095733128861142018309698518338004264986620436575649273930818511976286031814032407175581082634360034043647154417318729103220139473056412083488205200154826026920464324048241119666885149646620932396362439256337/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "Gaussian_arithmetic": "799706340941027340775418082768187875450809374654130162517129049207097138577862765477885163718563777256028347157094359048634662589611852480982450411110169615183127487165913473228838484142483481815731318966498169936435832593675425684024124549431280011969870322688738239370816421537095461195406761634524027208313232396362439256337/800799706340941027041275234545856329776247830965814336272672023402841057308997877392253545981842237147414494585808492576182693778719919712595166062111059989987161916306578407215205036175753987991318878928812740664510735163101638341003233601487955243138990871252660765201240110954450073711970476108165820097189860800000000000000000", + "scalar_work": "3998531704705138705876356266193506980442133237911475253205222660571326374569372334492069091087512366914006690391064663779409777469290702861646698855350129563830792713479542334048983187158435447091247034217460827979376485000228789696958530501252252567933355333331799044331260239337390309077311194297804415967756432396362439256337/4003998531704705135206376172729281648881239154829071681363360117014205286544989386961267729909211185737072472929042462880913468893599598562975830310555299949935809581532892036076025180878769939956594394644063703322553675815508191705016168007439776215694954356263303826006200554772250368559852380540829100485949304000000000000000000", + "dimension": "499999999999999999500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663" + }, + "minimum_margin": "499816463088141900297205128072064209357872762473754060265120273141700647703658743382805420527724846975592877478909642980124495569641960257795177119462673369997408872199010767526949918234737985071151720661720420744910146430561047807811523991448063834848293602940951288905774813618317819206478221072341490762115432396362439256337/500499816463088141900797021591160206110154894353633960170420014626775660818123673370158466238651398217134059116130307860114183611699949820371978788819412493741976197691611504509503147609846242494574299330507962915319209476938523963127021000929972026961869294532912978250775069346531296069981547567603637560743663000000000000000000", + "absorption_gap": "50814455653279599605912403920475467689891133729836613858997801160368669812329776579313753874214066924611747739865787326050485519926743314114316512999476013878833729813414833736712964266239303578938251743475578791412507913984858725146283546617971323267439413365906777275361310820993085031603445738463215008656933/125124954115772035475199255397790051527538723588408490042605003656693915204530918342539616559662849554283514779032576965028545902924987455092994697204853123435494049422902876127375786902461560623643574832626990728829802369234630990781755250232493006740467323633228244562693767336632824017495386891900909390185915750000000000000000", + "fixed_complex_outer_ceiling": "999632926176283805553/1000999632926176283805553", + "next_grid_above_ceiling": true, + "five_rounds_insufficient_at_selected_slacks": true, + "previous_three_round_kappa": "249658664283159/250000000000000000", + "previous_six_round_kappa": "499317329045417/500000000000000000", + "prior_chain_regression_passed": true, + "negative_controls_rejected": [ + "next_grid", + "zero_eta", + "zero_beta", + "unit_beta", + "zero_bootstrap_gap", + "invalid_constant_bound" + ], + "finite_envelope": { + "proof": "PROOF.md", + "representation": "Unchanged PR384 inherited finite envelope; fixed-depth PR185 ordinary wrappers restore internal rows", + "semantic": { + "G": { + "base": 2, + "exponent": 30000 + }, + "E": { + "base": 2, + "exponent": 100000 + }, + "B_upper": { + "base": 2, + "exponent": 100001 + }, + "C0": { + "base": 2, + "exponent": 210000 + }, + "C1": 1, + "strict_literal_gap": 1, + "induction_gap_lower": 1 + }, + "rows": { + "coefficient": 20161, + "degree": 1000000, + "suffix_slope": 4000000, + "degree_gap": "23971789/25" + } + } +} diff --git a/research/e8-outer-slack-refinement/LICENSE b/research/e8-outer-slack-refinement/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/e8-outer-slack-refinement/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/research/e8-outer-slack-refinement/MANIFEST.json b/research/e8-outer-slack-refinement/MANIFEST.json new file mode 100644 index 0000000000..c56e3af2a6 --- /dev/null +++ b/research/e8-outer-slack-refinement/MANIFEST.json @@ -0,0 +1,48 @@ +{ + "BOOTSTRAP-SOURCES.json": "41e7b050106547655516ca30f905d4a5d5c3f05ad41b122ed8202af807481bee", + "EXPECTED-COARSE-PRECISION.json": "67f39110e7d9fd34c53ddee54a4bfdcebd191a31b423d92c9a3313bffa4e35b0", + "EXPECTED-WITNESS.json": "4bb91f69fd0b16d5a2943b59e56dd4de2a9b62b4383a5faaa762216440b6c3c9", + "LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "NOTICE.md": "eb15ca83343fadc44f184513680aaaca34d447e04f5929c30054afb205732ddc", + "PARAMETERS.json": "46dd4cda5a8e3e52b0fc32cc85f0ee9a1b51651b9af53d8b7f7c8adf4d6d5b00", + "PROOF.md": "15997b908604d124d688482db46e58da3117ecf1c176597afb1556a767c073d8", + "README.md": "6cc26b0b3fec0278ec1e99c1640249769533b05680fd07b075ab6e60c4043bfe", + "SIX-ROUND-18-DIGIT-COARSE-WITNESS.json": "8c1748221ff23700f6169bf77754b6e079484965f27ab713ded9b83adf6b8e58", + "SOURCE.json": "157eb7e23d9845707d71ff071f55f845e7e7f6d8a04073b778643ea7f6c6810c", + "THREE-ROUND-WITNESS.json": "395b3e94459fa561b4b491ac23e4f5f6ad5fb9e5f4e3bc9a9f5484dce2843f48", + "bootstrap-sources/docs/research/community-round8-review.md": "47ba1520e251d501396ca7d316c75848a572036caad111060148a30b00ac4ad0", + "bootstrap-sources/research/community-round8-audit/pr185-proof-reviewed.md": "bbac6ec77f315dd76324f4595b8c7a9b0ec719f3903d0c56c61f23990326e8fa", + "bootstrap-sources/research/five-stage-source527-banks/proof/FINITE_BIT_ACCOUNTING.md": "602923520af184670170bf159fde7b4c72e79a72570eddd7746b7c97bc51fc5b", + "coarse_precision.py": "95963420b5a96e773cf914667cec26299b7f08e58094eb761cff8324b9cf6dac", + "refine.py": "5fd7df9da60f2c4496b70373333035b130ab29365d531cbe73cbf84ce75dac78", + "source384/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "source384/MANIFEST.sha256": "81391dd38d839ee93036926b96c3d0e15a3f1d57f8490a3dfeb7b0ab764fdc9f", + "source384/NOTICE.md": "4f2d5ada65cfddac05ae6c6b826b80e2930ad03102b03468f901ae6ab07e40ee", + "source384/PROOF.md": "acefbedcd58f631d06698235947320b7fd80e7c7fd5fdca663c0fe4f1c5bd9f4", + "source384/README.md": "a41fae4ff443295a8ca4a66c23ad82cb1779394a55ba2f31685cba57c486e3c9", + "source384/code/cxcheck.py": "97b461509656798d30b2610b4755ce825b1f84ae8772b9b4efd5c84d7404385b", + "source384/code/cxfar.py": "316cbf7d7c777e1fbe8a5d5fb249f0970b591330f4c2769c6827965a0e9c1adf", + "source384/code/cxfinal.py": "7b2afb0be9591c72d31d7fbcce4e2d45bbe09daf7caa21123bca050b92cd2882", + "source384/code/cxkernel.py": "8fc2a43e70fa8c1ce3f3025c9568b562accc5cf25b2ed53d7c0a1cbf954a0599", + "source384/code/cxop.py": "2655e1e9ec94fb39512329ec86d261959ccd7c635c7535238f254a82861c2db1", + "source384/code/cxpiece.py": "1c78b3025203c802c3aab9cc4113c48a7357d582f5bc75c47bde7953787f2e82", + "source384/code/cxretime.py": "e7e06595c12fbafb707a6846719c54b85e0c2bb105927e7e7ee20f028a37438b", + "source384/code/cxsplit.py": "9f6c0718f371120b015733983b3c91285a3825d306b557f0b9013059c6c88b0e", + "source384/code/e8core.py": "1cb286196c1530d06f50f0997febc5993b388f33464e295611b920ba30a24eeb", + "source384/code/engines/base_two_moment.py": "aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098", + "source384/code/engines/moment.py": "81cbc864e106418fc7854322746f72180cb8110ff39f74450a3b8d55a82c1482", + "source384/code/engines/outer.py": "c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c", + "source384/code/far9.py": "ce5c8d4510c916f4b8ce122ddd9a45bb735d45dcbc1d2334cbf2e8793d6513aa", + "source384/code/layout_bk.py": "e650d16538db8d80495fda5109cdfa0775e1d5f3b56b0aa39e5c1efc660877e7", + "source384/code/nine.py": "6a63cc4150a630ad5b3edc1df5e9ed4c6381cae887cca15dca192b793c3c13d4", + "source384/complex/LICENSE-wht-power-saving-lean": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "source384/complex/NOTICE-wht-power-saving-lean": "557c9ad4660eebd14a00583736c4d12d2c45f3fc9bc148845f9f3efec72c9434", + "source384/complex/gcert1-e8-r783.json.gz": "4b92f00fc7454b9b15e6d71a3b05062792eacca0a0ca4efee46f87827d57c8aa", + "source384/complex/gx/gx.py": "6f3dc8bb639933227a8dae181ec4a542e85c7276be9c9e330f49518e7b630b95", + "source384/complex/gx/gxcore.py": "eb972c06fe8c322db2d9a8d9a7d05596e8f40c4ca8e5f42eb6df3c7361b5d517", + "source384/data/bit/bitE8-kernel.json.gz": "947f6e1266f009c6c54647e0b348b1e2076bb584b54fae19016bc8086741876a", + "source384/data/gcert1-e8-r783-far.json.gz": "f2664ee7bcdfb55893abe9f1be8ee6a394a602e8262e611de2a0328bbd508aa7", + "source384/data/pr377/GLOBAL-REVIEW.json": "5ab0d754c01500879dd6c2a70322d08016e2917b3f5f84655923d383729411ad", + "source384/verify.sh": "ea4fc79ca6149a35279f6a71f7d3510fd372f7e17f0d64de847261e0d6c818b4", + "verify.py": "88bb331f254042baa441cffedee8e7a1945d86f337f1e161de79f214b059d714" +} diff --git a/research/e8-outer-slack-refinement/NOTICE.md b/research/e8-outer-slack-refinement/NOTICE.md new file mode 100644 index 0000000000..af96013742 --- /dev/null +++ b/research/e8-outer-slack-refinement/NOTICE.md @@ -0,0 +1,9 @@ +# Attribution + +Fixed six-level extension of the reviewed PR185 bootstrap, exact witness and coarse-precision refinement and retained-family grid ceiling: Rohan Arun with OpenAI Codex assistance. Apache-2.0. + +All local constructions, paid profiles and pinned suppliers are from Chafik Boukhalfa / chafreaky's PR #384, with substantial Anthropic Claude assistance. Its original notices credit Jacob Sussman, Zhihao Chen / jacklightChen (#377), Ali Romman / aliromman (#365), DaysSky, Dylan Crow / utcorvusvolat-dotcom, and earlier contributors. + +The unchanged outer assembly is the PR #315 engine by eumemic with Anthropic Claude assistance, retaining icekylinx's PR #144 constraints adapted from Zhihao Chen's PR #23 and the reviewed balanced prefix from the RaD project (hipotures), as credited in its source header. This refinement changes the caller's witness parameters and retains additional certified coarse-root precision using the two unchanged moment engines. + +The pinned main-branch community review records Rohan Arun's PR185 stopped-leaf bootstrap and its completed-interface conditions. The finite-cutoff accounting source is retained with its original surrounding attribution and scope. The six-level extension is new here; the prior review covered three levels. diff --git a/research/e8-outer-slack-refinement/PARAMETERS.json b/research/e8-outer-slack-refinement/PARAMETERS.json new file mode 100644 index 0000000000..bbc4ad22f6 --- /dev/null +++ b/research/e8-outer-slack-refinement/PARAMETERS.json @@ -0,0 +1,6 @@ +{ + "bootstrap_rounds": 6, + "eta": "1/1000000000000000000", + "beta": "1/1000000000000000000", + "saving_backoff": "1/1000000000000000000000000" +} diff --git a/research/e8-outer-slack-refinement/PROOF.md b/research/e8-outer-slack-refinement/PROOF.md new file mode 100644 index 0000000000..915d08efd8 --- /dev/null +++ b/research/e8-outer-slack-refinement/PROOF.md @@ -0,0 +1,60 @@ +# Fixed six-level bootstrap and the retained outer ceiling + +## Pinned interfaces and acyclic composition + +The base completed ordinary saving is a0=384599/10^10. The bit and complex constructions and paid profiles are unchanged from #384. The complex coarse saving is selected with finer rational precision as established below. Use s=(1-beta)b-10^-24 with beta=eta=10^-18. Exact comparison gives a0=1 dominating its already fixed primitive, recurrence, wrapper, row, setup, padding and previous ordinary constants. There is no claim that the executable has measured C. Let ell>=1 be an integer with C<2^ell, and delta the minimum stage gap. Choose + +`L=ceil(max(1,36/delta^2,2*(4+ell)/delta))`, `e0=2^L`. + +For t=log2(e)>=L, `log2(1+t)<=3*sqrt(t)<=delta*t/2` and `log2(C)+4<=delta*t/2`. Hence `C(1+log2(e))*e^(-delta)<=1/16`. Each lower-order term is absorbed; their fixed multiplicity may be included in C. Below e0, use the preceding completed algorithm. A finite next constant can be chosen at least `C_large+C_old*2^(L*(a_j-a_(j-1)))`. This choice is sequential, not circular, and independent of input width. + +The checker implements this cutoff formula, asserts both sufficient inequalities, and exercises representative bit bounds 1, 80 and 210001 at every stage. Those instances check the implementation, while the algebra above proves the statement for any fixed dominating C. Zero gap and invalid bit bound are rejected. + +## Restored rows and fixed tapes + +Each inner completed call borrows from its two supplied chunks, keeps all outer fields as complete spectators, and restores its row coordinate before returning. Binary-radix padding and tape/program counts multiply only through six fixed levels. The parent therefore receives the same completed endpoint interface and does not need an external row multiplier. No raw reversal or free weighted operation is assumed. The retained external 252 allowance is unused slack, not an estimate of the new algorithm's internal reserve. The complex finite envelope and external row coefficient 20161 remain unchanged. + +This is the same conditional fixed-depth reasoning in the reviewed PR185 mechanism, extended here from three levels to six. It is not an assertion that the previous review already checked six levels or that an all-size tape compiler was machine-verified. + +## Exact witness and grid ceiling + +Use a=a6, q=a(1-2 eta), epsilon=(1-eta)/(1+q). The pinned outer assembly verifies all 47 strict constraints, including all seven performance margins; their minimum is M=epsilon*q. The result is the greatest 10^-18 multiple strictly below M. The next point, zero eta, zero beta and unit beta are rejected. A separate regression reproduces the former three-level witness at its original coarse input; five levels at the same slacks do not reach the new grid point. + +Every valid witness in this unchanged outer formula has a a_j`) and row-borrowing toll (`c < 1-a_j`) are strictly lower order. All gaps are positive fixed rationals. The very small depth-3 gap affects asymptotic constants and thresholds; it is not a practical speedup claim. + +Independently, `a_j = c - c^j (c-a_0)`. The verifier checks this closed form against every recurrence step. It also checks `kappa < a_j/(1+a_j) < c/(1+c)`. + +## Nested row restoration and fixed tapes + +The outer construction's row stock still has `log_q S(e,w)=O(w log e)`: its unchanged cover recursion supplies that stock, and its new ordinary leaves need no *external* extra stock. When an inner `A_(j-1)` borrows high digits, it borrows from the two chunks passed to that ordinary call, retains all outer fields as complete spectators, and restores its row coordinate before returning. Hence the parent sees exactly the original complete ordinary interchange. The parent does not assume a raw reversed operation preserves a borrowed range. + +The parent high-part exchange has width `k=O(w log e)` and costs `O(V k^(1-a_(j-1)))`, conservatively bounded by `O(Vw log e)`. Its own internal borrowing is included in that completed bound. Nested padding factors and program/tape counts multiply only across three fixed levels, and each completed interface restores its rows. They remain constants independent of input size. This is finite program composition, not a new unbounded stack of tapes or an uncharged row multiplier. + +For fixed positive c and fixed wrapper depth, ancestor and prefix-control descriptors remain polynomial in each active atom width. The complete q^w target fibers absorb their polynomial preparation, as in notes/three-stage-cover-bit.tex. Wrapper constants may depend on the selected level but not on input size; no growing-depth program is used. + +The bridge retains the original external row coefficient and its extra 252 ordinary-leaf allocation conservatively. **252 is not asserted to be the new leaf's actual internal reserve.** The new leaf's additional externally supplied stock is zero because it uses its completed internal-borrowing wrapper. The old allocation remains unused slack. All complex finite-group, scalar, router and precision formulas are rechecked unchanged by the parent validator. + +## Exact assembly and scope + +Only the uniform-bit fields of the bridge change. The validator reconstructs the new leaf saving from the pinned original PR182 certificate and the exact finite recurrence. It rejects a fictitious base, detached saving, unpaid atom exponent or external-row assumption. It separately runs the complete original bridge validator with the original leaf fields, preserving every scalar, complex, finite-group and row formula. The unchanged 47-constraint assembly body then consumes the newly checked ordinary saving. + +Depth 3 gives `kappa = 660627334074291/10^18`, approximately `0.000660627334074291`, a `0.062219284%` improvement over PR182. Both physical supplier moments are recomputed with rational intervals; the next coarse grid point is excluded. All 47 constraints, seven margins, and the next final grid exclusion are checked. The finite physical words themselves are inherited as source-pinned evidence and are not claimed to have been newly replayed by the arithmetic verifier. + +This is a compositional improvement to the retained conditional ordinary-supplier interface. It does not improve the coarse physical profile, prove the analytic/fixed-tape hypotheses independently, or establish global optimality. PR183 records the existing assembly ceiling; it does not perform this finite ordinary-leaf replacement. diff --git a/research/e8-outer-slack-refinement/bootstrap-sources/research/five-stage-source527-banks/proof/FINITE_BIT_ACCOUNTING.md b/research/e8-outer-slack-refinement/bootstrap-sources/research/five-stage-source527-banks/proof/FINITE_BIT_ACCOUNTING.md new file mode 100644 index 0000000000..42a585d742 --- /dev/null +++ b/research/e8-outer-slack-refinement/bootstrap-sources/research/five-stage-source527-banks/proof/FINITE_BIT_ACCOUNTING.md @@ -0,0 +1,126 @@ +# Portable five-stage BIT finite bill + +The executable `finite_check.run` accepts the freshly reconstructed source +ledger, physical tags, independently checked scalar projection, exact current +basis-prime result, exact moment calculation and optional global lowering +result. It reads no saved execution receipt. Source expectations are checked +against those computed objects, not substituted for them. The complete +package runner is responsible for generating its inputs before this call. + +## Quantifiers and inherited primitive hypotheses + +Fix this candidate and an eligible odd prime q>2^80 before the input widths +n,w are chosen. All represented determinant and route exclusions lie in +{2,3,5,7}. The primitive constant C may depend on q, the fixed source recipe, +the finite bootstrap level and the retained primitive implementations. It +does not depend on n,w, ancestor values or unrelated spectator widths except +through logical volume V. + +The three byte-pinned public sources supplied here are +`three-stage-cover-bit.tex`, `three-stage-cover-rows.tex`, and +`copied-centers-lemma.tex`. Their exact-tape, completed ordinary-leaf and +complete-stream hypotheses are retained. All high matrix fibers are batched; +prefix descriptor preparation has fixed polynomial cost in w and is paid +over the complete q^w target fiber. Unrelated spectators use ripple counters. +Fresh child role fields never enter the ancestor weight descriptor. Finite +low-type tables, initialization and sequential scans are charged in C. +There is no unit-cost random-access oracle or new numerical Turing-machine +constant requirement. + +## Actual finite recipe + +Let m=120, W=23,683, E=495,304, v=1,760, R=16,643, d=m^2 and +J=20v+10R+4v=208,670. The last 4v=7,040 families pay the explicit final +complete-stream exchange; they are not equal-frame payload shears. + +The check derives from the fresh word 12,858,690 weighted additions or +21,787,770 unit additions, including all six bridge families. Its +cancellation-free prefix lift is +64*37,623^3*9,430,154^2=303,094,329,841,208,644,962,256,113,408<2^98. +No old defining-integer endpoint is imposed on the F2 supplier. + +The actual rational 48-dimensional route is reconstructed, eliminated and +inversely replayed: 195 additions, 44 swaps and 27 scalings, with denominator +set {1,2,3,6}. A missing addition fails reconstruction. Coordinate +permutations and embedding give the other ports and stages. + +Per route, pay at most 23,707*|GL_120(F_q)| low-role transpositions and +16*(d+1)^2 high affine factors. Per good edge, pay at most 8m^2+8 elementary +normalizer wrappers. The same compiler pays all exterior completions. +There are 120 copied-center episodes. Their recursive rank-22 calls and +their scalar reads are already included in E and the scalar count; their +copy/erase and parking passes are separately paid by the complete-stream +primitive, using one additional work stream. + +For a bad edge with N=2m=240, the exact inherited Gaussian fallback uses at +most 6N(N-1)+3N+6(N-1)=346,314<32m^2=460,800 children. Keep the entire +larger allowance in the moment. Coefficient preparation uses only unit +pivot inversions. Allocate 128N^3 ring operations per edge per low class: +four 8N^3 elimination/inversion allocations and sixteen 2N^3 matrix products +give 64N^3; the remaining 64N^3 pays extraction, copying, generic tests, +factor output and the bad-branch elimination. Matrix bit costs and descriptor +arithmetic are paid by the inherited primitive theorem. Invertibility testing +of each candidate low matrix additionally gets 16m^3 operations. + +Overcharging every finite recipe item over every low matrix gives + + B(q) <= [unit+J*16(d+1)^2+J*(W+24)+E*(8m^2+8) + +E*128(2m)^3+16m^3+120+E+1]*q^14400 + = 1,568,901,757,016,837*q^14400 < q^14401. + +These are explicit ring/recipe counts, not single-step machine costs. All +fixed-tape, table, setup and selector constants stay in C_primitive, giving +the normalized toll C*n+C*w^(1-a_old) after increasing one finite C. +No recursive child is absorbed into this nonrecursive constant. + +## Weighted induction and rows + +Set c=704197288590873/10^18 and tau=1-c. Exact interval recomputation, +adding the entire 10^-16*32m^2 fallback envelope per edge, proves + + 1-mu_tau > 774/10^21, + 1-mu_1 = 107421874442783/69383789062500000 > 0. + +For the retained recurrence +T(n,w)<=sum_r c_r*T(r*floor(n/120),w)+C*n+C*w^(1-a_old), +take A=C*(1+1/(1-mu_1)+1/(1-mu_tau)). Induction bounds T by +A*(n+n^tau*w^(1-a_old)): the linear and stopped gaps separately pay the +two tolls; the leaves follow A>=C. Floors only decrease the child sizes. + +The maximum ratio is 5/6, so four levels halve. The depth bound +4*ceil(log2(max(2,n))) changes stock, not the one-level moment. Paying all +24 temporary roles gives per-level log_q stock below 14400w+1. Add the +inherited old-leaf reserve. The new contribution is at most +57,604w*ceil(log2(max(2,n))). Borrow and restore these complete high digits; +successive residuals and the two-call ordinary wrapper reuse the reserve. +One outer row padding factor is below two; binary-radix padding costs less +than q^2 in logical volume. The temporary roles never enter the denominator W. + +## Finite ordinary bootstrap and cutoff + +Starting with completed ordinary a0=384599/10^10, set beta=c and repeat +a_(j+1)=(1-c)c+c*a_j exactly three times. The finite result is + + a3=704197288358392787581160456097840009769165126434639147437106139267359/10^72. + +At each stage, the paid exponents are 1-c, 1-a_(j+1), c with a logarithm, +and c(1-a_j). The exact positive gaps are c-a_(j+1), +1-a_(j+1)-c, 1-a_(j+1)-c(1-a_j), and 1-c (for row fitting). + +Choose a finite integer C>=1 dominating that stage's already fixed primitive, +recurrence, wrapper, row, setup, padding and previous ordinary constants. +Let delta be the minimum positive gap and + + L=ceil(max(1,36/delta^2,2*(4+ceil(log2 C))/delta)), e0=2^L. + +For e>=e0, C(1+log2 e)e^(-delta)<=1/16. Indeed for t=log2 e, +log2(1+t)<=3sqrt(t)<=delta*t/2 and log2 C+4<=delta*t/2. +Thus every lower-order toll is covered and the borrowed high part fits. +Below e0 use the previously completed ordinary algorithm. A finite next +constant is C_large+C_old*2^(L*(a_(j+1)-a_j)). This choice is sequential, +not circular, and uniform in the input and complete spectators. + +This proves the finite-accounting and ordinary-bootstrap step at the same +conditional theorem level as the retained public baseline. It does not claim +an independent proof of those inherited primitives, a measured universal +machine constant, or execution at every input width. diff --git a/research/e8-outer-slack-refinement/coarse_precision.py b/research/e8-outer-slack-refinement/coarse_precision.py new file mode 100644 index 0000000000..7f5c506358 --- /dev/null +++ b/research/e8-outer-slack-refinement/coarse_precision.py @@ -0,0 +1,26 @@ +"""Retain 24 certified decimal places in the unchanged paid PR384 moment. +Both independently written rational engines and the original positive fallback +are retained. Decimal arithmetic proposes endpoints; it never admits them. +""" +from pathlib import Path +from fractions import Fraction as Q +import importlib.util +ROOT=Path(__file__).resolve().parent + +def module(name): + spec=importlib.util.spec_from_file_location('precision_'+name,ROOT/'source384/code/engines'/(name+'.py')) + obj=importlib.util.module_from_spec(spec);spec.loader.exec_module(obj);return obj + +def certify(profile,m,stock,original_coarse): + M=module('moment');B=module('base_two_moment');H={int(k):v for k,v in profile.items()} + assert (m,stock)==(73,14727) + assert m*stock-sum(r*n for r,n in H.items())==2496 + root=M.certify(H,m,stock,True);lo=Q(root['lower']);hi=Q(root['upper']);step=Q(1,10**24) + assert hi-lo==step and original_coarse0 and isinstance(coefficient_bits,int) and coefficient_bits>=1 + L=ceil(max(Q(1),36/delta**2,2*(4+coefficient_bits)/delta)) + assert L*delta**2>=36 and L*delta>=2*(4+coefficient_bits) + return L + +def refine(b,c): + spec=importlib.util.spec_from_file_location('pinned_outer',ROOT/'source384/code/engines/outer.py') + outer=importlib.util.module_from_spec(spec);spec.loader.exec_module(outer) + params=json.loads((ROOT/'PARAMETERS.json').read_text());depth=params['bootstrap_rounds'];assert depth==6 + grid=Q(1,10**18);eta=Q(params['eta']);beta=Q(params['beta']);backoff=Q(params['saving_backoff']) + saving=(1-beta)*b-backoff + assert Q(0)0 + examples={str(bits):str(cutoff_log2(delta,bits)) for bits in (1,80,210001)} + stages.append(dict(level=j+1,ordinary_calls_only_to_level=j,gaps={k:str(v) for k,v in gaps.items()},minimum_gap=str(delta),cutoff_examples_by_constant_bits=examples)) + chain.append(a) + previous=json.loads((ROOT/'THREE-ROUND-WITNESS.json').read_text()) + prior_saving=(1-beta)*Q(previous['complex_coarse'])-backoff + prior_chain=[initial] + for _ in range(3):prior_chain.append((1-prior_saving)*prior_saving+prior_saving*prior_chain[-1]) + assert list(map(str,prior_chain))==previous['bootstrap_chain'] + previous_six=json.loads((ROOT/'SIX-ROUND-18-DIGIT-COARSE-WITNESS.json').read_text()) + a=chain[-1];q=a*(1-2*eta);minimum=(1-eta)*q/(1+q) + scaled=minimum/grid;kappa=grid*((scaled.numerator-1)//scaled.denominator) + bridge=dict(proof='PROOF.md',representation='Unchanged PR384 inherited finite envelope; fixed-depth PR185 ordinary wrappers restore internal rows', + semantic=dict(G=dict(base=2,exponent=30000),E=dict(base=2,exponent=100000),B_upper=dict(base=2,exponent=100001),C0=dict(base=2,exponent=210000),C1=1,strict_literal_gap=1,induction_gap_lower=1), + rows=dict(coefficient=20161,degree=10**6,suffix_slope=4*10**6,degree_gap=Q(10**6)-Q(51*20161,25))) + asm=outer.assembly(a,b,bridge,kappa,eta=eta,beta=beta) + assert len(asm['strict_constraints'])==47 and all(x>0 for x in asm['strict_constraints'].values()) + assert asm['minimum_margin']==minimum + rejected=[] + for name,k,e,be in [('next_grid',kappa+grid,eta,beta),('zero_eta',kappa,Q(0),beta),('zero_beta',kappa,eta,Q(0)),('unit_beta',kappa,eta,Q(1))]: + try:outer.assembly(a,b,bridge,k,eta=e,beta=be) + except AssertionError:rejected.append(name) + else:raise AssertionError('accepted invalid witness '+name) + for name,delta,bits in [('zero_bootstrap_gap',Q(0),80),('invalid_constant_bound',Q(1,2),0)]: + try:cutoff_log2(delta,bits) + except AssertionError:rejected.append(name) + else:raise AssertionError('accepted invalid finite cutoff '+name) + # For the pinned outer formula all valid witnesses have a0; + # consequently the compact margin is Q(previous_six['kappa']) + # Five levels at the same slack values do not yet reach the chosen grid. + a5=chain[-2];q5=a5*(1-2*eta);assert (1-eta)*q5/(1+q5) 2·48²) with its row coefficient 15,445 < 20,161; +- m = 73, which is beyond #375's m ≤ 72 cover bound; +- everything #377 retains from #352: the local E8 invocation theorem, the general Clifford/compiler interfaces, the tape primitives, precision and row allowances, and the analytic recurrence interfaces. + +None of #377's scripts were run. Only its receipt's `profile`, `m`, `live` and `deficit` are read, and its scripts were read as data. + +**#377's certificate-specific finite checks are not re-run on the new unit.** These are: +- the #352 emitter/splice and the scalar-word and lifetime replay (1,242,936 local events, 1,023 dirty columns); +- the local Clifford frame checks (946 frames, 3,120 transitions, 240 adapters); +- the finite invoice's local terms. + +The new unit has the same ports, start/final frames, retained totals and operator. Its gates and frames differ: there are 775/1,226 gates (against 773/1,220, +0.4 %) and 948 frames (two new). The new transitions are nested, as `gx.check1` E1 checks, so they fall under #377's general Clifford compiler interface. The finite invoice's exponents (router < 2³⁰⁰⁰⁰ against 7,984 bits used) leave far more slack than a 0.4 % change in the scalar-macro count consumes. Still, these are obligations of this package and are stated as such. + +**#378's own conditions** carry over: there is no Lean proof of the new certificate, which is checked by Sussman's `gx.check1`/`gxcore` and by the full operator identity. + +**The bit side is #382's claim**, including its halving-degree-two admission. Here we re-derive c from the word only. #382's stage replays, legality and B₃ formal-columns checks are in `research/e8-kernel-bit-b3/`. + +This is a conditional finite construction, not a formal verification of the multiplication theorem. + +## Credits + +- **jacklightChen (Zhihao Chen), #377:** the nine-stage compressed complex component, which is the whole complex construction used here. It covers the window, banks, padding, phases, invoice and the profile rule this package reproduces. +- **Jacob Sussman:** the E8 unit `gcert1-e8-r783`, `gx`/`gxcore` and the stage geometry (wht-power-saving-lean, Apache-2.0). +- **aliromman (#365):** the first coupled re-timing of this unit. #378's moves generalise it. +- **DaysSky (#363, #373, #375):** B_K, the seven-stage bit construction, and the halving-degree-two guard used on the bit side. +- **utcorvusvolat-dotcom (#370):** the E8 bit word under our #382 stages. +- PR #315's moment engines and outer assembly (DreamingOfClouds). +- **Ours:** the far-piece-relocation certificate (#378), the bit word stages (#382), and this substitution. + +Prepared by Chafik Boukhalfa (chafreaky) with substantial Anthropic Claude assistance. Apache-2.0 (`LICENSE`). See `NOTICE.md` and `PROOF.md`. diff --git a/research/e8-outer-slack-refinement/source384/code/cxcheck.py b/research/e8-outer-slack-refinement/source384/code/cxcheck.py new file mode 100644 index 0000000000..4973f511e5 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/cxcheck.py @@ -0,0 +1,23 @@ +"""Complex certificate checks: Jacob Sussman's gx.check1 (E0-E7: sizes, labels/nesting, equal frames at gates, scatter +cut, gate shapes, bracket rule, exact scalar x-content replay E5, price data E6, exterior gauges E7) and his gxcore +mirror histogram, a flipped-sign control (must fail E5), and the source-span rule (our check: the x-content support of +every non-y operand, and of a slot destination after the gate, lies in the gate frame). +usage: cxcheck.py CERT.json.gz GXDIR""" +import sys, os, gzip, json, copy +from collections import Counter +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from cxretime import CX +c = json.load(gzip.open(sys.argv[1])); sys.path.insert(0, sys.argv[2]); import gx, gxcore +st = {}; gx.check1(c, scalar=True, stats=st) +Hinv = Counter() +for w in c['blocks'].values(): + for r, n in w.items(): Hinv[int(r)] += n +assert gxcore.mirror(gxcore.normal(copy.deepcopy(c)))['hist'] == dict(Hinv), 'gxcore histogram' +c2 = copy.deepcopy(c) +for g in c2['A']: + if g[0] in ('out', 'in') and g[3]: t, a, b = g[3][0]; g[3][0] = [t, -a, b]; break +try: gx.check1(c2, scalar=True); raise SystemExit('flipped sign accepted') +except AssertionError as e: assert str(e).startswith('E5'), str(e) +sv = CX(c).span_ok(); assert sv == 0, sv +print(' %s: gx.check1 PASS (E0-E7, exact scalar), gxcore mirror PASS, flipped sign rejected (E5), source-span violations 0 | h %d v %d R %d cst %d N %d, gates A/B %d/%d, frames %d' + % (os.path.basename(sys.argv[1]), c['h'], c['v'], c['R'], c['cst'], c['N'], len(c['A']), len(c['B']), len(c['frames']))) diff --git a/research/e8-outer-slack-refinement/source384/code/cxfar.py b/research/e8-outer-slack-refinement/source384/code/cxfar.py new file mode 100644 index 0000000000..a8e53204f9 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/cxfar.py @@ -0,0 +1,85 @@ +"""Far piece relocation on a split gcert/1 program: an elementary piece (out: u += c s with s only read; in: s += c u with +u only read) moves forward/backward across gates that commute with it as scalar operations (they touch neither u, nor +write the read register; for an in-piece, other gates may only ADD into s from sources other than u, never read s), +within its phase, and gets its own best frame between the new neighbours. Greedy best move per pass. +usage: cxfar.py CERT(.json.gz or anneal output) GXDIR OUT [passes]""" +import sys, os, gzip, json, math, copy, random +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from cxpiece import * +from cxretime import sweep as bsweep + + +def rw(g): + """(reads, writes) of a gate""" + if g[0] == 'neg': return {g[2]}, {g[2]} + if g[0] == 'out': return {g[2]} | {t for t, _, _ in g[3]} | set(g[4]), {t for t, _, _ in g[3]} + return {g[2]} | {s for s, _, _ in g[3]}, {g[2]} + + +def far_pass(c, tag, a, m): + M = CX(c); d = lambda f: len(M.fr[f]); chi = lambda r: 0.0 if r <= 0 else r * (math.exp(a * math.log(m / r)) - 1) + G = M.gates; best = None + for i, (ph, g) in enumerate(G): + if g[0] == 'out' and len(g[3]) == 1 and not g[4]: u = g[3][0][0]; s = g[2]; kind = 'out' + elif g[0] == 'in' and len(g[3]) == 1: u = g[2]; s = g[3][0][0]; kind = 'in' # u written (dst), s read + else: continue + # registers: w = written register (u for out, u for in): naming: wreg written, rreg read + wreg, rreg = u, s + iw, ir = M.where[i][wreg], M.where[i][rreg] + f_i = M.gf[i] + pw, nw = M.F(wreg, iw - 1), M.F(wreg, iw + 1) + a_r, b_r = M.F(rreg, ir - 1), M.F(rreg, ir + 1) + rem_r = chi(d(f_i) - d(a_r)) + chi(d(b_r) - d(f_i)) - chi(d(b_r) - d(a_r)) + for step in (1, -1): + j = i + while True: + j += step + if j < 0 or j >= len(G) or G[j][0] != ph: break + rj, wj = rw(G[j][1]) + if wreg in rj or rreg in wj: break # does not commute (another addition into wreg also breaks: keep simple) + if rreg not in rj: continue # read register untouched: same neighbours + # new position just after j (forward) or just before j (backward): rreg neighbours change + jr = M.where[j][rreg] + if step == 1: ps, ns = M.F(rreg, jr), M.F(rreg, jr + 1) if jr + 1 != ir else b_r + else: ps, ns = (M.F(rreg, jr - 1) if jr - 1 != ir else a_r), M.F(rreg, jr) + if step == 1 and jr + 1 == ir: continue + loE = echelon(list(M.lb[i]) + list(M.fr[ps]) + list(M.fr[pw])) + hiV = span_vecs(M.fr[ns]) & span_vecs(M.fr[nw]) + if not all(x in hiV for x in loE): continue + cands = {M.fid(loE), M.fid(echelon(sorted(hiV))), ps, ns, pw, nw} + for x in sorted(hiV - span_vecs(loE))[:64]: cands.add(M.fid(echelon(loE + [x]))) + old_w = chi(d(f_i) - d(pw)) + chi(d(nw) - d(f_i)) + for F in cands: + if not (inside(M.fr[ps], M.fr[F]) and inside(M.fr[F], M.fr[ns]) and inside(M.fr[pw], M.fr[F]) and inside(M.fr[F], M.fr[nw]) and inside(loE, M.fr[F])): continue + gain = old_w - chi(d(F) - d(pw)) - chi(d(nw) - d(F)) + rem_r - (chi(d(F) - d(ps)) + chi(d(ns) - d(F)) - chi(d(ns) - d(ps))) + if gain > 1e-9 and (best is None or gain > best[0]): best = (gain, i, j, step, F) + if best is None: return c, tag, 0.0 + gain, i, j, step, F = best + gates = [copy.deepcopy(x) for x in G] + for k in range(len(gates)): gates[k][1][1] = M.gf[k] + gates[i][1][1] = F + order = [k for k in range(len(gates)) if k != i] + pos = order.index(j) + (1 if step == 1 else 0); order.insert(pos, i) + c2 = copy.deepcopy(c); c2['frames'] = [list(x) for x in M.fr]; c2['A'] = []; c2['B'] = []; tag2 = [] + for k in order: + c2[gates[k][0]].append(gates[k][1]); tag2.append(list(tag[k][:2]) + (['far', k] if k == i else list(tag[k][2:]))) + return rehist(c2), tag2, gain + + +if __name__ == '__main__': + src = json.load(gzip.open(sys.argv[1])); sys.path.insert(0, sys.argv[2]); import gx + if 'cert' in src: c, tag = src['cert'], [tuple(t) for t in src['tag']] + else: c, tag = split(src) + K = 3; h = c['h']; m = (2 * K + 1) * h; b0 = price(c, K); a = float(b0); rng = random.Random(1) + print('start b3', b0, float(b0)); passes = int(sys.argv[4]) if len(sys.argv) > 4 else 100 + for p in range(passes): + c, tag, g = far_pass(c, tag, a, m) + M = CX(c) + for s in range(10): + m1, _ = single_sweep(M, a, m, rng); m2, _ = bsweep(M, a, m, rng) + if not (m1 or m2): break + c = rehist(to_cert(M)); c, tag, g2 = piece_pass(c, tag, a, m) + b = price(c, K); print('pass', p, 'far gain/a %.3f piece %.3f' % (g / a, g2 / a), 'b3', b, '%.12e' % float(b), flush=True) + if g == 0 and g2 == 0: break + gx.check1(c, scalar=True); print('gx.check1 PASS') + json.dump(dict(cert=c, tag=[list(t) for t in tag]), gzip.open(sys.argv[3], 'wt')) diff --git a/research/e8-outer-slack-refinement/source384/code/cxfinal.py b/research/e8-outer-slack-refinement/source384/code/cxfinal.py new file mode 100644 index 0000000000..3c55ca4c63 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/cxfinal.py @@ -0,0 +1,29 @@ +"""Finalize an optimised split program: merge consecutive elementary gates of one phase that share kind, frame and the +read register (fan-out: same source, distinct targets) or the destination (fan-in: same destination, distinct sources), +drop unused appended frames, recompute the block histograms and N. usage: cxfinal.py IN(anneal/far output) ORIG OUT""" +import sys, os, gzip, json, copy +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from cxkernel import rehist +def finalize(c, c0): + c = copy.deepcopy(c) + for ph in ('A', 'B'): + out = [] + for g in c[ph]: + p = out[-1] if out else None + if p and p[0] == g[0] == 'out' and p[1] == g[1] and p[2] == g[2] and not ({t for t, _, _ in g[3]} | set(g[4])) & ({t for t, _, _ in p[3]} | set(p[4])): + p[3] = p[3] + g[3]; p[4] = p[4] + g[4] + elif p and p[0] == g[0] == 'in' and p[1] == g[1] and p[2] == g[2] and not {s for s, _, _ in g[3]} & {s for s, _, _ in p[3]}: + p[3] = p[3] + g[3] + else: out.append(copy.deepcopy(g)) + c[ph] = out + used = set(c['start']) | set(c['final']) | {g[1] for g in c['A'] + c['B']} | {f for _, _, f in c['ret']} + keep = list(range(len(c0['frames']))) + [i for i in range(len(c0['frames']), len(c['frames'])) if i in used] + ren = {o: n for n, o in enumerate(keep)}; c['frames'] = [c['frames'][i] for i in keep] + for ph in ('A', 'B'): + for g in c[ph]: g[1] = ren[g[1]] + c['derived_from'] = c0['derived_from'] + ' | e8st far piece relocation + block retiming (chafreaky)' + return rehist(c) +if __name__ == '__main__': + x = json.load(gzip.open(sys.argv[1])); c = x['cert'] if 'cert' in x else x; c0 = json.load(gzip.open(sys.argv[2])) + w = finalize(c, c0); print('gates A/B', len(w['A']), len(w['B']), 'frames', len(w['frames'])) + with gzip.GzipFile(sys.argv[3], 'wb', mtime=0) as f: f.write(json.dumps(w, separators=(',', ':')).encode()) diff --git a/research/e8-outer-slack-refinement/source384/code/cxkernel.py b/research/e8-outer-slack-refinement/source384/code/cxkernel.py new file mode 100644 index 0000000000..32b26a1755 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/cxkernel.py @@ -0,0 +1,222 @@ +"""Shared-donor response kernel on a gcert/1 complex program (Sussman's format), via exterior gauges (rule E7/Q2). +Entry: pivot slot p, entrance E (a frame inside p's first frame and inside every donor's first frame), donors d with +rational coefficients c_d such that resp(p) + sum c_d resp(d) = 0, where resp(s) in Q^v = the column of slot s's +initial value in the y rows of the product (A, scatter, B). Transform: p starts at E (ext gauge [p, E]); at the start +of A each donor climbs to E and takes d += c_d p ('in' gate at E). Then Q2 holds for p. +Price (entrance-residual rule, as the bit side's #320/#329 lineage): W = 2Kv + sum_slots (h - dim ext)/h, deficit fixed. +usage: cxkernel.py CERT.json.gz GXDIR OUT.json.gz [K]""" +import sys, os, gzip, json, math, copy +from fractions import Fraction as Fr +from collections import Counter +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from e8core import coarse +from layout_bk import layout + + +def reduce(u, basis): + for b in basis: + if u >> (b.bit_length() - 1) & 1: u ^= b + return u +def inside(a, b): return all(reduce(u, b) == 0 for u in a) +def echelon(vecs): + """reduced echelon (descending pivots) of the F2 span of vecs""" + B = [] + for u in vecs: + u = reduce(u, B) + if u: + B = [b ^ u if b >> (u.bit_length() - 1) & 1 else b for b in B] + [u] + B.sort(reverse=True) + return B + + +def responses(c): + v, R = c['v'], c['R']; n = 2 * v + R + reg = [dict() for _ in range(n)] + for r in range(2 * v, n): reg[r] = {r: Fr(1)} + def axpy(t, src, co): + d = reg[t] + for k, u in src.items(): + w = d.get(k, 0) + co * u + if w: d[k] = w + else: d.pop(k, None) + def run(gates): + for g in gates: + if g[0] == 'neg': reg[g[2]] = {k: -u for k, u in reg[g[2]].items()} + elif g[0] == 'out': + src = dict(reg[g[2]]) + for t, a, b in g[3]: axpy(t, src, Fr(a, b)) + else: + for s, a, b in g[3]: axpy(g[2], reg[s], Fr(a, b)) + run(c['A']) + tot = {k: dict(reg[s]) for k, s, _ in c['ret']} + for t in range(v): + for k, a, b in c['scat']['table'][t]: axpy(v + t, tot[k], Fr(a, b)) + run(c['B']) + resp = {s: {} for s in range(2 * v, n)} + for t in range(v): + for s, co in reg[v + t].items(): resp[s][t] = co + return resp + + +def first_frames(c): + v, R = c['v'], c['R']; n = 2 * v + R; first = {} + for ph in ('A', 'B'): + for g in c[ph]: + regs = [g[2]] + ([t for t, _, _ in g[3]] + list(g[4]) if g[0] == 'out' else [s for s, _, _ in g[3]] if g[0] == 'in' else []) + for r in regs: + if r >= 2 * v and r not in first and g[1] != 0: first[r] = g[1] + return first + + +class QBasis: + """incremental rational basis over Q^v with combination tracking (donor slots)""" + def __init__(self): self.rows = [] # (pivot, vec dict, combo dict) + def reduce(self, x): + x = dict(x); cm = {} + for p, vec, co in self.rows: + if p in x: + f = x[p] / vec[p] + for k, u in vec.items(): + w = x.get(k, 0) - f * u + if w: x[k] = w + else: x.pop(k, None) + for k, u in co.items(): + w = cm.get(k, 0) - f * u + if w: cm[k] = w + else: cm.pop(k, None) + return x, cm + def add(self, x, slot): + r, cm = self.reduce(x) + cm = {k: u for k, u in cm.items()}; cm[slot] = cm.get(slot, 0) + 1 + p = min(r); self.rows.append((p, r, cm)) + + +def select(c, a, K=3): + h, v, R = c['h'], c['v'], c['R']; m = (2 * K + 1) * h + fr = [tuple(f) for f in c['frames']]; dim = [len(f) for f in fr] + chi = lambda r: 0.0 if r <= 0 else r * (math.exp(a * math.log(m / r)) - 1) + resp = responses(c); first = first_frames(c) + ret = {s for _, s, _ in c['ret']} + H = [s for s in range(2 * v, 2 * v + R) if s not in ret and s in first and c['start'][s] == 0] + # candidate entrances: frames of the table inside some first frame, plus pairwise intersections not in table skipped + fset = sorted(set(first[s] for s in H)) + cand = [E for E in range(2, len(fr)) if dim[E] > 0 and dim[E] < h and any(inside(fr[E], fr[f]) for f in fset)] + ins = {} + def isin(E, f): + k = (E, f) + if k not in ins: ins[k] = inside(fr[E], fr[f]) + return ins[k] + groups = {E: [s for s in H if isin(E, first[s])] for E in cand} + avail_p = set(H); avail_d = set(H); donor_at = {} + def plan(E): + e = dim[E]; G = groups[E]; mem = [] + for s in G: + d1 = dim[first[s]] + dc = (0.0 if donor_at.get(s) == E else (chi(e) + chi(d1 - e) - chi(d1)) if s in avail_d else None) + if s in donor_at and donor_at[s] != E: dc = None + pg = chi(d1) - chi(d1 - e) if s in avail_p else None + if dc is None and pg is None: continue + mem.append((s, dc, pg)) + mem.sort(key=lambda t: (t[1] if t[1] is not None else 1e9, t[2] if t[2] is not None else -1)) + B = QBasis(); slots = {}; piv = [] + for s, dc, pg in mem: + r, cm = B.reduce(resp[s]) + if not r and pg is not None and pg > 0: piv.append((s, cm, pg)) + elif r and dc is not None: B.add(resp[s], s); slots[s] = dc + if not piv: return None + keep = list(piv) + def users(): + u = Counter() + for _, cm, _ in keep: + for k in cm: u[k] += 1 + return u + while keep: + u = users(); best = None + for i, (s, cm, pg) in enumerate(keep): + freed = sum(slots[k] for k in cm if u[k] == 1) + if freed > pg and (best is None or freed - pg > best[0]): best = (freed - pg, i) + if best is None: break + keep.pop(best[1]) + u = users(); gain = sum(pg for _, _, pg in keep) - sum(slots[k] for k in u) + if gain <= 1e-15: return None + # coefficients: resp(p) = sum cm_k resp(k) -> donor gate d += (-cm_d) p + return gain, [(s, {k: -x for k, x in cm.items()}) for s, cm, _ in keep] + plans = {E: plan(E) for E in cand} + chosen = []; total = 0.0 + while True: + live = [(p[0], E) for E, p in plans.items() if p] + if not live: break + g, E = max(live); _, ents = plans[E] + touched = set() + for p, cm in ents: + chosen.append((E, p, cm)); avail_p.discard(p); avail_d.discard(p); touched.add(p) + for d in cm: donor_at[d] = E; avail_p.discard(d); avail_d.discard(d); touched.add(d) + total += g + for E2 in cand: + if plans.get(E2) and any(s in touched for s in groups[E2]): plans[E2] = plan(E2) + plans[E] = plan(E) + return chosen, total + + +def apply(c, chosen): + c = copy.deepcopy(c); head = [] + ext = [] + for E, p, cm in chosen: + ext.append([p, E]); c['start'][p] = E + byd = {} + for E, p, cm in chosen: + for d, co in cm.items(): byd.setdefault((d, E), []).append([p, co.numerator, co.denominator]) + for (d, E), lst in sorted(byd.items()): head.append(['in', E, d, sorted(lst)]) + c['A'] = head + c['A']; c['ext'] = sorted(ext) + return c + + +def rehist(c): + """recompute block histograms and N exactly as gx.check1 counts them (climbs per class, COPY ranks)""" + v, R = c['v'], c['R']; n = 2 * v + R; dim = [len(f) for f in c['frames']] + cls = lambda r: 'x' if r < v else 'y' if r < 2 * v else 's' + cur = list(c['start']); H = {'x': Counter(), 'y': Counter(), 's': Counter(), 'c': Counter()} + def climb(r, f): + if cur[r] != f: H[cls(r)][dim[f] - dim[cur[r]]] += 1; cur[r] = f + for ph in ('A', 'B'): + if ph == 'B': + for k, s_, f in c['ret']: H['c'][dim[f]] += 1 + for g in c[ph]: + regs = [g[2]] + ([t for t, _, _ in g[3]] + list(g[4]) if g[0] == 'out' else [x for x, _, _ in g[3]] if g[0] == 'in' else []) + for r in regs: climb(r, g[1]) + for r in range(n): climb(r, c['final'][r]) + c['blocks'] = {k: {str(r): x for r, x in sorted(w.items())} for k, w in H.items()} + c['N'] = sum(r * x for w in H.values() for r, x in w.items()) + return c + + +def price(c, K): + """returns b in B_K with the entrance-residual W""" + h, v, R, cst = c['h'], c['v'], c['R'], c['cst'] + Hinv = Counter() + for w in c['blocks'].values(): + for r, n in w.items(): Hinv[int(r)] += n + s = 2 * K + 1; m = s * h; lay = layout(K, h, split=(m - 1) // 2 if K > 2 else None) + tails = sum(len(c['frames'][f]) for _, f in c['ext']) + T = 1 if tails % h == 0 else h + H = Counter({r: T * s * n for r, n in Hinv.items()}) + for r in lay['blocks']: H[r] += T * 2 * v + W = (2 * K * v + R) * T - tails * T // h; assert tails * T % h == 0 + assert m * W - sum(r * n for r, n in H.items()) == T * (2 * K * v - s * cst), 'deficit' + assert 2 * max(H) < m + return coarse(H, m, W) + + +if __name__ == '__main__': + c = json.load(gzip.open(sys.argv[1])); sys.path.insert(0, sys.argv[2]); import gx, gxcore + K = int(sys.argv[4]) if len(sys.argv) > 4 else 3 + b0 = price(c, K); print('start b(B_%d) =' % K, b0, float(b0)) + chosen, tot = select(c, float(b0), K) + fr = c['frames'] + print('entries', len(chosen), 'chi %.5f' % tot, 'ranks', Counter(len(fr[E]) for E, _, _ in chosen), + 'donors', len({d for _, _, cm in chosen for d in cm})) + w = rehist(apply(c, chosen)); w['derived_from'] = c['derived_from'] + ' + shared-donor kernel via exterior gauges' + st = {}; gx.check1(w, scalar=True, stats=st); print('gx.check1 (E0-E7 incl. exact scalar E5 and Q2) PASS', st) + for K2 in (2, 3, 4): + b = price(w, K2); print('b(B_%d) =' % K2, b, float(b)) + json.dump(w, gzip.open(sys.argv[3], 'wt')) diff --git a/research/e8-outer-slack-refinement/source384/code/cxop.py b/research/e8-outer-slack-refinement/source384/code/cxop.py new file mode 100644 index 0000000000..772d6698da --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/cxop.py @@ -0,0 +1,32 @@ +"""Full rational operator of a gcert/1 program (A, scatter, B) on all registers, every initial value a variable; +compare two programs. usage: cxop.py CERT1 CERT2 [GXDIR]""" +import sys, gzip, json +from fractions import Fraction as Fr +def load(p): + x = json.load(gzip.open(p)); return x['cert'] if 'cert' in x else x +def op(c): + v, R = c['v'], c['R']; n = 2 * v + R + reg = [{r: Fr(1)} for r in range(n)] + def axpy(t, src, co): + d = reg[t] + for k, u in src.items(): + w = d.get(k, 0) + co * u + if w: d[k] = w + else: d.pop(k, None) + def run(G): + for g in G: + if g[0] == 'neg': reg[g[2]] = {k: -u for k, u in reg[g[2]].items()} + elif g[0] == 'out': + src = dict(reg[g[2]]) + for t, a, b in g[3]: axpy(t, src, Fr(a, b)) + else: + for s, a, b in g[3]: axpy(g[2], reg[s], Fr(a, b)) + run(c['A']); tot = {k: dict(reg[s]) for k, s, _ in c['ret']} + for t in range(v): + for k, a, b in c['scat']['table'][t]: axpy(v + t, tot[k], Fr(a, b)) + run(c['B']); return reg, tot +a, ta = op(load(sys.argv[1])); b, tb = op(load(sys.argv[2])) +assert ta == tb, 'retained totals differ' +diff = [r for r in range(len(a)) if a[r] != b[r]] +print('full rational operator on all %d registers (every initial value a variable) and the retained totals: %s' % (len(a), 'IDENTICAL' if not diff else 'DIFFER at %d registers' % len(diff))) +assert not diff diff --git a/research/e8-outer-slack-refinement/source384/code/cxpiece.py b/research/e8-outer-slack-refinement/source384/code/cxpiece.py new file mode 100644 index 0000000000..6cebe19c80 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/cxpiece.py @@ -0,0 +1,64 @@ +"""Piece relocation on a split gcert/1 program: a fan-out piece (s -> t) or fan-in piece (t += s) of an original gate +moves to the end (frame F >= the group frame) or the start (F <= the group frame) of its group, with its own frame +F between the outside neighbours of the shared register and of its own register (source-span rule kept). +Pieces of one original gate commute (fan-out pieces read an unchanged source; fan-in pieces add into one destination).""" +import sys, os, gzip, json, math, random, copy +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from cxsplit import * + + +def piece_pass(c, tag, a, m, eps=1e-9): + M = CX(c); d = lambda f: len(M.fr[f]); chi = lambda r: 0.0 if r <= 0 else r * (math.exp(a * math.log(m / r)) - 1) + groups = {} + for gi, t in enumerate(tag): groups.setdefault(tuple(t[:2]), []).append(gi) + best = None + for t, gis in groups.items(): + if len(gis) < 2: continue + f = M.gf[gis[0]] + if any(M.gf[g] != f for g in gis): continue + g0 = M.gates[gis[0]][1]; shared = g0[2] + if any(M.gates[g][1][2] != shared for g in gis): continue + ish = [M.where[x][shared] for x in gis] + info = [] + for gi in gis: + uniq = [r for r in M.where[gi] if r != shared] + if len(uniq) != 1: info.append(None); continue + u = uniq[0]; iu = M.where[gi][u]; info.append((u, M.F(u, iu - 1), M.F(u, iu + 1))) + for side in ('end', 'start'): + if side == 'end': ps, ns = f, M.F(shared, max(ish) + 1) + else: ps, ns = M.F(shared, min(ish) - 1), f + cands = set() + for k, gi in enumerate(gis): + if info[k] is None: continue + u, pu, nu = info[k] + loE = echelon(list(M.lb[gi]) + list(M.fr[ps]) + list(M.fr[pu])) + hiV = span_vecs(M.fr[ns]) & span_vecs(M.fr[nu]) + if not all(x in hiV for x in loE): continue + cands |= {M.fid(loE), M.fid(echelon(sorted(hiV))), ps, ns, pu, nu} + for x in sorted(hiV - span_vecs(loE)): cands.add(M.fid(echelon(loE + [x]))) + for F in cands: + if not (inside(M.fr[ps], M.fr[F]) and inside(M.fr[F], M.fr[ns])): continue + chosen = []; gain = 0.0 + for k, gi in enumerate(gis): + if info[k] is None: continue + u, pu, nu = info[k] + if not (inside(M.fr[pu], M.fr[F]) and inside(M.fr[F], M.fr[nu]) and inside(M.lb[gi], M.fr[F])): continue + du = chi(d(f) - d(pu)) + chi(d(nu) - d(f)) - chi(d(F) - d(pu)) - chi(d(nu) - d(F)) + if du > eps: chosen.append(gi); gain += du + if not chosen or len(chosen) == len(gis): continue + gain -= chi(d(F) - d(ps)) + chi(d(ns) - d(F)) - chi(d(ns) - d(ps)) + if gain > eps and (best is None or gain > best[0]): best = (gain, chosen, side, F, gis) + if best is None: return c, tag, 0.0 + g_, chosen, side, F, gis = best + gates = [copy.deepcopy(M.gates[i]) for i in range(len(M.gates))] + for i in range(len(gates)): gates[i][1][1] = M.gf[i] + for gi in chosen: gates[gi][1][1] = F + rest = [i for i in range(len(gates)) if i not in set(chosen)] + anchor = max(set(gis) - set(chosen)) if side == 'end' else min(set(gis) - set(chosen)) + pos = rest.index(anchor) + (1 if side == 'end' else 0) + order = rest[:pos] + sorted(chosen) + rest[pos:] + c2 = copy.deepcopy(c); c2['frames'] = [list(x) for x in M.fr]; c2['A'] = []; c2['B'] = []; tag2 = [] + for i in order: + c2[gates[i][0]].append(gates[i][1]) + tag2.append(list(tag[i][:2]) + ([side, len(tag)] if i in chosen else [])) + return rehist(c2), tag2, g_ diff --git a/research/e8-outer-slack-refinement/source384/code/cxretime.py b/research/e8-outer-slack-refinement/source384/code/cxretime.py new file mode 100644 index 0000000000..06f79f8280 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/cxretime.py @@ -0,0 +1,169 @@ +"""Retiming / descent on a gcert/1 complex program: move gate frames inside +[span(LB_g + prev frames of participants), AND of next frames] with the source-span rule (the x-content support of every +non-y operand, and of a slot destination after the gate, lies in the gate frame). Pins: start, scatter (y at 0, retained +slots at their ret frame), final. Greedy best-improvement with the chi ledger at m = (2K+1)h. +usage: cxretime.py CERT.json.gz GXDIR OUT.json.gz [K] [sweeps]""" +import sys, os, gzip, json, math, random, copy +from fractions import Fraction as Fr +from collections import Counter +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from cxkernel import reduce, inside, echelon, rehist, price + + +def regs_of(g): + if g[0] == 'neg': return [g[2]] + if g[0] == 'out': return [g[2]] + [t for t, _, _ in g[3]] + list(g[4]) + return [g[2]] + [s for s, _, _ in g[3]] + + +class CX: + def __init__(self, c): + self.c = c; v = c['v']; self.v = v; n = 2 * v + c['R']; self.n = n + self.fr = [tuple(f) for f in c['frames']]; self.key = {f: i for i, f in enumerate(self.fr)} + self.gates = [['A', g] for g in c['A']] + [['B', g] for g in c['B']] + self.gf = [g[1] for _, g in self.gates] + nA = len(c['A']) + occ = [[('p', c['start'][r])] for r in range(n)] + retf = {s: f for _, s, f in c['ret']} + for gi, (ph, g) in enumerate(self.gates): + if gi == nA: + for t in range(v): occ[v + t].append(('p', 0)) + for s, f in retf.items(): occ[s].append(('p', f)) + for r in regs_of(g): occ[r].append(('g', gi)) + for r in range(n): occ[r].append(('p', c['final'][r])) + self.occ = occ; self.where = [dict() for _ in self.gates] + for r in range(n): + for i, (k, x) in enumerate(occ[r]): + if k == 'g': self.where[x][r] = i + self.lb = self._lb() + + def _lb(self): + c = self.c; v = self.v; ports = c['ports'] + sup = [{r} if r < v else set() for r in range(self.n)] + lb = [] + for ph, g in self.gates: + need = set() + if g[0] == 'out': + for t, _, _ in g[3]: sup[t] |= sup[g[2]] + if g[2] < v or g[2] >= 2 * v: need |= sup[g[2]] + for t, _, _ in g[3]: + if t >= 2 * v: need |= sup[t] + elif g[0] == 'in': + for s, _, _ in g[3]: + sup[g[2]] |= sup[s] + if s < v or s >= 2 * v: need |= sup[s] + if g[2] >= 2 * v: need |= sup[g[2]] + lb.append(tuple(echelon([ports[x] for x in need]))) + return lb + + def fid(self, f): + f = tuple(f) + if f not in self.key: self.key[f] = len(self.fr); self.fr.append(f) + return self.key[f] + + def F(self, r, i): + k, x = self.occ[r][i]; return x if k == 'p' else self.gf[x] + + def span_ok(self): + return sum(1 for gi in range(len(self.gates)) if not inside(self.lb[gi], self.fr[self.gf[gi]])) + + +_sv = {} +def span_vecs(B): + B = tuple(B) + if B not in _sv: + out = {0} + for b in B: out |= {x ^ b for x in out} + _sv[B] = frozenset(out) + return _sv[B] + + +def block_of(M, gi): + f = M.gf[gi]; S = {gi}; stack = [gi] + while stack: + g = stack.pop() + for r, i in M.where[g].items(): + for j in (i - 1, i + 1): + k, x = M.occ[r][j] + if k == 'g' and x not in S and M.gf[x] == f: S.add(x); stack.append(x) + return S + + +def try_move(M, S, chi, d, temp=0.0, rng=None): + """move gate set S (all at one frame) to the best feasible frame; returns gain or None""" + old = M.gf[next(iter(S))]; regs = {} + for g in S: + for r, i in M.where[g].items(): regs.setdefault(r, []).append(i) + parts = [] + for r, ii in regs.items(): + lo_i, hi_i = min(ii), max(ii) + if len(ii) != hi_i - lo_i + 1: return None + parts.append((M.F(r, lo_i - 1), M.F(r, hi_i + 1))) + loE = echelon([u for g in S for u in M.lb[g]] + [u for p, _ in parts for u in M.fr[p]]) + hiV = None + for _, q in parts: + vs = span_vecs(M.fr[q]); hiV = vs if hiV is None else hiV & vs + if not all(u in hiV for u in loE): return None + cands = {M.fid(loE), M.fid(echelon(sorted(hiV)))} | {p for p, _ in parts} | {q for _, q in parts} + for u in sorted(hiV - span_vecs(loE)): cands.add(M.fid(echelon(loE + [u]))) + def ok(F): + return all(inside(M.fr[p], M.fr[F]) and inside(M.fr[F], M.fr[q]) for p, q in parts) and inside(loE, M.fr[F]) + def score(F): return sum(chi(d(F) - d(p)) + chi(d(q) - d(F)) for p, q in parts) + base = score(old); opts = [(score(F), F) for F in cands if F != old and ok(F)] + if not opts: return None + if temp > 0: + sc, F = rng.choice(opts) + if sc < base - 1e-12 or rng.random() < math.exp(-(sc - base) / temp): + for g in S: M.gf[g] = F + return base - sc + return None + sc, F = min(opts) + if sc < base - 1e-12: + for g in S: M.gf[g] = F + return base - sc + return None + + +def subblocks(M, S): + T = sorted(S); out = [S] + for k in range(1, len(T)): out.append(set(T[:k])); out.append(set(T[k:])) + out += [{g} for g in T] if len(T) > 1 else [] + return out + + +def sweep(M, a, m, rng, temp=0.0): + d = lambda f: len(M.fr[f]); chi = lambda r: 0.0 if r <= 0 else r * (math.exp(a * math.log(m / r)) - 1) + moved = 0; gain = 0.0; idx = list(range(len(M.gates))); rng.shuffle(idx); done = set() + for gi in idx: + if gi in done: continue + S = block_of(M, gi); done |= S + subs = subblocks(M, S) if len(S) <= 12 else [S] + if temp > 0: subs = [rng.choice(subs)] + for sub in subs: + g = try_move(M, sub, chi, d, temp, rng) + if g is not None: moved += 1; gain += g; break + return moved, gain + + +def to_cert(M): + c = copy.deepcopy(M.c); c['frames'] = [list(f) for f in M.fr] + A = []; B = [] + for gi, (ph, g) in enumerate(M.gates): + g2 = copy.deepcopy(g); g2[1] = M.gf[gi]; (A if ph == 'A' else B).append(g2) + c['A'] = A; c['B'] = B + return rehist(c) + + +if __name__ == '__main__': + c = json.load(gzip.open(sys.argv[1])); sys.path.insert(0, sys.argv[2]); import gx + K = int(sys.argv[4]) if len(sys.argv) > 4 else 3; sw = int(sys.argv[5]) if len(sys.argv) > 5 else 20 + h = c['h']; m = (2 * K + 1) * h + M = CX(c); print('span violations on input', M.span_ok()) + b0 = price(c, K); print('start b', b0, float(b0)); rng = random.Random(1) + for s in range(sw): + mv, g = sweep(M, float(b0), m, rng); print('sweep', s, 'moved', mv, 'chi/a %.4f' % (g / float(b0)), flush=True) + if not mv: break + w = to_cert(M); print('span violations', M.span_ok()) + st = {}; gx.check1(w, scalar=True, stats=st); print('gx.check1 PASS') + for K2 in (2, 3): b = price(w, K2); print('b(B_%d) =' % K2, b, float(b)) + json.dump(w, gzip.open(sys.argv[3], 'wt')) diff --git a/research/e8-outer-slack-refinement/source384/code/cxsplit.py b/research/e8-outer-slack-refinement/source384/code/cxsplit.py new file mode 100644 index 0000000000..e9cd44a1fe --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/cxsplit.py @@ -0,0 +1,92 @@ +"""Split every multi-addition gate of a gcert/1 program into elementary single-addition gates in the same order (same +scalar operator: fan-out pieces read an unchanged source, fan-in pieces add into one destination), then run block and +single-gate retiming (cxretime) on the split program, then re-merge adjacent pieces of one original gate that kept a +common frame. usage: cxsplit.py CERT.json.gz GXDIR OUT.json.gz [K] [sweeps] [seed]""" +import sys, os, gzip, json, math, random, copy +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from cxretime import * +from cxretime import sweep as block_sweep + + +def split(c): + c = copy.deepcopy(c); tag = [] + for ph in ('A', 'B'): + out = [] + for gi, g in enumerate(c[ph]): + if g[0] == 'out' and len(g[3]) + len(g[4]) > 1: + pieces = [['out', g[1], g[2], [x], []] for x in g[3]] + if g[4]: pieces[0][4] = list(g[4]) if pieces else None + for p_ in pieces: out.append(p_); tag.append((ph, gi)) + elif g[0] == 'in' and len(g[3]) > 1: + for x in g[3]: out.append(['in', g[1], g[2], [x]]); tag.append((ph, gi)) + else: out.append(g); tag.append((ph, gi)) + c[ph] = out + return c, tag + + +def merge(c, tag): + c = copy.deepcopy(c); k = 0 + for ph in ('A', 'B'): + out = []; prev = None + for g in c[ph]: + t = tag[k]; k += 1 + if prev is not None and prev[0] == t and out[-1][0] == g[0] and out[-1][1] == g[1] and out[-1][2] == g[2]: + out[-1][3] = out[-1][3] + g[3] + if g[0] == 'out': out[-1][4] = out[-1][4] + g[4] + else: out.append(copy.deepcopy(g)) + prev = (t,) + c[ph] = out + return c + + +def single_sweep(M, a, m, rng): + d = lambda f: len(M.fr[f]); chi = lambda r: 0.0 if r <= 0 else r * (math.exp(a * math.log(m / r)) - 1) + moved = 0; gain = 0.0; idx = list(range(len(M.gates))); rng.shuffle(idx) + for gi in idx: + old = M.gf[gi]; parts = [(M.F(r, i - 1), M.F(r, i + 1)) for r, i in M.where[gi].items()] + loE = echelon(list(M.lb[gi]) + [u for p, _ in parts for u in M.fr[p]]) + hiV = None + for _, q in parts: + vs = span_vecs(M.fr[q]); hiV = vs if hiV is None else hiV & vs + if not all(u in hiV for u in loE): continue + cands = {M.fid(loE), M.fid(echelon(sorted(hiV)))} | {p for p, _ in parts} | {q for _, q in parts} + loS = span_vecs(loE) + for u in sorted(hiV - loS): cands.add(M.fid(echelon(loE + [u]))) + def ok(F): return all(inside(M.fr[p], M.fr[F]) and inside(M.fr[F], M.fr[q]) for p, q in parts) and inside(loE, M.fr[F]) + def score(F): return sum(chi(d(F) - d(p)) + chi(d(q) - d(F)) for p, q in parts) + base = score(old); best, bs = old, base + for F in cands: + if F != old and ok(F): + sc = score(F) + if sc < bs - 1e-12: best, bs = F, sc + if best != old: M.gf[gi] = best; moved += 1; gain += base - bs + return moved, gain + + +def prune_frames(c): + """drop unused appended frames (keep the original table prefix), renumber""" + return c + + +if __name__ == '__main__': + c0 = json.load(gzip.open(sys.argv[1])); sys.path.insert(0, sys.argv[2]); import gx + K = int(sys.argv[4]) if len(sys.argv) > 4 else 3; sw = int(sys.argv[5]) if len(sys.argv) > 5 else 30 + rng = random.Random(int(sys.argv[6]) if len(sys.argv) > 6 else 1) + h = c0['h']; m = (2 * K + 1) * h; b0 = price(c0, K); print('start b', b0, float(b0)) + c, tag = split(c0); M = CX(c); a = float(b0) + for s in range(sw): + m1, g1 = single_sweep(M, a, m, rng); m2, g2 = block_sweep(M, a, m, rng) + print('sweep', s, 'single', m1, 'block', m2, 'chi/a %.4f' % ((g1 + g2) / a), flush=True) + if not (m1 or m2): break + w = to_cert(M); w = rehist(merge(w, tag)) + # drop unused frames beyond the original table + used = set(w['start']) | set(w['final']) | {g[1] for g in w['A'] + w['B']} | {f for _, _, f in w['ret']} + keep = list(range(len(c0['frames']))) + [i for i in range(len(c0['frames']), len(w['frames'])) if i in used] + ren = {o: n for n, o in enumerate(keep)}; w['frames'] = [w['frames'][i] for i in keep] + for ph in ('A', 'B'): + for g in w[ph]: g[1] = ren[g[1]] + w = rehist(w) + print('span violations', CX(w).span_ok(), '| gates A/B', len(w['A']), len(w['B']), 'vs', len(c0['A']), len(c0['B']), '| new frames', len(w['frames']) - len(c0['frames'])) + st = {}; gx.check1(w, scalar=True, stats=st); print('gx.check1 PASS (E0-E7, exact scalar E5)') + for K2 in (2, 3): b = price(w, K2); print('b(B_%d) =' % K2, b, float(b)) + json.dump(w, gzip.open(sys.argv[3], 'wt')) diff --git a/research/e8-outer-slack-refinement/source384/code/e8core.py b/research/e8-outer-slack-refinement/source384/code/e8core.py new file mode 100644 index 0000000000..78983b3687 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/e8core.py @@ -0,0 +1,203 @@ +"""Our own engine for bitE8/1 words (E8 root-line labels, h = 8): frame algebra over Q via root-line masks, +legality/F2 replay, five-stage histogram, exact bit coarse saving and PR #315 outer assembly (our engine copies). +Chafik Boukhalfa (chafreaky) with Anthropic Claude assistance; Apache-2.0.""" +import gzip, json, os, importlib.util +from fractions import Fraction as Q +from collections import Counter + +HERE = os.path.dirname(os.path.abspath(__file__)) +def _load(n): + s = importlib.util.spec_from_file_location('e8_' + n, os.path.join(HERE, "engines", n + ".py")) + m = importlib.util.module_from_spec(s); s.loader.exec_module(m); return m +moment = _load('moment'); other = _load('base_two_moment'); outer = _load('outer') + +B2 = Q(876248285600677, 10**18) # Sussman E8 five-stage (PR #352) +B3 = Q(932783231884153, 10**18) # DaysSky seven-stage B_3 (PR #363; no Lean proof) + + +def load_word(p): + with (gzip.open(p, 'rt') if p.endswith('.gz') else open(p)) as f: + return json.load(f) + + +def save_word(c, p): + with gzip.open(p, 'wt') as f: + json.dump(c, f, separators=(',', ':')) + + +def rank(vecs): + rows = [[Q(x) for x in r] for r in vecs]; rk = 0 + n = len(rows[0]) if rows else 0 + for col in range(n): + p = next((i for i in range(rk, len(rows)) if rows[i][col] != 0), None) + if p is None: continue + rows[rk], rows[p] = rows[p], rows[rk] + for i in range(len(rows)): + if i != rk and rows[i][col] != 0: + f = rows[i][col] / rows[rk][col]; rows[i] = [a - f * b for a, b in zip(rows[i], rows[rk])] + rk += 1 + return rk + + +class Lat: + """Root-spanned subspaces of Q^8 represented by the mask of root lines they contain.""" + def __init__(self, lines): + self.lines = [tuple(x) for x in lines]; self.v = len(lines) + self._dim = {0: 0}; self._close = {} + # Gram (form /2) for orthogonality + self.ip = [[sum(a * b for a, b in zip(x, y)) // 2 for y in self.lines] for x in self.lines] + + def close(self, mask): + """mask of all root lines in span(roots of mask)""" + if mask in self._close: return self._close[mask] + idx = [i for i in range(self.v) if mask >> i & 1] + basis = [] + for i in idx: + if rank([self.lines[j] for j in basis] + [self.lines[i]]) > len(basis): basis.append(i) + d = len(basis); out = 0 + if d == 8: out = (1 << self.v) - 1 + elif d: + B = [self.lines[j] for j in basis] + for i in range(self.v): + if rank(B + [self.lines[i]]) == d: out |= 1 << i + self._close[mask] = out; self._close[out] = out; self._dim[out] = d + return out + + def dim(self, mask): + if mask not in self._dim: self.close(mask) + return self._dim[mask] + + def basis(self, mask): + b = [] + for i in range(self.v): + if mask >> i & 1 and rank([self.lines[j] for j in b] + [self.lines[i]]) > len(b): b.append(i) + return b + + def perp(self, t): + return self.close(sum(1 << j for j in range(self.v) if self.ip[t][j] == 0)) + + +def to_masks(c, L): + return [L.close(sum(1 << i for i in fr)) for fr in c['frames']] + + +PHASES = ('D', 'A', 'B', 'C') + + +def replay(c, L=None, masks=None, check_f2=True, span=True, span_mode='z'): + """Exact legality + F2 replay + histogram of a bitE8/1 word. Returns dict(H_local, steps, ...). + Legality: each register's frames nested (mask inclusion = exact Q-subspace inclusion for root-spanned frames) and + strictly increasing at each move; every gate at one common frame; D compensation at frame 0; y at frame 0 at the + scatter; COPY of retained totals; final frames (x, helpers FULL; y_t at its cap t-perp). + Source-span: every non-target operand's x-support lies in the gate frame.""" + L = L or Lat(c['lines']); masks = masks or to_masks(c, L) + v, R, h = c['v'], c['R'], c['h']; n = 2 * v + R; FULL = (1 << v) - 1 + cur = [masks[f] for f in c['start']] + for r in range(v): assert cur[r] == L.close(1 << r), 'x start' + for r in range(v, 2 * v): assert cur[r] == 0, 'y start at 0' + sig = [L.dim(cur[r]) for r in range(n)] + H = Counter(); steps = 0; viol = [] + val = [1 << i for i in range(n)] + zsupp = [{i: 1} if i < v else {} for i in range(n)] # integer support of each register over the x columns (all ADDs are +1) + def climb(r, m): + nonlocal steps + if cur[r] == m: return + assert cur[r] & ~m == 0 and cur[r] != m, ('not nested', r) + H[L.dim(m) - L.dim(cur[r])] += 1; steps += 1; cur[r] = m + def run(gates, ph): + for k, (f, d, srcs) in enumerate(gates): + m = masks[f] + assert d >= v and d not in srcs and len(set(srcs)) == len(srcs), (ph, k) + for x in [d] + srcs: climb(x, m) + for s in srcs: + val[d] ^= val[s] + if span: + if s < v or s >= 2 * v: + ms = sum(1 << i for i in zsupp[s]) + if ms & ~m: viol.append((ph, k, s)) + zd = zsupp[d] + for i, a in zsupp[s].items(): + w = zd.get(i, 0) + a + if w: zd[i] = w + else: zd.pop(i, None) + if span_mode == 'f2': + zsupp[d] = {i: 1 for i in range(v) if val[d] >> i & 1} + if span and d >= 2 * v: + md = sum(1 << i for i in zsupp[d]) + if md & ~m: viol.append((ph, k, d)) + run(c['D'], 'D') + for r in range(v, n): assert cur[r] == masks[c['start'][r]], 'D compensation at frame 0 (helpers untouched otherwise)' + run(c['A'], 'A') + for t in range(v): assert cur[v + t] == 0, 'y at frame 0 at the scatter' + copies = [val[q] for q in c['ret']] + for q in c['ret']: + assert q >= 2 * v; H[L.dim(cur[q])] += 1 + for t, row in enumerate(c['scatter']): + for k in row: val[v + t] ^= copies[k] + run(c['B'], 'B'); run(c['C'], 'C') + for r in range(n): climb(r, masks[c['final'][r]]) + for r in range(v): assert cur[r] == FULL + for r in range(2 * v, n): assert cur[r] == FULL + for t in range(v): assert cur[v + t] == L.perp(t), 'y final at cap' + if check_f2: + for s in range(v): assert val[s] == 1 << s + for t in range(v): assert val[v + t] == (1 << (v + t)) | (1 << t), ('target', t) + for r in range(2 * v, n): assert val[r] == 1 << r, ('helper', r) + return dict(sig=sig, viol=viol, H=H, steps=steps, n=n, v=v, R=R, h=h, L=L, masks=masks, ncopy=len(c['ret'])) + + +def profile(H_local, v, h=8): + prof = Counter({j: 5 * c for j, c in H_local.items()}) + for j in (2 * h - 2, h - 1, 2 * h + 2, 4): prof[j] += 2 * v + return prof + + +def coarse(H, m, W): + grid = Q(1, 10**18) + root = moment.certify(dict(H), m, W, True); c = Q(int(Q(root['lower']) * 10**18), 10**18) + assert moment.moment(H, m, W, c, True)[1] < 1 < moment.moment(H, m, W, c + grid, True)[0] + fb = 32 * m * m * sum(H.values()) + _, up = other.moment(m, W, list(H.items()), c); _, bad = other.moment(m, W, [(1, fb)], c) + lo, _ = other.moment(m, W, list(H.items()), c + grid); blo, _ = other.moment(m, W, [(1, fb)], c + grid) + assert up + Q(1, 10**16) * bad < 1 < lo + Q(1, 10**16) * blo + return c + + +def kappa(c, b): + grid = Q(1, 10**18); eta = Q(1, 10**12); beta = Q(1, 10**9); cap = (1 - beta) * b + sv = min(c, Q(((cap - grid) * 10**18).__floor__(), 10**18)); binding = 'bit' if sv == c else 'complex' + chain = [Q(384599, 10**10)] + for _ in range(3): + a = (1 - sv) * sv + sv * chain[-1]; assert chain[-1] < a < sv < 1 - a; chain.append(a) + bit = chain[-1] + bridge = dict(proof='PROOF.md', representation='Exact powers with source-bound finite overcharges', + semantic=dict(G=dict(base=2, exponent=30000), E=dict(base=2, exponent=100000), B_upper=dict(base=2, exponent=100001), + C0=dict(base=2, exponent=210000), C1=1, strict_literal_gap=1, induction_gap_lower=1), + rows=dict(coefficient=20161, degree=10**6, suffix_slope=4 * 10**6, degree_gap=Q(10**6) - Q(51 * 20161, 25))) + q = bit * (1 - 2 * eta); mn = (1 - eta) * q / (1 + q); t = mn * 10**18; k = Q((t.numerator - 1) // t.denominator, 10**18) + asm = outer.assembly(bit, b, bridge, k, eta=eta, beta=beta) + assert len(asm['strict_constraints']) == 47 and min(asm['strict_constraints'].values()) > 0 + try: + outer.assembly(bit, b, bridge, k + grid, eta=eta, beta=beta); raise SystemExit('ADJACENT ADMITTED') + except AssertionError: pass + return k, binding + + +def price_word(c, **kw): + r = replay(c, **kw) + v, h, R = r['v'], r['h'], r['R']; m = 5 * h + resid = sum(h - r['sig'][x] for x in range(2 * v, 2 * v + R)) + T = 1 if resid % h == 0 else h + W = (4 * v * h + resid) * T // h; assert (4 * v * h + resid) * T % h == 0 + prof = Counter({j: T * k for j, k in profile(r['H'], v, h).items()}); mass = sum(a * b for a, b in prof.items()) + L_copy = h * r['ncopy'] + assert m * W - mass == T * (4 * v - 5 * L_copy), ('deficit', m * W - mass) + assert 2 * max(prof) < m + cc = coarse(prof, m, W) + return dict(c=cc, H=r['H'], prof=prof, W=W, T=T, resid=resid, m=m, deficit=m * W - mass, replay=r) + + +def phi_fn(m, W, a): + """linearized moment term per child of rank r (float), for search scoring""" + import math + return lambda r: r / (m * W) * math.exp(a * math.log(m / r)) diff --git a/research/e8-outer-slack-refinement/source384/code/engines/base_two_moment.py b/research/e8-outer-slack-refinement/source384/code/engines/base_two_moment.py new file mode 100644 index 0000000000..14a90fa0e7 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/engines/base_two_moment.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +"""Maintainer arithmetic cross-check of the pinned PR39 certificate. + +Uses no producer/checker imports. Counts are inputs, not proved by this script. +80-term rational logarithms and 12-term exponentials independently enclose +the two moments. The accompanying written review addresses their realization. +""" +import argparse +from fractions import Fraction as Q +from hashlib import sha256 +import json +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +GRID = 10**30 + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def log_unit(x): + require(1 <= x <= 2, "logarithm range") + z = (x-1)/(x+1) + lo = 2*sum((z**(2*j+1)/(2*j+1) for j in range(80)), Q(0)) + return lo, lo+2*z**161/(161*(1-z*z)) + + +def log_bounds(x): + k = 0 + while x > 2: + x /= 2 + k += 1 + lo, hi = log_unit(x) + l2, u2 = log_unit(Q(2)) + lo, hi = lo+k*l2, hi+k*u2 + # Outward rational rounding keeps later certificates compact. + return Q((lo*GRID).__floor__(), GRID), Q((hi*GRID).__ceil__(), GRID) + + +def exp_bounds(x): + require(0 <= x < 1, "exponential range") + term = total = Q(1) + for j in range(1, 13): + term *= x/j + total += term + tail = term*x/13/(1-x/14) + return total, total+tail + + +def moment(m, W, entries, saving): + lo = hi = Q(0) + for t, count in entries: + t, count = int(t), int(count) + require(0 < t < m and count > 0, "improper child") + l, u = log_bounds(Q(m, t)) + lower = exp_bounds(saving*l)[0] + upper = exp_bounds(saving*u)[1] + lo += Q(t*count, m*W)*lower + hi += Q(t*count, m*W)*upper + return Q((lo*GRID).__floor__(), GRID), Q((hi*GRID).__ceil__(), GRID) + diff --git a/research/e8-outer-slack-refinement/source384/code/engines/moment.py b/research/e8-outer-slack-refinement/source384/code/engines/moment.py new file mode 100644 index 0000000000..7d697cb452 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/engines/moment.py @@ -0,0 +1,113 @@ +"""Independent prospective ordinary five-stage cost, never supplier admission. + +Consumes a raw one-invocation ledger made from the actual source/internal/target +paths. No packed profile is used as an input. Missing physical/finite/compiler +obligations must remain explicit in the accompanying report. +""" +from collections import Counter +from decimal import Decimal, localcontext, ROUND_FLOOR +from fractions import Fraction as F +from functools import lru_cache +from math import factorial +import hashlib, json, sys +from pathlib import Path + +DYAD = 1 << 224 + +def floor(x): return F(x.numerator*DYAD//x.denominator, DYAD) +def ceil(x): return -floor(-x) + +@lru_cache(None) +def logarithm(x): + """Mercator bounds after binary reduction; ln(2) via two Mercator sums. + + For 1 <= y < 2, log(y) is an alternating series in z=y-1. + We instead reduce to 1 <= y < 3/2, and bound log(3/2) and + log(2) by the same alternating series at z=1/2 and z=1/3, + using log(2)=log(3/2)+log(4/3). All sums are exact rationals. + """ + assert x >= 1 + k = 0 + while x >= 2: x /= 2; k += 1 + j = int(x >= F(3, 2)) + if j: x /= F(3, 2) + def mercator(y): + z=y-1 + assert 0 <= z <= F(1,2) + # An even partial sum is below log; the next term bounds its tail. + t=z; s=F(0) + for n in range(1, 225): + s += (t if n & 1 else -t)/n + t *= z + return s, s+t/225 + a,b=mercator(x); c,d=mercator(F(3,2)); e,f=mercator(F(4,3)) + return floor(a+(k+j)*c+k*e), ceil(b+(k+j)*d+k*f) + +def exponential(l,u): + assert 0 <= l <= u < F(1,10) + def poly(x): + s=t=F(1) + for j in range(1,25): t=t*x/j; s+=t + return s,t + lo,_=poly(l);hi,last=poly(u) + return floor(lo),ceil(hi+last*u/25/(1-u/26)) + +def moment(H,m,W,a,bad=False): + lo=hi=F(0) + for r,n in H.items(): + assert 0 < r < m and n > 0 + l,u=logarithm(F(m,r)); e,f=exponential(a*l,a*u) + p=F(r*n,m*W);lo+=p*e;hi+=p*f + if bad: + # Existing envelope shape, only conditionally portable to the new cover. + l,u=logarithm(F(m));e,f=exponential(a*l,a*u) + p=F(32*m*sum(H.values()),10**16*W) + lo+=p*e;hi+=p*f + return floor(lo),ceil(hi) + +def decimal(x): + with localcontext() as c: + c.prec=70 + return str(Decimal(x.numerator)/Decimal(x.denominator)) + +def certify(H,m,W,bad=False): + with localcontext() as c: + c.prec=70 + terms=[(Decimal(r*n)/Decimal(m*W),(Decimal(m)/Decimal(r)).ln()) for r,n in H.items()] + fallback=Decimal(32*m*sum(H.values()))/Decimal(10**16*W) if bad else Decimal(0) + lm=Decimal(m).ln();lo=Decimal(0);hi=Decimal('.003') + for _ in range(210): + a=(lo+hi)/2 + if sum(p*(a*l).exp() for p,l in terms)+fallback*(a*lm).exp()<1:lo=a + else:hi=a + q=int(((lo+hi)/2*10**24).to_integral_value(rounding=ROUND_FLOOR)) + lo=F(q,10**24);hi=lo+F(1,10**24) + lv=moment(H,m,W,lo,bad);hv=moment(H,m,W,hi,bad) + assert lv[1]<10 for v in slacks.values()),{k:str(v) for k,v in slacks.items() if v<=0} + assert min(margins.values())==minimum + assert margins['balanced_prefix']-minimum==eta and 1-eps-r==eta/2 + assert 1-eps*(1+c)==eta-eps*eta/4 + return dict(parameters=dict(a_bit=a,a_complex=b,tau=tau,sigma=sigma, + eta=eta,beta=beta,q=q,c=c,epsilon=eps,lambda_=lam, + lambda_prime=lp,alpha_squared_power=r,delta=delta, + C0=bridge['semantic']['C0'],C1=1,kappa=kappa), + strict_constraints=slacks,margins=margins,minimum_margin=minimum, + absorption_gap=minimum-kappa, + recurrence=dict(internal=internal,leaf=leaf,reservations=1-c)) diff --git a/research/e8-outer-slack-refinement/source384/code/far9.py b/research/e8-outer-slack-refinement/source384/code/far9.py new file mode 100644 index 0000000000..69d6efc047 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/far9.py @@ -0,0 +1,34 @@ +"""Our far-piece-relocation search (cxfar.py: far relocation, single/block retiming, in-group piece relocation), with the +chi ledger and the price taken in #377's nine-stage setting (m = 73, pooled profile of nine.py) instead of B_3 at m = 63. +usage: far9.py CERT.json.gz GXDIR OUT.json.gz [passes]""" +import sys, os, json, gzip, random +from collections import Counter +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from cxfar import far_pass, piece_pass, split, CX, rehist, to_cert, bsweep +from cxsplit import single_sweep +from e8core import coarse + + +def price9(c): + H = Counter() + for bl in c['blocks'].values(): + for r, n in bl.items(): H[int(r)] += 72 * n + for r in (16, 8, 32, 8, 48, 8, 48, 32, 16): H[r] += 1920 + H[1] += 7047; return coarse(H, 73, 14727) + + +if __name__ == '__main__': + sys.path.insert(0, sys.argv[2]); import gx + src = json.load(gzip.open(sys.argv[1])) + c, tag = (src['cert'], [tuple(t) for t in src['tag']]) if 'cert' in src else split(src) + m = 73; b0 = price9(c); a = float(b0); rng = random.Random(1); print('start b9', b0, float(b0), flush=True) + for p in range(int(sys.argv[4]) if len(sys.argv) > 4 else 120): + c, tag, g = far_pass(c, tag, a, m); M = CX(c) + for s in range(10): + m1, _ = single_sweep(M, a, m, rng); m2, _ = bsweep(M, a, m, rng) + if not (m1 or m2): break + c = rehist(to_cert(M)); c, tag, g2 = piece_pass(c, tag, a, m) + b = price9(c); print('pass', p, 'far/a %.3f piece/a %.3f' % (g / a, g2 / a), 'b9', b, '%.15e' % float(b), flush=True) + if g == 0 and g2 == 0: break + gx.check1(c, scalar=True); print('gx.check1 PASS') + json.dump(dict(cert=c, tag=[list(t) for t in tag]), gzip.open(sys.argv[3], 'wt')) diff --git a/research/e8-outer-slack-refinement/source384/code/layout_bk.py b/research/e8-outer-slack-refinement/source384/code/layout_bk.py new file mode 100644 index 0000000000..57aa98085b --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/layout_bk.py @@ -0,0 +1,63 @@ +"""Our own check of the bridged layout B_K (Sussman's B_2, Work/Bridge/Net.lean; DaysSky's B_K generalisation, PR #363), +reimplemented from the schedule stated in PR #363's README and Sussman's coordinate-frame stage geometry: +K bank pairs, 2K+1 stages on H + 2K.H (m = (2K+1)h). Pair 1: forward, backward, forward; pair p >= 2: backward, forward, +borrowing its first forward from pair p-1 through twin gates (+-1 additions at equal frames). +Checks: frames are coordinate sets; every climb nested; twin gates at equal frames; each invocation entered at its +stage frame; final frames; m-1 moves per data role; exchange identity X_p = -y_p, Y_p = x_p (exact integer +linear algebra on symbolic coefficient vectors). Returns the idle climbs per role pair (optionally split at s). +Chafik Boukhalfa (chafreaky) with Anthropic Claude assistance; Apache-2.0.""" +def layout(K, h, split=None): + s = 2 * K + 1; m = s * h; l = 0 + blk = lambda name, skip=None: {(name, j) for j in range(h) if j != skip} + B0 = blk('b0'); F = ['F%d' % i for i in range(s - 1)] + ALL = set(B0).union(*[blk(f) for f in F]); assert len(ALL) == m + def enter(t, X): + if t == 0: return {('b0', l)} if X else set() + base = set(B0) if X else B0 - {('b0', l)} + for f in F[:t - 1]: base |= blk(f, l) + return base + def leave(t, X): + return (set(B0) if X else B0 - {('b0', l)}) if t == 0 else enter(t, X) | blk(F[t - 1], l) + sched = [(0, 'F', 1), (1, 'B', 1), (2, 'F', 1)] + for p in range(2, K + 1): sched += [(2 * p - 1, 'B', p), (2 * p, 'F', p)] + fr = {(X, p): enter(0, X) for p in range(1, K + 1) for X in (True, False)} + inv = {k: 0 for k in fr}; idle = {k: [] for k in fr} + # symbolic values: vector over symbols x1..xK, y1..yK + sym = lambda nm, p: tuple(int(q == (nm, p)) for q in [(a, b) for a in 'xy' for b in range(1, K + 1)]) + val = {(True, p): sym('x', p) for p in range(1, K + 1)} | {(False, p): sym('y', p) for p in range(1, K + 1)} + add = lambda u, w, c: tuple(a + c * b for a, b in zip(u, w)) + def go(k, new, is_idle): + assert fr[k] <= new, 'climb not nested' + if new != fr[k]: + (idle[k].append(len(new) - len(fr[k])) if is_idle else None) + if not is_idle: inv[k] += len(new) - len(fr[k]) + fr[k] = set(new) + def gate(d, s_, c): + assert fr[d] == fr[s_], 'twin gate at unequal frames' + val[d] = add(val[d], val[s_], c) + for t, kind, p in sched: + for X in (True, False): + go((X, p), enter(t, X), True); go((X, p), leave(t, X), False) + if kind == 'F': val[(False, p)] = add(val[(False, p)], val[(True, p)], 1) + else: val[(True, p)] = add(val[(True, p)], val[(False, p)], -1) + for q in range(2, K + 1): + if t in (2 * q - 3, 2 * q - 2): + for X in (True, False): go((X, q), fr[(X, q - 1)], True) + if t == 2 * q - 3: gate((True, q - 1), (True, q), 1); gate((False, q), (False, q - 1), -1) + else: gate((False, q), (False, q - 1), 1); gate((True, q - 1), (True, q), -1) + for k in fr: go(k, ALL if k[0] else ALL - {('b0', l)}, True) + for q in range(K, 1, -1): gate((False, q - 1), (False, q), -1); gate((True, q), (True, q - 1), 1) + for k in fr: assert inv[k] + sum(idle[k]) == m - 1 + for p in range(1, K + 1): + assert val[(True, p)] == tuple(-a for a in sym('y', p)) and val[(False, p)] == sym('x', p), ('exchange', p) + assert idle[(True, p)] == idle[(False, p)] + blocks = [r for p in range(1, K + 1) for r in idle[(True, p)]] + if split: + out = [] + for r in blocks: + while r > split: out.append(split); r -= split + if r: out.append(r) + blocks = out + return dict(m=m, per_pair={p: idle[(True, p)] for p in range(1, K + 1)}, blocks=blocks) +if __name__ == '__main__': + print(layout(2, 9)); print(layout(3, 9)); print(layout(3, 9, split=31)) diff --git a/research/e8-outer-slack-refinement/source384/code/nine.py b/research/e8-outer-slack-refinement/source384/code/nine.py new file mode 100644 index 0000000000..309c28228e --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/code/nine.py @@ -0,0 +1,76 @@ +"""Exact coarse savings for jacklightChen's PR #377 nine-stage complex component with the local E8 certificate swapped, +our bit word (PR #382) in B_3 unsplit, and PR #315's outer assembly. +#377's paid profile (its complex_candidate.py / global_nine.py, read as data) is + L*T * (sum over all local blocks x, y, s, c of the certificate's child histogram) [L = 9 stages, T = 8 replicas] + + 2*v*T * (idle ranks 2j(h-1), h-1 for j = 1..k-1, and 2(k-j)(h-1) for j = 1..k) [k = 4 pairs] + + L*R paid rank-1 bank paddings, +with m = 73, live W = 8*v*T + L*R = 14727. Only the pooled local histogram depends on the certificate. +usage: nine.py ORIG.json.gz OURS.json.gz PR377_GLOBAL_REVIEW.json BITWORD.json.gz OUT.json""" +import sys, os, json, gzip +from collections import Counter +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from e8core import coarse, kappa, price_word, load_word, Q +from layout_bk import layout + +k, L, T = 4, 9, 8 + + +def nine_profile(c): + h, v, R = c['h'], c['v'], c['R']; assert (h, v, R, c['cst']) == (9, 120, 783, 72) + H = Counter() + for block in c['blocks'].values(): + for r, n in block.items(): H[int(r)] += L * T * n + idle = [x for j in range(1, k) for x in (2 * j * (h - 1), h - 1)] + [2 * (k - j) * (h - 1) for j in range(1, k + 1)] + assert idle == [16, 8, 32, 8, 48, 8, 48, 32, 16, 0] + for r in idle: + if r: H[r] += 2 * v * T + H[1] += L * R + m, W = h + 8 * (L - 1), 8 * v * T + L * R; assert (m, W) == (73, 14727) + assert m * W - sum(r * n for r, n in H.items()) == T * (2 * k * v - L * c['cst']) == 2496 + return H, m, W + + +def degree(H, m): + mx = max(H); t = 1 + while m ** t <= 2 * mx ** t: t += 1 + return mx, t + + +def bit_bk_unsplit(word, K=3): + p = price_word(word); h, v = 8, 120; s = 2 * K + 1; m = s * h; resid = p['resid'] + T8 = 1 if resid % h == 0 else h + lay = layout(K, h) + H = Counter({r: T8 * s * c for r, c in p['H'].items()}) + for r in lay['blocks']: H[r] += T8 * 2 * v + W = (2 * K * v * h + resid) * T8 // h; assert (2 * K * v * h + resid) * T8 % h == 0 + assert m * W - sum(r * c for r, c in H.items()) == T8 * (2 * K * v - s * 72), 'deficit' + mx, t = degree(H, m); assert m <= 72 + return coarse(H, m, W), mx, t, m + + +load = lambda p: json.load(gzip.open(p)) +orig, ours, g = load(sys.argv[1]), load(sys.argv[2]), json.load(open(sys.argv[3])) +H0, m, W = nine_profile(orig) +assert {str(r): n for r, n in sorted(H0.items())} == g['profile'] and (g['m'], g['live'], g['deficit']) == (m, W, 2496) +print(' #377 profile rebuilt from Sussman\'s certificate equals GLOBAL-REVIEW.json field for field (m %d, W %d, deficit 2496)' % (m, W)) +H1, _, _ = nine_profile(ours) +d = {r: H1.get(r, 0) - H0.get(r, 0) for r in sorted(set(H0) | set(H1)) if H1.get(r, 0) != H0.get(r, 0)} +print(' profile with the re-timed certificate:', dict(sorted(H1.items()))) +print(' profile delta (= 72 x pooled local delta):', d) +assert all(x % 72 == 0 for x in d.values()) and sum(r * x for r, x in d.items()) == 0 +mx0, t0 = degree(H0, m); mx1, t1 = degree(H1, m); assert (mx0, t0) == (mx1, t1) == (48, 2) +b0 = coarse(H0, m, W); assert b0 == Q(999240641319551, 10**18), b0 +b1 = coarse(H1, m, W) +print(' b (#377, Sussman\'s unit) = %s = %.15e [= #377]' % (b0, float(b0))) +print(' b (#377 with our re-timed unit) = %s = %.15e (+%.6e)' % (b1, float(b1), float(b1 - b0))) +assert b1 > b0 +word = load_word(sys.argv[4]); c, mxb, tb, mb = bit_bk_unsplit(word) +assert c == Q(251726760077483, 25 * 10**16) and (mxb, tb, mb) == (34, 2, 56), (c, mxb, tb) +print(' bit c (PR #382 word, B_3 unsplit, m %d, max child %d, halving degree %d) = %s = %.15e' % (mb, mxb, tb, c, float(c))) +k0, bd0 = kappa(c, b0); k1, bd1 = kappa(c, b1) +assert k0 == Q(998243154231047, 10**18) and bd0 == 'complex' +print(' kappa with #377 as shipped = %s = %.15e (%s-bound) [= PR #382]' % (k0, float(k0), bd0)) +print(' kappa with the re-timed unit = %s = %.15e (%s-bound)' % (k1, float(k1), bd1)) +json.dump(dict(b_377=str(b0), b=str(b1), b_float=float(b1), c=str(c), kappa_382=str(k0), kappa=str(k1), kappa_float=float(k1), binding=bd1, + profile={str(r): n for r, n in sorted(H1.items())}, profile_delta={str(r): x for r, x in d.items()}, max_child=mx1, halving_degree=t1), + open(sys.argv[5], 'w'), indent=1) diff --git a/research/e8-outer-slack-refinement/source384/complex/LICENSE-wht-power-saving-lean b/research/e8-outer-slack-refinement/source384/complex/LICENSE-wht-power-saving-lean new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/complex/LICENSE-wht-power-saving-lean @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/research/e8-outer-slack-refinement/source384/complex/NOTICE-wht-power-saving-lean b/research/e8-outer-slack-refinement/source384/complex/NOTICE-wht-power-saving-lean new file mode 100644 index 0000000000..7008ce01c1 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/complex/NOTICE-wht-power-saving-lean @@ -0,0 +1,489 @@ +Walsh-Hadamard power saving (wht-power-saving-lean) +Copyright 2026 Jacob Sussman + +Repository: https://github.com/jacobalansussman/wht-power-saving-lean + +This repository is not a project of OpenAI. OpenAI did not write, review or +endorse it. The package name "OAI" and the namespace "OAI.PowerSaving" are +those of openai/math and are kept only because the new files extend that +development. + +This repository is not a project of CrocSwap/integer-mult-bounds either. Its +authors did not write, review or endorse it. Section 6 says what is taken +from their repository. + +This repository contains files from, and files derived from, the repository +"openai/math" (https://github.com/openai/math), family 130, "Exact Fourier +transforms below n log n", at commit fd4aeeb2ee4fc729c18d98444fed42fd0529eeeb. +That repository is published under the Apache License, Version 2.0. A copy of +the licence is in the file LICENSE. The upstream repository has no NOTICE file +and its licence text names no copyright holder; the files are attributed here +to the authors of openai/math (OpenAI). + +1. Unmodified upstream files. + The 89 files under OAI/Computability/ are byte-for-byte copies of the files + with the same paths under lean/ in openai/math at the commit above. They + have not been changed. Modified copies of some of them are under + Work/Fourier/ and Work/FourierE8/ and are listed in section 7. + One more file of openai/math is here unchanged, outside the Lean build: + third-party/openai-math/lean/ComparatorChallenges/UniformFourier.lean is a + byte-for-byte copy of lean/ComparatorChallenges/UniformFourier.lean at the + commit above (the statement of OpenAI's Fourier challenge). It is included + so that the modified copy named in section 2 can be compared with it. + +2. Files that contain upstream text. + - Work/CarrierCheck/ChallengeB2Ke16x.lean, + Work/CarrierCheck/ChallengeB2Ke16xR.lean, + Work/GCert/Data/ChallengeB2Gp193x.lean, + Work/GCert/Data/ChallengeB2Ge8x.lean and the text template + tools/gen/templates/ChallengeB2L16x.lean.txt each contain, as their + lines 22-270, lines 9-257 of + lean/ComparatorChallenges/UniformFourier.lean of openai/math (the RAM cost + model), unchanged. Everything else in these files was written for this + repository. + - Work/Fourier/UniformFourierChallenge.lean is a modified copy of + lean/ComparatorChallenges/UniformFourier.lean of openai/math (the + statement of OpenAI's Fourier challenge, 336 lines). Changes: a comment + was added at the top; the exponent 1 - 1/(10^(13:ℕ)) was replaced by + 1 - 7474546/(10^(10:ℕ)); seven names received the suffix "Z" + (decimalExponent, decimalTime, TimeBounds, DFTGoal, ConvGoal, + transform_main, convolution_main). Everything else in the file is the + upstream text, unchanged. See section 7. + - Work/FourierE8/UniformFourierChallenge.lean is a second modified copy + of the same upstream file, for the fourth result, with the same three + kinds of change: a comment added at the top; the exponent replaced by + 1 - 8762478/(10^(10:ℕ)); the suffix "E8" on the same seven names. + Everything else in the file is the upstream text, unchanged. See + section 7. + - Work/Scratch/Engine.lean and Work/Block/Engine.lean contain copies of + proofs of openai/math, changed for this repository: sections 1, 2 and 5 + of Work/Scratch/Engine.lean are upstream proofs with the batch layout + renamed, and both files contain a copy of the private upstream theorem + "hills_project" (lean/OAI/Computability/FourierTransform/ + TensorProgram.lean) with its envelope generalised. The comments in the + two files mark these places. + - lakefile.lean is adapted from lean/lakefile.lean of openai/math: the same + package name, toolchain, package option and Mathlib pin; every other + dependency was removed and the libraries of this repository were added. + lean-toolchain is a byte-for-byte copy of lean/lean-toolchain. + lake-manifest.json lists Mathlib and its dependencies at the revisions of + lean/lake-manifest.json. + - RELATED-WORK.md reproduces the BibTeX entries of two manuscripts of + openai/math. + +3. New files that build on upstream proofs. + The other files under WHTCheck/ and Work/ were written for this + repository. They import the upstream files, and several of them generalise + or adapt proofs of upstream files (for example Work/Block/Recursion.lean, + which says so in its header). They are changes and additions made for this + repository and are not part of openai/math. + +4. How the new files were made. + Jacob Sussman made the new files on 2026-10-08, 2026-10-09 and 2026-10-10 + by directing a team of AI agents (Claude). The agents wrote the new Lean + files, the certificate data and the generator scripts. They made the + rebuild scripts under tools/rebuild/, in part by adapting programs of + CrocSwap/integer-mult-bounds (section 6): ten of the thirteen on + 2026-10-09, tidied for this repository on 2026-10-10, and three on + 2026-10-10. On 2026-10-10 they also wrote the search programs under + tools/e8/ and found with them the certificate of the fourth result + (section 8). See README.md, section 4. + +5. Ideas taken from other public work. + The network of the first result uses ideas published by others, among them + the helper circuit "NStar3" (Swapnil-jain/integer-mult-kappa, which credits + CrocSwap pull request #36 and Paureel for parts of it), its transfer to + family 130 (shea256/fourier-transform-below-nlogn), and "carrier links" and + "whole-residual batching" (pull requests to CrocSwap/integer-mult-bounds). + No file of Swapnil-jain/integer-mult-kappa or of + shea256/fourier-transform-below-nlogn is included here. One comment in + Work/Scratch/Engine.lean quotes three counts reported in + Swapnil-jain/integer-mult-kappa and names that source. The general frame + lemma that Work/GFrame proves is stated in + notes/general-clifford-frames.tex of CrocSwap/integer-mult-bounds; its Lean + proof was written for this repository. The credits, with links, are in + RELATED-WORK.md. + +6. Data derived from, and programs adapted from, + CrocSwap/integer-mult-bounds (second result). + The helper circuit of the second result is the paired-cube circuit of the + repository "CrocSwap/integer-mult-bounds" + (https://github.com/CrocSwap/integer-mult-bounds), in the state of its pull + request #193. It is the design of that community: icekylinx (pull requests + #144 and #184), eumemic (#168, and #117 behind its modules), ikeboy / + Avi Eisenberg (#191 and #193), with an664 (#128) credited there for the + workspace-sharing principle, and DaysSky (#162) and chafreaky (#163) + credited by #168 for its closure-compiled carrier arcs and for the + fusion of its single-target outputs. That repository is published under + the Apache + License, Version 2.0 (the same licence text as the file LICENSE). Its + NOTICE file begins "A sharper exponent for integer multiplication / + Copyright 2026 Douglas Colkitt" and says that the community release "is + not solely Douglas Colkitt's work". A complete copy of that NOTICE file, as + it is at the head of pull request #193, is in + third-party/CrocSwap-integer-mult-bounds/NOTICE. + + The data were taken from these files of that repository. They were loaded + as data by the programs under tools/rebuild/. No program of that + repository was run, and none is included here unchanged; six of the + programs under tools/rebuild/ are adapted from programs of that + repository ("Programs", below). + - at the head of pull request #168 (eumemic), + 4a3c769e5c5430e7114c4d3e099ff34664677f17: + references/paired-cube/sources/local_L1.json + references/paired-cube/sources/tmod_TE_TD_TB3_1_1_4_full_6.0617964e-4.json + references/paired-cube/sources/pmod_J0_full_6.0666810e-4.json + references/paired-cube/sources/qmod_climb3u_best.json + references/paired-cube/selected-module/matching-arcs.json + references/paired-cube/physical/frames.json + - at the head of pull request #193 (ikeboy), + 187e1010ac8b259af8e9b5166f68b64bc27b4b47: + research/source-assisted-v4/data/physical-pairs.json + + Two more files at the head of pull request #168 are read for comparison + only: the programs print whether their graph and their counts agree + with them. Nothing in the certificate is taken from them: + references/paired-cube/selected-module/SOURCE.json + certificates/paired-cube-complex-input.json + + One more file is fetched and read only on request. No certificate and + no Lean module of this repository is made from it; the documentation + gives its sha256 and the price that tools/gx/gxdry.py computes for + the certificate that the rebuild makes from it: + - at the head of pull request #233 (chafreaky), + 109a857a329d18ed5552d5573f17ddfa886ae57f: + research/source-assisted-v4-layer/witness/physical-pairs.json + + None of these ten files is included in this repository. + tools/rebuild/fetch_inputs.py fetches them and checks their sha256. + + Files of this repository that contain data derived from them: + tools/certificate/gcert1-p11-pr193.json.gz and the Lean data modules + generated from it, Work/GCert/Data/Gen/P193*.lean and the files they import + from Work/GCert/Data/Gen/P193/; its block counts are also in the generated + modules Work/GCert/Data/P193Price.lean, RateB2Gp193.lean, RateB2Gp193x.lean + and InstB2Gp193.lean. + Changes made: the circuit was rebuilt from those data as one explicit, + renumbered list of additions with a table of frames, in the certificate + format "gcert/1" of this repository; its 1,980 in-place steps were written + as pairs of additions with rescaled coefficients; the Lean data modules + were generated from that list. No file of that repository is included + unchanged, except the copy of its NOTICE file named above. + + Programs. The Python files under tools/rebuild/ were made by the agents + (section 4), who read programs of that repository as text and ran none + of them. Six of the thirteen files are adapted from those programs: + the parts named below follow the outside program statement by statement + or method by method, with the layout changed, some names changed and + the parts that this certificate does not use left out. Each of the six + says so in its first lines. + - tools/rebuild/compile.py: the function closure follows + compile_closure of scripts/paired_cube/closure.py; the function + select follows the first part of select of + scripts/paired_cube/gauges.py. + - tools/rebuild/graphgen.py: the class Gen follows the class Graph of + scripts/paired_cube/graph.py; its method fuse follows the branch + "f8:" of merge_outputs of scripts/paired_cube/modules.py, which + fuses the three single-target outputs of a port into one. That + branch came with pull request #168 (eumemic), which says of the + fusion that it "follows #163's same-singleton fusion" and credits + it so: "Same-singleton output fusion: @chafreaky (#163); the fold + orders here come from our own search." + - tools/rebuild/aligned.py: the functions op_tags, local_values and + build follow op_tags, local_values and main of + research/source-assisted-v4/source_aligned_local_v4.py, except its + search for pairs and the records it writes. + - tools/rebuild/stage.py: the order of the events, the backward pass + (responses) and many names are those of + research/terminal-sinks/sinks_gate.py and of + scripts/paired_cube_physical.py; the event records and the exact + arithmetic were written for this repository, and the frame scan + was rewritten so that it returns every block. + - tools/rebuild/build.py: the function target_hist and the field names + of profile follow the last part of select of + scripts/paired_cube/gauges.py; the calls that make the graph and its + hash follow regenerate of scripts/paired_cube_producer.py. + - tools/rebuild/f2.py: the function perp follows perp, and the second + half of the function rref follows the second half of basis, of + scripts/paired_cube/frames.py. + The outside programs are those at the two commits named above + (source_aligned_local_v4.py at the second, the others at the first). + Of the other seven files, rebuild.py, fetch_inputs.py, rbpaths.py, + rewrite.py, phys.py and emit.py were written for this repository. + modules.py was written for this repository too; for the three module + files it checks the contract that the outside + scripts/paired_cube/modules.py states for them in its functions + triple_module_from, pair_module_from and all_but_one_from, each of + which is marked there "eumemic, Claude assistance; Apache-2.0". + + Notices and attribution sentences in the first lines of those outside + programs, quoted with the line numbers of each file at its commit. + The other lines of each header say what the program does and name no + person: + + scripts/paired_cube/closure.py, lines 4-5 (pull request #168, + eumemic; from pull request #162, DaysSky): + Copyright 2026 DaysSky (PR162, + research/extended-links/cxlinks.py), Apache-2.0; moved here + unchanged apart from this header and the imports (eumemic, Claude + assistance). + + scripts/paired_cube/graph.py, modules.py, frames.py, gauges.py and + scripts/paired_cube_producer.py (pull request #144, icekylinx; + graph.py, modules.py and paired_cube_producer.py changed in #168, + eumemic), the two comment lines at the top of each: + Copyright 2026 icekylinx. Apache-2.0. + Developed with GPT-6 Astra assistance; integrated with Codex + assistance. + graph.py, lines 6-9: + The coarse positive query modules restrict the already adopted + PR117 DAG (eumemic; Apache-2.0; Claude assistance; + cbb05ce504d571546d9b7794c186a613c659c3bf). The paired-channel + decomposition and this assembly are new work for icekylinx with + OpenAI GPT-6 Astra assistance. + modules.py, lines 6-7: + The pair-disjoint module is a specialization of the already + adopted PR117 positive DAG (eumemic, Apache-2.0, pinned + cbb05ce504d571546d9b7794c186a613c659c3bf). + modules.py, line 272, above merge_outputs: + Output merging (pmerge.py variants; eumemic, Claude assistance; + Apache-2.0). + frames.py, line 7: + New work for icekylinx, OpenAI GPT-6 Astra assistance. + paired_cube_producer.py, line 8: + Copyright 2026 icekylinx, Apache-2.0; OpenAI GPT-6 Astra + assistance, inherited PR117 notices. + + scripts/paired_cube_physical.py, lines 4-7 (pull request #168, + eumemic): + Prepared by eumemic with Anthropic Claude assistance. Apache-2.0. + The signed word, frozen arcs, gauges, chronology and shared-core + accounting are icekylinx's PR144. Frame descent under PR130's + general Clifford frames and compensated birth-cut reuse follow + PR131 and jamesyc's PR124; deadline (late) compensation reads + follow PR143. + + research/terminal-sinks/sinks_gate.py, lines 4-6 (pull request + #168, eumemic): + The substitution is the terminal-sink lemma of PR #166 by jamesyc + (closed by its author), independently audited here: this gate's + own frame scans, replay and controls carry the soundness argument + and do not use #166's checker. Gate, audit and integration by + eumemic with Anthropic Claude assistance. Apache-2.0. + + research/source-assisted-v4/source_aligned_local_v4.py, lines 4-9 + (pull requests #191 and #193, ikeboy / Avi Eisenberg): + Derived from + research/source-assisted/decision/source_aligned_local.py + (icekylinx, GPT-6 Astra assistance, Apache-2.0). Only the three + frozen query modules change: this copy reads PR168 v4's selected + modules (eumemic, Claude assistance) from + references/paired-cube/sources instead of the PR168 fd25adb7 + modules. The local configuration, arc transport, frame + inheritance and physical layer code are unchanged. + + Notices of that NOTICE file that pertain to these data, quoted: + + Paired-cube and shared-core extension, 9 October 2026 + Copyright 2026 icekylinx + + Source-assisted common-frame extension (2026-10-09) + Copyright 2026 icekylinx. Apache-2.0. + Substantial dependency: eumemic PR168, + fd25adb7fbaa12ee761d02c733c54d1d2a7687ee + + The full text of both notices, and the notices of the work they build on, + are in the copy named above. The credits, with links and with the words of + pull request #193 about its own sources, are in README.md ("Whose circuit + this is") and in RELATED-WORK.md, section 1. + +7. Modified copies of upstream files (third and fourth results). + The files listed below are copies of files of openai/math at the commit + above, changed for this repository. Each begins with a comment that names + the upstream file it is derived from and states what was changed. The + upstream originals under lean/OAI/Computability/ are in this repository + as well, unchanged (section 1), and the copies import them. The upstream + challenge file lean/ComparatorChallenges/UniformFourier.lean is in this + repository in both forms: unchanged under third-party/openai-math/ + (section 1) and modified (section 2). + + - Work/Fourier/ArbitraryLength.lean: modified copy of + lean/OAI/Computability/FourierTransform/ArbitraryLength.lean (224 + lines; 159 of them unchanged in the copy). Changes: identifiers renamed + on 64 lines (18 names: 15 with the suffix Z, 3 with Z inserted); 1 + import line replaced by 1; 15 comment lines added; no other change to + the code. + - Work/Fourier/Asymptotics.lean: modified copy of + lean/OAI/Computability/FourierTransform/Asymptotics.lean (187 lines; + 112 of them unchanged in the copy). Changes: identifiers renamed on 74 + lines (32 names: 26 with the suffix Z, 6 with Z inserted); 1 import + line replaced by 1; 15 comment lines added; no other change to the + code. + - Work/Fourier/Axioms.lean: written for this repository (not a copy of an + upstream file). + - Work/Fourier/ConvolutionProgram.lean: modified copy of + lean/OAI/Computability/FourierTransform/ConvolutionProgram.lean (100 + lines; 77 of them unchanged in the copy). Changes: identifiers renamed + on 22 lines (10 names: 9 with the suffix Z, 1 with Z inserted); 1 + import line replaced by 1; 15 comment lines added; no other change to + the code. + - Work/Fourier/Goal.lean: written for this repository; contains lines of + upstream files: of its 7 code lines, 6 are lines of + lean/OAI/Computability/FourierTransform/Goal.lean (original lines 35, + 75-77, 79, 81): unchanged: its lines 25; with identifiers renamed: its + lines 21, 24, 26, 28, 30. + - Work/Fourier/Main.lean: modified copy of + lean/OAI/Computability/FourierTransform/Main.lean (151 lines; 90 of + them unchanged in the copy). Changes: identifiers renamed on 59 lines + (40 names: 35 with the suffix Z, 5 with Z inserted); 1 import line + replaced by 2; 24 comment lines added; other code lines changed: 1 of + the original, 1 of the copy (copy line 59). + - Work/Fourier/Seam.lean: written for this repository; contains lines of + upstream files: of its 122 code lines, 15 are lines of + lean/OAI/Computability/FourierTransform/TensorProgram.lean (original + lines 36-37, 95-96): unchanged: its lines 93-94, 113-114, 141-142, + 163-164, 185-187, 194-196; with identifiers renamed: its lines 184; 3 + are lines of lean/OAI/Computability/FourierTransform/TensorSaving.lean + (original lines 83-84, 114): with identifiers renamed: its lines 45-46, + 59; 1 is a line of lean/OAI/Computability/FourierTransform/Main.lean + (original line 60): with identifiers renamed: its lines 213. + - Work/Fourier/SectorAlgorithm.lean: modified copy of + lean/OAI/Computability/FourierTransform/SectorAlgorithm.lean (224 + lines; 162 of them unchanged in the copy). Changes: identifiers renamed + on 61 lines (17 names: 13 with the suffix Z, 4 with Z inserted); 1 + import line replaced by 1; 15 comment lines added; no other change to + the code. + - Work/Fourier/SynchronizedAlgorithm.lean: modified copy of + lean/OAI/Computability/FourierTransform/SynchronizedAlgorithm.lean (126 + lines; 94 of them unchanged in the copy). Changes: identifiers renamed + on 31 lines (12 names: 10 with the suffix Z, 1 with Z inserted, 1 + other), the other being "canopy" to "Grove.canopy" (5 lines); 1 import + line replaced by 1; 16 comment lines added; no other change to the + code. + - Work/Fourier/TransformProgram.lean: modified copy of + lean/OAI/Computability/FourierTransform/TransformProgram.lean (146 + lines; 94 of them unchanged in the copy). Changes: identifiers renamed + on 51 lines (21 names: 19 with the suffix Z, 2 with Z inserted); 1 + import line replaced by 1; 15 comment lines added; no other change to + the code. + - Work/Fourier/UniformBounds.lean: modified copy of + lean/OAI/Computability/FourierTransform/UniformBounds.lean (183 lines; + 115 of them unchanged in the copy). Changes: identifiers renamed on 67 + lines (29 names: 25 with the suffix Z, 4 with Z inserted); 1 import + line replaced by 1; 15 comment lines added; no other change to the + code. + - Work/Fourier/UniformFourierChallenge.lean: modified copy of + lean/ComparatorChallenges/UniformFourier.lean (336 lines; 328 of them + unchanged in the copy). Changes: identifiers renamed on 7 lines (7 + names: 7 with the suffix Z); 12 comment lines added; other code lines + changed: 1 of the original, 1 of the copy (copy line 281). + - Work/Fourier/WorkingCompiler.lean: modified copy of + lean/OAI/Computability/FourierTransform/WorkingCompiler.lean (153 + lines; 104 of them unchanged in the copy). Changes: identifiers renamed + on 48 lines (14 names: 14 with the suffix Z); 1 import line replaced by + 1; 15 comment lines added; no other change to the code. + - Work/Fourier/WorkingPreparation.lean: modified copy of + lean/OAI/Computability/FourierTransform/WorkingPreparation.lean (212 + lines; 156 of them unchanged in the copy). Changes: identifiers renamed + on 55 lines (30 names: 28 with the suffix Z, 2 with Z inserted); 1 + import line replaced by 1; 15 comment lines added; no other change to + the code. + - Work/Fourier/WorkingTransform.lean: modified copy of + lean/OAI/Computability/FourierTransform/WorkingTransform.lean (119 + lines; 91 of them unchanged in the copy). Changes: identifiers renamed + on 27 lines (9 names: 8 with the suffix Z, 1 with Z inserted); 1 import + line replaced by 1; 15 comment lines added; no other change to the + code. + + Changes made to the eleven copied proof files: every declaration received + the letter "Z" in its name (as a suffix of its own name, or of the name + of the declaration it belongs to), so that it does not collide with the + upstream declaration of the same name; the upstream exponent "alpha" + (1 - 2/10^11) and the bound "hills" defined from it were replaced by + "alphaZ" (1 - 7474547/10^10) and "hillsZ", which are defined in + Work/Fourier/Seam.lean, and the single use of the upstream theorem + "hills_program" by "hillsZ_program"; the five definitions of the upstream + statement that contain its exponent (decimalExponent, decimalTime, + TimeBounds, DFTGoal, ConvGoal) were replaced by the versions of + Work/Fourier/Goal.lean, whose exponent is 1 - 7474546/(10^(10:ℕ)); + the import lines point to the copies; a header comment was added. + Two further changes: in the copy of Main.lean the same constant stands + once as the literal 2/10^11 and was replaced there too, and the two + final theorems of that copy received a documentation comment; in the + copy of SynchronizedAlgorithm.lean the name "canopy" was written out as + "Grove.canopy" in 5 places, because the short name is shadowed in the + larger environment of the copy. The script also renamed three names + inside upstream comments; the comments are otherwise the upstream ones + and describe the upstream network. + The proofs are those of openai/math. The copies were made by the script + tools/fourier/mkchain.py of this repository. + + Work/Fourier/Goal.lean contains copies of those five definitions of + lean/OAI/Computability/FourierTransform/Goal.lean, with the exponent + replaced and the suffix "Z" on the five names. + + Work/Fourier/Seam.lean was written for this repository. It repeats the + statement of the upstream theorem "hills_program" (TensorProgram.lean) and + the definition of "hills" (TensorSaving.lean) with the two names replaced; + its header says so. + + Fourth result. The 15 files under Work/FourierE8/ repeat the 15 files + under Work/Fourier/ for the kernel program of the fourth result, file + for file and under the same file names: ArbitraryLength.lean, + Asymptotics.lean, ConvolutionProgram.lean, Goal.lean, Main.lean, + SectorAlgorithm.lean, SynchronizedAlgorithm.lean, TransformProgram.lean, + UniformBounds.lean, UniformFourierChallenge.lean, WorkingCompiler.lean, + WorkingPreparation.lean, WorkingTransform.lean, Seam.lean and + Axioms.lean. The eleven copied proof files, + Goal.lean and UniformFourierChallenge.lean are modified copies of the + same upstream files as their namesakes above, made by the script + tools/fourier/mkchain_e8.py (a copy of tools/fourier/mkchain.py with + its constants changed). The changes are those described above with + three differences: the suffix is "E8" where the copies of the third + result have "Z"; "alphaE8" is 1 - 8762479/10^10; and the exponent of + Work/FourierE8/Goal.lean is 1 - 8762478/(10^(10:ℕ)). Each of these + files begins with a comment that names the upstream file it is derived + from and states what was changed. Work/FourierE8/Seam.lean and + Work/FourierE8/Axioms.lean were written for this repository: they are + Work/Fourier/Seam.lean and Work/Fourier/Axioms.lean with names and + numbers replaced, and the seam repeats the same upstream statement and + definition as the seam of the third result. The proofs are those of + openai/math. + + The work of others that the third result follows (danadran01, shea256, + eumemic) is credited in README.md ("Whose reduction this is") and in + RELATED-WORK.md, section 1. No file of their repositories is included + here. + +8. The certificate of the fourth result and the search programs. + tools/certificate/gcert1-e8-r783.json.gz, the Lean data modules + generated from it (Work/GCert/Data/Gen/E8*.lean, Work/GCert/Data/Gen/E8/ + and the modules of Work/GCert/Data/ with E8 or B2Ge8 in their names) and + the Python programs under tools/e8/ were made by the agents for this + repository on 2026-10-10 (section 4). The circuit in that certificate + is not the circuit of section 6, and no data file of + CrocSwap/integer-mult-bounds was loaded to make it. It uses three + devices that were published by others in pull requests to that + repository: + - the in-place pair, a + b and a - b formed on the two arrays that held + a and b: icekylinx (#184), carried in #191 and #193 (ikeboy); + - the re-use of a finished helper with a compensating read: jamesyc + (#124) and eumemic (#143); + - the late pairing rule, the choice of which finished helper a new + value takes: Chafik Boukhalfa (the account chafreaky), #200 and #233, + and pull request #2 of this repository. The search programs apply the + idea with a greedy rule of their own; his program, his pairs and his + certificate were not used. + No program of that repository is included in tools/e8/, imported or + run by it. The programs of tools/e8/ have not been compared statement + by statement with the programs of that repository, as those of + tools/rebuild/ were (section 6). The integer programme of + tools/e8/ is solved with the open-source solver HiGHS, called through + SciPy (scipy.optimize.milp), with NumPy; none of the three is included + here. The credits, with links, are in README.md ("Whose ideas the new + unit uses") and in RELATED-WORK.md, section 8. + +Not included in this repository and fetched by the build: Mathlib +(https://github.com/leanprover-community/mathlib4, Apache License 2.0) and its +dependencies. The comparator (https://github.com/leanprover/comparator) is a +separate tool and is not included. diff --git a/research/e8-outer-slack-refinement/source384/complex/gcert1-e8-r783.json.gz b/research/e8-outer-slack-refinement/source384/complex/gcert1-e8-r783.json.gz new file mode 100644 index 0000000000..0bd0bacf74 Binary files /dev/null and b/research/e8-outer-slack-refinement/source384/complex/gcert1-e8-r783.json.gz differ diff --git a/research/e8-outer-slack-refinement/source384/complex/gx/gx.py b/research/e8-outer-slack-refinement/source384/complex/gx/gx.py new file mode 100644 index 0000000000..6d14c0a976 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/complex/gx/gx.py @@ -0,0 +1,296 @@ +#!/usr/bin/python3 -I +"""gx.py. OWN code (imports nothing of port-producer, nothing outside). +(1) convert(c0): gcert/0 (port-producer's event list) -> gcert/1, the LEAN-FACING NORMAL FORM: + only the main phase (no read0 / undo / uninj: the invocation theorem derives the dirt gate and the undo + gate from the product), every gate an elementary fan-out or fan-in add, the 4x4 K block written as three + such adds plus a sign carried by one register, the star scatter as a table. +(2) check1(c1): the local decidable conditions of EXTENDED-CERT-SPEC.md on a gcert/1 file: + E0 sizes, E1 labels (nested subspaces by containment, equal frame at a gate), E2 scatter cut, + E3 shape (kinds of gates; X1; S1), E4 bracket rule S2, E5 scalar (x-content replay: hid and X3), + E6 price data (block histograms, N), E7 exterior gauges only (Q2). Raises AssertionError(": ..."). +""" +from fractions import Fraction as Fr +from collections import Counter +from math import lcm + + +def need(c, msg): + if not c: + raise AssertionError(msg) + + +def reduce(u, basis): + """basis: reduced echelon, pivot = leading bit, descending. Returns u modulo the span.""" + for b in basis: + if u >> (b.bit_length() - 1) & 1: + u ^= b + return u + + +def echelon_ok(f): + piv = [b.bit_length() - 1 for b in f] + if any(b == 0 for b in f) or piv != sorted(piv, reverse=True) or len(set(piv)) != len(piv): + return False + return all(not (b >> p & 1) for i, b in enumerate(f) for j, p in enumerate(piv) if i != j) + + +def inside(a, b): + return all(reduce(u, b) == 0 for u in a) + + +def par(x): + return bin(x).count("1") & 1 + + +KJ = [[[1, 2] if i == j else [-1, 2] for j in range(4)] for i in range(4)] + + +def convert(c0): + need(c0["format"] == "gcert/0", "input is not gcert/0") + v, h, R = c0["v"], c0["h"], c0["R"] + ev = c0["events"] + cen = [n for n, e in enumerate(ev) if e[0] == "centre"] + need(cen == list(range(cen[0], cen[0] + len(cen))), "centres are not contiguous: no single scatter cut") + A, B, ret = [], [], [] + neg = set() # x registers currently holding MINUS their value (between the two K blocks) + openq = {} + for n, e in enumerate(ev): + k = e[0] + out = A if n < cen[0] else B + if k in ("read0", "undo", "uninj"): + continue + if k == "inj": + need(e[2] not in neg, "inj reads a negated x register") + out.append(["out", e[3], e[2], [[e[1], 1, 1]], []]) + elif k == "op": + if e[3] == -1: + out.append(["neg", e[5], e[1]]) + else: + need(e[3] == 1, "op ca") + out.append(["out", e[5], e[2], [[e[1], e[4], 1]], []]) + elif k == "centre": + ret.append([e[2], e[1], e[3]]) + elif k == "gread": + hit = set(t for t, _, _ in e[3]) + out.append(["out", e[2], e[1], [[v + t, a, b] for t, a, b in e[3]], [v + t for t in e[4] if t not in hit]]) + elif k == "rread": + out.append(["out", e[2], e[1], [[v + t, a, b] for t, a, b in e[3]], []]) + elif k == "ysh": + out.append(["out", e[4], e[2], [[e[1], e[3], 1]], []]) + elif k == "yw": + out.append(["out", e[4], e[2], [[e[1], e[3][0], e[3][1]]], []]) + elif k == "kd": + out.append(["out", e[3], e[2], [[e[1], -1 if e[2] in neg else 1, 1]], []]) + elif k == "ktr": + q = tuple(e[1]) + need(e[2] == KJ, "ktr matrix is not 1 - J/2") + x1, rest = q[0], list(q[1:]) + if q not in openq: # first block: x := M x, register x1 keeps the sign + out.append(["in", e[3], x1, [[r, 1, 1] for r in rest]]) + out.append(["out", e[3], x1, [[r, -1, 2] for r in rest], []]) + out.append(["in", e[3], x1, [[r, 1, 1] for r in rest]]) + openq[q] = n + neg.add(x1) + else: # second block: the three adds undone in reverse order + out.append(["in", e[3], x1, [[r, -1, 1] for r in rest]]) + out.append(["out", e[3], x1, [[r, 1, 2] for r in rest], []]) + out.append(["in", e[3], x1, [[r, -1, 1] for r in rest]]) + del openq[q] + neg.discard(x1) + else: + raise AssertionError("unknown event kind %r" % k) + need(not openq and not neg, "a K block is not closed") + ext = sorted([z[3], z[1]] for z in c0["gauge"] if z[5]) + c1 = dict(format="gcert/1", derived_from=c0["name"] + " (gcert/0)", p=c0["p"], h=h, v=v, R=R, cst=c0["cst"], + N=c0["N"], ports=c0["ports"], frames=c0["frames"], start=c0["start"], final=c0["final"], + ext=ext, ret=sorted(ret), scat=dict(inside=c0["scat"]["inside"], outside=c0["scat"]["outside"]), + A=A, B=B, blocks=c0["blocks"]) + return c1 + + +def scat_row(c, t): + """the scatter of target t: [(k, coefficient)], from the table or from the star rule""" + sc = c["scat"] + if "table" in sc: + return [(k, Fr(a, b)) for k, a, b in sc["table"][t]] + sin, sout = Fr(*sc["inside"]), Fr(*sc["outside"]) + return [(k, sin if c["ports"][t] >> k & 1 else sout) for k in range(c["h"])] + + +def gate_regs(g): + if g[0] == "neg": + return [g[2]], [], [] + if g[0] == "out": + return [g[2]] + [t for t, _, _ in g[3]] + list(g[4]), [(t, g[2], Fr(a, b)) for t, a, b in g[3]], g[4] + if g[0] == "in": + return [g[2]] + [s for s, _, _ in g[3]], [(g[2], s, Fr(a, b)) for s, a, b in g[3]], [] + raise AssertionError("E0: unknown gate kind %r" % (g[0],)) + + +def check1(c, scalar=True, stats=None): + need(c.get("format") == "gcert/1", "E0: format") + h, v, R = c["h"], c["v"], c["R"] + nreg = 2 * v + R + ports, fr = c["ports"], [tuple(f) for f in c["frames"]] + need(len(ports) == v == len(set(ports)) and all(par(q) and 0 < q < 1 << h for q in ports), "E0: ports") + need(fr[0] == () and fr[1] == tuple(1 << i for i in range(h - 1, -1, -1)), "E0: frames 0 and 1") + need(all(echelon_ok(f) for f in fr) and len(set(fr)) == len(fr), "E0: frame table not reduced echelon / repeats") + dim = [len(f) for f in fr] + start, final = c["start"], c["final"] + need(len(start) == len(final) == nreg, "E0: start / final") + ext = {r: f for r, f in c["ext"]} + for t in range(v): + need(fr[start[t]] == (ports[t],) and final[t] == 1, "E1: x start / final") + f = fr[final[v + t]] + need(start[v + t] == 0 and len(f) == h - 1 and all(par(u & ports[t]) == 0 for u in f), "E1: y start / final") + for r in range(2 * v, nreg): + need(start[r] == ext.get(r, 0) and final[r] == 1, "E1: slot start / final") + cls = lambda r: "x" if r < v else "y" if r < 2 * v else "s" + cur = list(start) + H = {"x": Counter(), "y": Counter(), "s": Counter(), "c": Counter()} + steps = set() + + def climb(r, f, where): + o = cur[r] + if o != f: + if (o, f) not in steps: + need(dim[o] < dim[f] and inside(fr[o], fr[f]), "E1: step not nested (%s, register %d)" % (where, r)) + steps.add((o, f)) + H[cls(r)][dim[f] - dim[o]] += 1 + cur[r] = f + okind = {("x", "s"), ("s", "s"), ("s", "y"), ("x", "y"), ("x", "x"), ("y", "y")} + ysum, piv, ytg = Counter(), set(), set() + inc = 0 + for ph, gates in (("A", c["A"]), ("B", c["B"])): + if ph == "B": # ---- E2: the scatter cut + need(sorted(k for k, _, _ in c["ret"]) == list(range(len(c["ret"]))), "E2: retained totals numbered 0..") + if "table" in c["scat"]: + need(len(c["scat"]["table"]) == v and all(0 <= k < len(c["ret"]) for row in c["scat"]["table"] for k, _, _ in row), + "E2: scatter table") + else: + need(len(c["ret"]) == h, "E2: one retained total per coordinate (star rule)") + for k, s, f in c["ret"]: + need(cls(s) == "s" and cur[s] == f, "E2: retained slot %d is not at its frame" % s) + H["c"][dim[f]] += 1 + need(all(cur[v + t] == 0 for t in range(v)), "E2: a y role left frame 0 before the scatter") + for i, g in enumerate(gates): + regs, pairs, _ = gate_regs(g) + need(all(0 <= r < nreg for r in regs) and len(set(regs)) == len(regs), "E3: registers of gate %s%d" % (ph, i)) + inc += len(regs) + for r in regs: + climb(r, g[1], "%s%d" % (ph, i)) + for t, s, co in pairs: + kd = (cls(s), cls(t)) + need(kd in okind, "E3: gate kind %s -> %s (gate %s%d)" % (kd + (ph, i))) + need(ph == "B" or kd in {("x", "s"), ("s", "s")}, "E3: bank gate before the scatter (gate A%d)" % i) + if kd == ("y", "y"): + ysum[s, t] += co + piv.add(s) + ytg.add(t) + need(ph == "B" or all(cls(r) != "y" for r in regs), "E2: y role named in phase A") + for r in range(nreg): + climb(r, final[r], "final") + need(not (piv & ytg), "E4: a pivot is the target of a gate reading y") + need(all(x == 0 for x in ysum.values()), "E4: y-reads of a (pivot, target) pair do not cancel") + Hs = {k: {str(r): n for r, n in sorted(w.items())} for k, w in H.items()} + need(Hs == c["blocks"], "E6: block histograms") + N = sum(r * n for w in H.values() for r, n in w.items()) + tails = sum(dim[f] for f in ext.values()) + need(N == c["N"] and N + tails == R * h + 2 * v * (h - 1) + c["cst"], "E6: N") + if stats is not None: + stats.update(steps=len(steps), incidences=inc, blocks=sum(sum(w.values()) for w in H.values()), + step_work=sum(dim[a] * dim[b] for a, b in steps), ysh_pairs=len(ysum)) + if scalar: + scal(c, stats) + q2(c) + return True + + +def scal(c, stats=None): + """E5: exact replay of the x-content of every register through A, scatter, B.""" + h, v, R = c["h"], c["v"], c["R"] + nreg = 2 * v + R + reg = [({r: Fr(1)} if r < v else {}) for r in range(nreg)] + den = {"x": 1, "y": 1, "s": 1} + mx = {"x": Fr(0), "y": Fr(0), "s": Fr(0)} + cls = lambda r: "x" if r < v else "y" if r < 2 * v else "s" + + def axpy(t, src, co): + d = reg[t] + for k, u in src.items(): + w = d.get(k, 0) + co * u + if w: + d[k] = w + kk = cls(t) + if w.denominator != 1: + den[kk] = lcm(den[kk], w.denominator) + if abs(w) > mx[kk]: + mx[kk] = abs(w) + else: + d.pop(k, None) + + def run(gates): + for g in gates: + if g[0] == "neg": + reg[g[2]] = {k: -u for k, u in reg[g[2]].items()} + elif g[0] == "out": + src = dict(reg[g[2]]) + for t, a, b in g[3]: + axpy(t, src, Fr(a, b)) + else: + for s, a, b in g[3]: + axpy(g[2], reg[s], Fr(a, b)) + run(c["A"]) + tot = {k: dict(reg[s]) for k, s, _ in c["ret"]} + for t in range(v): + for k, co in scat_row(c, t): + axpy(v + t, tot[k], co) + run(c["B"]) + need(all(reg[t] == {t: 1} for t in range(v)), "E5: an x role is not restored (X3)") + need(all(reg[v + t] == {t: 1} for t in range(v)), "E5: a target does not receive exactly its source (hid)") + if stats is not None: + stats.update(den=dict(den), maxabs={k: str(x) for k, x in mx.items()}, + gates_A=len(c["A"]), gates_B=len(c["B"])) + + +def q2(c): + """E7 (only for files with exterior gauges, rule (2)): for every slot q that starts off the zero frame, the + column of q in the y rows of the product is zero (its dirt is removed in line, the derived dirt gate at + frame 0 does not touch it). Replay with the gauged slots as variables, x = 0.""" + h, v, R = c["h"], c["v"], c["R"] + ext = [r for r, _ in c["ext"]] + if not ext: + return True + reg = [dict() for _ in range(2 * v + R)] + for r in ext: + reg[r] = {r: Fr(1)} + + def axpy(t, src, co): + d = reg[t] + for k, u in src.items(): + w = d.get(k, 0) + co * u + if w: + d[k] = w + else: + d.pop(k, None) + + def run(gates): + for g in gates: + if g[0] == "neg": + reg[g[2]] = {k: -u for k, u in reg[g[2]].items()} + elif g[0] == "out": + src = dict(reg[g[2]]) + for t, a, b in g[3]: + axpy(t, src, Fr(a, b)) + else: + for s, a, b in g[3]: + axpy(g[2], reg[s], Fr(a, b)) + run(c["A"]) + tot = {k: dict(reg[s]) for k, s, _ in c["ret"]} + for t in range(v): + for k, co in scat_row(c, t): + if tot[k]: + axpy(v + t, tot[k], co) + run(c["B"]) + need(all(not reg[v + t] for t in range(v)), "E7: the dirt of an exterior-gauged slot reaches a y role (Q2)") + return True diff --git a/research/e8-outer-slack-refinement/source384/complex/gx/gxcore.py b/research/e8-outer-slack-refinement/source384/complex/gx/gxcore.py new file mode 100644 index 0000000000..3e3f0a3076 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/complex/gx/gxcore.py @@ -0,0 +1,375 @@ +"""gxcore.py: gcert/1 JSON -> normal data D, PYTHON MIRROR of the two Lean checks +(label side: E0 frames, E1 pairs, E1/E2/E6 replay in segments; scalar side: E3 kinds, E4 bracket, E5 replay +in source batches, E7), derived data (distinct climbs, cut states, block histogram) and kernel sizes. +Own code; the reference is gx.py (check1), not imported. Python 3, standard library only.""" +import json, gzip +from collections import Counter +from math import gcd + + +class Reject(Exception): + pass + + +def need(c, msg): + if not c: + raise Reject(msg) + + +def load(path): + c = json.load(gzip.open(path, "rt") if path.endswith(".gz") else open(path)) + need(c.get("format") == "gcert/1", "E0: format is not gcert/1") + return c + + +def co(num, den): + need(den > 0, "E0: denominator") + return (num < 0, abs(num), den) + + +def normal(c): + """the Lean-facing data: gates as tuples, coefficients (neg, num, den), ret by total""" + def gate(g): + if g[0] == "out": + return ("out", g[1], g[2], [(t, co(a, b)) for t, a, b in g[3]], list(g[4])) + need(g[0] == "in", "E0: unknown gate kind %r" % (g[0],)) + return ("in", g[1], g[2], [(s, co(a, b)) for s, a, b in g[3]]) + ret = sorted(c["ret"]) + need([k for k, _, _ in ret] == list(range(len(ret))), "E2: retained totals numbered 0..") + sc = c["scat"] + scat = ("table", [[(k, co(a, b)) for k, a, b in row] for row in sc["table"]]) if "table" in sc else \ + ("star", co(*sc["inside"]), co(*sc["outside"])) + return dict(h=c["h"], v=c["v"], R=c["R"], N=c["N"], cst=c["cst"], ports=list(c["ports"]), + frames=[list(f) for f in c["frames"]], start=list(c["start"]), final=list(c["final"]), + ext=[tuple(e) for e in c.get("ext", [])], ret=[(s, f) for _, s, f in ret], scat=scat, + A=[gate(g) for g in c["A"]], B=[gate(g) for g in c["B"]], + blocks={k: {int(r): n for r, n in c["blocks"][k].items()} for k in "xysc"}) + + +def regs(g): + return [g[2]] + [t for t, _ in g[3]] + (g[4] if g[0] == "out" else []) + + +def adds(g): + """single adds (tgt, src, coef) in order""" + return [(t, g[2], k) for t, k in g[3]] if g[0] == "out" else [(g[2], s, k) for s, k in g[3]] + + +def reduce(u, basis): + for b in basis: + if u >> (b.bit_length() - 1) & 1: + u ^= b + return u + + +def echelon_ok(f): + piv = [b.bit_length() - 1 for b in f] + if any(b == 0 for b in f) or any(piv[i] <= piv[i + 1] for i in range(len(piv) - 1)): + return False + return all(not (b >> p & 1) for i, b in enumerate(f) for j, p in enumerate(piv) if i != j) + + +def par(x): + return bin(x).count("1") & 1 + + +def cls(D, r): + return "x" if r < D["v"] else "y" if r < 2 * D["v"] else "s" + + +# ---- label side ------------------------------------------------------------------------------------------ +def chk_frames(D): + """E0: ports; frame table reduced echelon, no repeats, zero first, full second""" + h, v, fr = D["h"], D["v"], D["frames"] + p = D["ports"] + need(len(p) == v == len(set(p)) and all(par(q) and 0 < q < 1 << h for q in p), "E0: ports") + need(len(fr) >= 2 and fr[0] == [] and fr[1] == [1 << i for i in range(h - 1, -1, -1)], "E0: frames 0 and 1") + need(all(echelon_ok(f) and all(b < 1 << h for b in f) for f in fr), "E0: frame table not reduced echelon") + need(len(set(map(tuple, fr))) == len(fr), "E0: frame table has repeats") + return [len(f) for f in fr] + + +def derive(D): + """distinct climbs in order of first use (NOT a check: plain replay of the frame ids)""" + cur, seen, pairs = list(D["start"]), set(), [] + + def go(r, f): + o = cur[r] + if o != f: + if (o, f) not in seen: + seen.add((o, f)) + pairs.append((o, f)) + cur[r] = f + for g in D["A"] + D["B"]: + for r in regs(g): + go(r, g[1]) + for r, f in enumerate(D["final"]): + go(r, f) + return pairs + + +def chk_pairs(D, dim, pairs): + """E1, level 2: every listed pair is a nested pair of the table; returns the mask-operation count""" + fr, n, work = D["frames"], len(D["frames"]), 0 + for a, b in pairs: + need(a < n and b < n and dim[a] < dim[b], "E1: pair (%d, %d) does not climb" % (a, b)) + need(all(reduce(u, fr[b]) == 0 for u in fr[a]), "E1: pair (%d, %d) is not nested" % (a, b)) + work += dim[a] * dim[b] + return work + + +def cut_points(D, gmax, wmax=210000): + """replay segments: each phase (A, B) is cut into k pieces of equal gate count, k = the least number with at + most `gmax` gates AND at most `wmax` work per piece on average (work = sum over gates of the dimension of the + gate's frame; measured at h = 22: about 1 ms of kernel time per unit, NOTES.md). + Cut points = gate counts in A ++ B (always 0, |A| and the end).""" + nA, nB = len(D["A"]), len(D["B"]) + cuts = [0] + for off, gs in ((0, D["A"]), (nA, D["B"])): + n = len(gs) + k = max(1, -(-n // gmax), -(-sum(len(D["frames"][g[1]]) for g in gs) // wmax)) + cuts += [off + (n * i) // k for i in range(1, k + 1)] + return sorted(set(cuts)) + + +def label_data(D, dim, cuts): + """for gx-labels (gcert-interface.md LABELS v1): ordered block ranks per replay segment, the final climbs as + gates without adds (same final frame, at most 32 registers, only registers that still climb), their ranks, + the largest number of registers named by one gate. Plain replay (the mirror has accepted the file).""" + cur, G = list(D["start"]), D["A"] + D["B"] + rs, most = [], 0 + for a, b in zip(cuts, cuts[1:]): + r = [] + for g in G[a:b]: + most = max(most, len(regs(g))) + for x in regs(g): + if cur[x] != g[1]: + r.append(dim[g[1]] - dim[cur[x]]) + cur[x] = g[1] + rs.append(r) + by = {} + for x, f in enumerate(D["final"]): + if cur[x] != f: + by.setdefault(f, []).append(x) + fins, rF = [], [] + for f in sorted(by): + for i in range(0, len(by[f]), 32): + xs = by[f][i:i + 32] + fins.append(("out", f, xs[0], [], xs[1:])) + rF += [dim[f] - dim[cur[x]] for x in xs] + return dict(rs=rs, fins=fins, rF=rF, most=max(most, 32 if fins else 0)) + + +def chk_replay(D, dim, pairs, cuts): + """E1 (labels), E2 (scatter cut), E6 (price), in the segments given by `cuts`. + Returns (states at the cuts, histogram by class, visits per segment).""" + h, v, R, fr = D["h"], D["v"], D["R"], D["frames"] + n = 2 * v + R + start, final, ext = D["start"], D["final"], dict(D["ext"]) + need(len(start) == len(final) == n, "E0: start / final") + for t in range(v): + need(fr[start[t]] == [D["ports"][t]] and final[t] == 1, "E1: x start / final") + f = fr[final[v + t]] + need(start[v + t] == 0 and len(f) == h - 1 and all(par(u & D["ports"][t]) == 0 for u in f), "E1: y start / final") + for r in range(2 * v, n): + need(start[r] == ext.get(r, 0) and final[r] == 1, "E1: slot start / final") + ok = set(pairs) + need(len(ok) == len(pairs), "E1: pair list has repeats") + cur = list(start) + H = {k: Counter() for k in "xysc"} + + def climb(r, f, where): + o = cur[r] + if o != f: + need((o, f) in ok, "E1: climb (%d, %d) is not a tested pair (%s, register %d)" % (o, f, where, r)) + H[cls(D, r)][dim[f] - dim[o]] += 1 + seg[dim[f] - dim[o]] += 1 + cur[r] = f + seg, segs = Counter(), [] + G, nA = D["A"] + D["B"], len(D["A"]) + states, visits = [], [] + need(cuts[0] == 0 and cuts[-1] == len(G) and cuts == sorted(cuts), "cut points") + for a, b in zip(cuts, cuts[1:]): + states.append(list(cur)) + vs = 0 + for i in range(a, b): + if i == nA: + scatter_cut(D, cur, dim, H, seg) + g = G[i] + rs = regs(g) + need(all(0 <= r < n for r in rs) and len(set(rs)) == len(rs), "E3: registers of gate %d" % i) + need(i >= nA or all(r < v or r >= 2 * v for r in rs), "E2: y role named in phase A (gate %d)" % i) + vs += len(rs) + for r in rs: + climb(r, g[1], "gate %d" % i) + visits.append(vs) + if b < len(G): + segs.append(seg) + seg = Counter() + if nA == len(G): + scatter_cut(D, cur, dim, H, seg) + states.append(list(cur)) + for r in range(n): + climb(r, final[r], "final") + segs.append(seg) + Hb = {k: dict(sorted(w.items())) for k, w in H.items()} + need(Hb == D["blocks"], "E6: block histogram differs from `blocks`") + N = sum(r * c for w in H.values() for r, c in w.items()) + need(N == D["N"] and N + sum(dim[f] for f in ext.values()) == R * h + 2 * v * (h - 1) + D["cst"], "E6: N") + need(sum(r * c for r, c in H["c"].items()) == D["cst"], "E6: cst") + return states, Hb, visits, [[w[r] for r in range(h + 1)] for w in segs] + + +def scatter_cut(D, cur, dim, H, seg): + v = D["v"] + if D["scat"][0] == "table": + need(len(D["scat"][1]) == v and all(k < len(D["ret"]) for row in D["scat"][1] for k, _ in row), "E2: scatter table") + else: + need(len(D["ret"]) == D["h"], "E2: one retained total per coordinate (star rule)") + for s, f in D["ret"]: + need(s >= 2 * v and cur[s] == f, "E2: retained slot %d is not at its frame" % s) + H["c"][dim[f]] += 1 + seg[dim[f]] += 1 + need(all(cur[v + t] == 0 for t in range(v)), "E2: a y role left frame 0 before the scatter") + + +# ---- scalar side ----------------------------------------------------------------------------------------- +SC = 6 # all scalar entries are kept as integers in units of 1/6 +KINDS = {("x", "s"), ("s", "s"), ("s", "y"), ("x", "y"), ("x", "x"), ("y", "y")} + + +def chk_shape(D): + """E3 kinds, E4 bracket""" + ysum, piv, ytg = Counter(), set(), set() + for ph in "AB": + for i, g in enumerate(D[ph]): + for t, s, (ng, a, b) in adds(g): + kd = (cls(D, s), cls(D, t)) + need(kd in KINDS and t != s, "E3: gate kind %s -> %s (gate %s%d)" % (kd + (ph, i))) + need(ph == "B" or kd in {("x", "s"), ("s", "s")}, "E3: bank gate before the scatter (gate A%d)" % i) + if kd == ("y", "y"): + need(SC % b == 0, "E4: denominator beyond sixths") + ysum[s, t] += (-a if ng else a) * (SC // b) + piv.add(s) + ytg.add(t) + need(not (piv & ytg), "E4: a pivot is the target of a gate reading y") + need(all(x == 0 for x in ysum.values()), "E4: y-reads of a (pivot, target) pair do not cancel") + return len(ysum) + + +def scat_row(D, t): + sc = D["scat"] + if sc[0] == "table": + return sc[1][t] + return [(k, sc[1] if D["ports"][t] >> k & 1 else sc[2]) for k in range(D["h"])] + + + +def replay(D, init, count=None): + """exact replay through A, scatter, B of sparse vectors with entries in sixths; `init` = register -> {key: 6}""" + v = D["v"] + reg = [dict(init.get(r, ())) for r in range(2 * v + D["R"])] + + def axpy(t, src, k): + ng, a, b = k + d = reg[t] + for key, u in src.items(): + w = u * a + need(w % b == 0, "E5: an entry needs a denominator beyond sixths (register %d)" % t) + w = w // b + w = d.get(key, 0) + (-w if ng else w) + if count is not None: + count[key] += 1 + if w: + d[key] = w + else: + d.pop(key, None) + + def run(gates): + for g in gates: + if g[0] == "out": + src = dict(reg[g[2]]) + for t, k in g[3]: + axpy(t, src, k) + else: + for s, k in g[3]: + axpy(g[2], reg[s], k) + run(D["A"]) + afterA = sum(len(d) for d in reg) + tot = [dict(reg[s]) for s, _ in D["ret"]] + for t in range(v): + for k, cf in scat_row(D, t): + if tot[k]: + axpy(v + t, tot[k], cf) + run(D["B"]) + return reg, afterA + + +def chk_scalar(D, batches=1): + """E5 (+ E7 when `ext` is non-empty). Returns stats: denominators and largest numerators per class in the + units of the spec (x halves, y sixths, slots integers), updates per source batch, entries after A.""" + v = D["v"] + count = Counter() + reg, afterA = replay(D, {t: {t: SC} for t in range(v)}, count) + need(all(reg[t] == {t: SC} for t in range(v)), "E5: an x role is not restored (X3)") + need(all(reg[v + t] == {t: SC} for t in range(v)), "E5: a target does not receive exactly its source (hid)") + if D["ext"]: + rg, _ = replay(D, {r: {r: SC} for r, _ in D["ext"]}) + need(all(not rg[v + t] for t in range(v)), "E7: the dirt of an exterior-gauged slot reaches a y role") + step = -(-v // batches) + per = [sum(count[k] for k in range(lo, min(lo + step, v))) for lo in range(0, v, step)] + return dict(updates=sum(count.values()), per_batch=per, afterA=afterA, + batches=[(lo, min(lo + step, v)) for lo in range(0, v, step)]) + + +def digits(D): + """largest |entry| met and denominators per class, by a second replay that watches every write (slow path + kept separate from the check): returns {class: (lcm of denominators, largest |numerator| in units 1/den)}""" + v = D["v"] + den = {"x": 1, "y": 1, "s": 1} + mx = {"x": 0, "y": 0, "s": 0} + reg = [({r: SC} if r < v else {}) for r in range(2 * v + D["R"])] + + def axpy(t, src, k): + ng, a, b = k + d, kk = reg[t], cls(D, t) + for key, u in src.items(): + w = d.get(key, 0) + (-(u * a // b) if ng else u * a // b) + if w: + d[key] = w + q = SC // gcd(w, SC) + if den[kk] % q: + den[kk] = den[kk] * q // gcd(den[kk], q) + if abs(w) > mx[kk]: + mx[kk] = abs(w) + else: + d.pop(key, None) + for g in D["A"]: + for t, s, k in adds(g): + axpy(t, reg[s], k) + tot = [dict(reg[s]) for s, _ in D["ret"]] + for t in range(v): + for k, cf in scat_row(D, t): + axpy(v + t, tot[k], cf) + for g in D["B"]: + for t, s, k in adds(g): + axpy(t, reg[s], k) + return {k: (den[k], mx[k] * den[k] // SC if (mx[k] * den[k]) % SC == 0 else "%d/6" % mx[k]) for k in "xys"} + + +def mirror(D, gmax=12000, batches=1, pairs=None, cuts=None): + """both checks; returns everything the generator and the dry run need""" + dim = chk_frames(D) + pairs = derive(D) if pairs is None else pairs + work = chk_pairs(D, dim, pairs) + cuts = cut_points(D, gmax) if cuts is None else cuts + states, H, visits, segH = chk_replay(D, dim, pairs, cuts) + ysh = chk_shape(D) + S = chk_scalar(D, batches) + hist = Counter() + for k in "xysc": + for r, n in H[k].items(): + hist[r] += n + return dict(dim=dim, pairs=pairs, pair_work=work, cuts=cuts, states=states, H=H, visits=visits, ysh=ysh, + scal=S, hist=dict(sorted(hist.items())), segH=segH, + lab=label_data(D, dim, cuts)) diff --git a/research/e8-outer-slack-refinement/source384/data/bit/bitE8-kernel.json.gz b/research/e8-outer-slack-refinement/source384/data/bit/bitE8-kernel.json.gz new file mode 100644 index 0000000000..22141be33d Binary files /dev/null and b/research/e8-outer-slack-refinement/source384/data/bit/bitE8-kernel.json.gz differ diff --git a/research/e8-outer-slack-refinement/source384/data/gcert1-e8-r783-far.json.gz b/research/e8-outer-slack-refinement/source384/data/gcert1-e8-r783-far.json.gz new file mode 100644 index 0000000000..56708f99a4 Binary files /dev/null and b/research/e8-outer-slack-refinement/source384/data/gcert1-e8-r783-far.json.gz differ diff --git a/research/e8-outer-slack-refinement/source384/data/pr377/GLOBAL-REVIEW.json b/research/e8-outer-slack-refinement/source384/data/pr377/GLOBAL-REVIEW.json new file mode 100644 index 0000000000..332f011f05 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/data/pr377/GLOBAL-REVIEW.json @@ -0,0 +1,70 @@ +{ + "status": "PASS_NINE_STAGE_SOURCE_BOUND_TEMPLATE_OWNERS_PROFILE_AND_FINITE_INVOICE", + "m": 73, + "live": 14727, + "physical": 15520, + "invocations": 72, + "local_source_events": 1242936, + "paid_calls": 310455, + "rank_mass": 1072575, + "deficit": 2496, + "profile": { + "1": 157599, + "2": 43488, + "3": 37296, + "4": 10080, + "5": 15480, + "6": 23832, + "7": 3096, + "8": 7488, + "9": 576, + "16": 3840, + "32": 3840, + "48": 3840 + }, + "whole_residual_assignments": 56376, + "bank_padding_calls": 7047, + "bridge_additions": 17280, + "terminal_shift_calls": 3840, + "terminal_complete_stream_movements": 7680, + "work_lifetimes_freshly_revalidated": true, + "owner_injections": true, + "cover_route_bijections": "Explicit invertible right factors; roles sharing a bank have different disjoint block images, hence different right factors.", + "template_sha256": "fb51fe86a8299b4c5f3d03d90e8766e321d534f29fe4ab9d093fdfb8b9826a13", + "finite_invoice": { + "local_primitive_bound": 7040446135448, + "local_adapters": 271472, + "compiler": 25934336, + "scalar_primitives_all_invocations": 5057712, + "outside_adapter_bound": 1988400, + "pervertex": 558479956303543, + "group_bits": 2628, + "live_stock_bits": 2642, + "physical_stock_bits": 2642, + "logical_groups_bits": 2677, + "router_bits": 7984, + "literal_bits": 35284, + "required_C0_bits": 200012, + "G_exponent": 30000, + "E_exponent": 100000, + "C0_exponent": 210000, + "halving_degree": 2, + "halving_integer_inequality": [ + 5329, + 4608 + ], + "induction_gap_multiple_B": 49, + "physical_row_coefficient": 15445, + "retained_row_coefficient": 20161 + }, + "source_hashes": { + "/Users/chenzhihao/Documents/Codex/2026-10-11/integer-mult-joint-breakthrough/work/complex-nine-pr-audit/work/native358/vendor/complex-reserve/upstream/pr352/code/complex/code/complex_splice.py": "aaf46c8e5c68875b8315892e924e082b2f219f8d042dd14937e7cd2f72456dce", + "work/complex-nine-native/local-admission/UPSTREAM-GUARD.json": "9cc4b3819eda28a1fd1fa5e9913c36fd3041ec69608474a3be8b812945d69944", + "work/complex-nine-native/local-admission/INDEPENDENT-AUDIT.json": "2912f82f8cad02fd166f7c328e96a51451e8c960178b226173ace3338cf6a60c", + "work/complex-nine-native/CLIFFORD-REVIEW.json": "da4eb36041e4793a83500a5e3e40c15ded2dba0a1fcb1296ca977e5e6bc6063a", + "work/complex-nine-native/DATA-PHASES.json": "f621f6d4296cb215f334830356c5f79fe10d6d04d15b3ccda76ba0885ab67d0a" + }, + "seconds": 22.21225808293093, + "scope": "Finite source-bound global recipe, exact owner factors, paid histogram and conservative scalar/tape/precision/row invoice. Requires explicit mathematical integration of the compressed window lift and arbitrary-bank dirty composition; this is not a Lean proof or final multiplication exponent certificate.", + "cover_correction_calls": 14727 +} \ No newline at end of file diff --git a/research/e8-outer-slack-refinement/source384/verify.sh b/research/e8-outer-slack-refinement/source384/verify.sh new file mode 100644 index 0000000000..7a6ec7c956 --- /dev/null +++ b/research/e8-outer-slack-refinement/source384/verify.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# One-command verification of research/e8-far-nine-complex. usage: bash verify.sh [--quick] /fresh/output/dir +# python3 >= 3.11, standard library only. --quick skips step 4 (regeneration of the certificate under #377's ledger). +set -euo pipefail +QUICK=0; if [ "${1:-}" = "--quick" ]; then QUICK=1; shift; fi +HERE=$(cd "$(dirname "$0")" && pwd); WD=$(mkdir -p "$1" && cd "$1" && pwd) +case "$WD" in "$HERE"*) echo "output dir must be outside the package"; exit 2;; esac +PY="${PYTHON:-python3} -I -B"; C=$HERE/code; GX=$HERE/complex/gx +ORIG=$HERE/complex/gcert1-e8-r783.json.gz; OURS=$HERE/data/gcert1-e8-r783-far.json.gz +G377=$HERE/data/pr377/GLOBAL-REVIEW.json; WORD=$HERE/data/bit/bitE8-kernel.json.gz + +echo "== 0. manifest"; (cd "$HERE" && $PY -c " +import hashlib,sys,os +bad=0;listed=set() +for line in open('MANIFEST.sha256'): + h,p=line.rstrip('\n').split(' ',1);listed.add(p) + if hashlib.sha256(open(p,'rb').read()).hexdigest()!=h: print('MISMATCH',p);bad+=1 +files={os.path.relpath(os.path.join(r,f)) for r,_,fs in os.walk('.') for f in fs if '__pycache__' not in r}-{'MANIFEST.sha256'} +if files-listed: print('UNLISTED',sorted(files-listed));bad+=1 +sys.exit(1 if bad else 0)") && echo " all files match MANIFEST.sha256" + +echo "== 1. pinned inputs (git blob ids)" +$PY -c " +import hashlib +def blob(p): + d=open(p,'rb').read();return hashlib.sha1(b'blob %d\0'%len(d)+d).hexdigest() +pins={'$ORIG':('0bd0bacf744f1c31419e05b834e34a92be77ae57','Sussman gcert1-e8-r783 (wht-power-saving-lean 9c94857; = #363/#365/#375/#378 vendored copy)'), + '$GX/gx.py':('6d14c0a976146eb881c1e3897b2476f8633d4e9c','Sussman tools/gx/gx.py'), + '$GX/gxcore.py':('3e3f0a3076f3c326e7833c74eceecb3436dd3185','Sussman tools/gx/gxcore.py'), + '$OURS':('56708f99a48c3f86bfcabfc526c2ff224bdba66a','PR #378 re-timed certificate gcert1-e8-r783-far (c248962)'), + '$G377':('332f011f05f1b433e184e207ddf2c724de735514','PR #377 receipt GLOBAL-REVIEW.json (jacklightChen, d0a620f)'), + '$WORD':('22141be33d588ed9495feaeedda7efe205a5f8d0','PR #382 E8 bit word bitE8-kernel (015f00b)')} +for p,(h,what) in pins.items(): + assert blob(p)==h,(p,blob(p));print(' ',h[:12],what) +assert hashlib.sha256(open('$ORIG','rb').read()).hexdigest()=='4b92f00fc7454b9b15e6d71a3b05062792eacca0a0ca4efee46f87827d57c8aa' +print(' Sussman certificate sha256 4b92f00f... = the E8 certificate pinned by #377 (its README and native358 sources)')" + +echo "== 2. complex certificates: Sussman's checkers, the source-span rule, and the full operator identity" +$PY $C/cxcheck.py $ORIG $GX +$PY $C/cxcheck.py $OURS $GX +$PY $C/cxop.py $ORIG $OURS +$PY -c " +import gzip,json +a=json.load(gzip.open('$ORIG'));b=json.load(gzip.open('$OURS')) +assert (a['h'],a['v'],a['R'],a['cst'],a['N'],a['ports'],a['start'],a['final'],a['ret'],a['scat'],a['ext'])==(b['h'],b['v'],b['R'],b['cst'],b['N'],b['ports'],b['start'],b['final'],b['ret'],b['scat'],b['ext']) +assert b['frames'][:len(a['frames'])]==a['frames'] +print(' same h, v, R, cst, N = %d, ports, start/final frames, retained totals, scatter table; frame table extended by %d frames'%(b['N'],len(b['frames'])-len(a['frames'])))" + +echo "== 3. #377's nine-stage profile, rebuilt from the certificate, with the swapped unit; bit c; PR #315 outer assembly" +$PY $C/nine.py $ORIG $OURS $G377 $WORD $WD/kappa.json +$PY -c " +import json;k=json.load(open('$WD/kappa.json')) +assert k['b']=='999632926176283/1000000000000000000' and k['kappa']=='998634656132003/1000000000000000000' and k['binding']=='complex' +assert k['max_child']==48 and k['halving_degree']==2 +print('PASS conditional kappa =',k['kappa'],'=',k['kappa_float'],'(complex-bound: #377 nine-stage component with the re-timed E8 unit; bit PR #382)')" + +if [ $QUICK = 0 ]; then + echo "== 4. regeneration: our search re-run from Sussman's original with #377's ledger (m = 73) reaches the shipped certificate" + $PY $C/far9.py $ORIG $GX $WD/regen-split.json.gz 120 > $WD/regen.txt + tail -2 $WD/regen.txt + $PY $C/cxfinal.py $WD/regen-split.json.gz $ORIG $WD/regen.json.gz + $PY -c " +import gzip;assert gzip.open('$WD/regen.json.gz').read()==gzip.open('$OURS').read();print(' regenerated certificate equals the shipped one (decompressed bytes): no further move of this family helps at m = 73')" +fi diff --git a/research/e8-outer-slack-refinement/verify.py b/research/e8-outer-slack-refinement/verify.py new file mode 100644 index 0000000000..0dc7dbae05 --- /dev/null +++ b/research/e8-outer-slack-refinement/verify.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +"""Full pinned PR384 replay, followed by the exact changed assembly witness.""" +from pathlib import Path +from fractions import Fraction as Q +import argparse,hashlib,json,os,subprocess,sys +sys.dont_write_bytecode=True +sys.set_int_max_str_digits(0) +ROOT=Path(__file__).resolve().parent +read=lambda p:json.loads(p.read_text()) +sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest() +def integrity(): + manifest=read(ROOT/'MANIFEST.json') + assert {str(p.relative_to(ROOT)) for p in ROOT.rglob('*') if p.is_file()}==set(manifest)|{'MANIFEST.json'} + for name,h in manifest.items():assert sha(ROOT/name)==h,name + assert sha(ROOT/'source384/MANIFEST.sha256')==read(ROOT/'SOURCE.json')['manifest_sha256'] +def main(): + assert __debug__,'Assertions must stay enabled' + ap=argparse.ArgumentParser();ap.add_argument('output',type=Path);args=ap.parse_args();out=args.output.resolve() + assert not out.exists() and out!=ROOT and ROOT not in out.parents + integrity();out.mkdir(parents=True);(out/'tmp').mkdir() + script=(ROOT/'source384/verify.sh').read_text();old='HERE=$(cd "$(dirname "$0")" && pwd)';oldpy='PY="${PYTHON:-python3} -I -B"' + assert script.count(old)==1 and script.count(oldpy)==1 + script=script.replace(old,'HERE=$SOURCE384').replace('set -euo pipefail',"set -euo pipefail\nIFS=$'\\n\\t'") + script=script.replace(oldpy,'PY=py; py() { "$VERIFY_PYTHON" -I -B "$@"; }') + (out/'baseline.sh').write_text(script) + env=dict(os.environ,SOURCE384=str(ROOT/'source384'),VERIFY_PYTHON=sys.executable,PYTHONDONTWRITEBYTECODE='1',TMPDIR=str(out/'tmp')) + print('RUN full PR384 replay and regeneration',flush=True) + with (out/'baseline.log').open('w') as f:subprocess.run(['bash',str(out/'baseline.sh'),str(out/'baseline')],cwd=out,env=env,stdout=f,stderr=subprocess.STDOUT,check=True) + baseline=read(out/'baseline/kappa.json');source=read(ROOT/'SOURCE.json') + assert baseline['kappa']==source['kappa'] and baseline['binding']=='complex' + from refine import refine + from coarse_precision import certify + precision=certify(baseline['profile'],73,14727,Q(baseline['b'])) + assert precision==read(ROOT/'EXPECTED-COARSE-PRECISION.json') + (out/'COARSE-PRECISION.json').write_text(json.dumps(precision,indent=2)+'\n') + witness=refine(Q(precision['coarse_lower']),Q(baseline['c'])) + upper=Q(precision['coarse_upper']) + assert upper/(1+upper)before + (out/'WITNESS.json').write_text(json.dumps(witness,indent=2,default=str)+'\n') + integrity();result=dict(status='PASS_EXACT_OUTER_SLACK_REFINEMENT',kappa=str(k),kappa_float=float(k),baseline_kappa=str(before),absolute_gain=str(k-before),relative_gain_percent=float(100*(k/before-1)),strict_constraints=47,negative_controls=len(witness['negative_controls_rejected']),next_grid_above_fixed_complex_outer_ceiling=True,bootstrap_rounds=witness['bootstrap_rounds'],gain_over_previous_three_round=str(k-Q(witness['previous_three_round_kappa'])),gain_over_previous_six_round=str(k-Q(witness['previous_six_round_kappa'])),coarse_constructions_unchanged=True,coarse_precision_digits=24,two_moment_engines=True,next_grid_above_unrounded_moment_ceiling=True,scope='Same conditional supplier assumptions and open obligations as PR384. Fixed six-level PR185 ordinary bootstrap, strict witness parameters and 24-place coarse moment enclosure; inherited completed-leaf/restored-row/analytic interfaces remain conditional. No coarse circuit change or Lean proof.') + (out/'RESULT.json').write_text(json.dumps(result,indent=2)+'\n');print(json.dumps(result,indent=2),flush=True) +if __name__=='__main__':main() diff --git a/research/joint-dual/SOURCE.json b/research/joint-dual/SOURCE.json index e3a8386b17..e1fbf9c5aa 100644 --- a/research/joint-dual/SOURCE.json +++ b/research/joint-dual/SOURCE.json @@ -3,9 +3,9 @@ "base_pr57_commit": "cd350f76c9bc01489ec83568bded532cb69be938", "base_pr58_commit": "bc2f7ed4c20dc18898305ab17165c0c995cbb804", "files": { - "Makefile": "768131bd4ce18433f6abccdc9812a38c92e11220e3a1019c6d95334b42f529d1", + "Makefile": "cd0fb59dc078d1fdf54a163ea13bb3660d03c8fe69c1a7f99fc8e5f476a3d5c2", "NOTICE": "b49022cb4104d90b182e4c335f670faf45529025b15db77bf0291835083c28bd", - "README.md": "d104c31d5b7e0d3a8d011a0e3517ab615e5b499b3dc05684f7ad3cadcd28bdae", + "README.md": "b81f8035b859007add6693c6d860371c9100a6766e494045495a28a457a5fcb9", "certificates/joint-dual-compiler.json": "516c4d85158553dabd0a98216a064b2a7397957a9d5dd0df1d6e5aec53a4e805", "certificates/joint-dual-profiles-23.json": "159fa8fee175fc1d24f63e72d3c2f1dc9f4fcd78b938c5e7d2f735fd0fd37209", "certificates/joint-dual-profiles-25.json": "8d190ce42d097e828c5756918c52f2963df576cf4c6600b0fc7f2b7fdb6ad223",