diff --git a/research/frontier1094-idle-star-ceiling/README.md b/research/frontier1094-idle-star-ceiling/README.md new file mode 100644 index 0000000000..dc62e45699 --- /dev/null +++ b/research/frontier1094-idle-star-ceiling/README.md @@ -0,0 +1,111 @@ +# Idle rank-48 repartitions on #1094: exact ceiling, PR1252 recount and a star-move lead + +**Scoped finding; no new selected κ and no admitted construction.** For one named +residual subproblem of the selected #1094 packing, the idle rank-48 remainder, this +package gives an exact price ceiling, an independent recount of PR1252's matching +maximum, and the exact optimum of a broader move class with an explicit overlay. The +overlay is structurally verified but has **not** been through the controller, invoice +or strict assembly admission that PR1252 ran. The selected record, `upstream/` and +every frozen input are unchanged. + +## Object + +The frozen #1094 replay (`research/community-frontier1094-audit/selected-replay.tar.gz`, +`candidate/strict/global/hosted/IDLE-REMAINDER-FRAMES.json.gz`) has **4,866 idle +rank-48 children** that are unhosted, have no pending offset and are absent from the +T16 owner map. They lie in **1,792 (replica, port) groups** of sizes +`{1: 45, 2: 703, 3: 761, 4: 283}`. The rest of the idle remainder (hosted rank-1/3/7 +children) and all local-word children are held fixed. + +PR1252 (Gonzalo-Mier, head `1b9db2fa`) moves 3 commuting axes inside 1,825 disjoint +pairs, `48 + 48 → 45 + 51`. Its open questions ask for an independent reproduction of +the matching maximum and for coordinated moves among more than two children. + +## Result + +Exact native prices from the pinned multicold `moment`/`base_two_moment`/`outer` engines +(the price and outer recipe are PR1252's `math_support.price`, restated): + +| Profile | 48-children become | κ (native) | Gain over #1094 | Share of ceiling gain | +|---|---|---|---:|---:| +| #1094 selected | 4,866 × 48 | 0.001672660197076918 | — | 0% | +| PR1252 pair class (independent recount: **1,825**) | 1,825×45, 1,216×48, 1,825×51 | 0.001672846574134982 | 1.864e-7 | 37.9% | +| **Disjoint-star class optimum** | 796×42, 765×45, 948×48, 2,357×51 | **0.001672987659462603** | 3.275e-7 | 66.6% | +| **Ceiling: any within-group repartition** | 283×39, 761×42, 703×45, 45×48, 3,074×51 | **0.001673151843213755** | 4.916e-7 | 100% | + +Conservative prices are 0.001672660194225008 (matches the selected record), 0.001672846571282754 +(matches PR1252), 0.001672987656610135 and 0.001673151840361007. + +1. **Ceiling.** In a group of `k` such children the mass is `48k`. No child can be + deleted, because `48k > 51(k−1)` for `k ≤ 16`, and splitting a child only raises the + subadditive moment. The halving guard caps ranks at 51 (`73² > 2·51²`). The main + moment `Σ r^(1−a)` is Schur-concave at a fixed child count, so the + majorization-maximal vector `(51^(k−1), 51−3k)` minimizes it. With the outer recipe + unchanged, **no within-group repartition of these children, under any commuting rule, + can exceed κ = 0.001673151843213755**. As a control, four deterministic random + repartitions are priced and all stay below the ceiling. This bounds PR1252's + "multi-child moves" route at about **+0.00000049** κ, which is 3.4% of PR1240's + fixed-word packing headroom (κ < 0.0016872026). Larger gains need hosted or + local-word mass, which PR1240 covers, or a different word. +2. **PR1252 recount.** Under PR1252's rule, an independent per-group exhaustive + matching finds exactly **1,825** pairs. Under the same rule, this reproduces its κ + at both native and conservative precision. +3. **Star class.** A centre child sends up to 3 axes to each of several leaves, and + leaves reach 51. Every moved axis satisfies the per-axis PR1252 rule: it commutes + with all original leaf axes, every stage entry/exit X and Y, the terminal Y + translation and the terminal translations of both centre and leaf. The class + contains the pair class. The exact per-group optimum comes from enumerating set + partitions × centres with bipartite b-matching of axes, and the choice is invariant + between `a = 0.0016756` and `a = 0.01`. It yields **2,357 moves from 1,561 + centres** and κ = 0.001672987659462603. This is +1.41e-7 over PR1252 and two + thirds of the ceiling gain. The moves are in `STAR-MOVES.json.gz`. + +## Verification + +```sh +python3 -B research/frontier1094-idle-star-ceiling/analyze.py --check # ~5 s +python3 -B research/frontier1094-idle-star-ceiling/verify.py # ~2 s +python3.12 scripts/research_package.py --package research/frontier1094-idle-star-ceiling +``` + +`analyze.py --check` recomputes everything from the committed replay archive and +requires byte-identical `RESULT.json` and star payloads. Each price asserts acceptance +at its exact endpoint, rejection at endpoint+1e-24, all 47 strict outer constraints, +and rejection of the next 1e-18 κ grid point. `verify.py` does not import +`analyze.py`. It re-derives every move's commuting conditions and checks the orthonormal +resulting axis sets, unchanged per-group axis multisets (hence each group's Z4 phase +polynomial), disjoint stars, the rank cap, the absence of hosted and owner children, and +the profile. Seven mutation controls must be rejected: a non-commuting axis, an axis +moved twice, a reused leaf, a rank-52 leaf, a foreign axis, a hosted leaf and a centre +that is also a leaf. Its receipt is `STAR-AUDIT.json`. + +**Not checked:** the serialized controller/owner audit, the mixed-provider invoice and +the strict global assembly with its negative controls, for the star overlay. The +soundness of composing PR1252 transfers into stars is inherited from PR1252's pair +argument and not proved here (see the open questions). The all-size compiler, +common-label/mutable-source realization, hosting, precision/tape and analytic-transfer +obligations of the selected record remain conditional. + +## Open next questions + +The structured list is in [TASK.json](TASK.json): + +- **Admission of the star overlay.** Generalize PR1252's `audit_allcold_idle_overlay.py` + from pairs to `(centre, leaf, moved_axes)` records, re-pin the SPEC and rerun its + controller and assembly controls. This is blocked on PR1252 being unmerged. +- **Contract for multi-leaf moves.** Does a moved idle axis need to commute with + anything beyond the donor and receiver? The first step is to state the controller + contract. +- **Stacking on stronger words.** Apply the same analysis to the idle remainders of the + open X54 / mixed-T37 candidates (PR1218/PR1261, κ ≈ 0.0016758), since the gain is + additive in the moment. + +## Credit + +Gonzalo-Mier's PR1252 provides the move, the commuting rule and the pricing recipe, and +its open questions define this scope. The #1094 replay, T16 owner map and engines are +those of the selected review and its retained supplier ancestry. PR1240 (Douglas Colkitt) +provides the broader fixed-word packing ceiling. Coordination is in +[Discussion #1265](https://github.com/CrocSwap/integer-mult-bounds/discussions/1265). +This package was prepared by Guéorgui Maissouradze (GitHub: PatatePatatePatate) with +substantial Claude (Anthropic) assistance. Apache-2.0. diff --git a/research/frontier1094-idle-star-ceiling/RESULT.json b/research/frontier1094-idle-star-ceiling/RESULT.json new file mode 100644 index 0000000000..c167053e7a --- /dev/null +++ b/research/frontier1094-idle-star-ceiling/RESULT.json @@ -0,0 +1,174 @@ +{ + "status": "PASS_IDLE48_REPARTITION_CEILING", + "replay_archive": { + "research/community-frontier1094-audit/selected-replay.tar.gz": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + }, + "inputs": { + "hosted/IDLE-REMAINDER-FRAMES.json.gz": "650c14a1de75015fdae5c02ea18f1d0fd2de35d249b5ff2cd77f3b1afe604985", + "base/work/complex-nine-native/DATA-PHASES.json": "c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa", + "audit/OWNERS-AND-PROFILE.json": "30bafff060afcfb3644e951214d66cfaffe58242881c652e28003958b42127cc", + "research/complex-t16-rare-pattern-exchanges/OWNERS.json.gz": "87902c528dfab7d503dcf8a784260e3ab6fb7424c418a1820f7261f25be7b6bc", + "research/community-frontier1094-audit/ASSEMBLY.json": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + "eligible_children": 4866, + "owner_slot_rank48_children": 0, + "groups": 1792, + "group_size_histogram": { + "1": 45, + "2": 703, + "3": 761, + "4": 283 + }, + "pair_class_maximum_pairs": 1825, + "star_vector_invariant_between_a": [ + 0.0016756, + 0.01 + ], + "star_vector_invariant": true, + "star_rank_histogram": { + "42": 796, + "45": 765, + "48": 948, + "51": 2357 + }, + "relaxation_rank_histogram": { + "39": 283, + "42": 761, + "45": 703, + "48": 45, + "51": 3074 + }, + "profiles": { + "baseline_1094": { + "1": 349604, + "2": 60192, + "3": 62585, + "4": 20448, + "5": 11808, + "7": 7, + "8": 1152, + "48": 4866 + }, + "pair_class_max (PR1252 rule, independent recount)": { + "1": 349604, + "2": 60192, + "3": 62585, + "4": 20448, + "5": 11808, + "7": 7, + "8": 1152, + "45": 1825, + "48": 1216, + "51": 1825 + }, + "star_class_optimum": { + "1": 349604, + "2": 60192, + "3": 62585, + "4": 20448, + "5": 11808, + "7": 7, + "8": 1152, + "42": 796, + "45": 765, + "48": 948, + "51": 2357 + }, + "relaxation_ceiling": { + "1": 349604, + "2": 60192, + "3": 62585, + "4": 20448, + "5": 11808, + "7": 7, + "8": 1152, + "39": 283, + "42": 761, + "45": 703, + "48": 45, + "51": 3074 + } + }, + "prices": { + "baseline_1094": { + "native": { + "endpoint": "67018507072324140917/40000000000000000000000", + "endpoint_decimal": "0.001675462676808103522925", + "kappa": "836330098538459/500000000000000000", + "kappa_decimal": "0.001672660197076918" + }, + "conservative": { + "endpoint": "1675462673946628390003/1000000000000000000000000", + "endpoint_decimal": "0.001675462673946628390003", + "kappa": "104541262139063/62500000000000000", + "kappa_decimal": "0.001672660194225008" + } + }, + "pair_class_max (PR1252 rule, independent recount)": { + "native": { + "endpoint": "104728104934992539263/62500000000000000000000", + "endpoint_decimal": "0.001675649678959880628208", + "kappa": "836423287067491/500000000000000000", + "kappa_decimal": "0.001672846574134982" + }, + "conservative": { + "endpoint": "1675649676098086086493/1000000000000000000000000", + "endpoint_decimal": "0.001675649676098086086493", + "kappa": "836423285641377/500000000000000000", + "kappa_decimal": "0.001672846571282754" + } + }, + "star_class_optimum": { + "native": { + "endpoint": "1675791237522814605259/1000000000000000000000000", + "endpoint_decimal": "0.001675791237522814605259", + "kappa": "1672987659462603/1000000000000000000", + "kappa_decimal": "0.001672987659462603" + }, + "conservative": { + "endpoint": "167579123466077825869/100000000000000000000000", + "endpoint_decimal": "0.001675791234660778258690", + "kappa": "334597531322027/200000000000000000", + "kappa_decimal": "0.001672987656610135" + } + }, + "relaxation_ceiling": { + "native": { + "endpoint": "837977986018757511763/500000000000000000000000", + "endpoint_decimal": "0.001675955972037515023526", + "kappa": "334630368642751/200000000000000000", + "kappa_decimal": "0.001673151843213755" + }, + "conservative": { + "endpoint": "1675955969175197279329/1000000000000000000000000", + "endpoint_decimal": "0.001675955969175197279329", + "kappa": "1673151840361007/1000000000000000000", + "kappa_decimal": "0.001673151840361007" + } + } + }, + "random_repartition_controls": [ + { + "max_rank": 51, + "kappa": "836429700237559/500000000000000000", + "below_ceiling": true + }, + { + "max_rank": 51, + "kappa": "836432225741851/500000000000000000", + "below_ceiling": true + }, + { + "max_rank": 51, + "kappa": "1672865883743733/1000000000000000000", + "below_ceiling": true + }, + { + "max_rank": 51, + "kappa": "418215852699067/250000000000000000", + "below_ceiling": true + } + ], + "star_moves": 2357, + "star_moves_payload_sha256": "d6d46d2acf47ce7e65434685d86a0542bed92b879579d81d5a115fa4c0f6f2dd" +} diff --git a/research/frontier1094-idle-star-ceiling/SOURCES.json b/research/frontier1094-idle-star-ceiling/SOURCES.json new file mode 100644 index 0000000000..a5eceac04d --- /dev/null +++ b/research/frontier1094-idle-star-ceiling/SOURCES.json @@ -0,0 +1,54 @@ +{ + "schema_version": 1, + "base_commit": "dadfea6e8a78ff6ba901705f87532a71c6f5bbb8", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "c05fafaa25ba95b2d5af86b1800427198e3d20eb", + "sha256": "89b5928bc92c81e2647b6d702a7ad85a6795b8f44e2eb267b2ff3145d8f2b2ce" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/community-frontier1094-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f", + "sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/engines/base_two_moment.py", + "usage": "input", + "git_blob": "14a90fa0e788217856f070382c9e61bd7c603c61", + "sha256": "aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/engines/moment.py", + "usage": "input", + "git_blob": "7d697cb45203fe72d97037403d6da41f71f3b7fd", + "sha256": "81cbc864e106418fc7854322746f72180cb8110ff39f74450a3b8d55a82c1482" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/engines/outer.py", + "usage": "input", + "git_blob": "43007488ad2c43187c77cc6798beff8b1cd76ad2", + "sha256": "c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/OWNERS.json.gz", + "usage": "input", + "git_blob": "d3ba33d7e703a3229d9fb8a360f69d2f318bbb70", + "sha256": "87902c528dfab7d503dcf8a784260e3ab6fb7424c418a1820f7261f25be7b6bc" + } + ] +} diff --git a/research/frontier1094-idle-star-ceiling/STAR-AUDIT.json b/research/frontier1094-idle-star-ceiling/STAR-AUDIT.json new file mode 100644 index 0000000000..d27bed6ed2 --- /dev/null +++ b/research/frontier1094-idle-star-ceiling/STAR-AUDIT.json @@ -0,0 +1,42 @@ +{ + "status": "PASS_INDEPENDENT_IDLE48_STAR_OVERLAY", + "moves": 2357, + "leaves": 2357, + "centres": 1561, + "profile": { + "1": 349604, + "2": 60192, + "3": 62585, + "4": 20448, + "5": 11808, + "7": 7, + "8": 1152, + "42": 796, + "45": 765, + "48": 948, + "51": 2357 + }, + "mutation_controls": { + "noncommuting_axis": "rejected", + "axis_moved_twice": "rejected", + "leaf_reused": "rejected", + "fourth_axis_rank52": "rejected", + "foreign_axis": "rejected", + "hosted_leaf": "rejected", + "centre_also_leaf": "rejected" + }, + "checks": [ + "per-axis PR1252 commuting rule", + "orthonormal resulting axis sets", + "group axis multisets unchanged", + "disjoint stars, leaves <= 51", + "no owner-map slots, no hosted/pending children", + "halving guard 73^2 > 2*51^2", + "profile equals RESULT.json star_class_optimum" + ], + "not_checked": [ + "serialized controller/owner audit", + "mixed-provider invoice", + "strict global assembly and its negative controls" + ] +} diff --git a/research/frontier1094-idle-star-ceiling/STAR-MOVES.json.gz b/research/frontier1094-idle-star-ceiling/STAR-MOVES.json.gz new file mode 100644 index 0000000000..f87c6ce924 Binary files /dev/null and b/research/frontier1094-idle-star-ceiling/STAR-MOVES.json.gz differ diff --git a/research/frontier1094-idle-star-ceiling/TASK.json b/research/frontier1094-idle-star-ceiling/TASK.json new file mode 100644 index 0000000000..60e155b655 --- /dev/null +++ b/research/frontier1094-idle-star-ceiling/TASK.json @@ -0,0 +1,72 @@ +{ + "schema_version": 1, + "task_id": "selected-packing", + "priority_revision": 2, + "base_commit": "dadfea6e8a78ff6ba901705f87532a71c6f5bbb8", + "original_card": { + "id": "selected-packing", + "question": "Is there a genuinely unsearched, explicitly bounded improvement to the selected packing?", + "starting_points": [ + "certificates/selected-result.json", + "research/heterogeneous-owner-assembly/README.md" + ], + "methods": [ + "Search a named unclaimed canonical candidate domain with a reproducible partition.", + "Prove a stronger scoped relaxation or exact optimum for one named residual subproblem." + ], + "acceptance_gate": "Check live PR overlap first, price both suppliers and distinguish a search best from an optimum.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Locate the selected packing source in the review and check live PRs for the same residual problem.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Define an unclaimed canonical domain and a favorable bound before starting a new search.", + "bottleneck_link": "An actual paid-profile gain can improve the frontier up to the other supplier cap.", + "allowed_variations": [ + "One bounded residual packing instance or exact relaxation." + ], + "scope_change_triggers": [ + "Rerunning an existing search with only a different seed as a separate mathematical contribution." + ], + "overlap_terms": [ + "T16", + "owner exchange", + "packing" + ] + }, + "scope_status": "refined", + "actual_scope": "Named residual subproblem of the selected #1094 packing: the 4,866 unhosted, non-owner idle rank-48 children of the frozen idle remainder (1,792 replica/port groups). (1) exact price ceiling over every within-group repartition of their axes with ranks <= 51; (2) independent recount of PR1252 pair-class maximum; (3) exact optimum and explicit overlay for the disjoint-star class under the per-axis PR1252 commuting rule.", + "scope_change_reason": "Refined from the generic card to one residual subproblem opened by PR1252 (its two open next questions: independent matching reproduction and coordinated multi-child moves). Uses the card's second method: exact relaxation plus exact optimum on a named class.", + "bottleneck_link": "Complex supplier binds. Repartitioning idle rank-48 children changes the paid histogram (not just scalar counts), so it moves the exact complex endpoint; the ceiling shows this whole route is worth at most +0.000000491646 in kappa over #1094, about 3.4% of the PR1240 fixed-word packing headroom (0.0016872026).", + "budget_minutes": 90, + "stop_rule": "Stop after the class ceiling, the exact star optimum and a structural verifier; do not attempt controller/invoice/assembly admission for the star overlay in this session.", + "outcome": "partial", + "evidence": "RESULT.json (exact prices of baseline, PR1252 pair class, star optimum, relaxation ceiling; 4 random repartition controls), STAR-MOVES.json.gz (2,357 explicit moves), STAR-AUDIT.json (independent verifier, 7/7 mutation controls rejected).", + "author": "Guéorgui Maissouradze / PatatePatatePatate", + "ai_assistance": "Substantial Claude (Anthropic, Claude Code, Opus 5.5) assistance in derivation, implementation, verification and documentation; directed in a donated session.", + "open_questions": [ + { + "question": "Does the 2,357-move star overlay pass the serialized controller/owner audit, the mixed-provider invoice and the strict global assembly that admitted PR1252?", + "why_it_matters": "Only then is kappa 0.001672987659462603 an admitted finite candidate on the #1094 replay rather than a priced structural lead.", + "first_step": "Generalise PR1252 audit_allcold_idle_overlay.py from pair records to (centre, leaf, moved_axes) records, emit the overlay frames/template, re-pin SPEC and rerun its 15 controller and 69 assembly controls.", + "blocked_by": "PR1252 is unmerged; its strict-pin SPEC must be regenerated for a new profile, and the retained T16 source emission is needed." + }, + { + "question": "Is the per-axis commuting rule sufficient when a centre sends axes to two or three leaves, i.e. do the leaves need to commute with each other's terminal translations?", + "why_it_matters": "The star class is the sequential composition of PR1252-rule transfers with the donor rank relaxed below 48; soundness of that composition is inherited, not proved here.", + "first_step": "State the controller contract a moved idle axis must satisfy and check whether it references only donor and receiver.", + "blocked_by": "The PR1252 package does not state the contract beyond the pair case." + }, + { + "question": "Do the open X54 / mixed-T37 constructions (PR1218, PR1261, kappa 0.0016758) have unhosted idle rank-48 remainders where the same star moves apply?", + "why_it_matters": "The idle-repartition gain is additive in the moment and may stack on a stronger base word.", + "first_step": "Run analyze.py logic on their idle-remainder frames after adapting the replay paths.", + "blocked_by": "Different replay layouts; those candidates are unreviewed." + } + ] +} diff --git a/research/frontier1094-idle-star-ceiling/VERIFY.json b/research/frontier1094-idle-star-ceiling/VERIFY.json new file mode 100644 index 0000000000..1d24529ce5 --- /dev/null +++ b/research/frontier1094-idle-star-ceiling/VERIFY.json @@ -0,0 +1,35 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1094-audit/ASSEMBLY.json", + "research/community-frontier1094-audit/selected-replay.tar.gz", + "research/complex-k492-owner-repair/vendor/multicold/engines/base_two_moment.py", + "research/complex-k492-owner-repair/vendor/multicold/engines/moment.py", + "research/complex-k492-owner-repair/vendor/multicold/engines/outer.py", + "research/complex-t16-rare-pattern-exchanges/OWNERS.json.gz" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/analyze.py", + "--check" + ], + "timeout_seconds": 300, + "checks": "Recomputes eligibility, PR1252 pair-class maximum, star-class optimum and relaxation ceiling from the committed #1094 replay archive; exact engine prices with acceptance/rejection at the 1e-24 endpoint and next-kappa-grid rejection; 4 random repartition controls below the ceiling; byte-identical RESULT.json and STAR-MOVES payload." + }, + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Independent per-move check (no import of analyze.py): commuting rule, orthonormal axis sets, group axis multisets, disjoint stars, cap 51, no hosted/owner children, profile; 7 mutation controls must be rejected." + } + ] +} diff --git a/research/frontier1094-idle-star-ceiling/analyze.py b/research/frontier1094-idle-star-ceiling/analyze.py new file mode 100644 index 0000000000..c0521d10dd --- /dev/null +++ b/research/frontier1094-idle-star-ceiling/analyze.py @@ -0,0 +1,324 @@ +#!/usr/bin/env python3 +"""Exact ceiling and star-move optimum for idle rank-48 repartitions on #1094. + +Reads the frozen #1094 idle remainder from the selected replay and answers, +for the unhosted idle rank-48 children of each (replica, port) group: + +1. relaxation: the best price of *any* within-group repartition with ranks in + [1, 51] and an unchanged child count (commuting constraints dropped); +2. pair class: an independent recount of PR1252's 48+48 -> 45+51 matching; +3. star class: the exact optimum over disjoint stars, where a centre child + moves axes to leaves under PR1252's commuting rule, each leaf capped at 51. + +Every profile is priced with the pinned multicold engines (exact rationals). +""" +import argparse, random, tarfile, gzip, hashlib, importlib.util, json, sys +from collections import Counter, defaultdict +from fractions import Fraction as Q +from functools import lru_cache +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +OUT = Path(__file__).resolve().parent +OWNER_MAP = ROOT / 'research/complex-t16-rare-pattern-exchanges/OWNERS.json.gz' +BASELINE = ROOT / 'research/community-frontier1094-audit/ASSEMBLY.json' +ENGINE_ROOT = ROOT / 'research/complex-k492-owner-repair/vendor/multicold/engines' +ENGINE_SHA256 = { + 'moment': '81cbc864e106418fc7854322746f72180cb8110ff39f74450a3b8d55a82c1482', + 'base_two_moment': 'aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098', + 'outer': 'c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c', +} +M, W, DEFICIT, CAP = 73, 14336, 5120, 51 +PAIR = 'pair_class_max (PR1252 rule, independent recount)' + + +REPLAY_TAR = ROOT / 'research/community-frontier1094-audit/selected-replay.tar.gz' +MEMBERS = ('hosted/IDLE-REMAINDER-FRAMES.json.gz', 'base/work/complex-nine-native/DATA-PHASES.json', + 'audit/OWNERS-AND-PROFILE.json') + + +def replay_inputs(root): + """{member: raw bytes}; read from the committed selected replay unless a + pre-extracted candidate/strict/global directory is given.""" + if root is not None: + return {m: (Path(root) / m).read_bytes() for m in MEMBERS} + with tarfile.open(REPLAY_TAR) as tar: + return {m: tar.extractfile('candidate/strict/global/' + m).read() for m in MEMBERS} + + +def parse(name, raw): + return json.loads(gzip.decompress(raw) if name.endswith('.gz') else raw) + + +def sha(p): return hashlib.sha256(Path(p).read_bytes()).hexdigest() + + +def read(p): + raw = Path(p).read_bytes() + return json.loads(gzip.decompress(raw) if str(p).endswith('.gz') else raw) + + +def decimal(q, places): + return '0.' + str(q.numerator * 10**places // q.denominator).zfill(places) + + +def dot(a, b): return (a & b).bit_count() & 1 + + +def load_engine(name): + path = ENGINE_ROOT / (name + '.py') + assert sha(path) == ENGINE_SHA256[name], name + spec = importlib.util.spec_from_file_location('idlestar_' + name, path) + mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod) + return mod + + +def price(profile, bad, baseline, eng): + """Exact complex endpoint and kappa; the outer recipe is PR1252's + math_support.price (retained #1094 recipe), re-stated here.""" + moment, base_two, outer = eng + assert M * W - sum(r * n for r, n in profile.items()) == DEFICIT + assert M * M > 2 * max(profile) ** 2 + endpoint = Q(moment.certify(profile, M, W, bad)['lower']) + for z, accept in ((endpoint, True), (endpoint + Q(1, 10**24), False)): + lo, hi = moment.moment(profile, M, W, z, bad) + blo, bhi = base_two.moment(M, W, list(profile.items()), z) + if bad: + slo, shi = base_two.moment(M, W, [(1, 32 * M * M * sum(profile.values()))], z) + blo += slo / 10**16; bhi += shi / 10**16 + assert (hi < 1 and bhi < 1) if accept else (lo > 1 and blo > 1) + bit = Q(baseline['bit_lower']); eta = beta = Q(1, 10**24) + s = min(bit, (1 - beta) * endpoint) - Q(1, 10**27) + chain = [Q(384599, 10**10)] + for _ in range(7): + old = chain[-1]; a = (1 - s) * s + s * old + gap = min(s - a, 1 - a - s, 1 - a - s * (1 - old), 1 - s) + assert old < a < s < 1 - a and gap > 0 + chain.append(a) + q = chain[-1] * (1 - 2 * eta) + ticks = (1 - eta) * q / (1 + q) * 10**18 + kappa = Q((ticks.numerator - 1) // ticks.denominator, 10**18) + bridge = {'semantic': {'C0': {'base': 2, 'exponent': 210000}, 'strict_literal_gap': 1}, + 'rows': {'degree_gap': Q(10**6) - Q(51 * 20161, 25)}} + assembled = outer.assembly(chain[-1], endpoint, bridge, kappa, eta=eta, beta=beta) + assert len(assembled['strict_constraints']) == 47 + assert all(x > 0 for x in assembled['strict_constraints'].values()) + try: + outer.assembly(chain[-1], endpoint, bridge, kappa + Q(1, 10**18), eta=eta, beta=beta) + except AssertionError: + pass + else: + raise AssertionError('next kappa grid point accepted') + return dict(endpoint=str(endpoint), endpoint_decimal=decimal(endpoint, 24), + kappa=str(kappa), kappa_decimal=decimal(kappa, 18)) + + +def group_context(rows, recipe): + ys = [int(s[k]) for s in recipe['stage_alignment'] for k in ('entry_Y', 'exit_Y')] + ys.append(int(recipe['terminal_Y_translation'])) + xs = [int(s[k]) for s in recipe['stage_alignment'] for k in ('entry_X', 'exit_X')] + stage = ys + xs + axes = [list(map(int, r['orthogonal_axes'])) for r in rows] + trans = [int(recipe['idle_children'][r['child']]['translation_after']) for r in rows] + k = len(rows) + # movable[d][l]: axes of donor d commuting with every axis of leaf l, all + # stage X/Y and terminal Y translations, and both terminal translations. + movable = [[None] * k for _ in range(k)] + for d in range(k): + for l in range(k): + if d != l: + fixed = axes[l] + stage + [trans[d], trans[l]] + movable[d][l] = frozenset(i for i, v in enumerate(axes[d]) + if all(dot(v, x) == 0 for x in fixed)) + return movable + + +def pair_edge(movable, i, j): + return len(movable[i][j]) >= 3 or len(movable[j][i]) >= 3 + + +def max_matching(k, edge): + @lru_cache(None) + def best(mask): + if not mask: return 0 + i = (mask & -mask).bit_length() - 1 + rest = mask & ~(1 << i) + value = best(rest) + for j in range(i + 1, k): + if rest >> j & 1 and edge(i, j): + value = max(value, 1 + best(rest & ~(1 << j))) + return value + return best((1 << k) - 1) + + +def star_flow(movable, centre, leaves, need): + """Max axes the centre can send: leaf l takes <= need distinct axes from + movable[centre][l]; each centre axis moves once (bipartite b-matching). + Returns {leaf: sorted centre-axis indices}.""" + slots = [(l, t) for l in leaves for t in range(need)] + match = {} + def augment(s, seen): + l = slots[s][0] + for ax in sorted(movable[centre][l]): + if ax in seen: continue + seen.add(ax) + if ax not in match or augment(match[ax], seen): + match[ax] = s; return True + return False + for s in range(len(slots)): + augment(s, set()) + sent = {l: [] for l in leaves} + for ax, s in match.items(): + sent[slots[s][0]].append(ax) + return {l: sorted(v) for l, v in sent.items()} + + +def cost(vec, a): + return sum(r ** (1 - a) for r in vec) + + +def partitions(items): + if not items: yield []; return + first, rest = items[0], items[1:] + for p in partitions(rest): + yield [[first]] + p + for i in range(len(p)): + yield p[:i] + [[first] + p[i]] + p[i + 1:] + + +def best_star(k, movable, a): + """Exact optimum of the disjoint-star class for one group at test exponent a. + + Enumerate set partitions of the k children; each block is a star with one + centre (or a singleton). Leaves receive up to CAP-48 = 3 axes from the centre. + Returns (sorted rank vector, [(centre, leaf, centre-axis indices)]).""" + best = None + for part in partitions(list(range(k))): + vec, moves = [], [] + for block in part: + if len(block) == 1: + vec.append(48); continue + options = [] + for c in block: + leaves = [x for x in block if x != c] + sent = star_flow(movable, c, leaves, CAP - 48) + v = [48 - sum(map(len, sent.values()))] + [48 + len(sent[l]) for l in leaves] + options.append((cost(v, a), v, [(c, l, sent[l]) for l in leaves if sent[l]])) + _, v, mv = min(options, key=lambda o: o[0]) + vec.extend(v); moves.extend(mv) + if best is None or cost(vec, a) < best[0] - 1e-12: + best = (cost(vec, a), sorted(vec), moves) + return best[1], best[2] + + +def main(): + ap = argparse.ArgumentParser(description=__doc__) + ap.add_argument('--replay-root', type=Path, + help='Optional extracted candidate/strict/global of selected-replay.tar.gz') + ap.add_argument('--no-price', action='store_true') + ap.add_argument('--check', action='store_true', + help='Recompute and compare with the committed RESULT.json and STAR-MOVES.json.gz; write nothing') + args = ap.parse_args() + raw = replay_inputs(args.replay_root) + frames, phases, audit = (parse(m, raw[m]) for m in MEMBERS) + owners = read(OWNER_MAP); baseline = json.loads(BASELINE.read_text()) + recipes = {x['port']: x for x in phases['recipes']} + roles = {(x['owner_replica'], x['port'], x['child']) for x in owners} + base_profile = Counter({int(k): v for k, v in audit['paid_profile'].items()}) + assert sum(r * n for r, n in base_profile.items()) == M * W - DEFICIT + + eligible, owner48 = defaultdict(list), defaultdict(list) + for row in frames: + if row['rank'] == 48 and row['hosted'] == 0 and row['pending_offset'] == 0: + key = (row['replica'], row['port'], row['child']) + (owner48 if key in roles else eligible)[row['replica'], row['port']].append(row) + n_elig = sum(map(len, eligible.values())); n_owner = sum(map(len, owner48.values())) + assert n_elig + n_owner == base_profile[48] and n_owner == 0 # owner map uses no idle 48 + sizes = Counter(len(v) for v in eligible.values()) + + a_test = 0.0016756 # near the endpoint; star choice is checked below to be a-invariant + pairs_total, relax, star = 0, Counter(), Counter() + star_alt = Counter(); star_moves = [] + for key, rows in sorted(eligible.items()): + k = len(rows) + relax.update([CAP] * (k - 1) + [48 * k - CAP * (k - 1)] if k > 1 else [48]) + movable = group_context(rows, recipes[key[1]]) + pairs_total += max_matching(k, lambda i, j: pair_edge(movable, i, j)) + vec, moves = best_star(k, movable, a_test) + star.update(vec); star_alt.update(best_star(k, movable, 0.01)[0]) + for c, l, idx in moves: + ca = list(map(int, rows[c]['orthogonal_axes'])) + star_moves.append(dict(replica=key[0], port=key[1], centre_child=rows[c]['child'], + leaf_child=rows[l]['child'], moved_axes=[str(ca[i]) for i in idx])) + + def with48(counter): + p = Counter(base_profile); p[48] -= sum(counter.values()); p.update(counter) + return {r: n for r, n in sorted((+p).items())} + + pair_profile = Counter(base_profile); pair_profile[48] -= 2 * pairs_total + pair_profile[45] += pairs_total; pair_profile[51] += pairs_total + profiles = { + 'baseline_1094': {r: n for r, n in sorted(base_profile.items())}, + PAIR: {r: n for r, n in sorted((+pair_profile).items())}, + 'star_class_optimum': with48(star), + 'relaxation_ceiling': with48(relax), + } + result = dict( + status='PASS_IDLE48_REPARTITION_CEILING', + replay_archive={str(REPLAY_TAR.relative_to(ROOT)): sha(REPLAY_TAR)}, + inputs={m: hashlib.sha256(raw[m]).hexdigest() for m in MEMBERS} + | {str(OWNER_MAP.relative_to(ROOT)): sha(OWNER_MAP), str(BASELINE.relative_to(ROOT)): sha(BASELINE)}, + eligible_children=n_elig, owner_slot_rank48_children=n_owner, + groups=len(eligible), group_size_histogram={str(k): v for k, v in sorted(sizes.items())}, + pair_class_maximum_pairs=pairs_total, + star_vector_invariant_between_a=[a_test, 0.01], star_vector_invariant=(star == star_alt), + star_rank_histogram={str(k): v for k, v in sorted(star.items())}, + relaxation_rank_histogram={str(k): v for k, v in sorted(relax.items())}, + profiles={name: {str(r): n for r, n in p.items()} for name, p in profiles.items()}, + ) + assert star == star_alt + if not args.no_price: + eng = tuple(load_engine(n) for n in ('moment', 'base_two_moment', 'outer')) + result['prices'] = {} + for name, p in profiles.items(): + result['prices'][name] = dict(native=price(p, False, baseline, eng), + conservative=price(p, True, baseline, eng)) + print(name, result['prices'][name]['native']['kappa_decimal'], file=sys.stderr) + P = {n: Q(v['native']['kappa']) for n, v in result['prices'].items()} + assert P['baseline_1094'] == Q(baseline['kappa']) + assert P['baseline_1094'] < P[PAIR] < P['star_class_optimum'] < P['relaxation_ceiling'] + # Control: deterministic random within-group repartitions (ranks in [1, 51], + # same child count and group mass) never price above the ceiling. + rng = random.Random(1094); controls = [] + for _ in range(4): + alt = Counter() + for rows in eligible.values(): + vec = [48] * len(rows) + for _ in range(6): + i, j = rng.randrange(len(vec)), rng.randrange(len(vec)) + t = min(rng.randint(0, 6), vec[i] - 1, CAP - vec[j]) if i != j else 0 + vec[i] -= t; vec[j] += t + alt.update(vec) + kap = Q(price(with48(alt), False, baseline, eng)['kappa']) + assert kap <= P['relaxation_ceiling'] + controls.append(dict(max_rank=max(alt), kappa=str(kap), below_ceiling=True)) + result['random_repartition_controls'] = controls + overlay = dict(schema='idle48-star-moves/1', source_frames_sha256=hashlib.sha256(raw[MEMBERS[0]]).hexdigest(), + moves=star_moves, profile=result['profiles']['star_class_optimum']) + payload = json.dumps(overlay, sort_keys=True, separators=(',', ':')).encode() + result['star_moves'] = len(star_moves) + result['star_moves_payload_sha256'] = hashlib.sha256(payload).hexdigest() + text = json.dumps(result, indent=2) + '\n' + if args.check: + assert (OUT / 'RESULT.json').read_text() == text, 'RESULT.json differs' + assert gzip.decompress((OUT / 'STAR-MOVES.json.gz').read_bytes()) == payload, 'STAR-MOVES differs' + print('PASS_IDLE48_REPARTITION_CEILING_RECOMPUTED', 'pairs=%d' % pairs_total) + return + gz = bytearray(gzip.compress(payload, mtime=0)); gz[9] = 255 + (OUT / 'STAR-MOVES.json.gz').write_bytes(bytes(gz)) + (OUT / 'RESULT.json').write_text(text) + print(result['status'], 'pairs=%d' % pairs_total) + + +if __name__ == '__main__': + main() diff --git a/research/frontier1094-idle-star-ceiling/verify.py b/research/frontier1094-idle-star-ceiling/verify.py new file mode 100644 index 0000000000..feb5f220df --- /dev/null +++ b/research/frontier1094-idle-star-ceiling/verify.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python3 +"""Independent structural check of STAR-MOVES.json.gz against the frozen #1094 replay. + +Does not import analyze.py. For every move it re-derives, from the frozen idle +frames and DATA-PHASES recipes, the PR1252 commuting rule applied per axis: +a moved axis must be orthogonal (Z2 symplectic dot 0 as used by PR1252) to all +original leaf axes, every stage entry/exit X and Y, the terminal Y translation, +and the terminal translations of both centre and leaf. It then checks the +resulting axis sets, the group axis unions, the rank profile, the halving guard +and RESULT.json. Mutation controls must each be rejected. +""" +import argparse, tarfile, copy, gzip, hashlib, json +from collections import Counter, defaultdict +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +OUT = Path(__file__).resolve().parent +OWNER_MAP = ROOT / 'research/complex-t16-rare-pattern-exchanges/OWNERS.json.gz' + + +def read(p): + raw = Path(p).read_bytes() + return json.loads(gzip.decompress(raw) if str(p).endswith('.gz') else raw) + + +REPLAY_TAR = ROOT / 'research/community-frontier1094-audit/selected-replay.tar.gz' +MEMBERS = ('hosted/IDLE-REMAINDER-FRAMES.json.gz', 'base/work/complex-nine-native/DATA-PHASES.json', + 'audit/OWNERS-AND-PROFILE.json') + + +def replay_inputs(root): + """{member: raw bytes}; read from the committed selected replay unless a + pre-extracted candidate/strict/global directory is given.""" + if root is not None: + return {m: (Path(root) / m).read_bytes() for m in MEMBERS} + with tarfile.open(REPLAY_TAR) as tar: + return {m: tar.extractfile('candidate/strict/global/' + m).read() for m in MEMBERS} + + +def parse(name, raw): + return json.loads(gzip.decompress(raw) if name.endswith('.gz') else raw) + + +def sha(p): return hashlib.sha256(Path(p).read_bytes()).hexdigest() +def dot(a, b): return (a & b).bit_count() & 1 + + +def gf2_rank(vs): + piv = {} + for x in vs: + while x: + b = x.bit_length() - 1 + if b in piv: x ^= piv[b] + else: piv[b] = x; break + return len(piv) + + +def check(moves, frames, recipes, roles, base_profile): + old = {(r['replica'], r['port'], r['child']): r for r in frames} + axes = {k: [int(v) for v in r['orthogonal_axes']] for k, r in old.items()} + new = {k: list(v) for k, v in axes.items()} + centres, leaves, moved_ids = set(), Counter(), set() + for m in moves: + rep, port = m['replica'], m['port'] + c, l = (rep, port, m['centre_child']), (rep, port, m['leaf_child']) + assert c != l and c in old and l in old + for k in (c, l): + r = old[k] + assert r['rank'] == 48 and r['hosted'] == 0 and r['pending_offset'] == 0 + assert k not in roles + centres.add(c); leaves[l] += 1 + rec = recipes[port] + fixed = ([int(s[q]) for s in rec['stage_alignment'] for q in ('entry_Y', 'exit_Y', 'entry_X', 'exit_X')] + + [int(rec['terminal_Y_translation'])] + + [int(rec['idle_children'][k[2]]['translation_after']) for k in (c, l)]) + mv = [int(v) for v in m['moved_axes']] + assert 1 <= len(mv) <= 3 + for v in mv: + assert v in axes[c] and (c, v) not in moved_ids + moved_ids.add((c, v)) + assert all(dot(v, x) == 0 for x in axes[l] + fixed) + new[c].remove(v); new[l].append(v) + assert not (centres & set(leaves)) and max(leaves.values()) == 1 # disjoint stars + groups = defaultdict(lambda: [Counter(), Counter()]) + for k in old: + a = new[k] + assert all(dot(x, y) == (i == j) for i, x in enumerate(a) for j, y in enumerate(a)) + assert gf2_rank(a) == len(a) and 1 <= len(a) <= 51 + groups[k[:2]][0].update(axes[k]); groups[k[:2]][1].update(a) + assert all(u == v for u, v in groups.values()) # group axis multiset unchanged + profile = Counter(base_profile) + profile.subtract(len(axes[k]) for k in old); profile.update(len(new[k]) for k in old) + profile = +profile + assert 73 ** 2 > 2 * max(profile) ** 2 + return {str(r): n for r, n in sorted(profile.items())}, len(set(leaves)), len(centres) + + +def main(): + ap = argparse.ArgumentParser(description=__doc__) + ap.add_argument('--replay-root', type=Path, + help='Optional extracted candidate/strict/global of selected-replay.tar.gz') + raw = replay_inputs(ap.parse_args().replay_root) + result = json.loads((OUT / 'RESULT.json').read_text()) + overlay = read(OUT / 'STAR-MOVES.json.gz') + for m in MEMBERS: + assert result['inputs'][m] == hashlib.sha256(raw[m]).hexdigest(), m + assert result['inputs'][str(OWNER_MAP.relative_to(ROOT))] == sha(OWNER_MAP) + assert overlay['source_frames_sha256'] == result['inputs'][MEMBERS[0]] + frames = parse(MEMBERS[0], raw[MEMBERS[0]]) + recipes = {x['port']: x for x in parse(MEMBERS[1], raw[MEMBERS[1]])['recipes']} + roles = {(x['owner_replica'], x['port'], x['child']) for x in read(OWNER_MAP)} + base = Counter({int(k): v for k, v in parse(MEMBERS[2], raw[MEMBERS[2]])['paid_profile'].items()}) + moves = overlay['moves'] + profile, n_leaves, n_centres = check(moves, frames, recipes, roles, base) + assert profile == overlay['profile'] == result['profiles']['star_class_optimum'] + assert n_leaves == len(moves) == result['star_moves'] + + # Mutation controls: each must be rejected. + def first_noncommuting(): + m = moves[0]; rep, port = m['replica'], m['port'] + rows = {r['child']: r for r in frames if (r['replica'], r['port']) == (rep, port)} + leaf = [int(v) for v in rows[m['leaf_child']]['orthogonal_axes']] + for v in rows[m['centre_child']]['orthogonal_axes']: + if any(dot(int(v), x) for x in leaf): return str(v) + bad = first_noncommuting() + controls = {} + def mutate(name, fn): + mm = copy.deepcopy(moves); fn(mm) + try: + check(mm, frames, recipes, roles, base) + except (AssertionError, KeyError, ValueError): + controls[name] = 'rejected' + else: + controls[name] = 'ACCEPTED' + mutate('noncommuting_axis', lambda mm: mm[0]['moved_axes'].__setitem__(0, bad)) + by_centre = defaultdict(list) + for i, m in enumerate(moves): + by_centre[m['replica'], m['port'], m['centre_child']].append(i) + i, j = next(v for v in by_centre.values() if len(v) >= 2)[:2] + hosted_leaf = next((r['replica'], r['port'], r['child']) for r in frames if r['hosted'] > 0) + mutate('axis_moved_twice', lambda mm: mm[j].__setitem__('moved_axes', list(mm[i]['moved_axes']))) + mutate('leaf_reused', lambda mm: mm[j].__setitem__('leaf_child', mm[i]['leaf_child'])) + mutate('fourth_axis_rank52', lambda mm: (mm[i]['moved_axes'].append(mm[j]['moved_axes'].pop()))) + mutate('foreign_axis', lambda mm: mm[0]['moved_axes'].__setitem__(0, str(1 << 72 | 1))) + mutate('hosted_leaf', lambda mm: mm[0].update(replica=hosted_leaf[0], port=hosted_leaf[1], + leaf_child=hosted_leaf[2])) + mutate('centre_also_leaf', lambda mm: mm.append(dict(mm[i], centre_child=mm[i]['leaf_child'], + leaf_child=mm[i]['centre_child']))) + assert all(v == 'rejected' for v in controls.values()), controls + receipt = dict(status='PASS_INDEPENDENT_IDLE48_STAR_OVERLAY', moves=len(moves), + leaves=n_leaves, centres=n_centres, profile=profile, mutation_controls=controls, + checks=['per-axis PR1252 commuting rule', 'orthonormal resulting axis sets', + 'group axis multisets unchanged', 'disjoint stars, leaves <= 51', + 'no owner-map slots, no hosted/pending children', 'halving guard 73^2 > 2*51^2', + 'profile equals RESULT.json star_class_optimum'], + not_checked=['serialized controller/owner audit', 'mixed-provider invoice', + 'strict global assembly and its negative controls']) + (OUT / 'STAR-AUDIT.json').write_text(json.dumps(receipt, indent=2) + '\n') + print(receipt['status'], 'moves=%d' % len(moves), 'controls=%d/%d rejected' % ( + sum(v == 'rejected' for v in controls.values()), len(controls))) + + +if __name__ == '__main__': + main()