diff --git a/research/p104-reroutes-on7623/EXPECTED.json b/research/p104-reroutes-on7623/EXPECTED.json new file mode 100644 index 0000000000..4467396b52 --- /dev/null +++ b/research/p104-reroutes-on7623/EXPECTED.json @@ -0,0 +1 @@ +{"kappa_prefix": "0.0036667343458950"} diff --git a/research/p104-reroutes-on7623/NOTICE b/research/p104-reroutes-on7623/NOTICE new file mode 100644 index 0000000000..02625d9df4 --- /dev/null +++ b/research/p104-reroutes-on7623/NOTICE @@ -0,0 +1,15 @@ +Apache-2.0. DreamingOfClouds with Claude Opus 5.5 (Anthropic), via Claude Code. + +The base word is our #7623 (14 loan + stationary-snapshot instances on our #7621), which uses SYLforge's device of +#7616 and #7620 and inherits #7620's composition: Ali Romman's #7605, our #7611 stay drops, Clear1nsight's #7612 +contact rechart, FanPUYen's #7604, SYLforge's #7603, ToikY's #7546/#7544 and rohanarun's signed #7113 caller, +and the courier lineage of our #7615/#7617 and the crowd's courier pattern (Clear1nsight's #7244/#7274/#7314/#7334/#7481, +rohanarun's #7480 and #7277, CubeJerry's #7577, petalas's #7326). #7627 (Clear1nsight) is cited only as a price point. + +Vendored data (unmodified, data only): data/base-7623-word.json.gz, data/invoice-7623.json and +data/affected-pairs-7623.json are our #7623's data/word.json.gz, data/invoice-new.json and data/affected-pairs-loan.json. + +check.py is our own code. Its replay, crossing and column-test sections are taken from our #7623 package; its column +tests follow the description of the affected-pair tests in #7620's README and native runner. The CLEAR certificate +check implements the acceptance rule of #7620's verify_certificates (read, not run). No other author's code was run; +their words are read as data. diff --git a/research/p104-reroutes-on7623/README.md b/research/p104-reroutes-on7623/README.md new file mode 100644 index 0000000000..198b11fe30 --- /dev/null +++ b/research/p104-reroutes-on7623/README.md @@ -0,0 +1,108 @@ +# CONDITIONAL κ = 0.0036667343458: seven stop edits and a joint hub re-settle on #7623 (premises: the same as #7623's) + +**κ = 0.00366673434589504230429298346749029694192150…, ×1.00118271 (+0.118271%) over our +[#7623](https://github.com/CrocSwap/integer-mult-bounds/pull/7623)** (κ 0.0036624027915539817894…), and ×1.00027363 over +[#7627](https://github.com/CrocSwap/integer-mult-bounds/pull/7627) (κ ≥ 0.003665731276). The official `evaluate_recursive_power` +bracket (256 bits) is [0.0036667343458, 0.0036667343459]. The claim 0.0036667343458 is below the exact crossing 0.00366673434589504. + +> **Premises: conditional on the same framework assumptions as #7623.** Those are exactly #7620's premises: its five framework +> assumptions (`native_all_columns`, `owned_erasure`, `compiler`, `precision_tape`, `analytic_recovery`) and its fixed allocation +> of 17·68 = 1,156 owned banks, with its CLEAR reading over #7623's **180 CLEARs**. This word adds no owned lifetime and no new kind +> of event. The 180 owned lifetimes (field, INIT chart, CLEAR chart), the 47 owned MOVEs, peak 50 and 68 labels are #7623's. The +> CLEAR *contents* do change (156 of 180), because the hub content they snapshot is re-derived. Each of the 180 CLEARs therefore carries its +> own exact certificate under #7620's `verify_certificates` rule (`data/clear-certificates.json`). If #7620's premises are refused, +> this word is void with #7620, #7621 and #7623. + +## The edits + +Base: #7623's word (`data/base-7623-word.json.gz`, 77,277 events). New word: `data/word.json.gz`, 208,738 events. Every edit is listed +in base-word coordinates in [data/edits.json](data/edits.json). That covers 23 deletions and 12 insertions on the interior events (every +MOVE/INIT/CLEAR, and every ADD/COPY/SCALE at a chart of dimension 1..8), plus `initial` for the two rebirths. Then come the re-derived hubs. + +| id | register | kind | route #7623 → new | new ops | +|---|---|---|---|---| +| E1 | helper 457 | rebirth + swap canceller (TR1) | 3→281→966→218→127 ⇒ born at 281 | `242 += -1*457` @281 | +| E2 | helper 461 | rebirth + swap canceller (TR1) | 3→285→994→201→127 ⇒ born at 285 | `10 += -1*461` @285 | +| E3 | helper 382 | re-route at an existing co-presence | drops 24: 3→849→… | `553 += 1/2*383` @24 (replaces 4 ops) | +| E4 | helper 490 | re-route at an existing co-presence | drops 725: 594→883→… | `1427 += -1*296` @725 (replaces `490 += 296`) | +| E5 | X main 44 | re-route at an existing co-presence | drops 849: 495→127 | `382 += -1*816` @849 (replaces `382 += 44`) | +| E6 | Y main 176 | re-route (twin pickup) | drops 1065: 449→928 | `176 += -1/4*1000`, `176 += -1*236` @928 (replace `176 += -1/2*379` @1065) | +| E7 | Y2 main 902 | stop deletion, no new op | drops 595: 3→618 | none (4 donor deliveries deleted) | +| hub | {0} chart and V | joint exact re-settle | n/a | every ADD/SCALE at dim 0 and dim 9 re-derived | + +**Why each kind is legal.** +- **TR1 swap canceller (E1, E2).** Helpers 457 and 461 were born at {0} and moved straight to their dim-3 first chart. Each is now + born at that chart; its first MOVE is deleted. While its row is still exactly e_h, one canceller op `j += -1*h` runs at that chart, + between registers that are both there. That is TR1's depth-1 swap: the token e_h now leaves on j. j = 242 is a {0}-born helper that + ends at V, and j = 10 is a kept X main. Its content is settled by the V mix, so no paid stay carries the token. Each helper's target + rank goes 9 → 6. +- **Re-route at an existing co-presence (E3–E6).** The register drops one interior stop with all its ops there, and its two MOVEs merge + into one strictly ascending MOVE. The content the stop delivered is re-made by one or two new ADDs between registers that already + share that chart at that moment in #7623's schedule. Each new op's legality is a chart check in the exact replay. For E5 the receiver + 382 ends at V, so the extra X content stays inside the V span and is absorbed by the V mix, and the {0} part by the {0} prefix. For E6 + the X content delivered to 176 is identical; the difference is {0} content plus two Y2 entries absorbed downstream. +- **Deletion with the hub re-settle (E7).** Main 902's stop at 595 is donor-only (it delivers to owned 1532 and to helpers 1479, 1255 + and 1495, which end at V). The four deliveries are deleted with no replacement. A positive control shows that the bare deletion + on #7623 already leaves every final row unchanged, because the deliveries cancel downstream. +- **Joint hub re-settle.** Every ADD/SCALE at the {0} chart (the prefix among helpers born at {0}) and at the full chart V (the mix of + registers ending at V) is solved jointly and exactly. The solution makes every final row equal #7623's and is factored into + ADD/SCALE events with 5-smooth coefficients (61,251 → 192,723 such events). + +Exactly the 7 edited registers change chains. Five new MOVE pairs appear, all strictly nested: (3,618), (3,849), (449,928), (495,127), +(594,883). Two leave: (24,849), (595,618). + +## Price + +Native paid delta per call {1:−2, 2:−3, 3:−5, 5:+1, 6:+2}; helper target delta per call {6:+2, 9:−2}. Over 17 calls: paid +{1:−34, 2:−51, 3:−85, 5:+17, 6:+34}, targets {6:+34, 9:−34}. Paid positions 110,145 → 110,026; rank surplus S = 1,424 unchanged. +Official tools (`price.py`): +- `compare_recursive_invoices` against #7623 gives `uniformly_better`, strictly negative for r^(1−C). +- `evaluate_recursive_power` (256 bits) gives `new_cost_lower` at C = 0.0036667343458, 0.0036624027915 (#7623) and + 0.003665731276 (#7627), and `new_cost_higher` at C = 0.0036667343459. + +Ordinary bill (17 calls, the repository `independent.py` formula with its call count set to 17): 786,433,632 for #7623 → 867,014,040 +for this word, below 10^9. The re-derived hubs triple the word length (77,277 → 208,738 events), and that is where the increase comes from. +Coefficients are 5-smooth. The replayed grid moves from #7623's (2-adic exponent 25, odd lcm 1,125, 40 numerator bits) to (20, 675, 34), +and non-dyadic literal events go from 5,903 to 12,312. + +## Checks + +```sh +python3.12 -B scripts/research_package.py --package research/p104-reroutes-on7623 +``` +`VERIFY.json` registers six commands: +- `core`: words, interior edit list, exact replay and legality of both words, rows, end charts and owned data, routes, coefficients, + invoice and κ. +- `certificates`: all 180 CLEAR certificates, with 2 rejecting controls. +- `controls`: 14 rejecting controls and 3 accepting. +- `columns1` and `columns2`: the affected-pair column tests. +- `price.py`. + +**Affected pairs.** #7623's census is 964 pairs. This word changes 7 routes, and the census becomes **981 pairs**: +17, the old and new +route pairs of the changed registers that were not already counted, with none dropped and every new MOVE pair inside. `check.py` runs 512 +forward and 512 adjoint Gaussian columns, signed Pauli action, absolute phase, exact ascent rank and a wrong-phase rejection on all 981 +pairs, in two halves. + +Independently of the package, the word passed our exact pricer, an independent exact row replay with chart legality, a replay modulo 2^89−1 and 2^107−1, +the repository's `independent.py` native audit (bad_inputs 0) and caller identity (bad_outputs [], 17 native calls), and an interval +gate on the κ bracket, with 6 rejecting controls. + +## Conditional premises and what is not rerun + +The claim carries exactly #7623's premises (above), over the same 180 CLEARs with new, individually certified contents, and the signed +#7113 caller and BIT premise of the base. This package does not rerun #7620's full native/signed 17-stage application, catalogue, outer +predicates or precision/tape counts. The header, end rows, owned lifetimes and labels are unchanged, but the coefficient grid and event +count are not (see Price), so the precision/tape figures quoted for #7620 do not carry over verbatim. No upstream maintainer has reviewed +the package. + +## Credit + +The base is our [#7623](https://github.com/CrocSwap/integer-mult-bounds/pull/7623) on [#7621](https://github.com/CrocSwap/integer-mult-bounds/pull/7621), +which uses SYLforge's loan + stationary-snapshot device ([#7616](https://github.com/CrocSwap/integer-mult-bounds/pull/7616), +[#7620](https://github.com/CrocSwap/integer-mult-bounds/pull/7620)). Signed caller: rohanarun's #7113. See [NOTICE](NOTICE). +DreamingOfClouds with Claude Opus 5.5 (Anthropic), via Claude Code. Apache-2.0. + +## Open next questions + +**The premises.** A ruling on #7620's inherited assumptions and its CLEAR reading (`owned_erasure`, clear-form-gap Q1) decides #7620, +#7621, #7623 and this word together. See [TASK.json](TASK.json). diff --git a/research/p104-reroutes-on7623/SOURCES.json b/research/p104-reroutes-on7623/SOURCES.json new file mode 100644 index 0000000000..c484f02b5a --- /dev/null +++ b/research/p104-reroutes-on7623/SOURCES.json @@ -0,0 +1,30 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "scripts/compare_recursive_invoices.py", + "usage": "input", + "git_blob": "fda2a852e9937e42fe40df0707694465ca7c1b48", + "sha256": "3930c22c11da7bc6042cfeb6e459ecb06e4478430037bee3469d034353855fc6" + }, + { + "path": "scripts/evaluate_recursive_power.py", + "usage": "input", + "git_blob": "ca50f8021fc3238a58fd420383f4619a8d008ace", + "sha256": "52b20f41fd0bb55fa88dccd6015af2ce358917817b9506720f3e60ce681cc3ad" + } + ] +} diff --git a/research/p104-reroutes-on7623/TASK.json b/research/p104-reroutes-on7623/TASK.json new file mode 100644 index 0000000000..86006a43dc --- /dev/null +++ b/research/p104-reroutes-on7623/TASK.json @@ -0,0 +1,117 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "p104-side-correction", + "question": "Can joint helper bases and a legal causal split improve the complete P104 productive/paid invoice?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "research/p104-helper-subspace-splits/README.md", + "research/dyadic-helper-channel-capacity/README.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Start with the selected #5599 emitted word and review pending #5718 distinct input/output bases plus #5717/#5719 coverage before claiming work. Pick one uncovered source word, helper group and cut region. Prove the arbitrary-input relation and legal entry/exit corrections, then compare full target and paid profiles. Reject if completion, owned lifetimes or consumer costs repay the gain. A static pairing rank alone is not a physical split.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "P104", + "helper basis", + "helper split", + "5718", + "dyadic capacity" + ], + "existing_checks": [ + { + "scope": "PR #4133: literal-slot defect", + "evidence": "research/p104-literal-slot-defect/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "88666f1dee93fbd85b31fd5d6f91a219e111b5f4", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4136: uniform commutation gap", + "evidence": "research/p104-uniform-commutation-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "281ce601a8be9db470de630759179c23e1dfaa88", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4140: uniform encoding gap", + "evidence": "research/p104-uniform-encoding-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "de25c6525aa866962309df5d107b32d55e6e5628", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4153: source-chart shortcut exhausts its optimistic allowance", + "evidence": "research/p104-source-chart-shortcut/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "9123241fea53df77e51ffe30d9aca1625d4bf3a8", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4154: fiber-tag seam mismatch", + "evidence": "research/p104-fiber-tag-seam/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "4ffcdaee5d6255a9cea1fe53a5424435068089d0", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "refined", + "actual_scope": "Exact #7623 word (our loan + stationary-snapshot word on #7621). Seven stop edits plus one joint hub re-settle: two TR1 swap-canceller rebirths (helpers 457 and 461 are born at their dim-3 first chart; 242 += -1*457 and 10 += -1*461 while their rows are still e_h), two helper re-routes at existing co-presences (382 drops chart 24: 553 += 1/2*383; 490 drops chart 725: 490 += 296 becomes 1427 += -1*296), two main re-routes at existing co-presences (X main 44 drops chart 849: 382 += 44 becomes 382 += -1*816; Y main 176 drops chart 1065: its pickup from 379 becomes 176 += -1/4*1000 and 176 += -1*236 at 928), and one plain main stop deletion (Y2 main 902 drops donor-only chart 595). Every ADD/SCALE at the {0} chart and at V is then re-derived jointly and exactly so that all final rows equal #7623's. Rows, end charts, owned MOVEs (47), the 180 owned lifetimes, peak 50 and 68 labels are #7623's; the 180 CLEAR contents change with the hub content and each carries an exact certificate under #7620's rule. Conditional on the same framework assumptions as #7623.", + "scope_change_reason": "Removes seven paid stops from #7623's word by re-routing their content through registers that already meet there (or, for 902, dropping a donor-only stop) and re-settling both hubs exactly; each edit was found by an exact screen over all interior stops of #7623 and checked by exact replay before it was stacked.", + "bottleneck_link": "Reduces the complete signed paid invoice by {1:-34, 2:-51, 3:-85, 5:+17, 6:+34} and moves two helper targets from rank 9 to rank 6 ({6:+34, 9:-34}) over the 17 native calls; paid positions 110,145 -> 110,026, rank-weighted S 1424 unchanged.", + "budget_minutes": 120, + "stop_rule": "One literal word with exact arbitrary-input row equality, legality, the interior edit list, exact certificates for all 180 CLEARs, all affected-pair column tests (981 pairs), complete invoice and a certified crossing.", + "outcome": "completed", + "evidence": "README.md, data/edits.json, check.py, price.py, VERIFY.json.", + "author": "DreamingOfClouds", + "ai_assistance": "Claude Opus 5.5 (Anthropic), via Claude Code.", + "open_questions": [ + { + "question": "Do #7623's premises (#7620's five inherited assumptions native_all_columns, owned_erasure, compiler, precision_tape, analytic_recovery, its 180-CLEAR reading and its fixed 17*68 bank allocation) hold?", + "why_it_matters": "The claimed kappa holds only if #7623's does. This word adds no owned lifetime and no new kind of event; its 180 CLEARs are the same lifetimes as #7623's with new contents, each certified exactly.", + "first_step": "Run check.py core and check.py certificates.", + "blocked_by": "A ruling on #7620's premises (owned_erasure, clear-form-gap Q1)." + } + ] +} diff --git a/research/p104-reroutes-on7623/VERIFY.json b/research/p104-reroutes-on7623/VERIFY.json new file mode 100644 index 0000000000..a12133e5bb --- /dev/null +++ b/research/p104-reroutes-on7623/VERIFY.json @@ -0,0 +1,77 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "scripts/compare_recursive_invoices.py", + "scripts/evaluate_recursive_power.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/check.py", + "core" + ], + "timeout_seconds": 180, + "checks": "Vendored #7623 word bytes and new word hash; header identical except initial[457] 3->281 and initial[461] 3->285; interior events (MOVE/INIT/CLEAR and ADD/COPY/SCALE at dims 1..8) = #7623's with the 23 deletions and 12 insertions of data/edits.json; exact arbitrary-input replay and legality of both words; all 1,569 rows and end charts equal #7623's; helpers identity, owned rows empty; owned MOVEs (47), 180 lifetimes, peak 50 and 68 labels unchanged; exactly the 7 edited registers change chains, as listed; 5 new strictly nested MOVE pairs; 5-smooth coefficients; native paid delta {1:-2, 2:-3, 3:-5, 5:+1, 6:+2} and helper target delta {6:+2, 9:-2} per call; S 1424; invoice and kappa 0.0036667343458950 recomputed; #7623 crossing reproduced. Prints PASS_CORE_ON_7623." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/check.py", + "certificates" + ], + "timeout_seconds": 180, + "checks": "Exact CLEAR certificates for all 180 CLEARs of the new word (#7620's verify_certificates rule: keys live, not the cleared field, exact sum; zero rows take the empty certificate), with two rejecting controls. Prints PASS_CERTIFICATES_ON_7623." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/check.py", + "controls" + ], + "timeout_seconds": 480, + "checks": "14 negative controls (each edit's new op dropped or its coefficient changed, rebirth undone in the header, stop re-taken, ownership flag, V-mix coefficient doubled, {0}-prefix op dropped, bare 902 stop drop on #7623 without re-settle) all rejected by exact replay or row/end-chart checks; the new and #7623 words accepted. Prints PASS_CONTROLS_ON_7623." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/check.py", + "columns1" + ], + "timeout_seconds": 150, + "checks": "Gaussian column tests (512 forward + 512 adjoint, signed Pauli action, absolute phase, exact rank, wrong-phase rejection) on the even-indexed half of the 981-pair affected census (#7623's 964 plus 17 pairs on the old or new routes of the 7 changed registers; none dropped), with rejecting controls. Prints PASS_COLUMNS_ON_7623_1." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/check.py", + "columns2" + ], + "timeout_seconds": 150, + "checks": "Same column tests on the odd-indexed half of the 981-pair census. Prints PASS_COLUMNS_ON_7623_2." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/price.py" + ], + "timeout_seconds": 60, + "checks": "Repository tools: uniformly_better against #7623; new_cost_lower at C=0.0036667343458, 0.0036624027915 (#7623) and 0.003665731276 (#7627); new_cost_higher at C=0.0036667343459. Prints PASS_PRICE." + } + ] +} diff --git a/research/p104-reroutes-on7623/check.py b/research/p104-reroutes-on7623/check.py new file mode 100644 index 0000000000..1a0e70d1e7 --- /dev/null +++ b/research/p104-reroutes-on7623/check.py @@ -0,0 +1,974 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Exact replay of seven stop edits and one joint hub re-settle on #7623's word. + +Standard library only. Written for this package; it imports no other package and runs no other author's code +(the #7623 word, invoice and affected-pair census are vendored as data). + +Modes (each is a separate VERIFY command): core, certificates, controls, columns1, columns2; all runs every mode. + +core + 1. Vendored #7623 word (data/base-7623-word.json.gz, sha256 97391721...) and new word (data/word.json.gz, sha256 fa1a8dad...). + 2. Header identical except initial[457] 3 -> 281 and initial[461] 3 -> 285 (the two rebirths). + 3. Interior: every MOVE/INIT/CLEAR and every ADD/COPY/SCALE at a chart of dimension 1..8 of the new word equals #7623's + interior with the 23 deletions and 12 insertions of data/edits.json (E1..E7), event for event and in order. + Everything else (ADD/SCALE at the {0} chart and at V) is the re-derived joint hub. + 4. Both words replayed over the rationals from arbitrary inputs with full legality checks (every ADD/COPY between two + registers at the same chart, every public MOVE strictly ascending, owned fields live). All 1,569 rows and end charts + equal #7623's; helpers end at identity; owned rows end empty; owned MOVE multiset, owned lifetimes (field, INIT chart, + CLEAR chart), peak 50, 68 labels and 180 CLEARs unchanged. + 5. Routes: exactly the 7 registers of E1..E7 change chains, each from route_before to route_after; new MOVE pairs strictly nested. + 6. Coefficients 5-smooth; grid statistics printed. + 7. Census, complete invoice (17 native calls), S and kappa recomputed; #7623's crossing reproduced. +certificates exact CLEAR certificates for all 180 CLEARs of the new word (#7620's verify_certificates rule), 2 rejecting controls. +controls negative controls (each edit's new op dropped or altered, hub corrupted, bare stop drop on #7623, ...) rejected; 2 positives. +columns1/2 affected-pair column tests on the 981-pair census (even / odd sorted index): 512 forward + 512 adjoint exact Gaussian + columns, signed Pauli action, absolute phase, exact ascent rank, wrong-phase rejection; rejecting controls. +""" +import collections +import multiprocessing +import copy +import decimal +import gzip +import hashlib +import json +import sys +from fractions import Fraction as Q +from pathlib import Path + +HERE = Path(__file__).resolve().parent +DATA = HERE / 'data' +BASE_SHA256 = '97391721ab7d30f8dd84c8d3c29a3c3ed2df2d65ca55e7ff8329bd09877681d2' +WORD_SHA256 = 'fa1a8dad12d28e6e5ced5a6989d49074efe15d6647ffc122cb28fcd666f366c2' +CALLS = 17 +CLAIM, ABOVE = '0.0036667343458', '0.0036667343459' + + +def require(cond, label): + if not cond: + raise AssertionError(label) + + +def load_gz(path): + return json.loads(gzip.decompress(path.read_bytes())) + + +def span(vectors): + s = {0} + for v in vectors: + require(type(v) is int and 0 < v < 512 and v not in s, 'frame vectors independent in F2^9') + s |= {x ^ v for x in s} + return frozenset(s) + + +def mains(W): + live = set(W['live']) + return live | {r + 112 for r in live} | set(W['hosted']['X2']) | set(W['hosted']['Y2']) + + +def replay(W): + """Exact replay; returns rows, end charts, MOVE chains and owned data. Raises on any illegality.""" + n, N = W['public'], W['public'] + W['owned_fields'] + sp = [span(f) for f in W['frames']] + rows = [{r: Q(1)} if r < n else {} for r in range(N)] + cur = list(W['initial']) + [None] * W['owned_fields'] + alive, chains, owned_moves = set(), collections.defaultdict(list), collections.Counter() + lifetimes, peak = collections.Counter(), 0 + init_chart = {} + stats = dict(max_den_exp=0, odd_den=1, max_num_bits=0, smooth=True) + + def note(q): + d = q.denominator + e = (d & -d).bit_length() - 1 + stats['max_den_exp'] = max(stats['max_den_exp'], e) + odd = d >> e + o = odd + for p in (3, 5): + while o % p == 0: + o //= p + if o != 1: + stats['smooth'] = False + if odd > 1 and stats['odd_den'] % odd: + stats['odd_den'] = stats['odd_den'] * odd // __import__('math').gcd(stats['odd_den'], odd) + stats['max_num_bits'] = max(stats['max_num_bits'], abs(q.numerator).bit_length()) + + for i, e in enumerate(W['program']): + op, r = e[0], e[1] + require(type(r) is int and 0 <= r < N, '%d register index' % i) + if op == 'MOVE': + a, b, flag = e[2], e[3], e[4] + require(type(flag) is bool and flag == (r >= n), '%d MOVE ownership flag' % i) + require(cur[r] == a, '%d MOVE from the current chart' % i) + if r >= n: + require(r in alive, '%d owned MOVE on a live field' % i) + require(sp[a] < sp[b] or sp[b] < sp[a], '%d owned MOVE nested' % i) + owned_moves[(a, b)] += 1 + else: + require(sp[a] < sp[b], '%d public MOVE strictly ascends' % i) + cur[r] = b + chains[r].append((a, b)) + elif op == 'INIT': + require(r >= n and r not in alive and len(e) == 3, '%d INIT of a dead owned field' % i) + alive.add(r); rows[r] = {}; cur[r] = e[2]; init_chart[r] = e[2] + peak = max(peak, len(alive)) + elif op == 'CLEAR': + require(r >= n and r in alive and cur[r] == e[2], '%d CLEAR at the current chart' % i) + lifetimes[(r, init_chart.pop(r), e[2])] += 1 + alive.discard(r); rows[r] = {}; cur[r] = None + elif op == 'SCALE': + q = Q(e[2]) + require(q != 0, '%d SCALE by zero' % i) + require(cur[r] == e[3] and (r < n or r in alive), '%d SCALE chart' % i) + rows[r] = {k: v * q for k, v in rows[r].items()} + for v in rows[r].values(): + note(v) + elif op in ('ADD', 'COPY'): + s, q, f = e[2], Q(e[3]), e[4] + require(type(s) is int and 0 <= s < N and s != r, '%d operand' % i) + require(q != 0, '%d zero coefficient' % i) + require(cur[r] == f and cur[s] == f, '%d ADD/COPY operands at chart %d' % (i, f)) + for x in (r, s): + require(x < n or x in alive, '%d owned field live' % i) + if op == 'COPY': + require(not rows[r], '%d COPY into a zero field' % i) + R = rows[r] + for k, v in rows[s].items(): + nv = R.get(k, 0) + q * v + if nv: + R[k] = nv + note(nv) + else: + R.pop(k, None) + else: + raise AssertionError('%d unknown op %r' % (i, op)) + require(not alive, 'every owned field cleared') + require(cur[:n] == list(W['final']), 'public fields end at final charts') + return dict(rows=rows, cur=cur, chains=chains, owned_moves=owned_moves, + lifetimes=lifetimes, peak=peak, sp=sp, stats=stats) + + +def crossing(T, P, digits=40): + """Root of F(C) = sum (T_r - P_r) r^(1-C) on [0.003, 0.0045] by bisection in 80-digit decimals.""" + D = decimal.Decimal + with decimal.localcontext(decimal.Context(prec=digits + 40)) as ctx: + ranks = sorted({int(r) for r in T} | {int(r) for r in P}) + terms = [(D(T.get(str(r), 0) - P.get(str(r), 0)) * r, D(r).ln()) for r in ranks] + + def F(C): + return sum((c * (-C * l).exp() for c, l in terms), D(0)) + lo, hi = D('0.003'), D('0.0045') + require(F(lo) > 0 > F(hi), 'crossing bracketed') + for _ in range(160): + mid = (lo + hi) / 2 + if F(mid) > 0: + lo = mid + else: + hi = mid + return decimal.Context(prec=digits).create_decimal(lo) + + +def invoice_json(P, T): + return {'schema': 'integer-mult-recursive-invoice/v1', + 'contract': {'model': 'mixed-target-unnormalized-power-v1', + 'rank_semantics': 'H_r costs r^(1-C); debit surrendered productive fields', + 'ambient_rank': 145, + 'boundary': 'complete signed #7113 caller application with 17 native calls'}, + 'paid': {k: P[k] for k in sorted(P, key=int)}, + 'targets': {k: T[k] for k in sorted(T, key=int)}} + + +def clears(W): + """Row content erased at every owned CLEAR, in program order.""" + n = W['public'] + rows = [{r: Q(1)} if r < n else {} for r in range(n + W['owned_fields'])] + out = [] + for e in W['program']: + op, r = e[0], e[1] + if op == 'INIT': + rows[r] = {} + elif op == 'CLEAR': + out.append((r, tuple(sorted(rows[r].items())))) + rows[r] = {} + elif op == 'SCALE': + rows[r] = {k: v * Q(e[2]) for k, v in rows[r].items()} + elif op in ('ADD', 'COPY'): + R = rows[r] + for k, v in rows[e[2]].items(): + nv = R.get(k, 0) + Q(e[3]) * v + if nv: + R[k] = nv + else: + R.pop(k, None) + return out + + + +def literal_coeffs(program): + return [Q(e[2]) for e in program if e[0] == 'SCALE'] + [Q(e[3]) for e in program if e[0] in ('ADD', 'COPY')] + + +def nondyadic(program): + return sum(1 for q in literal_coeffs(program) if q.denominator & (q.denominator - 1)) + + +# --------------------------------------------------------------------------- +# Column tests for every affected public chart pair (own implementation). +# A chart pair (a, b) is the operator F_a^dagger F_b of two nine-bit stabilizer +# frames (Gaussian-dyadic Clifford maps). For each pair this section (i) builds +# the circuit of F_a^dagger F_b directly from the frame definition, (ii) compiles +# it to the child recipe monomial . Fourier^r . monomial with r = dim b - dim a, +# (iii) requires the recipe and the direct circuit to agree in signed Pauli action +# and exact absolute phase, and (iv) compares all 512 forward and 512 adjoint +# Gaussian columns, then checks that a recipe with its absolute phase shifted is +# rejected. Gates: P (bit permutation), D (diagonal Z4 quadratic form), +# C (one Fourier line, (1+i)I/2 + (1-i)X/2), X (offset), phase (i^k). +# --------------------------------------------------------------------------- +NB = 9 +FULL = 1 << NB + + +def par(x): + return x.bit_count() & 1 + + +def rank2(rows): + piv = {} + for x in rows: + while x: + b = x.bit_length() - 1 + if b not in piv: + piv[b] = x + break + x ^= piv[b] + return len(piv) + + +def tr(rows, n=NB): + return tuple(sum(((rows[j] >> i) & 1) << j for j in range(n)) for i in range(n)) + + +def mvec(rows, x): + return sum(par(r & x) << i for i, r in enumerate(rows)) + + +def minv(rows, n=NB): + a = [r | (1 << (n + i)) for i, r in enumerate(rows)] + for j in range(n): + k = next(i for i in range(j, n) if a[i] >> j & 1) + a[j], a[k] = a[k], a[j] + for i in range(n): + if i != j and a[i] >> j & 1: + a[i] ^= a[j] + require([r & ((1 << n) - 1) for r in a] == [1 << i for i in range(n)], 'binary inverse') + return tuple(r >> n for r in a) + + +def extend(vecs, n=NB): + out = [] + for x in list(vecs) + [1 << i for i in range(n)]: + if rank2(out + [x]) > len(out): + out.append(x) + require(len(out) == n, 'basis extension') + return tuple(out) + + +def qform(Qr, al, x): + return (sum(al[i] for i in range(NB) if x >> i & 1) + + 2 * sum(par((Qr[i] >> (i + 1)) & (x >> (i + 1))) for i in range(NB) if x >> i & 1)) % 4 + + +def dagger(circ): + out = [] + for g in reversed(circ): + t = g[0] + if t == 'P': + out.append(('P', minv(g[1]))) + elif t == 'D': + out.append(('D', g[1], tuple(-a % 4 for a in g[2]))) + elif t == 'C': + out.append(('C', g[1], -g[2])) + elif t == 'phase': + out.append(('phase', -g[1] % 4)) + else: + out.append(g) + return tuple(out) + + +def fourier(r): + return tuple(('C', 1 << i, 1) for i in range(r)) + + +def frame_circuit(vecs): + r = len(vecs) + if r == 0: + return () + if r == NB: + return fourier(NB) + G = tr(extend(vecs)) + gi = tr(minv(G)) + Qr = tuple((1 << i) ^ sum(par(a & b) << j for j, b in enumerate(gi)) for i, a in enumerate(gi)) + chart = (('P', G), ('D', Qr, tuple((row >> i) & 1 for i, row in enumerate(Qr)))) + return dagger(chart) + fourier(r) + chart + + +def tableau(circ): + rows = [(1 << i, 0, 0) for i in range(NB)] + [(0, 1 << i, 0) for i in range(NB)] + for g in circ: + t = g[0] + out = [] + it = tr(minv(g[1])) if t == 'P' else None + for x, z, p in rows: + if t == 'P': + x, z = mvec(g[1], x), mvec(it, z) + elif t == 'X': + p += 2 * par(z & g[1]) + elif t == 'C': + if par(z & g[1]): + x ^= g[1] + p += 3 * g[2] + elif t == 'D': + p += sum(g[2][i] for i in range(NB) if x >> i & 1) + p += 2 * sum(par((g[1][i] >> (i + 1)) & (x >> (i + 1))) for i in range(NB) if x >> i & 1) + z ^= mvec(g[1], x) + else: + require(t == 'phase', 'gate type') + out.append((x, z, p % 4)) + rows = out + return tuple(rows) + + +_ACT = {} + + +def dact(g): + if g not in _ACT: + _ACT[g] = tuple(qform(g[1], g[2], x) for x in range(FULL)) + return _ACT[g] + + +def rot(pr, k): + a, b = pr + return ((a, b), (-b, a), (-a, -b), (b, -a))[k % 4] + + +def column(circ, basis=0): + """Exact Gaussian-dyadic column: ({address: (re, im)}, denominator exponent), value = num / 2^(den/2) ... .""" + val, den = {basis: (1, 0)}, 0 + for g in circ: + t = g[0] + res = {} + if t == 'C': + d, s = g[1], g[2] + for ad, (a, b) in val.items(): + for tg, pr in ((ad, (a - s * b, b + s * a)), (ad ^ d, (a + s * b, b - s * a))): + o = res.get(tg, (0, 0)) + res[tg] = (o[0] + pr[0], o[1] + pr[1]) + den += 1 + else: + for ad, pr in val.items(): + if t == 'P': + tg = mvec(g[1], ad) + elif t == 'X': + tg = ad ^ g[1] + elif t == 'D': + tg = ad + pr = rot(pr, dact(g)[ad]) + else: + require(t == 'phase', 'gate type') + tg = ad + pr = rot(pr, g[1]) + require(tg not in res, 'monomial map injective') + res[tg] = pr + val = {ad: pr for ad, pr in res.items() if pr != (0, 0)} + while den and all((a | b) % 2 == 0 for a, b in val.values()): + den -= 1 + val = {ad: (a // 2, b // 2) for ad, (a, b) in val.items()} + return val, den + + +def monomial_circuit(rec): + M, Qr, al = tuple(rec['matrix_rows']), tuple(rec['quadratic_rows']), tuple(rec['linear_Z4']) + require(tr(Qr) == Qr and all(al[i] % 2 == (Qr[i] >> i) & 1 for i in range(NB)), 'diagonal form') + minv(M) + return (('D', Qr, al), ('P', M), ('X', rec['offset']), ('phase', rec['phase'])) + + +def recipe_circuit(rec): + if rec['rank'] == 0: + return monomial_circuit(rec['left']) + return monomial_circuit(rec['right']) + fourier(rec['rank']) + monomial_circuit(rec['left']) + + +# compiler: symplectic tableau algebra used to produce the recipe +def pmul(a, b): + x, z, p = a + y, w, q = b + return x ^ y, z ^ w, (p + q + 2 * par(z & y)) % 4 + + +def tapply(T, pa): + x, z, ph = pa + out = (0, 0, ph) + for i in range(NB): + if x >> i & 1: + out = pmul(out, T[i]) + for i in range(NB): + if z >> i & 1: + out = pmul(out, T[NB + i]) + return out + + +def tcompose(A, B): + return tuple(tapply(A, p) for p in B) + + +def tidentity(): + return tuple([(1 << i, 0, 0) for i in range(NB)] + [(0, 1 << i, 0) for i in range(NB)]) + + +def tinverse(T): + cols = [x | (z << NB) for x, z, p in T] + ci = tr(minv(tr(cols, 2 * NB), 2 * NB), 2 * NB) + out = [] + for j, w in enumerate(ci): + x, z = w & (FULL - 1), w >> NB + u, v, p = tapply(T, (x, z, 0)) + require((u, v) == tidentity()[j][:2], 'tableau inverse') + out.append((x, z, -p % 4)) + return tuple(out) + + +class Op: + def __init__(s, tab, circ): + s.tab, s.circ = tab, tuple(circ) + + def then(s, o): + return Op(tcompose(o.tab, s.tab), s.circ + o.circ) + + def dag(s): + return Op(tinverse(s.tab), dagger(s.circ)) + + +def op_perm(G): + cols, gi = tr(G), minv(G) + return Op(tuple([(a, 0, 0) for a in cols] + [(0, a, 0) for a in gi]), [('P', tuple(G))]) + + +def op_diag(Qr, al=None): + Qr = tuple(Qr) + al = tuple(al) if al is not None else tuple((Qr[i] >> i) & 1 for i in range(NB)) + return Op(tuple([(1 << i, Qr[i], al[i]) for i in range(NB)] + [(0, 1 << i, 0) for i in range(NB)]), [('D', Qr, al)]) + + +def op_c(q, s=1): + return Op(tuple([(1 << i, 0, 0) for i in range(NB)] + + [(q if q >> i & 1 else 0, 1 << i, (3 * s) % 4 if q >> i & 1 else 0) for i in range(NB)]), [('C', q, s)]) + + +def op_x(b): + return Op(tuple([(1 << i, 0, 0) for i in range(NB)] + [(0, 1 << i, 2 * ((b >> i) & 1)) for i in range(NB)]), [('X', b)]) + + +def op_id(): + return Op(tidentity(), []) + + +def op_four(axes): + o = op_id() + for i in axes: + o = o.then(op_c(1 << i)) + return o + + +def op_had(axes): + S = op_diag(tuple(1 << i if i in axes else 0 for i in range(NB))) + return S.then(op_four(axes)).then(S) + + +def frame_op(vecs): + r = len(vecs) + if r == 0: + return op_id() + if r == NB: + return op_four(range(NB)) + G = tr(extend(vecs)) + gi = tr(minv(G)) + Qr = tuple((1 << i) ^ sum(par(a & b) << j for j, b in enumerate(gi)) for i, a in enumerate(gi)) + K = op_perm(G).then(op_diag(Qr)) + return K.dag().then(op_four(range(r))).then(K) + + +def split_monomial(op): + T = op.tab + require(all(x == 0 and p % 2 == 0 for x, z, p in T[NB:]), 'monomial tableau') + G = tr([x for x, z, p in T[:NB]]) + b = mvec(G, sum((p // 2) << i for i, (x, z, p) in enumerate(T[NB:]))) + cols = [mvec(tr(G), z) for x, z, p in T[:NB]] + Qr = tr(cols) + al = [(p - 2 * par(b & z)) % 4 for x, z, p in T[:NB]] + out = op_diag(Qr, al).then(op_perm(G)).then(op_x(b)) + require(out.tab == T, 'monomial rebuilt') + val, den = column(op.circ) + require(den == 0 and all(v == (0, 0) for a, v in val.items() if a != b), 'monomial column') + ph = [(1, 0), (0, 1), (-1, 0), (0, -1)].index(val[b]) + out = out.then(Op(tidentity(), [('phase', ph)])) + return out, dict(matrix_rows=G, offset=b, quadratic_rows=Qr, linear_Z4=al, phase=ph) + + +def lower(op): + Bc = [x for x, z, p in op.tab[NB:]] + r = rank2(Bc) + if not r: + mon, rec = split_monomial(op) + return dict(rank=0, left=rec, right=None) + G = tr(extend(Bc)) + A = minv(G) + PA = op_perm(A) + part = op.then(PA) + Bc = [x for x, z, p in part.tab[NB:]] + Dc = [z for x, z, p in part.tab[NB:]] + picks, sel = [], [] + for j, x in enumerate(Bc): + if rank2(sel + [x]) > len(sel): + picks.append(j) + sel.append(x) + require(len(picks) == r and all(x >> r == 0 for x in Bc), 'rank selection') + Br = tr(sel, r) + Bi = minv(Br, r) + Dr = tr([Dc[j] & ((1 << r) - 1) for j in picks], r) + Qs = tuple(sum(par(row & col) << j for j, col in enumerate(tr(Bi, r))) for row in Dr) + DQ = op_diag(Qs + (0,) * (NB - r)) + V = part.then(DQ).then(op_had(range(r))) + require(all(x == 0 for x, z, p in V.tab[NB:]), 'V monomial') + Vm, _ = split_monomial(V) + S = op_diag(tuple(1 << i if i < r else 0 for i in range(NB))) + left = S.dag().then(DQ.dag()).then(PA.dag()) + right = Vm.then(S.dag()).then(op_x((1 << r) - 1)) + lm, lrec = split_monomial(left) + rm, rrec = split_monomial(right) + comp = rm.then(op_four(range(r))).then(lm) + require(comp.tab == op.tab and column(comp.circ) == column(op.circ), 'recipe reproduces the pair operator') + return dict(rank=r, left=lrec, right=rrec) + + +def pair_columns(frames, a, b, wrong_phase=True): + """Full column test of the chart pair (a, b); returns its rank.""" + U, V = frames[a], frames[b] + rec = lower(frame_op(U).dag().then(frame_op(V))) + require(rec['rank'] == len(V) - len(U), 'exact public ascent rank of pair %s' % ((a, b),)) + expected = dagger(frame_circuit(U)) + frame_circuit(V) + actual = recipe_circuit(rec) + require(tableau(actual) == tableau(expected), 'signed Pauli action of pair %s' % ((a, b),)) + for x, y in ((actual, expected), (dagger(actual), dagger(expected))): + for c in range(FULL): + require(column(x, c) == column(y, c), 'Gaussian column %d of pair %s' % (c, (a, b))) + if wrong_phase: + bad = actual + (('phase', 1),) + require(tableau(bad) == tableau(actual) and column(bad) != column(expected), 'wrong absolute phase rejected') + return rec['rank'] + + + +# --------------------------------------------------------------------------- +# Package-specific checks. +# --------------------------------------------------------------------------- +MODE = sys.argv[1] if len(sys.argv) > 1 else 'all' +require(MODE in ('all', 'core', 'certificates', 'controls', 'columns1', 'columns2'), + 'mode is all, core, certificates, controls, columns1 or columns2') + + +def load_words(): + base_raw = (DATA / 'base-7623-word.json.gz').read_bytes() + require(hashlib.sha256(base_raw).hexdigest() == BASE_SHA256, 'vendored #7623 word bytes') + word_raw = (DATA / 'word.json.gz').read_bytes() + require(hashlib.sha256(word_raw).hexdigest() == WORD_SHA256, 'new word bytes') + return json.loads(gzip.decompress(base_raw)), json.loads(gzip.decompress(word_raw)) + + +def interior_test(W): + dim = [len(f) for f in W['frames']] + + def ok(e): + if e[0] in ('ADD', 'COPY'): + return 0 < dim[e[4]] < 9 + if e[0] == 'SCALE': + return 0 < dim[e[3]] < 9 + return True + return ok + + +def apply_interior(B, E): + """#7623's interior subsequence with the listed deletions and insertions.""" + ok, P = interior_test(B), B['program'] + dele, ins = {}, collections.defaultdict(list) + for ed in E['edits']: + for i, ev in ed['delete']: + require(P[i] == ev and ok(ev) and i not in dele, '%s deletion %d matches an interior base event' % (ed['id'], i)) + dele[i] = ev + for x in ed['insert']: + require(ok(x['event']), '%s insertion is interior' % ed['id']) + ins[x['before']].append(x['event']) + keys, k, out = sorted(ins), 0, [] + for i, e in enumerate(P): + if not ok(e): + continue + while k < len(keys) and keys[k] <= i: + out.extend(ins[keys[k]]) + k += 1 + if i not in dele: + out.append(e) + for key in keys[k:]: + out.extend(ins[key]) + return out, len(dele), sum(len(v) for v in ins.values()) + + +def chain_route(RX, X, r): + ch = RX['chains'].get(r, []) + return [ch[0][0]] + [b for a, b in ch] if ch else [X['initial'][r]] + + +def routes_of(X): + out = collections.defaultdict(list) + for e in X['program']: + if e[0] == 'MOVE' and e[1] < X['public']: + out[e[1]].append((e[2], e[3])) + return out + + +def move_pairs(X): + return {(e[2], e[3]) for e in X['program'] if e[0] == 'MOVE'} + + +def native_counts(W): + dim = [len(f) for f in W['frames']] + paid = collections.Counter(abs(dim[e[3]] - dim[e[2]]) for e in W['program'] if e[0] == 'MOVE') + M, n = mains(W), W['public'] + helpers = collections.Counter(dim[W['final'][r]] - dim[W['initial'][r]] for r in range(n) if r not in M) + return paid, helpers + + +def diff(a, b): + d = collections.Counter(b) + d.subtract(a) + return {k: v for k, v in sorted(d.items()) if v} + + +def verify_certificates(W, certs): + """#7620's verify_certificates rule at every CLEAR: erased row == sum of certificate coefficients times rows of live + registers other than the cleared field, exactly. A zero row needs the empty certificate. Returns per-CLEAR sizes and failures.""" + n = W['public'] + rows = [{r: Q(1)} if r < n else {} for r in range(n + W['owned_fields'])] + live, sizes, bad, seen = set(range(n)), [], [], 0 + for i, e in enumerate(W['program']): + op, r = e[0], e[1] + if op == 'INIT': + live.add(r) + rows[r] = {} + elif op == 'CLEAR': + seen += 1 + c = certs.get(str(i)) + okc = c is not None + if okc: + cert = {int(k): Q(v) for k, v in c.items()} + okc = all(k in live and k != r for k in cert) + s = {} + for k, cf in cert.items(): + for t, v in rows[k].items(): + s[t] = s.get(t, 0) + cf * v + okc = okc and {t: v for t, v in s.items() if v} == rows[r] + sizes.append(len(cert)) + if not okc: + bad.append(i) + rows[r] = {} + live.discard(r) + elif op == 'SCALE': + rows[r] = {k: v * Q(e[2]) for k, v in rows[r].items()} + elif op != 'MOVE': + R = rows[r] + for k, v in rows[e[2]].items(): + nv = R.get(k, 0) + Q(e[3]) * v + if nv: + R[k] = nv + else: + R.pop(k, None) + require(seen == len(certs), 'one certificate per CLEAR and no other') + return sizes, bad + + +def certificates_section(B, W): + certs = json.loads((DATA / 'clear-certificates.json').read_text())['clear_event_index'] + require(len(certs) == 180, '180 certificates') + sizes, bad = verify_certificates(W, certs) + require(not bad and len(sizes) == 180, 'every CLEAR certified (failures at %s)' % bad[:5]) + nz = sum(1 for s in sizes if s) + cb, cw = clears(B), clears(W) + same = sum(1 for a, b in zip(cb, cw) if a == b) + print('PASS CLEAR certificates: all 180 CLEARs of the new word erase an exact combination of other live registers' + ' (#7620 verify_certificates rule; %d nonzero rows, certificate sizes %d..%d; %d zero rows); %d of 180 CLEAR contents' + ' are identical to #7623\'s, the rest change with the re-derived hub content' % (nz, min(s for s in sizes if s), max(sizes), 180 - nz, same)) + k = next(i for i, c in certs.items() if c) + X = copy.deepcopy(certs) + f0 = next(iter(X[k])) + X[k][f0] = str(Q(X[k][f0]) + 1) + require(int(k) in verify_certificates(W, X)[1], 'corrupted coefficient rejected') + Y = copy.deepcopy(certs) + r = W['program'][int(k)][1] + Y[k][str(r)] = Y[k].pop(f0) + require(int(k) in verify_certificates(W, Y)[1], 'cleared field as a term rejected') + print('PASS certificate controls: corrupted coefficient (CLEAR at event %s) rejected; cleared field as a term rejected' % k) + print('PASS_CERTIFICATES_ON_7623') + + +def affected_pairs(B, W): + """#7623's 964-pair census plus every old- and new-route pair of the 7 registers whose chain changed; none leaves.""" + p964 = {tuple(p) for p in json.loads((DATA / 'affected-pairs-7623.json').read_text())} + require(len(p964) == 964, "#7623's census is 964 pairs") + rb, rw = routes_of(B), routes_of(W) + changed = [r for r in range(W['public']) if rb[r] != rw[r]] + require(changed == [44, 176, 382, 457, 461, 490, 902], 'changed routes are exactly E1..E7') + allp = p964 | {q for r in changed for q in rb[r] + rw[r]} + filep = {tuple(p) for p in json.loads((DATA / 'affected-pairs-new.json').read_text())} + require(allp == filep and len(allp) == 981 and not p964 - allp, 'census is 981 pairs (964 + 17), none dropped') + require(move_pairs(W) - move_pairs(B) <= allp, 'every new MOVE pair is tested') + return p964, allp + + +def _pair_job(args): + frames, a, b = args + return (a, b, pair_columns(frames, a, b)) + + +def columns_section(B, W, part): + p964, allp = affected_pairs(B, W) + frames = [tuple(f) for f in W['frames']] + mine = sorted(allp)[part::2] + print('affected pairs: 964 (#7623) + 17 = %d; half %d of 2 tests %d pairs' % (len(allp), part + 1, len(mine))) + jobs = [(frames, a, b) for a, b in mine] + with multiprocessing.Pool(min(8, multiprocessing.cpu_count())) as pool: + done = pool.map(_pair_job, jobs, chunksize=4) + require(len(done) == len(mine), 'all pairs of this half tested') + print('PASS columns half %d: %d chart pairs x (512 forward + 512 adjoint) exact Gaussian columns = %d, signed Pauli action,' + ' absolute phase, exact public ascent rank, wrong-phase rejection each' % (part + 1, len(done), len(done) * 1024)) + if part: + return + + def col_rejected(label, mutate): + try: + mutate() + except AssertionError as exc: + print('PASS control rejected: %s (%s)' % (label, str(exc)[:70])) + return + raise AssertionError('control not rejected: ' + label) + + def non_nested(): + pair_columns(frames, 260, 128) + require(not (span(frames[260]) < span(frames[128]) or span(frames[128]) < span(frames[260])), 'control pair is not nested') + col_rejected('column test rejects the non-nested pair (260,128)', non_nested) + exp_of = lambda a, b: dagger(frame_circuit(frames[a])) + frame_circuit(frames[b]) + newp = sorted(move_pairs(W) - move_pairs(B)) + for a, b in (newp[0], newp[-1]): + def tampered_recipe(a=a, b=b): + rec = lower(frame_op(frames[a]).dag().then(frame_op(frames[b]))) + rec['left']['offset'] ^= 1 + exp = exp_of(a, b) + require(tableau(recipe_circuit(rec)) == tableau(exp) and column(recipe_circuit(rec), 0) == column(exp, 0), 'recipe column 0') + col_rejected('column test rejects a (%d,%d) recipe with a shifted offset' % (a, b), tampered_recipe) + + def phase_only(a=a, b=b): + rec = lower(frame_op(frames[a]).dag().then(frame_op(frames[b]))) + require(column(recipe_circuit(rec) + (('phase', 2),), 0) == column(exp_of(a, b), 0), 'recipe column 0 phase') + col_rejected('column test rejects a (%d,%d) recipe with a global phase error' % (a, b), phase_only) + + +def run_controls(B, W): + RB = replay(B) + P0 = W['program'] + res = [] + + def outcome(P, X0, initial=None): + X = dict(X0) + X['program'] = P + if initial is not None: + X['initial'] = initial + try: + R = replay(X) + except AssertionError as ex: + return 'illegal: ' + str(ex) + if R['rows'] != RB['rows'] or R['cur'] != RB['cur']: + return 'rows/end charts differ (%d rows)' % sum(a != b for a, b in zip(R['rows'], RB['rows'])) + return None + + def test(label, P, X0=W, expect_reject=True, initial=None): + o = outcome(P, X0, initial) + require((o is not None) == expect_reject, 'control %s: %s' % (label, 'ACCEPTED' if o is None else 'REJECTED ' + o)) + if expect_reject: + res.append(1) + print('PASS control %s: %s %s' % ('rejected' if expect_reject else 'accepted', label, '(%s)' % o[:80] if o else ''), flush=True) + + def mod(f, base=P0): + P = list(base) + f(P) + return P + + def ix(ev, P=P0): + require(P.count(ev) == 1, 'control event present once: %r' % (ev,)) + return P.index(ev) + + def setv(old, new): + return lambda P: P.__setitem__(ix(old, P), new) + + dim = [len(f) for f in W['frames']] + N553 = ['ADD', 553, 383, '1/2', 24] + N1427 = ['ADD', 1427, 296, '-1', 725] + N816 = ['ADD', 382, 816, '-1', 849] + N1000 = ['ADD', 176, 1000, '-1/4', 928] + N236 = ['ADD', 176, 236, '-1', 928] + C457 = ['ADD', 242, 457, '-1', 281] + C461 = ['ADD', 10, 461, '-1', 285] + M902 = ['MOVE', 902, 3, 618, False] + M44 = ['MOVE', 44, 495, 127, False] + for ev in (N553, N1427, N816, N1000, N236, C457, C461, M902, M44): + ix(ev) + v_add = next(i for i, e in enumerate(P0) if e[0] == 'ADD' and dim[e[4]] == 9) + z_add = next(i for i, e in enumerate(P0) if e[0] == 'ADD' and dim[e[4]] == 0) + test('new word (positive)', P0, expect_reject=False) + test('#7623 word itself (positive)', B['program'], B, expect_reject=False) + test('1 E3 re-route 553 += 1/2*383 @24 dropped', mod(lambda P: P.remove(N553))) + test('2 E3 re-route coefficient 1/2 -> 1', mod(setv(N553, ['ADD', 553, 383, '1', 24]))) + test('3 E4 re-route 1427 += -1*296 @725 dropped', mod(lambda P: P.remove(N1427))) + test('4 E5 re-route 382 += -1*816 @849 dropped', mod(lambda P: P.remove(N816))) + test('5 E6 twin pickup 176 += -1/4*1000 @928 dropped', mod(lambda P: P.remove(N1000))) + test('6 E6 twin pickup 176 += -1*236 @928 coefficient -> +1', mod(setv(N236, ['ADD', 176, 236, '1', 928]))) + test('7 E1 canceller 242 += -1*457 @281 dropped', mod(lambda P: P.remove(C457))) + test('8 E2 canceller 10 += -1*461 @285 coefficient -> +1', mod(setv(C461, ['ADD', 10, 461, '1', 285]))) + ini = list(W['initial']) + ini[457] = 3 + test('9 E1 rebirth undone in the header only (457 born at {0})', P0, initial=ini) + test('10 E7 MOVE 902 3->618 replaced by 3->595 (stop not taken)', mod(setv(M902, ['MOVE', 902, 3, 595, False]))) + test('11 E5 MOVE 44 495->127 ownership flag True', mod(setv(M44, M44[:4] + [True]))) + test('12 first V-mix ADD coefficient doubled', mod(lambda P: P.__setitem__(v_add, P[v_add][:3] + [str(2 * Q(P[v_add][3]))] + P[v_add][4:]))) + test('13 first {0}-prefix ADD dropped', mod(lambda P: P.pop(z_add))) + Bp = B['program'] + E = json.loads((DATA / 'edits.json').read_text()) + eid = {ed['id']: ed for ed in E['edits']} + + def bare(ed, mv): + def f(P): + for i, ev in sorted(ed['delete'], reverse=True): + require(P[i] == ev, '%s event in #7623' % ed['id']) + del P[i] + P.insert(ed['delete'][0][0], mv) + return f + test('14 bare E3 stop drop on #7623 (382 goes 3->849, no 553 += 1/2*383, no hub re-settle)', + mod(bare(eid['E3'], ['MOVE', 382, 3, 849, False]), Bp), B) + test('E7 alone on #7623 without hub re-settle (positive: the four deliveries of 902 at 595 cancel downstream)', + mod(bare(eid['E7'], ['MOVE', 902, 3, 618, False]), Bp), B, expect_reject=False) + require(len(res) == 14, '14 negative controls rejected') + print('PASS_CONTROLS_ON_7623: 14/14 negative controls rejected, 3 positives accepted') + + +def core(B, W): + E = json.loads((DATA / 'edits.json').read_text()) + require(all(B[k] == W[k] for k in B if k not in ('program', 'initial')) and B.keys() == W.keys(), 'header identical except initial') + di = {r: [B['initial'][r], W['initial'][r]] for r in range(len(B['initial'])) if B['initial'][r] != W['initial'][r]} + want = {ed['register']: ed['initial'] for ed in E['edits'] if 'initial' in ed} + require(di == want == {457: [3, 281], 461: [3, 285]}, 'initial changes exactly the two rebirths') + print('PASS header: identical to #7623 except initial[457] 3 -> 281 and initial[461] 3 -> 285') + got, nd, ni = apply_interior(B, E) + ok = interior_test(W) + mine = [e for e in W['program'] if ok(e)] + require(got == mine, 'interior of the new word = #7623 interior + edit list') + require((nd, ni) == (23, 12), '23 deletions, 12 insertions') + hb = sum(1 for e in B['program'] if not ok(e)) + hw = sum(1 for e in W['program'] if not ok(e)) + print('PASS interior: %d interior events = #7623\'s %d - %d deleted + %d inserted (E1..E7); hub events (ADD/SCALE at {0} and V)' + ' %d -> %d; word %d -> %d events' % (len(mine), len(mine) - ni + nd, nd, ni, hb, hw, len(B['program']), len(W['program']))) + RB, R = replay(B), replay(W) + n = W['public'] + bad = [r for r in range(len(R['rows'])) if R['rows'][r] != RB['rows'][r]] + require(not bad, 'all rows equal #7623 (first differing %s)' % bad[:3]) + require(R['cur'] == RB['cur'], 'all end charts equal #7623') + M = mains(W) + require(all(R['rows'][r] == {r: Q(1)} for r in range(n) if r not in M), 'helpers end at identity') + require(all(not R['rows'][r] for r in range(n, len(R['rows']))), 'owned rows end empty') + require(R['owned_moves'] == RB['owned_moves'], 'owned MOVE multiset unchanged') + require(R['lifetimes'] == RB['lifetimes'] and sum(R['lifetimes'].values()) == 180, 'owned lifetimes (field, INIT chart, CLEAR chart) unchanged, 180') + require(R['peak'] == RB['peak'] == 50, 'owned peak 50') + labels = {e[1] for e in W['program'] if e[0] == 'INIT'} + require(len(labels) == 68 == W['owned_fields'], '68 owned labels') + print('PASS exact replay: both words legal; all %d rows and end charts equal #7623, helpers identity, owned empty;' + ' owned MOVEs (%d), 180 lifetimes, peak 50 and 68 labels unchanged' % (len(R['rows']), sum(R['owned_moves'].values()))) + changed = sorted(r for r in range(n) if chain_route(R, W, r) != chain_route(RB, B, r)) + require(changed == sorted(ed['register'] for ed in E['edits']), 'exactly the 7 registers of E1..E7 change chains') + for ed in E['edits']: + r = ed['register'] + require(chain_route(RB, B, r) == ed['route_before'] and chain_route(R, W, r) == ed['route_after'], + '%s route of %d: %s -> %s' % (ed['id'], r, chain_route(RB, B, r), chain_route(R, W, r))) + newp, gone = sorted(move_pairs(W) - move_pairs(B)), sorted(move_pairs(B) - move_pairs(W)) + for a, b in newp: + require(R['sp'][a] < R['sp'][b], 'new pair %s strictly nested' % ((a, b),)) + print('PASS routes: exactly registers %s change chains, as listed; %d new MOVE pairs %s, all strictly nested; %d leave %s' + % (changed, len(newp), newp, len(gone), gone)) + sb, sw = RB['stats'], R['stats'] + require(sw['smooth'], 'replayed coefficients have 5-smooth denominators') + for q in literal_coeffs(W['program']): + o = q.denominator + for p in (2, 3, 5): + while o % p == 0: + o //= p + require(o == 1, 'literal coefficient has a 5-smooth denominator') + print('PASS coefficients: 5-smooth; replayed grid #7623 (2-adic exponent %d, odd lcm %d, numerator bits %d) -> new (%d, %d, %d);' + ' non-dyadic literal events %d -> %d' % (sb['max_den_exp'], sb['odd_den'], sb['max_num_bits'], sw['max_den_exp'], sw['odd_den'], + sw['max_num_bits'], nondyadic(B['program']), nondyadic(W['program']))) + pb, hb_ = native_counts(B) + pw, hw_ = native_counts(W) + dP, dT = diff(pb, pw), diff(hb_, hw_) + require(dP == {1: -2, 2: -3, 3: -5, 5: 1, 6: 2} and dT == {6: 2, 9: -2}, 'native deltas per call') + print('PASS native per call: paid MOVE delta %s; helper target delta %s' % (dP, dT)) + inv0 = json.loads((DATA / 'invoice-7623.json').read_text()) + P0 = {k: inv0['paid'][k] for k in sorted(inv0['paid'], key=int)} + T0 = {k: inv0['targets'][k] for k in sorted(inv0['targets'], key=int)} + require(inv0 == invoice_json(P0, T0), 'invoice-7623.json is #7623\'s invoice in the official schema') + P, T = collections.Counter({int(k): v for k, v in P0.items()}), collections.Counter({int(k): v for k, v in T0.items()}) + for k, v in dP.items(): + P[k] += CALLS * v + for k, v in dT.items(): + T[k] += CALLS * v + require(min(P.values()) >= 0 and min(T.values()) >= 0, 'nonnegative counts') + Pn = {str(k): v for k, v in sorted(P.items()) if v} + Tn = {str(k): v for k, v in sorted(T.items()) if v} + Sf = lambda T_, P_: sum(int(k) * v for k, v in T_.items()) - sum(int(k) * v for k, v in P_.items()) + require(Sf(T0, P0) == Sf(Tn, Pn) == 1424, 'rank surplus S 1424 unchanged') + require(json.loads((DATA / 'invoice-new.json').read_text()) == invoice_json(Pn, Tn), 'invoice-new.json matches') + require(json.loads((DATA / 'invoice-zero.json').read_text()) == invoice_json({}, {}), 'zero invoice') + print('PASS complete invoice: paid positions %d -> %d, productive %d -> %d, S = 1424' % (sum(P0.values()), sum(Pn.values()), sum(T0.values()), sum(Tn.values()))) + k0, k1 = crossing(T0, P0), crossing(Tn, Pn) + require(decimal.Decimal('0.0036624027915') <= k0 <= decimal.Decimal('0.0036624027916'), '#7623 crossing reproduced') + print('PASS kappa #7623 %s' % k0) + print('PASS kappa new %s (ratio over #7623 %s)' % (k1, +decimal.Context(prec=12).divide(k1, k0))) + expected = json.loads((HERE / 'EXPECTED.json').read_text()) + require(str(k1)[:len(expected['kappa_prefix'])] == expected['kappa_prefix'], 'kappa digits as recorded') + require(decimal.Decimal(CLAIM) < k1 < decimal.Decimal(ABOVE), 'claim %s is below the exact crossing' % CLAIM) + print('PASS_CORE_ON_7623') + + +def main(): + B, W = load_words() + if MODE in ('core', 'all'): + core(B, W) + if MODE in ('certificates', 'all'): + certificates_section(B, W) + if MODE in ('controls', 'all'): + run_controls(B, W) + if MODE in ('columns1', 'all'): + columns_section(B, W, 0) + print('PASS_COLUMNS_ON_7623_1') + if MODE in ('columns2', 'all'): + columns_section(B, W, 1) + print('PASS_COLUMNS_ON_7623_2') + if MODE == 'all': + print('PASS_REROUTES_ON_7623_EXACT (conditional on the same framework assumptions as #7623)') + + +if __name__ == '__main__': + main() diff --git a/research/p104-reroutes-on7623/data/affected-pairs-7623.json b/research/p104-reroutes-on7623/data/affected-pairs-7623.json new file mode 100644 index 0000000000..89c535e4bf --- /dev/null +++ b/research/p104-reroutes-on7623/data/affected-pairs-7623.json @@ -0,0 +1 @@ +[[1,389],[1,390],[2,299],[3,1],[3,2],[3,4],[3,5],[3,9],[3,10],[3,11],[3,18],[3,21],[3,23],[3,24],[3,25],[3,26],[3,27],[3,29],[3,30],[3,31],[3,35],[3,39],[3,40],[3,46],[3,47],[3,50],[3,51],[3,52],[3,55],[3,56],[3,58],[3,60],[3,61],[3,66],[3,68],[3,69],[3,71],[3,78],[3,79],[3,82],[3,83],[3,84],[3,85],[3,86],[3,89],[3,90],[3,95],[3,96],[3,97],[3,100],[3,101],[3,102],[3,257],[3,259],[3,261],[3,278],[3,280],[3,281],[3,282],[3,284],[3,285],[3,298],[3,299],[3,300],[3,301],[3,313],[3,315],[3,319],[3,320],[3,321],[3,322],[3,323],[3,324],[3,327],[3,331],[3,332],[3,333],[3,334],[3,337],[3,338],[3,339],[3,340],[3,351],[3,353],[3,359],[3,360],[3,361],[3,369],[3,371],[3,372],[3,373],[3,375],[3,376],[3,377],[3,378],[3,381],[3,382],[3,386],[3,389],[3,390],[3,393],[3,394],[3,395],[3,397],[3,398],[3,399],[3,400],[3,401],[3,404],[3,405],[3,407],[3,408],[3,409],[3,410],[3,411],[3,413],[3,414],[3,415],[3,416],[3,417],[3,419],[3,420],[3,427],[3,429],[3,431],[3,432],[3,433],[3,435],[3,436],[3,438],[3,441],[3,443],[3,445],[3,447],[3,448],[3,451],[3,452],[3,453],[3,455],[3,456],[3,475],[3,486],[3,488],[3,492],[3,493],[3,495],[3,506],[3,521],[3,545],[3,546],[3,551],[3,561],[3,562],[3,574],[3,575],[3,576],[3,594],[3,595],[3,597],[3,602],[3,603],[3,652],[3,661],[3,744],[3,745],[3,746],[3,755],[3,757],[3,817],[3,1053],[3,1083],[4,447],[4,448],[5,443],[7,251],[9,635],[9,665],[10,270],[10,277],[11,275],[18,334],[21,370],[23,301],[24,429],[24,438],[24,849],[25,255],[26,390],[27,408],[27,411],[29,315],[30,351],[31,371],[31,372],[35,316],[39,484],[40,487],[42,501],[46,369],[47,486],[50,331],[51,333],[51,334],[52,313],[55,407],[56,410],[58,274],[60,446],[61,428],[66,272],[68,405],[69,409],[69,410],[70,386],[71,314],[76,386],[78,404],[78,407],[79,353],[82,427],[83,295],[83,296],[84,274],[85,276],[85,277],[86,260],[89,445],[90,441],[90,448],[93,310],[95,332],[95,344],[96,313],[97,485],[100,356],[101,369],[101,373],[101,376],[102,372],[128,127],[129,127],[131,127],[133,127],[134,127],[137,127],[139,127],[140,127],[141,127],[142,127],[143,127],[145,127],[147,127],[149,127],[152,127],[153,127],[155,127],[156,127],[158,127],[162,127],[163,127],[165,127],[167,127],[172,127],[174,127],[176,127],[178,127],[181,127],[183,127],[184,127],[186,127],[188,127],[190,127],[192,127],[194,127],[196,127],[200,127],[201,127],[202,127],[204,127],[206,127],[207,127],[209,127],[210,127],[212,127],[214,127],[215,127],[218,127],[221,127],[225,127],[227,127],[229,127],[238,127],[245,127],[246,127],[251,264],[255,261],[257,553],[257,682],[259,127],[259,723],[260,719],[260,906],[261,730],[261,736],[264,743],[270,285],[272,281],[274,283],[274,284],[275,287],[276,282],[277,280],[277,286],[278,564],[278,633],[280,826],[280,838],[280,951],[280,965],[281,827],[281,839],[281,952],[281,966],[282,537],[282,846],[282,959],[282,973],[283,525],[283,834],[283,960],[283,974],[284,850],[284,979],[284,993],[284,1074],[285,851],[285,866],[285,980],[285,994],[286,857],[286,873],[286,985],[286,999],[287,858],[287,874],[287,986],[287,1000],[295,300],[296,298],[298,526],[298,828],[298,953],[298,975],[299,829],[299,847],[299,954],[299,976],[300,538],[300,840],[300,961],[300,967],[301,835],[301,841],[301,962],[301,968],[310,716],[313,322],[313,323],[313,554],[314,326],[315,321],[315,822],[316,325],[319,838],[320,839],[321,526],[321,822],[322,554],[322,847],[323,853],[323,881],[323,981],[323,1007],[324,1008],[324,1075],[325,863],[325,889],[325,985],[325,1013],[326,864],[326,890],[326,986],[326,1014],[327,783],[327,907],[331,338],[331,817],[332,340],[332,555],[333,339],[333,823],[334,337],[334,343],[334,816],[337,816],[337,846],[338,525],[338,817],[339,823],[339,840],[340,555],[340,841],[343,855],[343,979],[344,856],[344,892],[344,980],[344,1016],[351,360],[351,555],[353,359],[353,823],[356,727],[359,538],[359,823],[360,555],[360,835],[361,885],[361,1009],[362,1010],[362,1076],[369,378],[369,379],[369,554],[370,382],[371,377],[371,822],[372,375],[372,381],[372,816],[372,871],[373,618],[373,733],[373,913],[375,537],[375,816],[376,817],[376,834],[377,822],[377,828],[378,554],[378,829],[379,877],[379,1001],[379,1007],[379,1077],[380,888],[380,1008],[381,871],[381,893],[382,872],[382,894],[382,994],[382,1016],[386,574],[386,740],[386,909],[389,395],[389,557],[390,393],[390,399],[390,818],[390,837],[393,818],[393,1074],[394,866],[395,557],[395,875],[397,881],[398,1075],[399,837],[399,891],[400,892],[401,922],[401,1062],[404,521],[404,913],[405,414],[405,821],[407,416],[407,417],[407,824],[407,836],[408,420],[408,833],[409,415],[409,556],[410,413],[410,419],[410,820],[410,832],[411,575],[411,912],[413,820],[413,873],[414,821],[414,874],[415,556],[415,867],[416,824],[416,868],[417,836],[417,883],[419,832],[419,889],[420,833],[420,890],[427,433],[427,556],[428,437],[429,576],[429,770],[431,850],[432,851],[433,556],[433,859],[435,885],[436,1076],[437,528],[437,973],[438,849],[438,894],[441,456],[441,527],[443,452],[443,821],[445,455],[445,848],[446,458],[447,453],[447,557],[448,451],[448,457],[448,820],[451,820],[451,857],[452,821],[452,858],[453,557],[453,612],[455,848],[455,1077],[456,527],[456,888],[457,844],[457,965],[458,845],[458,966],[475,877],[484,494],[485,497],[486,492],[486,837],[487,496],[488,548],[488,660],[492,837],[492,855],[493,856],[494,528],[495,872],[496,766],[497,767],[501,513],[506,651],[506,664],[513,127],[513,914],[521,913],[521,1029],[525,127],[525,974],[526,127],[526,975],[527,976],[528,127],[528,973],[537,127],[537,959],[538,127],[538,961],[545,665],[546,548],[548,127],[548,660],[551,553],[553,127],[553,682],[554,946],[555,948],[556,947],[557,945],[561,657],[562,564],[564,127],[564,633],[574,909],[574,1035],[575,912],[575,1036],[576,770],[576,1033],[594,602],[594,723],[594,760],[594,764],[594,765],[595,127],[595,603],[595,618],[595,736],[597,731],[597,732],[602,636],[602,638],[602,640],[602,641],[602,684],[602,685],[602,686],[602,687],[602,688],[602,689],[603,127],[612,127],[618,733],[618,789],[618,913],[631,127],[631,152],[633,127],[633,212],[635,127],[635,210],[636,631],[636,647],[638,645],[638,651],[640,647],[641,645],[645,127],[645,651],[647,127],[647,631],[649,127],[649,176],[651,127],[651,140],[651,174],[652,649],[652,657],[657,127],[657,649],[660,127],[660,231],[661,664],[664,127],[664,651],[665,127],[665,635],[674,127],[674,142],[682,127],[682,134],[682,180],[684,682],[684,695],[685,694],[685,696],[686,674],[686,693],[687,694],[688,695],[689,693],[693,127],[693,674],[694,127],[694,696],[695,127],[695,682],[696,127],[696,165],[716,783],[716,807],[719,907],[723,127],[723,902],[727,729],[729,789],[729,808],[730,127],[730,913],[731,826],[732,827],[733,238],[736,127],[736,909],[740,1062],[740,1071],[743,245],[743,922],[744,746],[744,916],[745,747],[746,207],[746,916],[747,245],[747,917],[755,757],[755,924],[757,923],[757,924],[760,853],[764,863],[765,864],[766,844],[767,845],[770,901],[783,807],[783,907],[789,808],[789,913],[807,932],[808,933],[816,939],[817,940],[818,939],[820,937],[821,938],[822,945],[823,947],[824,948],[826,127],[826,951],[827,127],[827,952],[828,127],[828,953],[829,127],[829,954],[832,951],[833,952],[834,127],[834,960],[835,127],[835,962],[836,961],[837,959],[838,127],[838,965],[839,127],[839,966],[840,127],[840,967],[841,127],[841,968],[844,127],[844,965],[845,127],[845,966],[846,127],[846,973],[847,127],[847,976],[848,975],[849,974],[850,127],[850,979],[851,127],[851,980],[853,127],[853,981],[855,127],[855,979],[856,127],[856,980],[857,127],[857,985],[858,127],[858,986],[859,127],[863,127],[863,985],[864,127],[864,986],[866,127],[866,994],[867,127],[868,127],[871,993],[872,127],[872,994],[873,127],[873,999],[874,127],[874,1000],[875,127],[877,127],[877,1001],[881,127],[881,1007],[883,127],[885,127],[885,1009],[888,127],[888,1008],[889,127],[889,1013],[890,127],[890,1014],[891,127],[892,127],[892,1016],[893,1015],[894,127],[894,1016],[901,246],[902,127],[906,127],[907,127],[907,177],[909,127],[912,127],[913,127],[913,147],[914,245],[916,127],[917,245],[922,195],[922,245],[923,127],[924,127],[932,128],[933,152],[937,137],[938,184],[939,184],[939,212],[940,192],[945,200],[945,210],[946,194],[947,210],[947,214],[948,194],[948,200],[951,127],[951,156],[951,162],[952,127],[952,139],[952,143],[953,127],[953,156],[954,127],[954,139],[959,127],[959,145],[959,178],[960,127],[960,221],[961,127],[961,163],[961,178],[962,127],[962,221],[965,127],[965,149],[965,206],[966,127],[966,218],[966,227],[967,127],[967,206],[968,127],[968,218],[973,127],[973,158],[973,229],[974,127],[974,147],[974,172],[975,127],[975,147],[975,158],[976,127],[976,172],[976,229],[979,127],[979,129],[979,153],[980,127],[980,133],[980,181],[981,127],[981,181],[985,127],[985,183],[985,196],[986,127],[986,155],[986,204],[993,127],[993,188],[993,209],[994,127],[994,201],[994,215],[999,127],[999,131],[1000,127],[1000,190],[1001,127],[1001,186],[1007,127],[1007,176],[1007,225],[1008,127],[1008,141],[1008,165],[1009,127],[1009,165],[1010,127],[1010,225],[1013,127],[1013,174],[1014,127],[1014,140],[1015,142],[1016,127],[1016,140],[1016,167],[1029,1079],[1033,1041],[1035,1042],[1036,1043],[1041,246],[1042,127],[1043,127],[1053,1083],[1062,922],[1062,1071],[1071,1082],[1074,127],[1074,993],[1075,127],[1075,1008],[1076,127],[1076,1010],[1077,127],[1077,1007],[1079,127],[1082,134],[1083,202]] \ No newline at end of file diff --git a/research/p104-reroutes-on7623/data/affected-pairs-new.json b/research/p104-reroutes-on7623/data/affected-pairs-new.json new file mode 100644 index 0000000000..1e192041d6 --- /dev/null +++ b/research/p104-reroutes-on7623/data/affected-pairs-new.json @@ -0,0 +1 @@ +[[1, 389], [1, 390], [2, 299], [3, 1], [3, 2], [3, 4], [3, 5], [3, 9], [3, 10], [3, 11], [3, 18], [3, 21], [3, 23], [3, 24], [3, 25], [3, 26], [3, 27], [3, 29], [3, 30], [3, 31], [3, 35], [3, 39], [3, 40], [3, 46], [3, 47], [3, 50], [3, 51], [3, 52], [3, 55], [3, 56], [3, 58], [3, 60], [3, 61], [3, 66], [3, 68], [3, 69], [3, 71], [3, 78], [3, 79], [3, 82], [3, 83], [3, 84], [3, 85], [3, 86], [3, 89], [3, 90], [3, 95], [3, 96], [3, 97], [3, 100], [3, 101], [3, 102], [3, 257], [3, 259], [3, 261], [3, 278], [3, 280], [3, 281], [3, 282], [3, 284], [3, 285], [3, 298], [3, 299], [3, 300], [3, 301], [3, 313], [3, 315], [3, 319], [3, 320], [3, 321], [3, 322], [3, 323], [3, 324], [3, 327], [3, 331], [3, 332], [3, 333], [3, 334], [3, 337], [3, 338], [3, 339], [3, 340], [3, 351], [3, 353], [3, 359], [3, 360], [3, 361], [3, 369], [3, 371], [3, 372], [3, 373], [3, 375], [3, 376], [3, 377], [3, 378], [3, 381], [3, 382], [3, 386], [3, 389], [3, 390], [3, 393], [3, 394], [3, 395], [3, 397], [3, 398], [3, 399], [3, 400], [3, 401], [3, 404], [3, 405], [3, 407], [3, 408], [3, 409], [3, 410], [3, 411], [3, 413], [3, 414], [3, 415], [3, 416], [3, 417], [3, 419], [3, 420], [3, 427], [3, 429], [3, 431], [3, 432], [3, 433], [3, 435], [3, 436], [3, 438], [3, 441], [3, 443], [3, 445], [3, 447], [3, 448], [3, 449], [3, 451], [3, 452], [3, 453], [3, 455], [3, 456], [3, 475], [3, 486], [3, 488], [3, 492], [3, 493], [3, 495], [3, 506], [3, 521], [3, 545], [3, 546], [3, 551], [3, 561], [3, 562], [3, 574], [3, 575], [3, 576], [3, 594], [3, 595], [3, 597], [3, 602], [3, 603], [3, 618], [3, 652], [3, 661], [3, 744], [3, 745], [3, 746], [3, 755], [3, 757], [3, 817], [3, 849], [3, 1053], [3, 1083], [4, 447], [4, 448], [5, 443], [7, 251], [9, 635], [9, 665], [10, 270], [10, 277], [11, 275], [18, 334], [21, 370], [23, 301], [24, 429], [24, 438], [24, 849], [25, 255], [26, 390], [27, 408], [27, 411], [29, 315], [30, 351], [31, 371], [31, 372], [35, 316], [39, 484], [40, 480], [40, 487], [42, 501], [46, 369], [47, 486], [50, 331], [51, 333], [51, 334], [52, 313], [55, 407], [56, 410], [58, 274], [60, 446], [61, 428], [66, 272], [68, 405], [69, 409], [69, 410], [70, 386], [71, 314], [76, 386], [78, 404], [78, 407], [79, 353], [82, 427], [83, 295], [83, 296], [84, 274], [85, 276], [85, 277], [86, 260], [89, 445], [90, 441], [90, 448], [93, 310], [95, 332], [95, 344], [96, 313], [97, 485], [100, 356], [101, 369], [101, 373], [101, 376], [102, 372], [128, 127], [129, 127], [131, 127], [133, 127], [134, 127], [137, 127], [139, 127], [140, 127], [141, 127], [142, 127], [143, 127], [145, 127], [147, 127], [149, 127], [152, 127], [153, 127], [155, 127], [156, 127], [158, 127], [162, 127], [163, 127], [165, 127], [167, 127], [172, 127], [174, 127], [176, 127], [178, 127], [181, 127], [183, 127], [184, 127], [186, 127], [188, 127], [190, 127], [192, 127], [194, 127], [196, 127], [200, 127], [201, 127], [202, 127], [204, 127], [206, 127], [207, 127], [209, 127], [210, 127], [212, 127], [214, 127], [215, 127], [218, 127], [221, 127], [225, 127], [227, 127], [229, 127], [238, 127], [245, 127], [246, 127], [251, 264], [255, 261], [257, 553], [257, 682], [259, 127], [259, 723], [260, 719], [260, 906], [261, 730], [261, 736], [264, 743], [270, 285], [272, 281], [274, 283], [274, 284], [275, 287], [276, 282], [277, 280], [277, 286], [278, 564], [278, 633], [280, 826], [280, 838], [280, 951], [280, 965], [281, 827], [281, 839], [281, 952], [281, 966], [282, 537], [282, 846], [282, 959], [282, 973], [283, 525], [283, 834], [283, 960], [283, 974], [284, 850], [284, 979], [284, 993], [284, 1074], [285, 851], [285, 866], [285, 980], [285, 994], [286, 857], [286, 873], [286, 985], [286, 999], [287, 858], [287, 874], [287, 986], [287, 1000], [295, 300], [296, 298], [298, 526], [298, 828], [298, 953], [298, 975], [299, 829], [299, 847], [299, 954], [299, 976], [300, 538], [300, 840], [300, 961], [300, 967], [301, 835], [301, 841], [301, 962], [301, 968], [310, 716], [313, 322], [313, 323], [313, 554], [314, 326], [315, 321], [315, 822], [316, 325], [319, 838], [320, 839], [321, 526], [321, 822], [322, 554], [322, 847], [323, 853], [323, 881], [323, 981], [323, 1007], [324, 1008], [324, 1075], [325, 863], [325, 889], [325, 985], [325, 1013], [326, 864], [326, 890], [326, 986], [326, 1014], [327, 783], [327, 907], [331, 338], [331, 817], [332, 340], [332, 555], [333, 339], [333, 823], [334, 337], [334, 343], [334, 816], [337, 816], [337, 846], [338, 525], [338, 817], [339, 823], [339, 840], [340, 555], [340, 841], [343, 855], [343, 979], [344, 856], [344, 892], [344, 980], [344, 1016], [351, 360], [351, 555], [353, 359], [353, 823], [356, 727], [359, 538], [359, 823], [360, 555], [360, 835], [361, 885], [361, 1009], [362, 1010], [362, 1076], [369, 378], [369, 379], [369, 554], [370, 382], [371, 377], [371, 822], [372, 375], [372, 381], [372, 816], [372, 871], [373, 618], [373, 733], [373, 913], [375, 537], [375, 816], [376, 817], [376, 834], [377, 822], [377, 828], [378, 554], [378, 829], [379, 877], [379, 1001], [379, 1007], [379, 1077], [380, 888], [380, 1008], [381, 871], [381, 893], [382, 872], [382, 894], [382, 994], [382, 1016], [386, 574], [386, 740], [386, 909], [389, 395], [389, 557], [390, 393], [390, 399], [390, 818], [390, 837], [393, 818], [393, 1074], [394, 866], [395, 557], [395, 875], [397, 881], [398, 1075], [399, 837], [399, 891], [400, 892], [401, 922], [401, 1062], [404, 521], [404, 913], [405, 414], [405, 821], [407, 416], [407, 417], [407, 824], [407, 836], [408, 420], [408, 833], [409, 415], [409, 556], [410, 413], [410, 419], [410, 820], [410, 832], [411, 575], [411, 912], [413, 820], [413, 873], [414, 821], [414, 874], [415, 556], [415, 867], [416, 824], [416, 868], [417, 836], [417, 883], [419, 832], [419, 889], [420, 833], [420, 890], [427, 433], [427, 556], [428, 437], [429, 576], [429, 770], [431, 850], [432, 851], [433, 556], [433, 859], [435, 885], [436, 1076], [437, 528], [437, 973], [438, 849], [438, 894], [441, 456], [441, 527], [443, 452], [443, 821], [445, 455], [445, 848], [446, 458], [447, 453], [447, 557], [448, 451], [448, 457], [448, 820], [449, 928], [449, 1065], [451, 820], [451, 857], [452, 821], [452, 858], [453, 557], [453, 612], [455, 848], [455, 1077], [456, 527], [456, 888], [457, 844], [457, 965], [458, 845], [458, 966], [475, 877], [480, 495], [484, 494], [485, 497], [486, 492], [486, 837], [487, 496], [488, 548], [488, 660], [492, 837], [492, 855], [493, 856], [494, 528], [495, 127], [495, 849], [495, 872], [496, 766], [497, 767], [501, 513], [506, 651], [506, 664], [513, 127], [513, 914], [521, 913], [521, 1029], [525, 127], [525, 974], [526, 127], [526, 975], [527, 976], [528, 127], [528, 973], [537, 127], [537, 959], [538, 127], [538, 961], [545, 665], [546, 548], [548, 127], [548, 660], [551, 553], [553, 127], [553, 682], [554, 946], [555, 948], [556, 947], [557, 945], [561, 657], [562, 564], [564, 127], [564, 633], [574, 909], [574, 1035], [575, 912], [575, 1036], [576, 770], [576, 1033], [594, 602], [594, 723], [594, 725], [594, 760], [594, 764], [594, 765], [594, 883], [595, 127], [595, 603], [595, 618], [595, 736], [597, 731], [597, 732], [602, 636], [602, 638], [602, 640], [602, 641], [602, 684], [602, 685], [602, 686], [602, 687], [602, 688], [602, 689], [603, 127], [612, 127], [618, 733], [618, 789], [618, 913], [631, 127], [631, 152], [633, 127], [633, 212], [635, 127], [635, 210], [636, 631], [636, 647], [638, 645], [638, 651], [640, 647], [641, 645], [645, 127], [645, 651], [647, 127], [647, 631], [649, 127], [649, 176], [651, 127], [651, 140], [651, 174], [652, 649], [652, 657], [657, 127], [657, 649], [660, 127], [660, 231], [661, 664], [664, 127], [664, 651], [665, 127], [665, 635], [674, 127], [674, 142], [682, 127], [682, 134], [682, 180], [684, 682], [684, 695], [685, 694], [685, 696], [686, 674], [686, 693], [687, 694], [688, 695], [689, 693], [693, 127], [693, 674], [694, 127], [694, 696], [695, 127], [695, 682], [696, 127], [696, 165], [716, 783], [716, 807], [719, 907], [723, 127], [723, 902], [725, 883], [727, 729], [729, 789], [729, 808], [730, 127], [730, 913], [731, 826], [732, 827], [733, 238], [736, 127], [736, 909], [740, 1062], [740, 1071], [743, 245], [743, 922], [744, 746], [744, 916], [745, 747], [746, 207], [746, 916], [747, 245], [747, 917], [755, 757], [755, 924], [757, 923], [757, 924], [760, 853], [764, 863], [765, 864], [766, 844], [767, 845], [770, 901], [783, 807], [783, 907], [789, 808], [789, 913], [807, 932], [808, 933], [816, 939], [817, 940], [818, 939], [820, 937], [821, 938], [822, 945], [823, 947], [824, 948], [826, 127], [826, 951], [827, 127], [827, 952], [828, 127], [828, 953], [829, 127], [829, 954], [832, 951], [833, 952], [834, 127], [834, 960], [835, 127], [835, 962], [836, 961], [837, 959], [838, 127], [838, 965], [839, 127], [839, 966], [840, 127], [840, 967], [841, 127], [841, 968], [844, 127], [844, 965], [845, 127], [845, 966], [846, 127], [846, 973], [847, 127], [847, 976], [848, 975], [849, 127], [849, 974], [850, 127], [850, 979], [851, 127], [851, 980], [853, 127], [853, 981], [855, 127], [855, 979], [856, 127], [856, 980], [857, 127], [857, 985], [858, 127], [858, 986], [859, 127], [863, 127], [863, 985], [864, 127], [864, 986], [866, 127], [866, 994], [867, 127], [868, 127], [871, 993], [872, 127], [872, 994], [873, 127], [873, 999], [874, 127], [874, 1000], [875, 127], [877, 127], [877, 1001], [881, 127], [881, 1007], [883, 127], [883, 1009], [885, 127], [885, 1009], [888, 127], [888, 1008], [889, 127], [889, 1013], [890, 127], [890, 1014], [891, 127], [892, 127], [892, 1016], [893, 1015], [894, 127], [894, 1016], [901, 246], [902, 127], [906, 127], [907, 127], [907, 177], [909, 127], [912, 127], [913, 127], [913, 147], [914, 245], [916, 127], [917, 245], [922, 195], [922, 245], [923, 127], [924, 127], [928, 186], [932, 128], [933, 152], [937, 137], [938, 184], [939, 184], [939, 212], [940, 192], [945, 200], [945, 210], [946, 194], [947, 210], [947, 214], [948, 194], [948, 200], [951, 127], [951, 156], [951, 162], [952, 127], [952, 139], [952, 143], [953, 127], [953, 156], [954, 127], [954, 139], [959, 127], [959, 145], [959, 178], [960, 127], [960, 221], [961, 127], [961, 163], [961, 178], [962, 127], [962, 221], [965, 127], [965, 149], [965, 206], [966, 127], [966, 218], [966, 227], [967, 127], [967, 206], [968, 127], [968, 218], [973, 127], [973, 158], [973, 229], [974, 127], [974, 147], [974, 172], [975, 127], [975, 147], [975, 158], [976, 127], [976, 172], [976, 229], [979, 127], [979, 129], [979, 153], [980, 127], [980, 133], [980, 181], [981, 127], [981, 181], [985, 127], [985, 183], [985, 196], [986, 127], [986, 155], [986, 204], [993, 127], [993, 188], [993, 209], [994, 127], [994, 201], [994, 215], [999, 127], [999, 131], [1000, 127], [1000, 190], [1001, 127], [1001, 186], [1007, 127], [1007, 176], [1007, 225], [1008, 127], [1008, 141], [1008, 165], [1009, 127], [1009, 165], [1009, 176], [1010, 127], [1010, 225], [1013, 127], [1013, 174], [1014, 127], [1014, 140], [1015, 142], [1016, 127], [1016, 140], [1016, 167], [1029, 1079], [1033, 1041], [1035, 1042], [1036, 1043], [1041, 246], [1042, 127], [1043, 127], [1053, 1083], [1062, 922], [1062, 1071], [1065, 928], [1071, 1082], [1074, 127], [1074, 993], [1075, 127], [1075, 1008], [1076, 127], [1076, 1010], [1077, 127], [1077, 1007], [1079, 127], [1082, 134], [1083, 202]] \ No newline at end of file diff --git a/research/p104-reroutes-on7623/data/base-7623-word.json.gz b/research/p104-reroutes-on7623/data/base-7623-word.json.gz new file mode 100644 index 0000000000..d4528141a4 Binary files /dev/null and b/research/p104-reroutes-on7623/data/base-7623-word.json.gz differ diff --git a/research/p104-reroutes-on7623/data/clear-certificates.json b/research/p104-reroutes-on7623/data/clear-certificates.json new file mode 100644 index 0000000000..0eb610b8ae --- /dev/null +++ b/research/p104-reroutes-on7623/data/clear-certificates.json @@ -0,0 +1 @@ +{"clear_event_index":{"127621":{"500":"-1","1072":"1"},"127623":{"307":"1"},"128028":{"510":"-1","1089":"1"},"128030":{"22":"1/4","23":"-3/4","320":"1/4","321":"-1/2","323":"-1","325":"1/2","330":"-1"},"128781":{"246":"1","510":"1"},"128787":{"262":"1","500":"1"},"128865":{"1477":"-1"},"128996":{"516":"-1","1094":"1"},"128998":{"22":"1/8","23":"1/8","320":"1/8","321":"1/4","323":"1/2","325":"1/4","330":"-1/2"},"129077":{"64":"1/8","385":"-1/4","387":"-1/2","389":"-1/4","394":"-1/2"},"129112":{"18":"1/4","39":"1/4","40":"1/4","288":"-1/4","289":"-1/2","291":"-1/2","298":"1"},"129225":{"17":"-5/8","103":"1/2","272":"-1/2","273":"-1/2","275":"-1","277":"1/2","282":"1"},"129234":{"512":"-1","1088":"1"},"129236":{"23":"-1/4","320":"-1/4","321":"-1/2","323":"-1","325":"1/2","330":"1"},"129391":{"535":"-1","1116":"1"},"129393":{"30":"1/4","353":"1/2","355":"-1","357":"-1/2","362":"-1"},"129396":{"64":"1/4","96":"1","385":"1/2","387":"-1","389":"-1/2","394":"-1"},"129468":{"64":"-1/4","65":"-1/2","96":"1/2","385":"-1/2","387":"-1","389":"1/2","394":"-1"},"129471":{"29":"-1/2","30":"-1/4","59":"1/2","353":"-1/2","355":"-1","357":"1/2","362":"-1"},"129893":{"522":"-1","1105":"1"},"129895":{"341":"1"},"129949":{"18":"1/4","39":"1/4","40":"1/4","288":"1/4","289":"1/2","291":"5/2","293":"-1","298":"-1"},"129956":{"23":"1/4","320":"1/4","321":"1/2","323":"1","325":"1/2","330":"-1","511":"-1","1084":"1"},"129960":{"23":"1/4","108":"1/2","320":"-1/4","321":"1/2","323":"-1","325":"-1/2","330":"-1"},"129996":{"18":"1/4","39":"-1/4","40":"1/4","288":"1/4","289":"-1/2","298":"-1"},"130081":{"524":"-1","1104":"1"},"130083":{"339":"1"},"130086":{"64":"-3/4","384":"-1/2","385":"-1/2","387":"-1","389":"1/2","394":"1"},"130154":{"30":"-1/4","59":"1/2","352":"-1/2","353":"-1/2","355":"-1","357":"1/2","362":"1"},"130157":{"8":"1/4","26":"1/4","368":"-3/4","369":"-1/2","371":"-1","373":"1/2","378":"1"},"130216":{"18":"1/4","39":"1/4","40":"1/4","288":"1/4","289":"1/2","293":"-1","298":"1"},"130226":{"35":"1/4","45":"1/4","107":"-1/4","304":"-1/4","305":"1/2","307":"-1","309":"-1/2","314":"1"},"130282":{"17":"-1/4","273":"1/2","275":"-1","277":"-1/2","282":"1"},"130289":{"513":"-1","1086":"1"},"130291":{"23":"1/4","108":"1/2","320":"-1/4","321":"1/2","323":"-1","325":"-1/2","330":"1"},"130531":{"104":"1/2","416":"-1/2","417":"1","421":"1/2","426":"2"},"130681":{"8":"1/8","26":"1/8","95":"-1/4","368":"-1/8","369":"-1/4","371":"1/2","373":"-1/4","378":"-1/2"},"132126":{"831":"1"},"132592":{"1082":"1"},"132730":{"30":"1/4","353":"1/2","355":"-1","357":"-1/2","362":"1"},"132741":{"30":"1/8","353":"-1/4","355":"-1/2","357":"-1/4","362":"-1/2"},"132755":{"30":"1/8","59":"-1/4","352":"1/4","353":"1/4","355":"1/2","357":"1/4","362":"-1/2"},"132766":{"30":"1/8","353":"-1/4","355":"1/2","357":"-1/4","362":"-1/2"},"133027":{},"133401":{"64":"-1/8","65":"-1/4","96":"3/8","385":"1/4","387":"-1/2","389":"1/4","394":"-1/2"},"133409":{"1343":"-1","1344":"-1","1346":"-1","1347":"-1"},"134188":{"18":"1","45":"1","61":"1","63":"1","103":"1","108":"1"},"134279":{"365":"1"},"134347":{"487":"1","1402":"1"},"134350":{"380":"1","424":"1"},"134360":{"476":"1"},"134539":{"169":"1","1470":"-1"},"134677":{"203":"1","1471":"-1"},"134729":{"88":"1"},"134771":{"451":"1"},"134821":{"628":"-2","630":"-2"},"135040":{"640":"-1/2","641":"-1/2"},"135097":{"913":"-1","927":"1"},"135141":{"228":"1"},"135153":{"674":"-2","712":"-1","714":"-1","883":"-2","1102":"4","1106":"2","1110":"2","1113":"-2","1224":"-2","1249":"4","1280":"4","1341":"-1","1342":"-1","1355":"4"},"135154":{"256":"1/4","336":"1/4"},"135155":{"256":"1/4","336":"1/4"},"135170":{"92":"1/4"},"135171":{"92":"1/4"},"135172":{"3":"1/4","26":"1/4","67":"1/8","721":"-1","723":"-1","775":"2","837":"4","942":"2","956":"-2","1134":"4","1138":"-2","1144":"-2"},"135173":{"3":"1/16","26":"1/16","67":"1/32","546":"1","721":"-1/4","723":"-1/4","775":"1/2","837":"1","942":"1/2","956":"-1/2","1105":"1","1134":"1","1137":"1","1138":"-1/2","1144":"-1/2"},"135174":{"3":"1/16","26":"1/16","67":"1/32","546":"1","721":"-1/4","723":"-1/4","775":"1/2","837":"1","942":"1/2","956":"-1/2","1105":"1","1134":"1","1137":"1","1138":"-1/2","1144":"-1/2"},"135175":{"3":"1/16","26":"1/16","67":"1/32","546":"1","721":"-1/4","724":"-1/4","725":"-1/4","775":"1/2","837":"1","942":"1/2","956":"-1/2","1105":"1","1134":"1","1137":"1","1138":"-1/2","1144":"-1/2","1390":"-1/4"},"135176":{"26":"1","95":"1/4","368":"1/4","381":"1","723":"1","724":"-1","725":"-1","865":"4","1390":"-1"},"135177":{"26":"1","95":"1/4","368":"1/4","381":"1","723":"1","724":"-1","725":"-1","865":"4","1390":"-1"},"135194":{"146":"-2","451":"1","496":"2","497":"-2","581":"-1","582":"-1","889":"-1","895":"1","897":"1","898":"-1","907":"1","919":"-1","1078":"1","1080":"1","1255":"1","1258":"1","1259":"1","1479":"1"},"135203":{"146":"-1/2"},"135204":{"41":"-3/4","42":"3/8","52":"2","106":"-15/16","240":"9/16","405":"-3/2","573":"-2","728":"-1/4","737":"1","813":"3/2","875":"-2","1154":"-2","1162":"3","1163":"-3","1168":"4","1173":"-2","1349":"-1","1353":"4","1365":"3/4","1373":"3/2","1380":"3/4","1385":"21/16","1392":"-3/8","1397":"-6","1448":"-3/4"},"135205":{"41":"1/4","42":"-1/8","106":"5/16","240":"-3/16","405":"1/2","728":"-1/4","813":"-1/2","1162":"-1","1163":"1","1365":"-1/4","1373":"-1/2","1380":"-1/4","1385":"-7/16","1392":"1/8","1397":"2","1448":"1/4"},"135249":{"223":"1","1469":"-1"},"135259":{"41":"1/4","42":"-1/8","106":"5/16","240":"-3/16","405":"1/2","728":"-1/4","813":"-1/2","1162":"-1","1163":"1","1365":"-1/4","1373":"-1/2","1380":"-1/4","1385":"-7/16","1392":"1/8","1397":"2","1448":"1/4"},"135299":{"572":"1"},"135304":{"338":"-1/4","674":"-1/2","712":"-1/4","714":"-1/4","883":"-1/2","1100":"1","1102":"1","1106":"1/2","1110":"1/2","1113":"-1/2","1224":"-1/2","1249":"1","1280":"1","1341":"-1/4","1342":"-1/4","1355":"1"},"135305":{"338":"-1/4","674":"-1/2","712":"-1/4","714":"-1/4","883":"-1/2","1100":"1","1102":"1","1106":"1/2","1110":"1/2","1113":"-1/2","1224":"-1/2","1249":"1","1280":"1","1341":"-1/4","1342":"-1/4","1355":"1"},"135306":{"338":"-1/4","674":"-1/2","712":"-1/4","714":"-1/4","863":"-2","883":"-1/2","1100":"1","1102":"1","1106":"1/2","1110":"1/2","1113":"-1/2","1224":"-1/2","1249":"1","1280":"1","1341":"-1/4","1342":"-1/4","1355":"1"},"135448":{"648":"1"},"135552":{},"135675":{"125":"1","1457":"-1"},"135696":{"139":"1","1474":"-1"},"135734":{"163":"1","1472":"-1"},"135741":{"201":"1","1465":"-1"},"135877":{"752":"-1","891":"1","937":"-1"},"135882":{"611":"1","613":"1","752":"1","891":"-1","937":"1"},"135889":{"278":"-1","292":"-1","342":"1","607":"-1","608":"-1/4","610":"3/4","611":"-1","612":"-1","613":"-1/2","770":"1","1277":"-1","1279":"2","1368":"-3","1374":"2"},"136118":{"128":"1","1476":"-1"},"136126":{"119":"1","1475":"-1"},"136129":{"154":"1","1458":"-1"},"136271":{"707":"4"},"136387":{"333":"1"},"136390":{"1466":"-1"},"136892":{"13":"1/4","41":"3/16","42":"-3/32","52":"-1/2","106":"15/64","240":"-9/64","402":"1/4","405":"3/8","573":"1/2","728":"1/16","737":"-1/2","813":"-3/8","875":"1/2","882":"1/2","895":"1/2","897":"1/2","907":"-1/2","928":"1/2","954":"1/2","957":"-1/2","968":"1/2","975":"1/2","1154":"1/2","1162":"-3/4","1163":"3/4","1168":"-1","1173":"1/2","1349":"1/4","1353":"-1","1365":"-3/16","1373":"-3/8","1380":"-3/16","1385":"-21/64","1392":"3/32","1397":"3/2","1448":"3/16","1474":"1/2"},"136893":{"13":"1/4","41":"-1/16","42":"1/32","52":"-1/2","106":"-5/64","240":"-13/64","402":"1/4","405":"-1/8","573":"1/2","728":"5/16","737":"-1/2","813":"1/8","875":"1/2","882":"1/2","895":"1/2","897":"1/2","907":"-1/2","928":"1/2","954":"1/2","957":"-1/2","968":"1/2","975":"1/2","1154":"1/2","1162":"1/4","1163":"-1/4","1168":"-1","1173":"1/2","1349":"1/4","1353":"-1","1365":"1/16","1373":"1/8","1380":"1/16","1385":"-9/64","1392":"-1/32","1397":"-1/2","1448":"-1/16","1474":"1/2"},"136894":{"13":"1/4","52":"-1/2","240":"-3/16","402":"1/4","573":"1/2","737":"-1/2","875":"1/2","882":"1/2","895":"1/2","897":"1/2","907":"-1/2","928":"1/2","954":"1/2","957":"-1/2","968":"1/2","975":"1/2","1154":"1/2","1168":"-1","1173":"1/2","1349":"1/4","1353":"-1","1385":"-3/16","1448":"1/4","1474":"1/2"},"137054":{"251":"2","265":"-2","471":"4","549":"2","650":"-1","674":"-1","704":"-1/2","882":"-1","884":"-1","889":"1","905":"-1","907":"-1","934":"1","938":"1","939":"1","946":"-1","947":"-1","948":"-1","952":"-1","955":"1","957":"1","963":"-1","965":"-1","968":"1","970":"1","1031":"-1","1033":"-1","1221":"-1","1222":"-1","1224":"-1","1302":"-1","1311":"-1","1312":"-1","1319":"-1","1338":"-1/2","1360":"-1","1361":"-1","1366":"-1","1426":"2"},"137150":{"74":"1"},"137559":{"513":"1"},"137608":{"477":"1"},"137647":{"522":"-1/2"},"137694":{"254":"1","559":"-1/2"},"137698":{"526":"1"},"137711":{"248":"1","546":"-1/2"},"137719":{"280":"1","568":"-1/2"},"137726":{"284":"1","575":"-1/2"},"137735":{"467":"1","489":"1"},"137742":{"252":"1","558":"-1/2"},"137748":{"563":"1","1399":"1"},"137755":{"540":"1","1436":"1"},"137774":{"396":"1","428":"1"},"137799":{"263":"1","512":"1"},"137826":{"479":"1","527":"1"},"137848":{"461":"1","523":"-1/2"},"137909":{"502":"1","550":"1"},"137940":{"302":"1","578":"-1/2"},"137948":{"349":"1"},"138011":{"1336":"1"},"138017":{"133":"3/2","483":"3/2","494":"1","506":"3/4","519":"7/4","543":"7/4","695":"5/2","697":"-1","698":"1","700":"-1/2","701":"-1/2","702":"-3/4","733":"1/2","767":"-5/4","883":"1","892":"1","896":"1","901":"1","929":"-1","962":"1","981":"1","1334":"-1","1336":"1/2","1337":"1","1340":"1/2","1362":"-1/2","1377":"2","1386":"3/2","1498":"2"},"138049":{"483":"-1","519":"-1","543":"-1","696":"-1","697":"1/4","698":"1/2","700":"1/2","702":"1","733":"1/2","767":"1/2","883":"1","892":"1","896":"1","901":"-1","924":"2","929":"-1","962":"1","981":"1","1334":"1","1337":"-1/2","1340":"1/2","1362":"2","1377":"-2","1386":"-1/2","1498":"-1"},"138050":{"133":"-1/2","483":"-1","519":"-1","543":"-1","696":"-1","697":"1/4","698":"1/2","700":"1/2","702":"1","733":"1/2","767":"1/2","883":"1","892":"1","896":"1","901":"-1","924":"2","929":"-1","962":"1","981":"1","1334":"1","1337":"-1/2","1340":"1/2","1362":"2","1377":"-2","1386":"-1/2","1498":"-1"},"138070":{"146":"4","228":"2","398":"-1","428":"-1","430":"-1","451":"-1","508":"2","581":"1","582":"1","637":"-1","922":"-1","925":"1","974":"1","983":"-1","1158":"-1/2","1160":"-1","1207":"2","1243":"-2","1400":"2","1479":"-3","1495":"-2"},"138123":{"38":"1","248":"-1","268":"-1","302":"1","546":"1/2","578":"-1/2","648":"-1","652":"-1","654":"-1","1449":"1","1450":"1"},"138237":{"165":"1","1473":"-1"},"138515":{"133":"-3","483":"-3","494":"-2","506":"-3/2","519":"-7/2","543":"-7/2","695":"-7/2","697":"2","698":"-2","700":"1","701":"1","702":"-3/2","767":"5/2","901":"-2","924":"2","986":"2","1334":"2","1336":"-1","1337":"-1","1362":"2","1377":"-4","1386":"-3","1498":"-2"},"138649":{"242":"1","499":"1"},"138702":{"576":"-1/2"},"138711":{"398":"1","430":"1"},"138731":{"534":"-1/2","1404":"1"},"138736":{"328":"1","573":"1"},"138774":{"529":"1"},"138781":{"247":"1","498":"1"},"138784":{"551":"1","1395":"1"},"138787":{"562":"1","1410":"1"},"138859":{"1466":"-1"},"138866":{"173":"1/2","278":"-1/4","292":"-1/4","342":"1/4","356":"1/4","607":"-1/4","608":"-1/16","610":"3/16","611":"-1/4","612":"-1/4","613":"-1/8","770":"1/4","891":"3/8","905":"3/8","1277":"-1/4","1279":"1/2","1280":"3/8","1368":"-3/4","1374":"1/2"},"138867":{"151":"1/2"},"138882":{"707":"4"},"138891":{"902":"-1/2","985":"-1/2"},"138908":{"466":"1","488":"1"},"138916":{"260":"1","501":"1"},"138919":{"458":"1","486":"1"},"138955":{"1481":"-1"},"138963":{},"138966":{"10":"1","547":"-1/2"},"139020":{"456":"1","474":"1"},"139057":{"300":"1","577":"-1/2"},"139085":{"173":"1"},"139234":{"244":"1","511":"1"},"139246":{"535":"-1/2","1405":"1"},"139634":{"541":"1","1435":"1"},"139710":{"457":"1","475":"1"},"139776":{"917":"-1"},"139784":{"28":"-1","129":"-1/2","150":"-1/2","286":"1","296":"-1","344":"-1","364":"-1","402":"-2","407":"-2","418":"-2","423":"-2","484":"-2","485":"2","568":"2","569":"2","570":"-1/2","575":"2","576":"3/2","651":"-1","661":"-1","662":"-1","707":"-1/2","732":"-1/2","810":"-1/2","882":"-1","883":"-1","888":"-1","889":"1","894":"-1","895":"-1","897":"-1","898":"-1","907":"1","908":"1","910":"-1","918":"-1","919":"-1","920":"-1","921":"-1","928":"-1","929":"-1","930":"-1","932":"-1","933":"-1","934":"-1","935":"1","950":"-1","952":"-1","953":"1","954":"-1","957":"1","958":"-1","959":"-1","963":"1","968":"-1","975":"-1","976":"-1","977":"-1","979":"1","980":"-1","981":"-1","982":"-1","995":"-2","1016":"-1","1018":"-1","1031":"-1","1033":"-1","1043":"-1/2","1047":"-1/2","1049":"-1/2","1205":"-2","1206":"2","1232":"-1","1238":"1/2","1291":"-1","1302":"-1","1303":"-1/2","1322":"-1","1323":"-1","1324":"1/2","1325":"1/2","1394":"1/2","1427":"-1"},"139857":{"60":"-4","151":"-2","348":"-4","623":"-1","625":"-1/2","626":"1","628":"2","629":"2","630":"2","768":"1/2"},"139889":{"334":"1","580":"1"},"139948":{"517":"1","553":"1"},"140174":{"1467":"-1"},"140865":{"438":"-1","585":"-1","769":"1"},"140888":{"41":"-1","42":"1/2","106":"-5/4","240":"3/4","405":"-2","728":"1","813":"2","1162":"4","1163":"-4","1365":"1","1373":"2","1380":"1","1385":"7/4","1392":"-1/2","1397":"-8","1448":"-1"},"140893":{"92":"1"},"140896":{"92":"1"},"140899":{"26":"-1","80":"-2","95":"1","368":"1","381":"4","723":"4","724":"-4","725":"-4","865":"16","1389":"-4","1390":"-4"},"140912":{"256":"1","336":"1","1342":"-2","1437":"2"},"140913":{"256":"1","336":"1","1342":"-2","1437":"2"},"140916":{"41":"-1","42":"1/2","106":"-5/4","240":"3/4","405":"-2","728":"1","813":"2","1162":"4","1163":"-4","1365":"1","1373":"2","1380":"1","1385":"7/4","1392":"-1/2","1397":"-8","1448":"-1"},"140927":{"9":"1","368":"1"},"141001":{},"141120":{"862":"-1"},"141126":{"7":"-1/2","87":"-1/2","226":"1","230":"1","473":"1","485":"1","496":"1","508":"1","521":"1","544":"1","779":"-1/2","857":"-1/2","882":"-1/2","883":"-1/2","884":"-1/2","888":"-1/2","889":"1/2","890":"-1/2","894":"-1/2","898":"-1/2","902":"-1/2","903":"-1/2","904":"-1/2","905":"-1/2","906":"-1/2","907":"-1/2","910":"-1/2","914":"-1/2","918":"-1/2","919":"-1/2","920":"-1/2","921":"-1/2","922":"-1/2","931":"-1/2","932":"-1/2","933":"-1/2","934":"-1/2","940":"-1/2","941":"-1/2","942":"-1/2","946":"-1/2","947":"-1/2","948":"-1/2","949":"-1/2","950":"-1/2","951":"-1/2","958":"-1/2","959":"-1/2","960":"-1/2","965":"-1/2","966":"-1/2","967":"-1/2","971":"-1/2","972":"-1/2","973":"-1/2","976":"-1/2","977":"-1/2","978":"-1/2","980":"-1/2","981":"-1/2","982":"-1/2","983":"-1/2","984":"-1/2","985":"-1/2","990":"1","994":"1/2","1000":"-1/2","1206":"1","1207":"1","1208":"-1/2","1343":"-1/4","1344":"-1/4","1346":"-1/4","1347":"-1/4","1354":"1","1393":"-1/4","1445":"1","1458":"-1/2","1466":"1","1477":"1","1490":"2"},"141154":{"998":"1"},"141489":{"22":"-1/2","23":"-1/2","49":"1","108":"-1","320":"-1/2","333":"-1","1492":"-2"},"141730":{"794":"-4","1082":"-1"},"143000":{"831":"-1","864":"-2","1025":"-2","1029":"-5/2"},"143172":{"998":"-1","1499":"1"},"143178":{},"143179":{},"143602":{"863":"1"}}} \ No newline at end of file diff --git a/research/p104-reroutes-on7623/data/edits.json b/research/p104-reroutes-on7623/data/edits.json new file mode 100644 index 0000000000..04e1a9f01e --- /dev/null +++ b/research/p104-reroutes-on7623/data/edits.json @@ -0,0 +1,538 @@ +{ + "base": "#7623 word (data/base-7623-word.json.gz, sha256 97391721ab7d30f8dd84c8d3c29a3c3ed2df2d65ca55e7ff8329bd09877681d2), 77,277 events", + "word": "data/word.json.gz (sha256 fa1a8dad12d28e6e5ced5a6989d49074efe15d6647ffc122cb28fcd666f366c2), 208,738 events", + "coordinates": "Indices are 0-based event positions in the #7623 word. \"delete\" lists [index, event]; an insert goes immediately before base event \"before\" (inserts with the same \"before\" keep list order). Applied to the INTERIOR subsequence (every MOVE/INIT/CLEAR and every ADD/COPY/SCALE at a chart of dimension 1..8), the 23 deletions and 12 insertions give the interior subsequence of the new word exactly. initial[h] changes for the two rebirths.", + "hub_resettle": "Joint hub re-settle: every ADD/SCALE at the {0} chart (dimension 0) and at the full chart V (dimension 9) is re-derived. The {0} prefix (helpers born at {0}) and the V mix (registers ending at V) are solved jointly and exactly so that every final row equals #7623's, then factored into ADD/SCALE events with 5-smooth coefficients. Dimension-0/9 ADD+SCALE events: 61,251 -> 192,723.", + "edits": [ + { + "id": "E1", + "kind": "rebirth + swap canceller (TR1)", + "register": 457, + "initial": [ + 3, + 281 + ], + "route_before": [ + 3, + 281, + 966, + 218, + 127 + ], + "route_after": [ + 281, + 966, + 218, + 127 + ], + "what": "Helper 457 was born at the {0} chart 3 and moved straight to its first chart 281 (dim 3). It is now born at 281 (its first MOVE is deleted). While its row is still exactly e_457, the depth-1 canceller 242 += -1*457 is placed at 281, before 457's first op; 242 is a {0}-born helper that ends at V, so the token e_457 rides out on a register whose content the V mix settles. Helper target rank 9 -> 6.", + "delete": [ + [ + 41420, + [ + "MOVE", + 457, + 3, + 281, + false + ] + ] + ], + "insert": [ + { + "before": 41421, + "event": [ + "ADD", + 242, + 457, + "-1", + 281 + ] + } + ] + }, + { + "id": "E2", + "kind": "rebirth + swap canceller (TR1)", + "register": 461, + "initial": [ + 3, + 285 + ], + "route_before": [ + 3, + 285, + 994, + 201, + 127 + ], + "route_after": [ + 285, + 994, + 201, + 127 + ], + "what": "Same as E1 for helper 461, born at 285 (dim 3); canceller 10 += -1*461 at 285, where 10 is a kept X main (it ends at V). Helper target rank 9 -> 6.", + "delete": [ + [ + 41526, + [ + "MOVE", + 461, + 3, + 285, + false + ] + ] + ], + "insert": [ + { + "before": 41527, + "event": [ + "ADD", + 10, + 461, + "-1", + 285 + ] + } + ] + }, + { + "id": "E3", + "kind": "helper re-route at an existing co-presence", + "register": 382, + "stop": 24, + "route_before": [ + 3, + 24, + 849, + 974, + 147, + 127 + ], + "route_after": [ + 3, + 849, + 974, + 147, + 127 + ], + "what": "Helper 382 drops its stop at chart 24 (dim 1) with its 4 ops there; its MOVEs 3->24->849 merge into 3->849. The one useful delivery is re-made as 553 += 1/2*383 at chart 24, where 553 and 383 already meet in #7623 (383 holds pure X26 there after its own swap).", + "delete": [ + [ + 34449, + [ + "MOVE", + 382, + 3, + 24, + false + ] + ], + [ + 34450, + [ + "ADD", + 382, + 26, + "1/2", + 24 + ] + ], + [ + 35717, + [ + "ADD", + 553, + 382, + "1", + 24 + ] + ], + [ + 35718, + [ + "ADD", + 382, + 553, + "-1", + 24 + ] + ], + [ + 35719, + [ + "ADD", + 382, + 1144, + "1", + 24 + ] + ], + [ + 35723, + [ + "MOVE", + 382, + 24, + 849, + false + ] + ] + ], + "insert": [ + { + "before": 34451, + "event": [ + "MOVE", + 382, + 3, + 849, + false + ] + }, + { + "before": 35720, + "event": [ + "ADD", + 553, + 383, + "1/2", + 24 + ] + } + ] + }, + { + "id": "E4", + "kind": "helper re-route at an existing co-presence", + "register": 490, + "stop": 725, + "route_before": [ + 3, + 594, + 725, + 883, + 1009, + 176, + 127 + ], + "route_after": [ + 3, + 594, + 883, + 1009, + 176, + 127 + ], + "what": "Helper 490 drops its stop at chart 725 (dim 4); MOVEs 594->725->883 merge into 594->883. Its pickup 490 += 296 at 725 is replaced by 1427 += -1*296 at 725, between registers already co-present there.", + "delete": [ + [ + 41510, + [ + "MOVE", + 490, + 594, + 725, + false + ] + ], + [ + 41512, + [ + "ADD", + 490, + 296, + "1", + 725 + ] + ], + [ + 42941, + [ + "MOVE", + 490, + 725, + 883, + false + ] + ] + ], + "insert": [ + { + "before": 41511, + "event": [ + "MOVE", + 490, + 594, + 883, + false + ] + }, + { + "before": 41513, + "event": [ + "ADD", + 1427, + 296, + "-1", + 725 + ] + } + ] + }, + { + "id": "E5", + "kind": "main re-route at an existing co-presence", + "register": 44, + "stop": 849, + "route_before": [ + 40, + 480, + 495, + 849, + 127 + ], + "route_after": [ + 40, + 480, + 495, + 127 + ], + "what": "Main 44 (an X main) drops its stop at chart 849 (dim 6); MOVEs 495->849->127 merge into 495->127. Its only op there, 382 += 44, is replaced by 382 += -1*816 at 849 earlier in the word, where 382 and 816 already meet. The receiver 382 ends at V, so the X surplus inside the V span is absorbed by the V mix and the {0} part by the {0} prefix.", + "delete": [ + [ + 42851, + [ + "MOVE", + 44, + 495, + 849, + false + ] + ], + [ + 42852, + [ + "ADD", + 382, + 44, + "1", + 849 + ] + ], + [ + 49092, + [ + "MOVE", + 44, + 849, + 127, + false + ] + ] + ], + "insert": [ + { + "before": 42258, + "event": [ + "ADD", + 382, + 816, + "-1", + 849 + ] + }, + { + "before": 42853, + "event": [ + "MOVE", + 44, + 495, + 127, + false + ] + } + ] + }, + { + "id": "E6", + "kind": "main re-route at an existing co-presence (twin pickup)", + "register": 176, + "stop": 1065, + "route_before": [ + 3, + 449, + 1065, + 928, + 186 + ], + "route_after": [ + 3, + 449, + 928, + 186 + ], + "what": "Main 176 (a Y main) drops its stop at chart 1065 (dim 5); MOVEs 449->1065->928 merge into 449->928. Its pickup 176 += -1/2*379 at 1065 is replaced by 176 += -1/4*1000 and 176 += -1*236 at chart 928, from registers that share 928 with it in #7623. The delivered X content is identical; the difference is {0} content (re-settled) and two Y2 entries absorbed downstream.", + "delete": [ + [ + 42628, + [ + "MOVE", + 176, + 449, + 1065, + false + ] + ], + [ + 42630, + [ + "ADD", + 176, + 379, + "-1/2", + 1065 + ] + ], + [ + 44312, + [ + "MOVE", + 176, + 1065, + 928, + false + ] + ] + ], + "insert": [ + { + "before": 42629, + "event": [ + "MOVE", + 176, + 449, + 928, + false + ] + }, + { + "before": 42629, + "event": [ + "ADD", + 176, + 1000, + "-1/4", + 928 + ] + }, + { + "before": 44395, + "event": [ + "ADD", + 176, + 236, + "-1", + 928 + ] + } + ] + }, + { + "id": "E7", + "kind": "main stop deletion (no new op)", + "register": 902, + "stop": 595, + "route_before": [ + 3, + 595, + 618, + 913, + 147 + ], + "route_after": [ + 3, + 618, + 913, + 147 + ], + "what": "Main 902 (a hosted Y2 main) drops its stop at chart 595 (dim 1); MOVEs 3->595->618 merge into 3->618. The stop was donor-only: 4 deliveries of its Y2 entries (to owned 1532 and to 1479, 1255, 1495, which end at V). They are deleted with no replacement; the joint hub re-settle restores every final row.", + "delete": [ + [ + 38582, + [ + "MOVE", + 902, + 3, + 595, + false + ] + ], + [ + 38583, + [ + "ADD", + 1532, + 902, + "2", + 595 + ] + ], + [ + 38881, + [ + "ADD", + 1479, + 902, + "-1/2", + 595 + ] + ], + [ + 38882, + [ + "ADD", + 1255, + 902, + "-1", + 595 + ] + ], + [ + 38883, + [ + "ADD", + 1495, + 902, + "-3/2", + 595 + ] + ], + [ + 38885, + [ + "MOVE", + 902, + 595, + 618, + false + ] + ] + ], + "insert": [ + { + "before": 38584, + "event": [ + "MOVE", + 902, + 3, + 618, + false + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/research/p104-reroutes-on7623/data/invoice-7623.json b/research/p104-reroutes-on7623/data/invoice-7623.json new file mode 100644 index 0000000000..638ad110b8 --- /dev/null +++ b/research/p104-reroutes-on7623/data/invoice-7623.json @@ -0,0 +1 @@ +{"schema": "integer-mult-recursive-invoice/v1", "contract": {"model": "mixed-target-unnormalized-power-v1", "rank_semantics": "H_r costs r^(1-C); debit surrendered productive fields", "ambient_rank": 145, "boundary": "complete signed #7113 caller application with 17 native calls"}, "paid": {"1": 68129, "2": 15946, "3": 11033, "4": 4964, "5": 6001, "6": 391, "7": 187, "8": 758, "9": 32, "16": 416, "24": 416, "32": 416, "40": 416, "48": 416, "56": 416, "64": 208}, "targets": {"1": 306, "2": 357, "3": 799, "4": 3825, "5": 1360, "6": 731, "7": 323, "8": 544, "9": 10888, "17": 416, "25": 416, "33": 416, "41": 416, "49": 416, "57": 416, "65": 416, "73": 208, "137": 208}} \ No newline at end of file diff --git a/research/p104-reroutes-on7623/data/invoice-new.json b/research/p104-reroutes-on7623/data/invoice-new.json new file mode 100644 index 0000000000..8b5bd00eaf --- /dev/null +++ b/research/p104-reroutes-on7623/data/invoice-new.json @@ -0,0 +1 @@ +{"schema": "integer-mult-recursive-invoice/v1", "contract": {"model": "mixed-target-unnormalized-power-v1", "rank_semantics": "H_r costs r^(1-C); debit surrendered productive fields", "ambient_rank": 145, "boundary": "complete signed #7113 caller application with 17 native calls"}, "paid": {"1": 68095, "2": 15895, "3": 10948, "4": 4964, "5": 6018, "6": 425, "7": 187, "8": 758, "9": 32, "16": 416, "24": 416, "32": 416, "40": 416, "48": 416, "56": 416, "64": 208}, "targets": {"1": 306, "2": 357, "3": 799, "4": 3825, "5": 1360, "6": 765, "7": 323, "8": 544, "9": 10854, "17": 416, "25": 416, "33": 416, "41": 416, "49": 416, "57": 416, "65": 416, "73": 208, "137": 208}} \ No newline at end of file diff --git a/research/p104-reroutes-on7623/data/invoice-zero.json b/research/p104-reroutes-on7623/data/invoice-zero.json new file mode 100644 index 0000000000..6b9ea16bcf --- /dev/null +++ b/research/p104-reroutes-on7623/data/invoice-zero.json @@ -0,0 +1 @@ +{"schema": "integer-mult-recursive-invoice/v1", "contract": {"model": "mixed-target-unnormalized-power-v1", "rank_semantics": "H_r costs r^(1-C); debit surrendered productive fields", "ambient_rank": 145, "boundary": "complete signed #7113 caller application with 17 native calls"}, "paid": {}, "targets": {}} \ No newline at end of file diff --git a/research/p104-reroutes-on7623/data/word.json.gz b/research/p104-reroutes-on7623/data/word.json.gz new file mode 100644 index 0000000000..d652af4f8a Binary files /dev/null and b/research/p104-reroutes-on7623/data/word.json.gz differ diff --git a/research/p104-reroutes-on7623/price.py b/research/p104-reroutes-on7623/price.py new file mode 100644 index 0000000000..588d659fd0 --- /dev/null +++ b/research/p104-reroutes-on7623/price.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Certify the price with the repository's own invoice tools. + +Runs scripts/compare_recursive_invoices.py (#7623 invoice against the new +one, concave order) and scripts/evaluate_recursive_power.py (new invoice +against the empty invoice at r^t, t = 1 - C) and requires: + - the new invoice is uniformly better than #7623's for every increasing + concave tariff, strictly for r^(1-C), 0 < C < 1; + - at C = 0.0036667343458 the new paid cost is strictly below the new + targets (F(C) > 0), so the crossing is above the claim; + - at C = 0.0036667343459 it is strictly above (F(C) < 0); + - at #7623's C = 0.0036624027915 and #7627's C = 0.003665731276 the new + invoice is strictly favourable. +The invoices themselves are recomputed from the words by check.py. +""" +import json +import subprocess +import sys +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +DATA = HERE / 'data' +CLAIM, ABOVE, PR7623, PR7627 = '0.0036667343458', '0.0036667343459', '0.0036624027915', '0.003665731276' + + +def tool(name, *args): + out = subprocess.run([sys.executable, '-I', '-B', str(ROOT / 'scripts' / name), *map(str, args)], + capture_output=True, text=True, check=True, timeout=120) + return json.loads(out.stdout) + + +def one_minus(c): + from decimal import Decimal + return str(1 - Decimal(c)) + + +def main(): + old, new, zero = DATA / 'invoice-7623.json', DATA / 'invoice-new.json', DATA / 'invoice-zero.json' + rep = tool('compare_recursive_invoices.py', old, new) + assert rep['classification'] == 'uniformly_better', rep['classification'] + assert rep['power_moment']['new_minus_old_sign'] == 'strictly_negative' + assert rep['delta_paid'] == {'1': -34, '2': -51, '3': -85, '5': 17, '6': 34}, rep['delta_paid'] + assert rep['delta_targets'] == {'6': 34, '9': -34}, rep['delta_targets'] + print('PASS compare_recursive_invoices #7623 -> new: uniformly_better, paid delta', rep['delta_paid'], 'target delta', rep['delta_targets']) + for c, want in ((CLAIM, 'new_cost_lower'), (ABOVE, 'new_cost_higher'), (PR7623, 'new_cost_lower'), (PR7627, 'new_cost_lower')): + r = tool('evaluate_recursive_power.py', zero, new, '--exponent', one_minus(c), '--bits', 256) + assert r['classification'] == want, (c, r['classification']) + print('PASS evaluate_recursive_power at C = %s (t = %s): %s' % (c, r['exponent'], want)) + print('PASS_PRICE kappa in (%s, %s)' % (CLAIM, ABOVE)) + + +if __name__ == '__main__': + sys.exit(main())