diff --git a/research/rank8-4470-entrance-count/README.md b/research/rank8-4470-entrance-count/README.md new file mode 100644 index 0000000000..aa04a92148 --- /dev/null +++ b/research/rank8-4470-entrance-count/README.md @@ -0,0 +1,174 @@ +# #4470 monotone rooms miss the rank-8/u2 cell + +**Negative result. No new κ.** The selected conditional exponent stays +`605457647/200000000000` (`0.003027288235`). This package does not touch that +record, and it does not read the selected k8 word. + +The integer cell in ToikY's `research/lever-integer-twins` puts paid mass +5586 at `{8:698, 2:1}` on a call. Open question 2 of +`research/rank8-u2-entrance-obstruction` asks whether the #4470 +productive-helper frames supply at least 698 monotone rank-8 slots. They do +not. This count uses only the #4470 endpoint frames. + +## Contract + +There are 632 persistent fields: 224 main fields and 408 helpers. Frames are +subspaces of \(\mathbb{F}_2^9\). A monotone chain on a field climbs from its +pinned entrance to its pinned exit, so its parts are positive integers summing +to at most \(\dim(\mathrm{exit}) - \dim(\mathrm{entrance})\). One such chain +holds at most one part of size 8, because every room has size at most 9. + +The census applies the parent helper-boundary edits and the #4470 entrance/exit +edits to the pinned canonical frames. Scalar-contact edits, including the +missing-join B/480 patch, retarget events and do not change these 632 endpoint +indices. Every exit contains its entrance. The room histogram is + +```text +{9:326, 8:271, 7:7, 4:28}. +``` + +| Fields | Count | Entrance | Exit | Room | +|---|---:|---|---|---:| +| Main fields | 112 | dimension 1 | dimension 9 | 8 | +| Main fields | 112 | dimension 0 | dimension 8 | 8 | +| Helpers | 326 | | | 9 | +| Helpers | 47 | | | 8 | +| Helpers | 7 | | | 7 | +| Helpers | 28 | | | 4 | + +The helper rows are the published profile `{4:28, 7:7, 8:47, 9:326}`, and +their rank mass is the published 3471. Main boundaries stay the original 224 +indices. There are `224 + 326 + 47 = 597` rooms of size at least 8. + +## Result + +597 is strictly less than 698, so the cell `{8:698, 2:1}` is not a monotone +histogram on these endpoints. The same rooms sum to + +```text +9·326 + 8·271 + 7·7 + 4·28 = 5263, +``` + +which is strictly less than 5586. No assignment of mass 5586 fits, with or +without the rank-8 cap. The feasible set priced by the k8 checker is empty +here, so this package does not recompute that moment. + +Replacing every pinned exit by the whole space, and keeping these entrances, +is a larger model. Entrance dimensions are `{0:470, 1:159, 2:1, 5:2}`, so the +rooms become `{9:470, 8:159, 7:1, 4:2}`. That model has 629 rank-8 slots and +capacity 5517. Both are still short: 629 < 698 and 5517 < 5586. The 32 slots +gained by the enlargement are exactly the fields whose pinned room is 4 or 7 +and whose entrance dimension is 0 or 1. The three fields with entrance +dimension 2 or 5 already exit at dimension 9 and stay below 8. + +The pinned native word, which these patches do not edit, has eight fused +rank-8 center jobs on owned register 0 in each orientation (a 3+5 pair, fused). +Charging those eight jobs as eight extra rooms of size 8 raises the two slot +counts to 605 and 637, and the two capacities to 5327 and 5581. All four +numbers remain strictly below the cell. One owned register would add at most +one room; the eight-job reading is the looser upper bound. + +## What was not shown + +Non-monotone paths, extra registers, and the selected #5413 frames are outside +this certificate. The k8 file's 648 slots are a different entrance table; this +checker rejects that number. Unknown restoration, precision and consumer costs +are not zero. No producer, consumer, or new exponent is claimed. + +The predecessor's three-step centre comparison and its 16/17 moment control +stay on the k8 word. They are not rerun. + +## Scope + +Card `complex-new-helper-inventory`, priority revision 7, base +`32890bc5de034ab8fc93ac88ead7279a6a416d04`. Scope status is **refined**. The +card asks for a new helper inventory with a favorable full bill. The bounded +question here is the open #4470 transfer of the monotone rank-8 obstruction. +The answer is that these frames do not host the cell. + +Ordered eligible list for session r39, rebuilt on 2026-10-25 against +`32890bc5de034ab8fc93ac88ead7279a6a416d04`. The order is the one recorded in +`research/f2-six-difference-basis`: open handoffs from the 19 October index, +then priority-table rows whose stated next decision is still open, then +catalogue cards that are not already one of those rows. Dropped before the +cut: work this account already delivered, questions closed on current main, +questions covered by an open pull request, and topics already on a fork +`cursor/*` branch. + +1. Caller that accepts `(w, q, v_N)` without restoring the original source + slots (discussion comment 19030045). Distinct from the encoded-exit + consumer, the `(N-P)⊗M` consumer, and open #5517. +2. Cost to place `L561` onto the four scratch windows before `L546 −= L561`. + The delivered move bill starts after placement. +3. PR2809 serializer reading: an ancestor chain, or one root-sized stream per + cut. The `O_q(V)` arithmetic does not bind that reading. +4. Matched parent park/restore versus the external-call bill for the #4166 + caller. Open #4167 and #4172 do not state that comparison. +5. Fixed-tape visit count of one blank-return of the 9475-row parent, + including cursor motion across the 124 omitted coordinates. The delivered + factor `9475·3^124` is the payload, not that invoice. +6. Whether the idle `{3:22783, 5:1625, 48:138492}` is a feasible pattern + vector of the 841-pattern program. The delivered moment comparison does + not enumerate patterns. +7. This package. + +A cached overlap search on 2026-10-25 (393 open pull requests, 4819 discussion +records, local notes at this base) found the predecessor histogram and its +#1166 handoff. Both say that certificate does not read the #4470 word. No +note stated the histograms `{9:326, 8:271, 7:7, 4:28}` or +`{9:470, 8:159, 7:1, 4:2}`. Coverage is not a novelty proof. + +## Reproduce + +Python 3.12, standard library only, from the repository root: + +```sh +python3 -B research/rank8-4470-entrance-count/verify.py +python3 -B scripts/research_package.py --package research/rank8-4470-entrance-count +``` + +Expected line: + +```text +PASS_RANK8_4470_ENTRANCE_COUNT slots=597/629 capacity=5263/5517 with_centers=605/637/5327/5581 ideal=698 mass=5586 helpers=4:28,7:7,8:47,9:326 no_new_kappa +``` + +The two slot numbers are the pinned exits and the full-space exits. The four +`with_centers` numbers are those counts and capacities after adding eight +rooms of size 8. The checker hashes the canonical frames, the native word, +both boundary patches, the join patch, and the selected record. It rebuilds +the rooms by elimination, locks the published helper profile and the +predecessor profile obtained by skipping the #4470 boundary edits, and rejects +a dependent basis, a non-nested exit, and an unpaired center event. Not run: +Lean, Docker, the selected cold replay, column replay, and any non-monotone +search. + +## Open next questions + +1. Do the selected #5413 frames have at least 698 monotone rank-8 slots? + This obstruction is about the #4470 endpoints. The selected frontier has + since moved, and a short count there would say whether the same cell is + still blocked. The first step is this same + `dim(exit) − dim(entrance)` census on that word's own persistent fields. + The blocker is that those frames are a different file; substituting 597 + or 629 would mix two templates. +2. Can one #4470 field emit two rank-8 parts by leaving its pinned exit and + returning? The full-space reading is still 69 slots short of 698, so + another part has to come from a changed path law. The first step is one + explicit climb, descent, and second climb, with the paid histogram of + that trace alone. The blocker is the nested-transport contract: a descent + is not a monotone room and needs its own restoration bill. + +## Credit + +The cell `{8:698, 2:1}` and the mass 5586 are ToikY's +`research/lever-integer-twins`, following Nick Petalas's PR #3874. The #4470 +frames, the helper profile `{4:28, 7:7, 8:47, 9:326}`, and the predecessor +profile `{4:26, 5:2, 7:29, 8:42, 9:309}` are Cinna Davis's joint helper +lattice, on zxv's native word and the PR4441/PR4447 boundary lineage. The +question is open question 2 of unpaidmoon's +`research/rank8-u2-entrance-obstruction`. This note does not reuse that +package's entrance table. + +Prepared by unpaidmoon with substantial Cursor Grok assistance. Apache-2.0. +No independent human review and no formal-kernel acceptance are claimed. diff --git a/research/rank8-4470-entrance-count/SOURCES.json b/research/rank8-4470-entrance-count/SOURCES.json new file mode 100644 index 0000000000..5097851222 --- /dev/null +++ b/research/rank8-4470-entrance-count/SOURCES.json @@ -0,0 +1,48 @@ +{ + "schema_version": 1, + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "fc3d4ba105e1f097d0d7d051a308281e86ab1446", + "sha256": "66974efdced4083c00025f97d95d83909a226cdf801edb9301c195c6641f6903" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + }, + { + "path": "research/fresh-helper-boundary/CHANGES.json", + "usage": "input", + "git_blob": "45744fedd0e28967aa72586048b8bc0c72f419a9", + "sha256": "cde73b8ff5b3c0d06e69e2293b991b24fd14a16dd4ccab7ff6b3439074a94624" + }, + { + "path": "research/joint-helper-lattice/PATCH.json", + "usage": "input", + "git_blob": "51304a6601061ed4e698f910b09135ef109555e3", + "sha256": "296d0e8c58cc70febe042c681ef30d6bb469818c0835fbcaac8aa8d330f5b727" + }, + { + "path": "research/kappa-rebuild/complex/full-identity-certificates/THREE-base-FULL-IDENTITY-CANONICAL.json.gz", + "usage": "input", + "git_blob": "4a8c4ed26e53a72362d571c972e65aff546be784", + "sha256": "6418ec3da24d548a57f5c3fe5b9062c26c9478e638504a61c387f5cfb5f4ed61" + }, + { + "path": "research/kappa-rebuild/complex/full-identity-certificates/THREE-base-FULL-IDENTITY-NATIVE.json.gz", + "usage": "input", + "git_blob": "b46d44c6ee624968dd57be928b0c15d9d45f3b2c", + "sha256": "c54b0a3e129d28e6dbf74fa731fc3bb70fe3c6705f07256750fbecddcc842d39" + }, + { + "path": "research/missing-join-frame/PATCH.json", + "usage": "input", + "git_blob": "f96d295d40014d4dd503f58eb3cdabcbb4b8e101", + "sha256": "9ab5328245ff02c9d0be21d39bcc375f50bc5d7909e9f7b9a3a9a6f812f5bd6e" + } + ] +} diff --git a/research/rank8-4470-entrance-count/TASK.json b/research/rank8-4470-entrance-count/TASK.json new file mode 100644 index 0000000000..6dc4bbff48 --- /dev/null +++ b/research/rank8-4470-entrance-count/TASK.json @@ -0,0 +1,72 @@ +{ + "schema_version": 1, + "task_id": "complex-new-helper-inventory", + "priority_revision": 7, + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "original_card": { + "id": "complex-new-helper-inventory", + "question": "Can a new local cost interface change the deficit-to-recursive-cost ratio beyond current packing?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/heterogeneous-owner-assembly/README.md", + "certificates/selected-result.json", + "research/selected-k8-unrestricted-ends/README.md" + ], + "methods": [ + "Propose a changed helper inventory and derive an optimistic exact moment.", + "Design a small completed instance and independently verify its endpoint and rank bill." + ], + "acceptance_gate": "A new physically realizable contract outside the frozen catalogue whose per-call profile, screened with ceiling.ceiling(), beats the selected word's packing ceiling; a lower cap does not establish identical circuitry or order attainable optima, and is insufficient to pass the stronger-budget target under this model. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Before any synthesis, write the candidate per-call local profile (and centre charge / unpaid coordinates if changed) and screen it with ceiling.ceiling(); reject it if even the ideal ceiling does not beat the selected word's by your stated margin.", + "bottleneck_link": "Packing of the selected word is capped at +0.87% (ceiling model); only a lower local excess spend or a changed coverage law raises the cap.", + "allowed_variations": [ + "Narrow to one changed boundary or helper type with explicit counts.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Mixing only providers already inside the pinned catalogue.", + "Only changing helper terminal subspaces and monotone frames within the fixed scalar word, entrances and cleanup contract already covered by #1995/#2013.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "helper inventory", + "heterogeneous-owner", + "mutable leaver" + ] + }, + "scope_status": "refined", + "actual_scope": "On the #4470 canonical frames, after the pinned helper-boundary edits, every one of the 632 persistent fields has a nested F_2^9 endpoint pair. The monotone rooms are {9:326, 8:271, 7:7, 4:28}: 597 slots of size at least 8 and total capacity 5263. The u=2 cell needs 698 rank-8 children and mass 5586, so it does not fit. Raising every exit to the whole space still leaves 629 slots and capacity 5517. Adding the eight retained center jobs as extra rooms of size 8 still leaves both readings short.", + "scope_change_reason": "The card asks for a new helper inventory whose fully charged profile beats the packing ceiling. This package answers the open transfer of the monotone rank-8 obstruction onto the #4470 frames and stops because the cell does not fit those rooms. It does not propose another ideal ceiling.", + "bottleneck_link": "The complex child-rank lever is what the u=2 cell uses to aim at a=1/98. A monotone word on the #4470 endpoints cannot reach 698 rank-8 parts, or even mass 5586. Selected kappa is unchanged.", + "budget_minutes": 60, + "stop_rule": "Stop when the pinned-exit census and the full-space upper bound are both strictly below 698 slots and both capacities are strictly below 5586. Do not replay columns, search non-monotone words, or rerun the selected cold replay.", + "outcome": "negative-result", + "evidence": "python3 -B research/rank8-4470-entrance-count/verify.py prints PASS_RANK8_4470_ENTRANCE_COUNT slots=597/629 capacity=5263/5517 with_centers=605/637/5327/5581 ideal=698 mass=5586 helpers=4:28,7:7,8:47,9:326 no_new_kappa.", + "author": "unpaidmoon", + "ai_assistance": "Substantial Cursor Grok assistance on the endpoint census, the full-space upper bound, and the verifier.", + "open_questions": [ + { + "question": "Do the selected #5413 frames have at least 698 monotone rank-8 slots?", + "why_it_matters": "This obstruction is about the #4470 endpoints. The selected frontier has moved to the #5413 completion, so the same cell might or might not fit that later frame file.", + "first_step": "Count dim(exit)-dim(entrance) on the #5413 persistent fields and compare the number of rooms of size at least 8 with 698.", + "blocked_by": "The #5413 frames are a different file. Substituting the #4470 counts 597 or 629 would mix two templates." + }, + { + "question": "Can one #4470 field emit two rank-8 parts by leaving its pinned exit and returning?", + "why_it_matters": "The full-space reading still has only 629 monotone rank-8 slots, 69 short of 698. A second part on one field would be a changed path law, not a larger monotone room.", + "first_step": "Write one explicit climb, descent, and second climb on a single #4470 field, and record the paid histogram of that trace alone.", + "blocked_by": "The nested-transport contract charges only the endpoint difference. A descent needs its own restoration bill before it can be counted as extra rank-8 capacity." + } + ] +} diff --git a/research/rank8-4470-entrance-count/VERIFY.json b/research/rank8-4470-entrance-count/VERIFY.json new file mode 100644 index 0000000000..3e93a9392c --- /dev/null +++ b/research/rank8-4470-entrance-count/VERIFY.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/fresh-helper-boundary/CHANGES.json", + "research/joint-helper-lattice/PATCH.json", + "research/kappa-rebuild/complex/full-identity-certificates/THREE-base-FULL-IDENTITY-CANONICAL.json.gz", + "research/kappa-rebuild/complex/full-identity-certificates/THREE-base-FULL-IDENTITY-NATIVE.json.gz", + "research/missing-join-frame/PATCH.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 60, + "checks": "Pinned #4470 endpoint rooms, the full-terminal upper bound, the eight center jobs, predecessor and failure controls, and the selected kappa pin." + } + ] +} diff --git a/research/rank8-4470-entrance-count/verify.py b/research/rank8-4470-entrance-count/verify.py new file mode 100644 index 0000000000..7f6f1fff6b --- /dev/null +++ b/research/rank8-4470-entrance-count/verify.py @@ -0,0 +1,269 @@ +#!/usr/bin/env python3 +"""The #4470 frames have fewer monotone rank-8 slots than the u=2 cell needs. + +Endpoint census only. This file does not import the joint constructor, does not +replay columns, and does not read the selected k8 word. No new kappa. +""" +import gzip +import hashlib +import json +from collections import Counter +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +CANONICAL = "research/kappa-rebuild/complex/full-identity-certificates/THREE-base-FULL-IDENTITY-CANONICAL.json.gz" +NATIVE = "research/kappa-rebuild/complex/full-identity-certificates/THREE-base-FULL-IDENTITY-NATIVE.json.gz" +PARENT = "research/fresh-helper-boundary/CHANGES.json" +PATCH = "research/joint-helper-lattice/PATCH.json" +JOIN = "research/missing-join-frame/PATCH.json" +SELECTED = "certificates/selected-result.json" +SHA = { + CANONICAL: "6418ec3da24d548a57f5c3fe5b9062c26c9478e638504a61c387f5cfb5f4ed61", + NATIVE: "c54b0a3e129d28e6dbf74fa731fc3bb70fe3c6705f07256750fbecddcc842d39", + PARENT: "cde73b8ff5b3c0d06e69e2293b991b24fd14a16dd4ccab7ff6b3439074a94624", + PATCH: "296d0e8c58cc70febe042c681ef30d6bb469818c0835fbcaac8aa8d330f5b727", + JOIN: "9ab5328245ff02c9d0be21d39bcc375f50bc5d7909e9f7b9a3a9a6f812f5bd6e", + SELECTED: "66974efdced4083c00025f97d95d83909a226cdf801edb9301c195c6641f6903", +} +HELPERS = {9: 326, 8: 47, 7: 7, 4: 28} +OLD_HELPERS = {9: 309, 8: 42, 7: 29, 5: 2, 4: 26} +ROOMS = {9: 326, 8: 271, 7: 7, 4: 28} +ENTRANCES = {0: 470, 1: 159, 2: 1, 5: 2} +FULL_ROOMS = {9: 470, 8: 159, 7: 1, 4: 2} +MAIN_PAIRS = {(1, 9): 112, (0, 8): 112} +MASS = 5586 +IDEAL_EIGHTS = 698 +KAPPA = "605457647/200000000000" + + +def fail(why): + raise ValueError(why) + + +def need(ok, why): + if not ok: + fail(why) + + +def load_bytes(path): + data = (ROOT / path).read_bytes() + need(hashlib.sha256(data).hexdigest() == SHA[path], "sha256 changed for " + path) + return data + + +def load_json(path): + data = load_bytes(path) + if path.endswith(".gz"): + data = gzip.decompress(data) + return json.loads(data) + + +def reduced(basis): + """Unique reduced basis of an F_2^9 subspace.""" + pivots = {} + for value in basis: + need(type(value) is int and 0 < value < 512, "frame vector outside F2^9") + row = value + for bit in sorted(pivots, reverse=True): + if row & (1 << bit): + row ^= pivots[bit] + if row: + bit = row.bit_length() - 1 + for other in list(pivots): + if pivots[other] & (1 << bit): + pivots[other] ^= row + pivots[bit] = row + return tuple(pivots[bit] for bit in sorted(pivots, reverse=True)) + + +def independent(basis): + row = tuple(basis) + red = reduced(row) + need(len(red) == len(row), "dependent frame basis") + return red + + +def room_of(entrance, exit_frame): + left = independent(entrance) + right = independent(exit_frame) + need(len(reduced(left + right)) == len(right), "exit does not contain entrance") + return len(right) - len(left) + + +def boundaries(apply_joint): + canonical = load_json(CANONICAL) + frames = [independent(row) for row in canonical["frames"]] + start = [int(index) for index in canonical["start"]] + final = [int(index) for index in canonical["final"]] + need(len(start) == len(final) == 632, "632 persistent fields") + original_main = (tuple(start[:224]), tuple(final[:224])) + parent = load_json(PARENT) + need(set(parent) == {"entrances", "exits", "gates"}, "parent boundary file") + need(len(parent["entrances"]) == 117 and len(parent["exits"]) == 42, "parent boundary counts") + need(len(parent["gates"]) == 395, "parent scalar-contact count") + for gate in parent["gates"]: + need(len(gate) == 4 and isinstance(gate[0], str), "parent gate is not a boundary edit") + for label, field in (("entrances", start), ("exits", final)): + seen = set() + for role, old, new in parent[label]: + need(224 <= role < 632 and role not in seen, "parent helper domain") + seen.add(role) + need(field[role] == old and 0 <= new < len(frames), "parent boundary pin") + field[role] = new + if apply_joint: + patch = load_json(PATCH) + need(patch["source_head"] == "322e0ec764aa7ef7801383feb1f656e460dd8bed", "patch predecessor") + seen = set() + counts = Counter() + for change in patch["changes"]: + phase, ordinal = change["phase"], change["ordinal"] + key = (phase, ordinal) + need(key not in seen, "duplicate patch location") + seen.add(key) + old = independent(change["old"]) + new = independent(change["new"]) + need(old != new, "unchanged patch entry") + counts[phase] += 1 + if phase in ("entrance", "exit"): + need(224 <= ordinal < 632, "patch changes a non-helper boundary") + field = start if phase == "entrance" else final + need(reduced(frames[field[ordinal]]) == old, "patch boundary source pin") + frames.append(new) + field[ordinal] = len(frames) - 1 + else: + need(phase in ("A", "B", "cleanup_tail"), "unknown patch phase") + need( + dict(counts) == {"A": 21, "B": 238, "cleanup_tail": 155, "entrance": 38, "exit": 47}, + "patch phase counts", + ) + need((tuple(start[:224]), tuple(final[:224])) == original_main, "main boundaries moved") + return frames, start, final + + +def census(frames, start, final): + rooms, helpers, entrances, full_rooms, main_pairs = ( + Counter() for _ in range(5) + ) + for register in range(632): + entrance = frames[start[register]] + exit_frame = frames[final[register]] + gap = room_of(entrance, exit_frame) + rooms[gap] += 1 + dimension = len(independent(entrance)) + entrances[dimension] += 1 + full_rooms[9 - dimension] += 1 + if register < 224: + main_pairs[(dimension, len(independent(exit_frame)))] += 1 + else: + helpers[gap] += 1 + return rooms, helpers, entrances, full_rooms, main_pairs + + +def slots_of(histogram): + need(all(rank < 16 for rank in histogram), "a room can hold two rank-8 parts") + return sum(count for rank, count in histogram.items() if rank >= 8) + + +def mass_of(histogram): + return sum(rank * count for rank, count in histogram.items()) + + +def center_jobs(program): + index = 0 + jobs = 0 + while index < len(program): + event = program[index] + if event[0] != "center": + index += 1 + continue + need(index + 1 < len(program), "unpaired center event") + second = program[index + 1] + need( + second[0] == "center" and event[1] == second[1] == 0 and event[3] == second[2], + "center split does not stay on register 0", + ) + need(sorted((event[4], second[4])) == [3, 5], "center job is not the retained 3+5 pair") + jobs += 1 + index += 2 + return jobs + + +def expect_fail(action, why): + try: + action() + except ValueError: + return + fail("negative control passed: " + why) + + +def join_shape(): + join = load_json(JOIN) + need( + set(join) == { + "phase", + "ordinal", + "old_frame", + "new_basis", + "old_basis", + "incoming_frames", + "outgoing_frames", + }, + "join patch grew a boundary field", + ) + need((join["phase"], join["ordinal"]) == ("B", 480), "join patch is not the pinned scalar contact") + independent(join["new_basis"]) + independent(join["old_basis"]) + + +def main(): + join_shape() + frames, start, final = boundaries(True) + rooms, helpers, entrances, full_rooms, main_pairs = census(frames, start, final) + need(dict(rooms) == ROOMS, "pinned room histogram") + need(dict(helpers) == HELPERS, "published helper profile") + need(sum(helpers.values()) == 408, "408 helpers") + need(dict(entrances) == ENTRANCES, "entrance dimensions") + need(dict(full_rooms) == FULL_ROOMS, "full-terminal room histogram") + need(dict(main_pairs) == MAIN_PAIRS, "main endpoint pairs") + need(mass_of(helpers) == 3471, "published helper rank mass") + slots = slots_of(rooms) + full_slots = slots_of(full_rooms) + capacity = mass_of(rooms) + full_capacity = mass_of(full_rooms) + need(slots == 597 and full_slots == 629, "rank-8 slot counts") + need(capacity == 5263 and full_capacity == 5517, "monotone capacities") + need(slots < IDEAL_EIGHTS and full_slots < IDEAL_EIGHTS, "ideal cell fits") + need(capacity < MASS and full_capacity < MASS, "mass 5586 fits") + need(8 * IDEAL_EIGHTS + 2 == MASS, "ideal cell mass") + need(slots != 648, "k8 slot count was reused") + programs = load_json(NATIVE) + need(set(programs) == {"forward", "backward"}, "both native orientations") + jobs = {name: center_jobs(program) for name, program in programs.items()} + need(jobs == {"forward": 8, "backward": 8}, "eight fused center jobs") + need(slots + 8 == 605 and full_slots + 8 == 637, "center-event slot upper bound") + need(capacity + 64 == 5327 and full_capacity + 64 == 5581, "center-event mass upper bound") + need(605 < IDEAL_EIGHTS and 637 < IDEAL_EIGHTS, "center-event slots reach 698") + need(5327 < MASS and 5581 < MASS, "center-event mass reaches 5586") + old_frames, old_start, old_final = boundaries(False) + old_rooms, old_helpers, _, _, _ = census(old_frames, old_start, old_final) + need(dict(old_helpers) == OLD_HELPERS, "predecessor helper profile") + need(dict(old_rooms) != ROOMS and slots_of(old_rooms) == 575, "joint patch did not move the census") + expect_fail(lambda: independent((1, 1)), "dependent basis") + expect_fail(lambda: room_of((1,), (2,)), "non-nested exit") + expect_fail(lambda: center_jobs([["center", 0, 1, 2, 5]]), "unpaired center") + selected = load_json(SELECTED) + need(selected["kappa"] == KAPPA, "selected kappa record changed") + print( + "PASS_RANK8_4470_ENTRANCE_COUNT" + " slots=597/629" + " capacity=5263/5517" + " with_centers=605/637/5327/5581" + " ideal=698" + " mass=5586" + " helpers=4:28,7:7,8:47,9:326" + " no_new_kappa" + ) + + +if __name__ == "__main__": + main()