diff --git a/research/retained-warp-opcode-dimension/PROOF.md b/research/retained-warp-opcode-dimension/PROOF.md new file mode 100644 index 0000000000..8fe1635476 --- /dev/null +++ b/research/retained-warp-opcode-dimension/PROOF.md @@ -0,0 +1,140 @@ +# No retained warp opcode changes dimension + +This is a scoped proof about one recorded alphabet. The selected value stays +`363005817/100000000000`. The impossibility is the chart-image law on this +alphabet. Every other warp alphabet stays outside the statement. + +The word is the pinned round-three centre word +`research/sol1337-contact-frontier/inputs/round3-native.json.gz`, SHA-256 +`7679daa4ec6a40f56fc7f0202379a6f454310e94945aba4f48beaaaafb838d05`, the same +bytes `retained_verify.SOURCE_HASH` names. Cao Yifan / intqwq, PR #4610, is +the source of the word. The open question is the second question of PR #7102: +the 240 emitted warps preserve dimension, and a dimension-changing warp would +be a different alphabet. This note answers that question for the alphabet the +word already records. + +## Hypotheses + +The ambient space is `GF(2)^9`. `canonical["h"]` is 9. Every chart basis +vector is an integer in `0..511`, and the retained span test makes the basis +independent. The dimension of a chart is the length of that basis. + +The recorded alphabet is `canonical["warps"]`. It is a list of 72 records +whose `op` fields are exactly `1..72` in that order. Record `k` stores a +source chart `from_frame`, a destination chart `to_frame`, and nine columns +`G_columns`. Those columns define the linear map `G_k` by + +```text +G_k(x) = xor of column i over each bit i set in x. +``` + +The retained inverse opcode `-k` is the column-wise inverse used by +`model.inv`: the unique vectors sent to the standard basis. The emitter and +`model.graph` both keep these 144 signed maps. A free-word symbol, including +the dual label that adds `1000000` in `retained_verify.emit`, is not another +spatial map. + +The chart-image law is the native monomial rule. Opcode `σ` admits an ordered +pair of charts `(A, B)` only when `G_σ` carries the span of `A` onto the span +of `B`. That is the check `model.build` states as “original native warp is +monomial”, and the check `model.build_pauli` states as “native chart image”. +`retained_verify.replay` does not apply this law: after editing the free word +it assigns the role’s chart to the event’s destination. An assignment that +fails the chart-image law is outside the alphabet. This note does not +construct one. + +## The dimension lemma + +Let `G` be a bijective linear map on `GF(2)^9`, and let `v_1, ..., v_d` be a +basis of a subspace `V`. If a subset of `G(v_1), ..., G(v_d)` sums to 0, apply +`G^{-1}`: the same subset of `v_1, ..., v_d` sums to 0, so the subset is +empty. The image vectors are therefore independent, and they span `G(V)`. +Hence `dim G(V) = dim V`. + +Every subspace is covered, including a chart that is not a recorded endpoint +and a chart that none of the 240 emitted warps uses. + +## Census of the 72 maps + +The checker evaluates each of the 72 column lists on all 512 vectors. Each +list is additive, has column rank 9, and has 512 distinct images, so each +`G_k` is a linear automorphism. Each inverse agrees with `model.inv`, is a +two-sided inverse, and is an automorphism as well. The domain of this census +is the whole list `canonical["warps"]`. The opcode check rejects any proper +sublist, so a sample of the records is not this census. + +Opcode 1 is the named map. Its columns are + +```text +[1, 2, 4, 8, 64, 19, 104, 197, 325]. +``` + +It joins frame 292 to frame 293. Both charts have dimension 4, and `G_1` +carries the span of frame 292 onto the span of frame 293. The two spans are +distinct: their Fourier rank, in the sense of `model.fourier_rank`, is 4. +Opcode 1 changes the chart and preserves the dimension. + +The same endpoint check on all 72 records gives 50 opcodes of dimension 4 and +22 of dimension 5. Every recorded pair is a chart image, so the monomial +Fourier rank between the image and the destination is 0. No recorded opcode +has unequal endpoint dimensions. + +## Unequal pairs are inadmissible + +Suppose `G_σ(span A) = span B` for a retained signed opcode. The lemma gives +`dim A = dim B`. An unequal pair fails the chart-image law for every retained +opcode. + +Frame 1 is the unique dimension-9 chart, and its span is the whole space. +Roles `112..223` end on 112 distinct charts of dimension 8, each a strict +subspace of frame 1. The Fourier rank of any such chart against frame 1 is 1, +the same width a transport would pay. For every one of the 144 signed maps and +every one of these 112 charts, the image has dimension 8 and Fourier rank 1 +against frame 1, so the image is not frame 1. No retained opcode admits a +warp from a Y exit onto frame 1. + +The 240 emitted events never use a dimension-8 chart. Their source-dimension +multiset is `{0: 72, 1: 24, 4: 50, 5: 22, 9: 72}`. Looking at some of those +events cannot see a dimension-8 pair. The prohibition on that pair is the +lemma, applied to the census of the 72 maps. + +## Products + +A composite of bijective linear maps is bijective and linear, so the lemma +applies to every finite product of retained opcodes and inverses. Along a walk +whose steps are admitted chart images, the dimension is constant. No such walk +carries a dimension-8 Y exit onto frame 1. The checker evaluates the composite +`G_1 ∘ G_2` as a fixture of that lemma. It does not enumerate the group +generated by the 72 maps. + +## The emitted events, recomputed + +This recount is an exhaustive census of a second finite list. It is the list +PR #7102 already used. It is recorded so the off-endpoint uses are visible, +and it is not the reason an unused unequal pair is forbidden. + +There are 240 emitted warp events, each on a live role. Each opcode is one of +the 144 signed retained maps, each event preserves dimension, and each event +is a chart image of its opcode. Of the 240, 72 land on that opcode’s oriented +recorded endpoints. Those 72 are exactly the events of dimension 4 or 5. +The other 168 land on other charts, with source dimensions +`{0: 72, 1: 24, 9: 72}`. The alphabet is used at dimensions other than its +recorded endpoint dimensions. +`canonical["warp_edges"]` is exactly the set of those 240 events collapsed to +180 classes `(sign, opcode, source, destination)`, and each class preserves +dimension. + +## What this statement leaves open + +The selected frontier stays `363005817/100000000000`. Opcode 1 is a chart +change inside one alphabet, not a selected-word decoder and not a new κ. + +The restored Y-exit round trip priced by PR #7102 is unchanged. Accepting the +one-way move onto frame 1 as an endpoint is a different contract. Same- +dimension relocation of a Y exit, by a retained opcode whose image happens to +be another rank-8 chart, is still open; the lemma says the image has dimension +8 and says nothing further about which chart it is. + +A warp alphabet other than these 72 maps and their inverses can still contain +a dimension-changing map. The free-word replay can still be given a chart +assignment that ignores `G`. Both of those objects are outside the hypotheses. diff --git a/research/retained-warp-opcode-dimension/README.md b/research/retained-warp-opcode-dimension/README.md new file mode 100644 index 0000000000..dc6d424562 --- /dev/null +++ b/research/retained-warp-opcode-dimension/README.md @@ -0,0 +1,85 @@ +# No retained warp opcode changes dimension + +**Scoped proof on one recorded alphabet. The selected κ stays +`363005817/100000000000`.** + +On the pinned round-three centre word, the recorded warp alphabet is the 72 +maps in `canonical["warps"]` together with the inverses `model.inv` retains. +Each map is a linear automorphism of `GF(2)^9`. Under the native chart-image +law, an automorphism admits only equal-dimension chart pairs. Opcode 1, the +named example, joins frame 292 to frame 293, both of dimension 4. No retained +opcode admits a warp from a dimension-8 Y exit onto the dimension-9 frame 1. +A finite product of retained opcodes preserves dimension as well. + +The argument is in [PROOF.md](PROOF.md). The checker recomputes the census +and the chart images. It does not trust the counts above as inputs. + +## Scope and evidence + +Catalogue card `complex-rank-shape-decoder`, priority revision 8, base +commit `e54523517d0f03e58352e647c403a5af3e525a57`. Scope status: +**changed**. The card asks whether a decoder or coframe change improves the +full signed moment. This package does not build that decoder. It answers the +second open question of PR #7102, on the same #4610 round-three word. The +reason is in [TASK.json](TASK.json). + +Evidence class: a proof that every bijective linear map preserves subspace +dimension, together with an exhaustive census of the 72 recorded maps. The +240 emitted warps are a second exhaustive census, recomputed from the event +list. PR #7102 already records that those 240 preserve dimension. The recount +splits them into 72 endpoint uses, at dimensions 4 and 5, and 168 other uses, +at dimensions 0, 1, and 9. The Y-exit prohibition is the lemma, because those +240 events never use a dimension-8 chart. + +Source pins are in [SOURCES.json](SOURCES.json). The catalogue and selected +record are provenance at the base commit. Full Git history is needed to +resolve them. The word, the retained emitter, and the contact-graph model are +live inputs. + +## Reproduce + +Python 3.12, standard library, from the repository root: + +```sh +python3 -B research/retained-warp-opcode-dimension/verify.py +python3 -O -B research/retained-warp-opcode-dimension/verify.py +python3 -I -W error -B research/retained-warp-opcode-dimension/verify.py +python3 -B scripts/research_package.py --package research/retained-warp-opcode-dimension --check-only +python3 -B scripts/research_package.py --package research/retained-warp-opcode-dimension +``` + +The marker is `PASS_RETAINED_WARP_OPCODE_DIMENSION` with `opcodes=72`, +`dimension_changing_opcodes=0`, `opcode_1=292->293 dim=4`, +`y_exit_to_frame1_admitted=0`, and `emitted_warps=240`. + +The positive fixture is opcode 1: frames 292 and 293, dimension 4, with the +recorded columns and a chart-image match. Controls reject a column of opcode +1 zeroed out, a 71-opcode sublist, the pair (Y exit, frame 1) under opcode 1, +a same-dimension chart outside that image, a sample of ten emitted events as +a stand-in for the alphabet, and a width-0 reading of the one-dimension gap. +Not run: `model.build` on the full contact graph, a physical caller, Lean, +Docker, and `make frontier7000-verify`. +`scripts/research_selected_baseline.py` is a binding check only. + +## Open next questions + +1. Which dimension-8 charts, if any, does opcode 1 carry a Y-exit chart onto? + The dimension lemma says the image has dimension 8, so the image is not + frame 1. It can still equal another rank-8 chart. A warp onto that chart + would move the exit with no paid transport, inside this alphabet. The + first step is to map the exit basis of Y role 112 by opcode 1’s columns + and test the image against the other 111 Y-exit spans. Nothing algebraic + blocks that census; this package stops once unequal dimensions are + excluded. The one-way acceptance of frame 1 as an endpoint is a different + contract and is not this question. + +## Credit + +The word is Cao Yifan / intqwq, PR #4610. The emitter is the retained centre +extension. The chart-image law and `model.inv` are the contact-graph model, +which credits PR #4672, PR #4654, PR #4610, and the PR #4470 lineage. The +question is the second open question of PR #7102. The Y-exit geometry follows +the round-three indexing in `research/y-exit-rank-lift-obstruction`, which +credits discussion #1166 comment 19133861, Chris R / Clear1nsight. +Prepared by unpaidmoon with substantial Cursor Grok assistance. Apache-2.0. +No independent human review or proof-kernel check is claimed. diff --git a/research/retained-warp-opcode-dimension/SOURCES.json b/research/retained-warp-opcode-dimension/SOURCES.json new file mode 100644 index 0000000000..2a6df87248 --- /dev/null +++ b/research/retained-warp-opcode-dimension/SOURCES.json @@ -0,0 +1,36 @@ +{ + "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": "research/sol1337-contact-frontier/inputs/round3-native.json.gz", + "usage": "input", + "git_blob": "46d929df83817b85a5387bcdb9745e0627d6366e", + "sha256": "7679daa4ec6a40f56fc7f0202379a6f454310e94945aba4f48beaaaafb838d05" + }, + { + "path": "research/sol1337-contact-frontier/vendor/model.py", + "usage": "input", + "git_blob": "a69138e4014424235345f3301fbe6b097caa1b8c", + "sha256": "7cc29edccb3679b2a5c9defeeb0a2ec6bcef9b01b97c2390bebc48f366395f1f" + }, + { + "path": "research/sol1337-contact-frontier/vendor/retained_verify.py", + "usage": "input", + "git_blob": "357cbff9874ce920c5b5ad839fd47d3f9c728bcb", + "sha256": "f5a67954f19dddc688460b91e5c1729d7820755c53313159ed136e4447021214" + } + ] +} diff --git a/research/retained-warp-opcode-dimension/TASK.json b/research/retained-warp-opcode-dimension/TASK.json new file mode 100644 index 0000000000..9fd13d8f7c --- /dev/null +++ b/research/retained-warp-opcode-dimension/TASK.json @@ -0,0 +1,75 @@ +{ + "schema_version": 1, + "task_id": "complex-rank-shape-decoder", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "complex-rank-shape-decoder", + "question": "Can a legal decoder or coframe change improve the full signed moment, including changed helper targets?", + "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", + "docs/research/recursive-invoice-preflight.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": "A source-bound arbitrary-input identity and legal producer/consumer boundary with the complete paid and productive target invoice, including restoration, ownership, native alignment and extra charges. Price under the actual current model; historical ceiling.py assumptions must be established before use. A favorable optimistic relaxation keeps a route open but is not a completed supplier. A scoped local result remains useful; expansion requires the family-level budget gate.", + "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": "Price one complete changed itinerary with both paid and productive histograms. Check #5693/#5698 for overlap and their exact hypotheses before another coframe search. Use the signed invoice preflight where its boundary contract agrees; an inconclusive concave comparison is not a power crossing. Stop if an optimistic complete budget fails at the chosen target or native delivery remains unspecified.", + "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": [ + "coframe", + "signed moment", + "5693", + "5698" + ], + "existing_checks": [ + { + "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": "changed", + "actual_scope": "On the pinned round-three centre word, every retained warp opcode in canonical['warps'] is a linear automorphism of GF(2)^9, and the native chart-image law therefore admits only equal-dimension chart pairs. Opcode 1 joins frames 292 and 293 at dimension 4. No retained opcode, and no finite product of retained opcodes, admits a warp from a dimension-8 Y exit onto frame 1.", + "scope_change_reason": "The card asks for a decoder or coframe change that improves the signed moment. This package does not build that decoder. It answers the dimension question left open by PR #7102, on the #4610 round-three alphabet rather than on a new opcode alphabet or the selected #7000 word.", + "bottleneck_link": "A favourable complex itinerary has to clear a complete signed bill. PR #7102 charges a transport for every dimension change and leaves open whether a retained warp could move a Y exit to frame 1 for free. Under the recorded alphabet and the chart-image law, that move is inadmissible, so the route stops before a decoder or a kappa claim.", + "budget_minutes": 60, + "stop_rule": "Stop once every retained opcode is shown to preserve dimension under the chart-image law, including every Y-exit pair with frame 1. Do not construct a new opcode, do not accept the one-way frame-1 endpoint, and do not claim a kappa change.", + "outcome": "negative-result", + "evidence": "python3 -B research/retained-warp-opcode-dimension/verify.py prints PASS_RETAINED_WARP_OPCODE_DIMENSION. PROOF.md records the dimension lemma, the 72-map census, and the separate recount of the 240 emitted events. The checker requires opcode 1's columns and rejects a singular alteration, a 71-opcode sublist, and the pair (Y exit, frame 1).", + "author": "unpaidmoon", + "ai_assistance": "Substantial Cursor Grok assistance with the proof and the checker. The word, the retained emitter, and the chart-image law are predecessor source.", + "open_questions": [ + { + "question": "Which dimension-8 charts, if any, does opcode 1 carry a Y-exit chart onto?", + "why_it_matters": "The dimension lemma puts the image in dimension 8, so the image is not frame 1. The image can still equal another rank-8 chart. A warp onto that chart would move the Y exit with no paid transport, inside this alphabet.", + "first_step": "Map the exit basis of Y role 112 by opcode 1's columns and test the image span for equality with each of the other 111 Y-exit spans.", + "blocked_by": "Nothing algebraic. The census is finite and was left unrun because this package stops once unequal dimensions are excluded." + } + ] +} diff --git a/research/retained-warp-opcode-dimension/VERIFY.json b/research/retained-warp-opcode-dimension/VERIFY.json new file mode 100644 index 0000000000..39d74c7b44 --- /dev/null +++ b/research/retained-warp-opcode-dimension/VERIFY.json @@ -0,0 +1,23 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "certificates/selected-result.json", + "research/sol1337-contact-frontier/inputs/round3-native.json.gz", + "research/sol1337-contact-frontier/vendor/model.py", + "research/sol1337-contact-frontier/vendor/retained_verify.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Census all 72 retained warp maps and their inverses, require the chart-image law on opcode 1 and on every Y-exit pair with frame 1, and reject a singular column, a 71-opcode sublist, and a ten-event sample." + } + ] +} diff --git a/research/retained-warp-opcode-dimension/verify.py b/research/retained-warp-opcode-dimension/verify.py new file mode 100644 index 0000000000..7bbdb215a2 --- /dev/null +++ b/research/retained-warp-opcode-dimension/verify.py @@ -0,0 +1,327 @@ +#!/usr/bin/env python3 +"""No retained warp opcode in the #7102 alphabet changes chart dimension. + +The round-three word, the retained emitter, and the contact-graph model are +predecessor inputs. This checker recomputes the opcode census. It does not +trust the counts in PROOF.md as inputs. Failures raise ValueError, including +under python -O. +""" + +from hashlib import sha256 +from pathlib import Path +import gzip +import importlib.util +import json + +ROOT = Path(__file__).resolve().parents[2] +HERE = Path(__file__).resolve().parent +WORD = ROOT / "research/sol1337-contact-frontier/inputs/round3-native.json.gz" +ENGINE = ROOT / "research/sol1337-contact-frontier/vendor/retained_verify.py" +MODEL = ROOT / "research/sol1337-contact-frontier/vendor/model.py" +SELECTED = ROOT / "certificates/selected-result.json" +SELECTED_KAPPA = "363005817/100000000000" +OPCODE_1_COLUMNS = (1, 2, 4, 8, 64, 19, 104, 197, 325) +AMBIENT = 9 +SPACE = 1 << AMBIENT + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def load_module(path, name): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def authenticate(engine): + pins = json.loads((HERE / "SOURCES.json").read_text(encoding="utf-8")) + by_path = {row["path"]: row for row in pins["files"]} + for path in (WORD, ENGINE, MODEL, SELECTED): + rel = path.relative_to(ROOT).as_posix() + raw = path.read_bytes() + need(sha256(raw).hexdigest() == by_path[rel]["sha256"], "changed input " + rel) + raw = WORD.read_bytes() + need(sha256(raw).hexdigest() == engine.SOURCE_HASH, "word hash disagrees with the retained emitter") + selected = json.loads(SELECTED.read_text(encoding="utf-8")) + need(selected["kappa"] == SELECTED_KAPPA, "selected frontier value moved") + return json.loads(gzip.decompress(raw)) + + +def mv(cols, vector): + image = 0 + for index, column in enumerate(cols): + if (vector >> index) & 1: + image ^= column + return image + + +def span(basis): + out = {0} + for vector in basis: + out |= {point ^ vector for point in tuple(out)} + return out + + +def vector_rank(vectors): + pivots = {} + for vector in vectors: + value = vector + while value: + bit = value.bit_length() - 1 + if bit not in pivots: + pivots[bit] = value + break + value ^= pivots[bit] + return len(pivots) + + +def prove_linear(cols): + """Column action is additive on GF(2)^9, hence linear.""" + need(len(cols) == AMBIENT, "a retained opcode has nine columns") + need(all(type(column) is int and 0 <= column < SPACE for column in cols), + "columns lie in GF(2)^9") + need(mv(cols, 0) == 0, "linear maps send 0 to 0") + for vector in range(SPACE): + for bit in range(AMBIENT): + axis = 1 << bit + need(mv(cols, vector ^ axis) == mv(cols, vector) ^ mv(cols, axis), + "column action is additive") + + +def bijective(cols): + prove_linear(cols) + images = {mv(cols, vector) for vector in range(SPACE)} + return len(images) == SPACE and vector_rank(cols) == AMBIENT + + +def inverse_columns(cols): + values = {mv(cols, vector): vector for vector in range(SPACE)} + need(len(values) == SPACE, "inverse is defined only for a bijective map") + return [values[1 << bit] for bit in range(AMBIENT)] + + +def require_two_sided_inverse(cols, inverse): + identity = [1 << bit for bit in range(AMBIENT)] + need([mv(cols, column) for column in inverse] == identity, "G inverse is a right inverse") + need([mv(inverse, column) for column in cols] == identity, "G inverse is a left inverse") + + +def chart_image(cols, source, dest): + """Native chart-image law: G carries the source span onto the destination span.""" + need(bijective(cols), "chart-image law is stated for a retained bijective opcode") + return span(mv(cols, vector) for vector in source) == span(dest) + + +def require_alphabet(warps): + ops = [record["op"] for record in warps] + need(ops == list(range(1, 73)), "recorded alphabet is exactly opcodes 1 through 72") + + +def expect_fail(fn, message): + try: + fn() + except ValueError: + return + raise ValueError(message) + + +def survey(model, payload): + canonical = payload["canonical"] + frames = canonical["frames"] + need(canonical["h"] == AMBIENT and canonical["v"] == 112, "ambient dimension and block length") + need(len(frames) == 4429, "recorded chart count") + for basis in frames: + for vector in basis: + need(type(vector) is int and 0 <= vector < SPACE, "every chart vector lies in GF(2)^9") + need(len(span(basis)) == 1 << len(basis), "chart dimension is the independent basis length") + need(span(basis) == model.span(basis), "span agrees with the contact-graph model") + + warps = canonical["warps"] + require_alphabet(warps) + endpoint_dims = {} + for record in warps: + opcode = record["op"] + cols = tuple(record["G_columns"]) + source_id = record["from_frame"] + dest_id = record["to_frame"] + need(0 <= source_id < len(frames) and 0 <= dest_id < len(frames), "opcode endpoints are charts") + need(bijective(cols), "retained opcode is a linear automorphism") + inverse = inverse_columns(cols) + need(inverse == model.inv(list(cols)), "inverse agrees with model.inv") + require_two_sided_inverse(cols, inverse) + need(bijective(inverse), "retained inverse opcode is a linear automorphism") + source = frames[source_id] + dest = frames[dest_id] + need(chart_image(cols, source, dest), "recorded source chart maps onto the recorded destination") + need(chart_image(inverse, dest, source), "inverse carries the destination back onto the source") + need(len(source) == len(dest), "recorded endpoints have equal dimension") + image = span(mv(cols, vector) for vector in source) + image_mask = model.mask(image) + dest_mask = model.mask(span(dest)) + need(model.fourier_rank(image_mask, dest_mask) == 0, "monomial chart image has Fourier rank 0") + endpoint_dims[len(source)] = endpoint_dims.get(len(source), 0) + 1 + if opcode == 1: + need(cols == OPCODE_1_COLUMNS, "opcode 1 keeps its recorded columns") + need(source_id == 292 and dest_id == 293, "opcode 1 joins frames 292 and 293") + need(len(source) == 4 and len(dest) == 4, "opcode 1 preserves dimension 4") + separation = model.fourier_rank(model.mask(span(source)), model.mask(span(dest))) + need(separation == 4, "opcode 1 moves between two distinct dimension-4 charts") + + need(endpoint_dims == {4: 50, 5: 22}, "recorded endpoint dimensions") + full = [index for index, basis in enumerate(frames) if len(basis) == AMBIENT] + need(full == [1], "frame 1 is the unique dimension-9 chart") + need(span(frames[1]) == set(range(SPACE)), "frame 1 is the whole 9-bit space") + final = canonical["final"] + y_ids = [final[role] for role in range(112, 224)] + need(len(set(y_ids)) == 112, "112 distinct Y-exit charts") + for chart in y_ids: + basis = frames[chart] + need(len(basis) == 8, "every Y exit has dimension 8") + need(span(basis) < span(frames[1]), "every Y exit sits strictly inside frame 1") + gap = model.fourier_rank(model.mask(span(basis)), model.mask(span(frames[1]))) + need(gap == 1, "the frame-1 gap of a Y exit has Fourier rank 1") + + full_span = span(frames[1]) + full_mask = model.mask(full_span) + for record in warps: + cols = tuple(record["G_columns"]) + inverse = inverse_columns(cols) + for chart in y_ids: + basis = frames[chart] + for signed in (cols, inverse): + images = [mv(signed, vector) for vector in basis] + image_span = span(images) + need(vector_rank(images) == 8, "a retained opcode preserves Y-exit dimension") + need(image_span != full_span, "image of a Y exit is not frame 1") + need(model.fourier_rank(model.mask(image_span), full_mask) == 1, + "Y-exit image against frame 1 keeps Fourier rank 1") + + # One explicit composition. Bijectivity of every factor implies the rest. + first = tuple(warps[0]["G_columns"]) + second = tuple(warps[1]["G_columns"]) + composed = [mv(first, mv(second, 1 << bit)) for bit in range(AMBIENT)] + need(bijective(composed), "a product of retained opcodes stays bijective") + y_basis = frames[y_ids[0]] + need(vector_rank(mv(composed, vector) for vector in y_basis) == 8, + "a product preserves Y-exit dimension") + + emitted = [event for event in payload["programs"]["forward"] if event[0] == "warp"] + need(len(emitted) == 240, "the word emits 240 warps") + by_op = {record["op"]: record for record in warps} + on_record = 0 + source_dims = {} + off_record_dims = {} + edge_classes = set() + for event in emitted: + need(len(event) == 5 and event[1][0] == "L", "emitted warp shape") + opcode = event[2] + source_id, dest_id = event[3], event[4] + need(type(opcode) is int and 1 <= abs(opcode) <= 72, "emitted opcode is a retained sign") + record = by_op[abs(opcode)] + cols = tuple(record["G_columns"]) + signed = cols if opcode > 0 else inverse_columns(cols) + source = frames[source_id] + dest = frames[dest_id] + need(len(source) == len(dest), "emitted warp preserves dimension") + need(chart_image(signed, source, dest), "emitted warp is a chart image of its opcode") + source_dims[len(source)] = source_dims.get(len(source), 0) + 1 + recorded_source = record["from_frame"] + recorded_dest = record["to_frame"] + if opcode < 0: + recorded_source, recorded_dest = recorded_dest, recorded_source + if (source_id, dest_id) == (recorded_source, recorded_dest): + on_record += 1 + else: + off_record_dims[len(source)] = off_record_dims.get(len(source), 0) + 1 + edge_classes.add((1 if opcode > 0 else -1, abs(opcode), source_id, dest_id)) + need(on_record == 72 and len(emitted) - on_record == 168, + "72 emitted warps use the recorded endpoints and 168 use other charts") + need(off_record_dims == {0: 72, 1: 24, 9: 72}, + "off-endpoint uses sit at dimensions 0, 1, and 9") + need(source_dims == {0: 72, 1: 24, 4: 50, 5: 22, 9: 72}, + "emitted warps never meet dimension 8") + need(8 not in source_dims, "no emitted warp has dimension 8") + recorded_edges = {tuple(edge) for edge in canonical["warp_edges"]} + need(recorded_edges == edge_classes and len(recorded_edges) == 180, + "warp_edges is exactly the 180 emitted classes") + for sign, opcode, source_id, dest_id in recorded_edges: + need(sign in (1, -1) and 1 <= opcode <= 72, "warp edge names a retained opcode") + need(len(frames[source_id]) == len(frames[dest_id]), "every recorded warp class preserves dimension") + + return {"y_ids": y_ids} + + +def controls(payload, facts): + frames = payload["canonical"]["frames"] + warps = payload["canonical"]["warps"] + cols = list(warps[0]["G_columns"]) + damaged = list(cols) + damaged[0] = 0 + need(not bijective(damaged), "zeroing one column of opcode 1 destroys bijectivity") + + def short_alphabet(): + require_alphabet(warps[:-1]) + + expect_fail(short_alphabet, "dropping opcode 72 is not a census of the alphabet") + + y_basis = frames[facts["y_ids"][0]] + frame_one = frames[1] + + def y_to_frame_one(): + need(chart_image(tuple(cols), y_basis, frame_one), "opcode 1 image") + + expect_fail(y_to_frame_one, "opcode 1 does not carry a Y exit onto frame 1") + + image = span(mv(tuple(cols), vector) for vector in frames[292]) + rejected_peer = None + for index, basis in enumerate(frames): + if len(basis) == 4 and span(basis) != image: + rejected_peer = index + break + need(rejected_peer is not None, "some dimension-4 chart is outside opcode 1's image") + + def wrong_peer(): + need(chart_image(tuple(cols), frames[292], frames[rejected_peer]), "false peer") + + expect_fail(wrong_peer, "equal dimension alone does not admit a chart pair") + + def ten_events(): + sample = [event[2] for event in payload["programs"]["forward"] if event[0] == "warp"][:10] + need(set(sample) == set(range(1, 73)), "ten emitted opcodes are the whole alphabet") + + expect_fail(ten_events, "ten emitted warps do not cover the opcode alphabet") + + def zero_gap(): + need(abs(len(y_basis) - len(frame_one)) == 0, "dimension gap") + + expect_fail(zero_gap, "the Y-exit gap is one dimension, so it is not a preserved pair") + + +def main(): + engine = load_module(ENGINE, "retained_centre_verify") + model = load_module(MODEL, "contact_graph_model") + payload = authenticate(engine) + facts = survey(model, payload) + controls(payload, facts) + print( + "PASS_RETAINED_WARP_OPCODE_DIMENSION " + "opcodes=72 inverses=72 bijective=72 " + "recorded_endpoint_dims=4:50,5:22 dimension_changing_opcodes=0 " + "opcode_1=292->293 dim=4 chart_fourier_rank=4 " + "y_exit_to_frame1_admitted=0 " + "composition_preserves_dimension=true " + "emitted_warps=240 emitted_dimension_changing=0 " + "emitted_on_recorded_endpoints=72 emitted_on_other_charts=168 " + "emitted_source_dims=0:72,1:24,4:50,5:22,9:72 " + "warp_edge_classes=180 " + "selected_kappa=363005817/100000000000 no_new_kappa=true " + "evidence_class=proof_plus_exhaustive_census" + ) + + +if __name__ == "__main__": + main()