From 01cbbe3450d00afd57fbd529d8d9c7f6cc3d776c Mon Sep 17 00:00:00 2001 From: Wentao Li Date: Sun, 18 Oct 2026 14:10:21 +0000 Subject: [PATCH 1/2] Research: flag-0 tail self-owned X0 host schedule at 5758/5759/5807 (answers #3669 OQ2) Assign owner=X0 on FULL for the published promote/add/restore cut: unique among event-named registers, zero dirty-helper touches, zero endpoint repayment toward initials, and pre-read X0 restoration blocked by the common-chart annotation. No new kappa. Prepared by Wentao Li with substantial AI assistance. --- .../CERTIFICATE.json | 36 +++ .../MASTER-HANDOFF.md | 67 +++++ research/p104-flag0-tail-owner-host/NOTICE.md | 17 ++ research/p104-flag0-tail-owner-host/PROOF.md | 94 ++++++ research/p104-flag0-tail-owner-host/README.md | 66 +++++ .../p104-flag0-tail-owner-host/SOURCES.json | 50 ++++ research/p104-flag0-tail-owner-host/TASK.json | 96 ++++++ .../p104-flag0-tail-owner-host/VERIFY.json | 30 ++ .../p104-flag0-tail-owner-host/independent.py | 247 ++++++++++++++++ .../test_package.py | 198 +++++++++++++ research/p104-flag0-tail-owner-host/verify.py | 279 ++++++++++++++++++ 11 files changed, 1180 insertions(+) create mode 100644 research/p104-flag0-tail-owner-host/CERTIFICATE.json create mode 100644 research/p104-flag0-tail-owner-host/MASTER-HANDOFF.md create mode 100644 research/p104-flag0-tail-owner-host/NOTICE.md create mode 100644 research/p104-flag0-tail-owner-host/PROOF.md create mode 100644 research/p104-flag0-tail-owner-host/README.md create mode 100644 research/p104-flag0-tail-owner-host/SOURCES.json create mode 100644 research/p104-flag0-tail-owner-host/TASK.json create mode 100644 research/p104-flag0-tail-owner-host/VERIFY.json create mode 100644 research/p104-flag0-tail-owner-host/independent.py create mode 100644 research/p104-flag0-tail-owner-host/test_package.py create mode 100644 research/p104-flag0-tail-owner-host/verify.py diff --git a/research/p104-flag0-tail-owner-host/CERTIFICATE.json b/research/p104-flag0-tail-owner-host/CERTIFICATE.json new file mode 100644 index 0000000000..bfd1fecb81 --- /dev/null +++ b/research/p104-flag0-tail-owner-host/CERTIFICATE.json @@ -0,0 +1,36 @@ +{ + "schema_version": 1, + "claim_id": "p104-flag0-tail-owner-host", + "pinned_main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "answers": "CrocSwap#3669 OQ2", + "flag_index": 0, + "source": 0, + "target": 34, + "source_register": "X0", + "target_register": "Y34", + "promote_event": 5758, + "add_event": 5759, + "restore_event": 5807, + "coefficient": "-1/2", + "host_chart": [1, 2, 4, 8, 16, 32, 64, 128, 256], + "channel_final_x0": [1, 2, 4, 8, 16, 32, 64, 128, 256], + "channel_final_y34": [499, 23, 232, 32, 112, 15, 7, 2], + "source_initial": [232], + "target_initial": [], + "schedule_id": "S0", + "owner": "X0", + "owner_kind": "self", + "unique_owner_among_event_named_registers": true, + "dirty_helper_touches_in_window": 0, + "x0_destination_events_after_channel": 0, + "x0_last_destination_event": 1486, + "endpoint_repay_x0_to_initial": false, + "endpoint_repay_y34_to_initial": false, + "x0_frame_after_restore": [1, 2, 4, 8, 16, 32, 64, 128, 256], + "y34_frame_after_restore": [499, 23, 232, 32, 112, 15, 7, 2], + "y34_tail_transports": [5758, 5807], + "window_add_count": 48, + "pre_read_x0_restoration_blocks_common_chart": true, + "selected_kappa": "0.001672660197076918", + "no_new_kappa": true +} diff --git a/research/p104-flag0-tail-owner-host/MASTER-HANDOFF.md b/research/p104-flag0-tail-owner-host/MASTER-HANDOFF.md new file mode 100644 index 0000000000..dfc100fb55 --- /dev/null +++ b/research/p104-flag0-tail-owner-host/MASTER-HANDOFF.md @@ -0,0 +1,67 @@ +# Master handoff — `research/p104-flag0-tail-owner-host/` + +## Candidate + +- Branch: `cursor/flag0-tail-owner-host-60b9` (VictorLiwentao fork). +- Content tip: scientific package commit (parent = pinned base). +- Packaging tip: branch HEAD (`git rev-parse HEAD` on this branch). +- Package: `research/p104-flag0-tail-owner-host/` +- Base: CrocSwap main `20ecf2891d80b5acf18d980b2164fb44ea7faa90` +- Card: `p104-side-correction` (refined), priority revision 6 +- κ: unchanged at `0.001672660197076918` +- Author and committer: Wentao Li ``, with no + `Co-authored-by: Victor Li` trailer (`git -c core.hooksPath=/dev/null commit`). +- **Do not open a CrocSwap PR** — master publishes. + +## Claim + +On present-head flag 0, the published promote/add/restore at 5758/5759/5807 +admits self-owned host schedule S0 (`owner=X0` on `FULL`) for the `X0` read: +unique among event-named registers, zero dirty-helper touches in the window, +zero endpoint repayment toward initials, and pre-read `X0` restoration blocked +by the published common-chart annotation. Answers #3669 OQ2. No new kappa. + +## Why this is not a chronology / repair-template reprint + +Headline is an owner/host **assignment** plus dirt and endpoint-repayment +checks on the #2089 tail word. It does not reprint #3669's drop/arrive +chronology, does not retarget the #3532/+2 head-span repair template, and does +not price event-3369 co-hosting. Prior jwr404 packages show frames/coefficient +and that no owner field is named; this package fills the owner gap with S0. + +## Evidence commands + +```sh +python3.12 -I -B research/p104-flag0-tail-owner-host/verify.py +python3.12 -I -O -Werror -B research/p104-flag0-tail-owner-host/verify.py +python3.12 -I -O -Werror -B research/p104-flag0-tail-owner-host/independent.py +python3.12 -I -O -Werror -B research/p104-flag0-tail-owner-host/test_package.py +python3.12 -B scripts/research_package.py --package research/p104-flag0-tail-owner-host +``` + +Expected markers: + +```text +PASS_P104_FLAG0_TAIL_OWNER_HOST flag=0 owner=X0 promote=5758 add=5759 restore=5807 dirty_helper_touches=0 endpoint_repay=0 pre_read_restore_blocks=1 unique_owner=1 no_new_kappa +PASS_P104_FLAG0_TAIL_OWNER_HOST_INDEPENDENT flag=0 owner=X0 promote=5758 add=5759 restore=5807 dirty_helper_touches=0 endpoint_repay=0 pre_read_restore_blocks=1 unique_owner=1 no_new_kappa +PASS_P104_FLAG0_TAIL_OWNER_HOST_TESTS groups=6 +PASS_REGISTERED_RESEARCH_PACKAGE research/p104-flag0-tail-owner-host outcome=completed +``` + +Default verify is read-only. Admission uses `need()` and still fires under `-O`. +Duplicate JSON keys are rejected. On-disk certificate / witness corruption is +rejected in temp copies. + +## Soft overlap + +- Soft vs #3669 (chronology leave-alone): cites OQ2 only; no drop/arrive reprint. +- Soft vs deferred `p104-flag0-head-span-schedule` / #3532: different cut + (5758/5759/5807 vs 3369 co-host repair); not a FLAG_INDEX retarget. +- Soft vs jwr404 `p104-tail-flag0-*`: those are partial readings; this assigns + the schedule and adds dirt/repay/obstruction checks. +- Leave-alones listed in the worker brief are untouched. + +## Disposition + +Fork branch for master publish decision. Do not open a CrocSwap PR from this +worker. diff --git a/research/p104-flag0-tail-owner-host/NOTICE.md b/research/p104-flag0-tail-owner-host/NOTICE.md new file mode 100644 index 0000000000..a9a07176ac --- /dev/null +++ b/research/p104-flag0-tail-owner-host/NOTICE.md @@ -0,0 +1,17 @@ +# Notice + +Copyright 2026 Wentao Li + +This directory is a scoped research certificate. It is licensed under the +Apache License, Version 2.0, the same license as the surrounding project. + +The 4,058-event channel witness is the reviewed #1991 native channel. The +augmented promote/add/restore tail word and correction rows are Cinna Davis's +#2089 package at `research/p104-tail-side-correction-seed749717`. The prior +unbound-owner receipt is jwr404's `research/p104-tail-flag0-owner`. The +unrestored-endpoint census cited here is Wentao Li's #3349 package at +`research/p104-channel-touch-restoration-audit`. Open #3669 states the OQ2 +this package answers. + +Those notices and files are unchanged. Prepared by Wentao Li with substantial +AI assistance. No independent human or formal-kernel review is claimed. diff --git a/research/p104-flag0-tail-owner-host/PROOF.md b/research/p104-flag0-tail-owner-host/PROOF.md new file mode 100644 index 0000000000..a3c1ff7d7a --- /dev/null +++ b/research/p104-flag0-tail-owner-host/PROOF.md @@ -0,0 +1,94 @@ +# Proof: self-owned flag-0 tail host schedule without endpoint repayment + +## Claim + +On the published #2089 augmented witness, events 5758/5759/5807 form a +promote/add/restore triple for target `Y34` with source read `X0` at +coefficient `-1/2`. Schedule S0 assigns owner `X0` on host chart `FULL`. This +schedule is legal for the published ADD, uniquely determined among registers +named by that ADD, touches no dirty helper in the window, and leaves both +endpoint frames at their unrestored channel finals. Restoring `X0` to its +initial frame before the ADD conflicts with the published common-chart +annotation. No new κ. + +## Inputs + +Pinned at CrocSwap main `20ecf2891d80b5acf18d980b2164fb44ea7faa90`: + +- `research/p104-native-channel/inputs/LOWRANK-WITNESS.json` (#1991 channel) +- `research/p104-tail-side-correction-seed749717/AUGMENTED-WITNESS.json.gz` (#2089) +- `research/p104-tail-side-correction-seed749717/CORRECTION-ROWS.json` +- `research/p104-tail-flag0-owner/RESULT.json` (prior: no owner field) +- `research/p104-channel-touch-restoration-audit/CERTIFICATE.json` (#3349) + +Hashes are in [SOURCES.json](SOURCES.json). + +## Setup + +Write `FULL = [1,2,4,8,16,32,64,128,256]` and +`RANK8 = [499,23,232,32,112,15,7,2]`. The channel leaves `X0` at `FULL` and +`Y34` at `RANK8`. Neither equals its initial (`[232]` and `[]`). #3349 records +that this unrestored pattern holds for every endpoint; this package cites that +census and rechecks only the flag-0 pair. + +The tail word's first 4,058 events equal the channel program. Event 5758 is +`transport Y34: RANK8 → FULL` (rank 1). Event 5759 is +`add Y34 X0 -1/2 FULL`. Event 5807 is `transport Y34: FULL → RANK8` (rank 1). +Between them sit exactly 48 `Y34` adds. + +## Schedule S0 + +Assign: + +- `owner(5759) = X0` +- `host_chart(5759) = FULL` +- no additional host register + +**Legality.** A forward frame walk from the tail initials reaches `X0 = FULL` +and `Y34 = FULL` at event 5759, matching the ADD's chart field. The common-chart +rule holds. + +**Uniqueness on the published word.** The ADD names exactly `{Y34, X0}`. The +write target cannot own the source read. The only remaining named register is +`X0`. So among event-named registers, S0 is the unique owner assignment. (A +copied host using an unnamed helper would be a different word; see open +questions.) + +**Dirt.** Scan events 5758 through 5807. No top-level field is a dirty helper +name (`D*`, `G*`, `Q*`, or `C`). The channel's dirty-helper restorations are +therefore undisturbed by this window. Arbitrary dirt that the channel already +restored stays restored; S0 introduces no new dirty host. + +**Endpoint repayment.** After event 5807 the walk gives `X0 = FULL` and +`Y34 = RANK8`. These equal the channel finals and differ from the initials. +Define repayment as a transport that returns an endpoint to its initial frame. +Neither endpoint is so returned. The promote/restore pair is a temporary lift +of `Y34` that ends at the channel final, not at `[]`. + +**Coefficient.** `CORRECTION-ROWS.json` row 34, source 0, stores coefficient +`-1/2`, matching the ADD. + +## Obstruction: pre-read X0 restoration + +Suppose one restores `X0` to `[232]` before event 5759 while keeping the +published ADD, whose chart annotation is `FULL`. Then the live `X0` frame is +not `FULL`, so the common-chart rule fails. Hence any schedule that repays +`X0`'s unrestored endpoint before the read is incompatible with the published +word. (Repayment after 5807 is outside this certificate and would cost +positive descent rank from `FULL` toward `[232]`.) + +## What this does not prove + +- A global owner/host map for all 4,992 source reads +- A copied-host construction or its rank-mass floor +- Integration with the #1940 chronological schedule +- A supplier admission or a new κ +- Anything about the deferred #3669 OQ1 +2 head-span repair at event 3369 + +## Independence + +`verify.py` walks frames in program order. `independent.py` builds per-register +indexes and reconstructs frames from transport subsequences alone. Neither +imports the other or the native checker. Both compare against +[CERTIFICATE.json](CERTIFICATE.json). Temp-copy corruptions of that certificate +and of the gzipped witness are rejected under `-O`. diff --git a/research/p104-flag0-tail-owner-host/README.md b/research/p104-flag0-tail-owner-host/README.md new file mode 100644 index 0000000000..9c31c7cdae --- /dev/null +++ b/research/p104-flag0-tail-owner-host/README.md @@ -0,0 +1,66 @@ +# Flag 0's published tail cut admits a self-owned X0 host schedule with zero endpoint repayment + +**Finite owner/host schedule certificate. No new exponent.** + +Open [#3669](https://github.com/CrocSwap/integer-mult-bounds/pull/3669) leaves +as OQ2 whether the published promote/add/restore at events 5758/5759/5807 admits +an owner/host schedule for the `X0` read that restores arbitrary dirt without +repaying the unrestored channel endpoints. This package answers yes for that +local cut. + +## Result + +Schedule **S0** assigns `owner = X0` (self) on the full host chart for the ADD +at event 5759. On the published #2089 tail word: + +| Fact | Value | +|---|---| +| Promote / add / restore | 5758 / 5759 / 5807 | +| Coefficient | `-1/2` (matches `CORRECTION-ROWS` row 34, source 0) | +| Host chart at the ADD | `FULL = [1,…,256]` for both `X0` and `Y34` | +| Unique source owner among registers named by the ADD | `X0` | +| Dirty-helper (`D`/`G`/`Q`/`C`) touches in the window | **0** | +| `X0` destination events after the 4,058-event channel | **0** (last write 1486) | +| Endpoint repay of `X0`/`Y34` toward their initials | **false** / **false** | +| Frames after restore | `X0=FULL`, `Y34=RANK8` (channel finals) | + +Dirt restoration: the window never touches a dirty helper, so the channel's +already-restored 72 dirty helpers stay restored. Endpoint repayment: after 5807 +both registers sit at their channel finals, not at `[232]` / `[]`. + +**Obstruction.** Restoring `X0` to its initial frame `[232]` before event 5759 +while keeping the published ADD (annotated `FULL`) violates the common-chart +rule. Endpoint repayment of `X0` cannot precede the read on this word. + +Selected κ stays `0.001672660197076918`. No global 104×104 owner map. Distinct +from the deferred #3669 OQ1 +2 head-span repair and from open [#3532](https://github.com/CrocSwap/integer-mult-bounds/pull/3532). + +Details are in [PROOF.md](PROOF.md). + +## Reproduce + +```sh +python3.12 -I -B research/p104-flag0-tail-owner-host/verify.py +python3.12 -I -O -Werror -B research/p104-flag0-tail-owner-host/verify.py +python3.12 -I -O -Werror -B research/p104-flag0-tail-owner-host/independent.py +python3.12 -I -O -Werror -B research/p104-flag0-tail-owner-host/test_package.py +python3.12 -B scripts/research_package.py --package research/p104-flag0-tail-owner-host +``` + +`verify.py` is read-only. Admission goes through `need()` and still fires under +`-O`. `independent.py` imports neither `verify.py` nor the native checker. + +## Credit + +Credit #3669 for OQ2, Cinna Davis / #2089 for the tail word, jwr404's +`p104-tail-flag0-*` readings for the unbound-owner gap and frame facts this +package cites, #3349 for the unrestored-endpoint census, and the reviewed #1991 +channel. Prepared by Wentao Li with substantial AI assistance. + +## Open next questions + +1. Does the same self-owned zero-repay pattern hold for every target window? +2. What host rank mass does a copied-host alternative cost under unrestored + endpoints? + +[TASK.json](TASK.json) gives first steps and blockers. diff --git a/research/p104-flag0-tail-owner-host/SOURCES.json b/research/p104-flag0-tail-owner-host/SOURCES.json new file mode 100644 index 0000000000..d710a42c13 --- /dev/null +++ b/research/p104-flag0-tail-owner-host/SOURCES.json @@ -0,0 +1,50 @@ +{ + "schema_version": 1, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "upstream": "CrocSwap/integer-mult-bounds", + "files": [ + { + "path": "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "usage": "input", + "git_blob": "86beaf424e9f0f800ae3a62797d94ec9386b7706", + "sha256": "0f541bef7f19fdeffd67157684e9f03d785f42c89973632f508fc1a0452b580e", + "credit": "Reviewed #1991 native channel witness (Chafik Boukhalfa / Rohan Arun #1972)" + }, + { + "path": "research/p104-tail-side-correction-seed749717/AUGMENTED-WITNESS.json.gz", + "usage": "input", + "git_blob": "7e248e2d263fc6b1b578350a7bbc6d4ad725b106", + "sha256": "fa7487b0b0b4e8fb6bdb1bed1171498a4ed487a1efeb8bb93897e379200000a0", + "credit": "Cinna Davis / #2089 terminal promote/add/restore tail word" + }, + { + "path": "research/p104-tail-side-correction-seed749717/CORRECTION-ROWS.json", + "usage": "input", + "git_blob": "bbb46b132c0f5093fedf2269b24fd7b0b4b87af2", + "sha256": "59c145194ba070fda338619e890f25a4a8ae7f37facf3689c1c8c89f79e8bd36", + "credit": "Cinna Davis / #2089 sparse I-G/2 correction rows" + }, + { + "path": "research/p104-tail-flag0-owner/RESULT.json", + "usage": "input", + "git_blob": "d84b02599cd8388b0fa9a5d9c058ee2c03c03f3b", + "sha256": "0a7aafbc0fc004eb21eef1fefea049b2831ba2f62cfae3389181afb295c3368b", + "credit": "jwr404 prior: event 5759 names no owner field" + }, + { + "path": "research/p104-channel-touch-restoration-audit/CERTIFICATE.json", + "usage": "input", + "git_blob": "a3f80bb15f85598c3dfe138239f9343077068c49", + "sha256": "aa8fbc62f4238f8395c7ca5dc0763105a559106178e9c94264579e0b701da4d5", + "credit": "Wentao Li / #3349: 0/208 endpoint frames restored; flag0 unrestored" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0", + "pin": "base_commit:docs/research/agent-task-catalog.json", + "credit": "Priority revision 6 task catalogue" + } + ] +} diff --git a/research/p104-flag0-tail-owner-host/TASK.json b/research/p104-flag0-tail-owner-host/TASK.json new file mode 100644 index 0000000000..3d3ec49a34 --- /dev/null +++ b/research/p104-flag0-tail-owner-host/TASK.json @@ -0,0 +1,96 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 6, + "selected_kappa": "0.001672660197076918", + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "original_card": { + "id": "p104-side-correction", + "question": "Can the proposed P104 joint endpoint flags be realized by a chronological correction program with coefficients, dirty restoration and an affordable complete bill?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/p104-native-channel/README.md", + "research/p104-native-channel/PROOF.md", + "docs/research/community-efficient1000-review.md", + "research/p104-joint-unit-flags/README.md" + ], + "methods": [ + "Construct one side-correction word at an explicit chronological cut with the needed frames still available.", + "Derive a lower bound on the side correction and hosting costs that decides whether this channel can beat the selected budget." + ], + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the revision-6 family record and #2981 static joint flags, alongside the reviewed #1991 channel. #2981 is an author-checked source archive, not an independently validated executable correction or a refutation of program-level lifetime floors.", + "scope": "Source-bound orientation only. Read the named package and review before relying on its local evidence; this command is not its replay or supplier admission." + }, + "first_experiment": "After checking live handoffs, pin one named collection from #2981 and attach acquisition/delivery times, source dependencies and coefficient requirements. Test legal access and arbitrary dirty restoration; price any completion against the full channel/endpoint/hosting allowance. Stop with the exact missing implication or a scoped counterexample rather than expanding the static cover census.", + "bottleneck_link": "Completing an already realized changed channel tests a concrete construction opportunity, instead of refining the incumbent packing. A positive local result still needs global and all-size admission.", + "allowed_variations": [ + "One correction factorization, one chronological cut, or one explicit hosting obstruction.", + "A changed correction schedule with an updated full bill and native frame contract." + ], + "scope_change_triggers": [ + "Recompiling the already certified low-rank channel without closing a new obligation.", + "Treating a pending ancestor, local histogram or unpriced side correction as an admitted global supplier.", + "Repeating a correction or physical conversion already supplied by a pending follow-up without adding independent coverage or a different unresolved obligation.", + "Repeating the 208-flag static matching or calling a static nested cover a chronological correction program. Independent audit of that certificate is distinct and remains useful." + ], + "overlap_terms": [ + "P104", + "I-G/2", + "side correction", + "native channel", + "1972", + "1991", + "2586", + "endpoint transport", + "physical dual", + "relay composition", + "2981", + "joint unit flags", + "acquisition delivery", + "static nesting" + ], + "existing_checks": [ + { + "scope": "PR #2981 reports static joint endpoint flags and a matching of 208 departure and arrival flags; archival intake is not independent verification.", + "evidence": "research/p104-joint-unit-flags/README.md", + "remaining": "Independent flag check and a chronological coefficient program with dirty restoration and a complete cost.", + "status": "author-checked", + "source_commit": "3d24b92d8ba057b57cb2d480170ec407520e6882", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "refined", + "actual_scope": "Answer #3669 OQ2 for present-head flag 0: on the published #2089 promote/add/restore at events 5758/5759/5807, exhibit the self-owned host schedule S0 (owner=X0 on the full chart) for the X0 read, prove it is the unique owner among registers named by that ADD, prove the window touches no dirty helper (channel dirt restorations preserved), prove both endpoints remain at their unrestored channel finals (zero repayment toward initials), and prove that restoring X0 to its initial frame before the ADD breaks the published common-chart annotation.", + "scope_change_reason": "#3669 OQ2 asks whether the published promote/add/restore admits an owner/host schedule for the X0 read that restores arbitrary dirt without repaying unrestored channel endpoints. Prior jwr404 readings show the frames, coefficient and that no owner field is named; #3349 shows endpoints unrestored. This package assigns the schedule and certifies dirt preservation, zero endpoint repayment and the pre-read restoration obstruction. Distinct from deferred flag0-head-span-schedule (+2 co-host at 3369) and from open #3532 flag-1 repair.", + "bottleneck_link": "A legal I-G/2 completion needs an owner/host for every source read with dirty restoration. For flag 0's published tail cut, self-ownership on the unrestored full frame closes that local obligation without endpoint repayment; global hosting across all 4992 reads remains open.", + "budget_minutes": 60, + "stop_rule": "Stop after S0 is certified with uniqueness, dirt non-touch, zero endpoint repayment and the pre-read obstruction, dual-scanned. Do not build a global 104-by-104 owner map, reprint #3669 chronology, retarget #3532 repair templates, or price a new kappa.", + "outcome": "completed", + "evidence": "Event 5759 is add Y34 X0 -1/2 on FULL after promote 5758 and before restore 5807. S0 assigns owner=X0 (self) on host chart FULL. Among registers named by that ADD the unique source owner is X0. Window 5758..5807 has 48 Y34 adds and 2 Y34 transports, zero D/G/Q/C touches. X0 has no destination event after channel prefix (last write 1486). After 5807, X0 remains FULL and Y34 returns to RANK8 \u2014 both equal channel finals, neither equals its initial, so endpoint repay mass toward initials is zero. Forcing X0 onto initial [232] before 5759 conflicts with the ADD's FULL annotation. Coefficient matches CORRECTION-ROWS row 34 source 0. Selected kappa unchanged.", + "author": "Wentao Li", + "ai_assistance": "Substantial AI assistance for derivation, implementation, checking and writing.", + "no_new_kappa": true, + "open_questions": [ + { + "question": "Does the same self-owned zero-repay schedule extend uniformly to all 104 targets' promote/add/restore windows, or do some source reads require a copied host?", + "why_it_matters": "Flag 0 is one of 4992 source reads. A uniform self-owned pattern would discharge the global owner gap left by #2089; a counterexample would force host mass on some rows.", + "first_step": "Scan every target window in the augmented witness for dirty-helper touches and source destination events after the channel prefix.", + "blocked_by": "This package certifies only the flag-0 window." + }, + { + "question": "What is the minimum added host rank mass for a copied-host alternative that leaves X0/Y34 at channel finals but routes the 5759 operand through a fresh dirty helper?", + "why_it_matters": "S0 pays zero new host mass. A copied-host floor would price the gap between self-ownership and helper hosting under unrestored endpoints.", + "first_step": "Search nested helper paths from empty to FULL that acquire X0 before 5759 and restore dirt after, with X0 unwritten.", + "blocked_by": "No copied-host word is constructed here." + } + ] +} diff --git a/research/p104-flag0-tail-owner-host/VERIFY.json b/research/p104-flag0-tail-owner-host/VERIFY.json new file mode 100644 index 0000000000..1ece3dfcec --- /dev/null +++ b/research/p104-flag0-tail-owner-host/VERIFY.json @@ -0,0 +1,30 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "research/p104-tail-side-correction-seed749717/AUGMENTED-WITNESS.json.gz", + "research/p104-tail-side-correction-seed749717/CORRECTION-ROWS.json", + "research/p104-tail-flag0-owner/RESULT.json", + "research/p104-channel-touch-restoration-audit/CERTIFICATE.json" + ], + "commands": [ + { + "argv": ["{python}", "-I", "-O", "-Werror", "-B", "{package}/verify.py"], + "timeout_seconds": 90, + "checks": "Forward frame walk: self-owned S0 schedule, dirt non-touch, zero endpoint repayment, pre-read restore obstruction" + }, + { + "argv": ["{python}", "-I", "-O", "-Werror", "-B", "{package}/independent.py"], + "timeout_seconds": 90, + "checks": "Index-list scan of the same owner/host schedule without importing verify.py" + }, + { + "argv": ["{python}", "-I", "-O", "-Werror", "-B", "{package}/test_package.py"], + "timeout_seconds": 180, + "checks": "Duplicate JSON keys, temp-tree corruption under -O, optimized admission, obstruction control, scanner agreement, read-only replay" + } + ] +} diff --git a/research/p104-flag0-tail-owner-host/independent.py b/research/p104-flag0-tail-owner-host/independent.py new file mode 100644 index 0000000000..cfdfb4a235 --- /dev/null +++ b/research/p104-flag0-tail-owner-host/independent.py @@ -0,0 +1,247 @@ +#!/usr/bin/env python3 +"""Independent index-list scan of the flag-0 tail owner/host schedule. + +Does not import verify.py. Builds per-register event indexes, reconstructs +X0/Y34 frames from their transport subsequences alone, and rechecks the +self-owned schedule, dirt non-touch, zero endpoint repayment, and the +pre-read restoration obstruction. Admission uses need(); active under -O. +""" + +from __future__ import annotations + +import gzip +import hashlib +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +MARKER = ( + "PASS_P104_FLAG0_TAIL_OWNER_HOST_INDEPENDENT flag=0 owner=X0 promote=5758 " + "add=5759 restore=5807 dirty_helper_touches=0 endpoint_repay=0 " + "pre_read_restore_blocks=1 unique_owner=1 no_new_kappa" +) +INPUTS = ( + "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "research/p104-tail-side-correction-seed749717/AUGMENTED-WITNESS.json.gz", + "research/p104-tail-side-correction-seed749717/CORRECTION-ROWS.json", + "research/p104-tail-flag0-owner/RESULT.json", + "research/p104-channel-touch-restoration-audit/CERTIFICATE.json", +) +FULL = (1, 2, 4, 8, 16, 32, 64, 128, 256) +RANK8 = (499, 23, 232, 32, 112, 15, 7, 2) +SOURCE_INIT = (232,) +TARGET_INIT = () +PROMOTE = 5758 +ADD = 5759 +RESTORE = 5807 +CHANNEL_LEN = 4058 +SELECTED_KAPPA = "0.001672660197076918" + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def pairs_unique(pairs): + value = {} + for key, item in pairs: + need(key not in value, "duplicate JSON key") + value[key] = item + return value + + +def read_json(path): + raw = Path(path).read_bytes() + need(len(raw) <= 8_000_000, "input exceeds 8 MB") + return json.loads(raw, object_pairs_hook=pairs_unique) + + +def read_json_gz(path): + raw = Path(path).read_bytes() + need(len(raw) <= 8_000_000, "gzip input exceeds 8 MB") + return json.loads(gzip.decompress(raw), object_pairs_hook=pairs_unique) + + +def sha256(path): + digest = hashlib.sha256() + with Path(path).open("rb") as handle: + for block in iter(lambda: handle.read(1 << 20), b""): + digest.update(block) + return digest.hexdigest() + + +def as_tuple(frame): + need(type(frame) is list, "frame type") + return tuple(frame) + + +def dirty_name(item): + if type(item) is not str: + return False + if item == "C": + return True + if len(item) < 2 or item[0] not in "DGQ": + return False + return item[1:].isdigit() + + +def authenticate(): + sources = read_json(HERE / "SOURCES.json") + pinned = {row["path"]: row for row in sources["files"] if row["usage"] == "input"} + need(set(pinned) == set(INPUTS), "input inventory changed") + for path, row in pinned.items(): + need(sha256(ROOT / path) == row["sha256"], "source hash " + path) + + +def index_program(program): + by_reg = {} + transports = {} + destinations = {} + for index, event in enumerate(program): + need(type(event) is list and event, "event") + names = [] + for item in event: + if type(item) is str and len(item) >= 2 and item[0] in "XYDGQC": + if item == "C" or item[1:].isdigit(): + names.append(item) + for name in names: + by_reg.setdefault(name, []).append(index) + if event[0] == "transport": + reg = event[1] + transports.setdefault(reg, []).append(index) + destinations.setdefault(reg, []).append(index) + elif event[0] == "add": + destinations.setdefault(event[1], []).append(index) + elif event[0] == "copy": + destinations.setdefault(event[1], []).append(index) + return by_reg, transports, destinations + + +def frame_at(program, initial, reg, cut): + frame = as_tuple(initial[reg]) + for index, event in enumerate(program[:cut]): + if event[0] != "transport" or event[1] != reg: + continue + need(as_tuple(event[2]) == frame, "transport mismatch at " + str(index)) + frame = as_tuple(event[3]) + return frame + + +def evaluate(): + authenticate() + certificate = read_json(HERE / "CERTIFICATE.json") + channel = read_json(ROOT / INPUTS[0]) + tail = read_json_gz(ROOT / INPUTS[1]) + rows = read_json(ROOT / INPUTS[2]) + owner_receipt = read_json(ROOT / INPUTS[3]) + touch = read_json(ROOT / INPUTS[4]) + + need(tail["program"][:CHANNEL_LEN] == channel["program"], "prefix drift") + program = tail["program"] + by_reg, transports, destinations = index_program(program) + + need(program[PROMOTE][0] == "transport" and program[PROMOTE][1] == "Y34", "promote") + need(as_tuple(program[PROMOTE][2]) == RANK8, "promote old") + need(as_tuple(program[PROMOTE][3]) == FULL, "promote new") + need(program[PROMOTE][4] == 1, "promote rank") + need(program[ADD] == ["add", "Y34", "X0", "-1/2", list(FULL)], "add") + need(program[RESTORE][0] == "transport" and program[RESTORE][1] == "Y34", "restore") + need(as_tuple(program[RESTORE][2]) == FULL, "restore old") + need(as_tuple(program[RESTORE][3]) == RANK8, "restore new") + + x0_at_add = frame_at(program, tail["initial_frames"], "X0", ADD + 1) + y34_at_add = frame_at(program, tail["initial_frames"], "Y34", ADD + 1) + need(x0_at_add == FULL and y34_at_add == FULL, "host chart at add") + need(x0_at_add == as_tuple(program[ADD][4]), "annotated chart") + + x0_after = frame_at(program, tail["initial_frames"], "X0", RESTORE + 1) + y34_after = frame_at(program, tail["initial_frames"], "Y34", RESTORE + 1) + need(x0_after == FULL and y34_after == RANK8, "frames after restore") + need(x0_after != SOURCE_INIT and y34_after != TARGET_INIT, "endpoint repaid") + + x0_dest_after = [i for i in destinations.get("X0", []) if i >= CHANNEL_LEN] + need(x0_dest_after == [], "X0 written after channel") + need(destinations.get("X0", [])[-1] == 1486, "X0 last destination") + + y34_tail_transports = [i for i in transports.get("Y34", []) if i >= CHANNEL_LEN] + need(y34_tail_transports == [PROMOTE, RESTORE], "Y34 transports") + + dirty = 0 + adds = 0 + for index in range(PROMOTE, RESTORE + 1): + event = program[index] + for item in event: + if dirty_name(item): + dirty += 1 + if event[0] == "add" and event[1] == "Y34": + adds += 1 + need(dirty == 0, "dirty helper touch") + need(adds == 48, "add count") + + # Unique owner: among registers named by the ADD, only X0 can own the read. + named = {program[ADD][1], program[ADD][2]} + need(named == {"Y34", "X0"}, "named set") + need((named - {"Y34"}) == {"X0"}, "unique owner") + + hits = [e for e in rows["rows"][34]["nonzero"] if e["source"] == 0] + need(len(hits) == 1 and hits[0]["coefficient"] == "-1/2", "coefficient") + + need(touch["frame_restored_sources"] == 0 and touch["frame_restored_targets"] == 0, + "touch unrestored") + need(owner_receipt["owner_assigned"] is False and owner_receipt["event"] == ADD, + "prior owner gap") + + # Pre-read restoration obstruction via index membership: SOURCE_INIT is not + # the annotated chart, so forcing X0 onto SOURCE_INIT before ADD conflicts. + need(SOURCE_INIT != FULL, "obstruction vacuous") + need(SOURCE_INIT != as_tuple(program[ADD][4]), "obstruction chart") + + expected = { + "schema_version": 1, + "claim_id": "p104-flag0-tail-owner-host", + "pinned_main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "answers": "CrocSwap#3669 OQ2", + "flag_index": 0, + "source": 0, + "target": 34, + "source_register": "X0", + "target_register": "Y34", + "promote_event": PROMOTE, + "add_event": ADD, + "restore_event": RESTORE, + "coefficient": "-1/2", + "host_chart": list(FULL), + "channel_final_x0": list(FULL), + "channel_final_y34": list(RANK8), + "source_initial": list(SOURCE_INIT), + "target_initial": list(TARGET_INIT), + "schedule_id": "S0", + "owner": "X0", + "owner_kind": "self", + "unique_owner_among_event_named_registers": True, + "dirty_helper_touches_in_window": 0, + "x0_destination_events_after_channel": 0, + "x0_last_destination_event": 1486, + "endpoint_repay_x0_to_initial": False, + "endpoint_repay_y34_to_initial": False, + "x0_frame_after_restore": list(FULL), + "y34_frame_after_restore": list(RANK8), + "y34_tail_transports": [PROMOTE, RESTORE], + "window_add_count": 48, + "pre_read_x0_restoration_blocks_common_chart": True, + "selected_kappa": SELECTED_KAPPA, + "no_new_kappa": True, + } + need(certificate == expected, "certificate mismatch") + return True + + +def main(): + evaluate() + print(MARKER) + + +if __name__ == "__main__": + main() diff --git a/research/p104-flag0-tail-owner-host/test_package.py b/research/p104-flag0-tail-owner-host/test_package.py new file mode 100644 index 0000000000..8ce4582236 --- /dev/null +++ b/research/p104-flag0-tail-owner-host/test_package.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python3 +"""Admission, corruption, obstruction control and scanner-agreement checks.""" + +from __future__ import annotations + +import hashlib +import json +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +sys.path.insert(0, str(HERE)) +import independent +import verify + +SLUG = "research/" + HERE.name + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def tree_digest(paths): + return {str(path): hashlib.sha256(path.read_bytes()).hexdigest() for path in paths} + + +def watched_files(): + files = [path for path in HERE.iterdir() if path.is_file()] + files.extend(ROOT / name for name in verify.INPUTS) + return sorted(files) + + +def test_duplicate_key(): + with tempfile.TemporaryDirectory() as tmp: + path = Path(tmp) / "dup.json" + path.write_text('{"a": 1, "a": 2}\n', encoding="utf-8") + for reader in (verify.read_json, independent.read_json): + try: + reader(path) + except ValueError as exc: + need(str(exc) == "duplicate JSON key", "duplicate message") + else: + need(False, "duplicate key accepted") + + +def stage_tree(tmp): + root = Path(tmp) + for name in verify.INPUTS: + destination = root / name + destination.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(ROOT / name, destination) + package = root / SLUG + package.mkdir(parents=True) + for path in HERE.iterdir(): + if path.is_file() and path.suffix in (".py", ".json"): + shutil.copyfile(path, package / path.name) + return root, package + + +def run_optimized(script): + return subprocess.run( + [sys.executable, "-I", "-O", "-B", str(script)], + check=False, + capture_output=True, + text=True, + timeout=90, + ) + + +def expect_rejection(script, needle): + done = run_optimized(script) + need(done.returncode != 0, "corruption accepted: " + script.name) + need(needle in done.stderr, "wrong rejection for " + script.name + ": " + done.stderr[-300:]) + + +def test_temp_copy_corruption(): + before = tree_digest(watched_files()) + with tempfile.TemporaryDirectory() as tmp: + root, package = stage_tree(tmp) + for name in ("verify.py", "independent.py"): + done = run_optimized(package / name) + need(done.returncode == 0, "clean temp copy failed: " + done.stderr[-300:]) + cert = package / "CERTIFICATE.json" + clean = cert.read_bytes() + mutations = ( + ("owner", "D0"), + ("dirty_helper_touches_in_window", 1), + ("endpoint_repay_x0_to_initial", True), + ("pre_read_x0_restoration_blocks_common_chart", False), + ("add_event", 5760), + ) + for key, value in mutations: + blob = json.loads(clean) + blob[key] = value + cert.write_text(json.dumps(blob, indent=2) + "\n", encoding="utf-8") + expect_rejection(package / "verify.py", "certificate mismatch") + expect_rejection(package / "independent.py", "certificate mismatch") + text = clean.decode("utf-8").replace( + '"schema_version": 1,', '"schema_version": 1,\n "schema_version": 1,', 1 + ) + cert.write_text(text, encoding="utf-8") + expect_rejection(package / "verify.py", "duplicate JSON key") + expect_rejection(package / "independent.py", "duplicate JSON key") + cert.write_bytes(clean) + # Corrupt the gzipped tail witness by flipping a byte in the compressed stream. + witness = root / verify.INPUTS[1] + raw = bytearray(witness.read_bytes()) + raw[len(raw) // 2] ^= 0xFF + witness.write_bytes(bytes(raw)) + for name in ("verify.py", "independent.py"): + done = run_optimized(package / name) + need(done.returncode != 0, "corrupt witness accepted") + need("source hash" in done.stderr or "gzip" in done.stderr.lower() + or "JSON" in done.stderr or "Error" in done.stderr + or done.returncode != 0, + "corrupt witness silent") + need(tree_digest(watched_files()) == before, "live files mutated by corruption test") + + +def test_optimized_admission(): + before = tree_digest(watched_files()) + for module in (verify, independent): + try: + module.need(False, "admission probe") + except ValueError as exc: + need(str(exc) == "admission probe", "need message") + else: + need(False, "need ignored under import") + done = subprocess.run( + [sys.executable, "-I", "-O", "-Werror", "-B", str(HERE / "verify.py")], + check=False, + capture_output=True, + text=True, + timeout=90, + cwd=str(ROOT), + ) + need(done.returncode == 0, "optimized verify failed: " + done.stderr[-300:]) + need(verify.MARKER in done.stdout, "verify marker missing") + need(tree_digest(watched_files()) == before, "verify mutated files") + + +def test_pre_read_restore_control(): + """Forcing X0 onto its initial frame before the ADD breaks the chart.""" + need(verify.SOURCE_INIT != verify.FULL, "control vacuous") + need(tuple(verify.SOURCE_INIT) != tuple(verify.FULL), "tuple control") + # The published ADD annotates FULL; initial is not that chart. + addition = ["add", "Y34", "X0", "-1/2", list(verify.FULL)] + need(addition[4] != verify.SOURCE_INIT, "annotated chart equals initial") + + +def test_scanner_agreement(): + before = tree_digest(watched_files()) + verify.evaluate() + independent.evaluate() + cert = verify.read_json(HERE / "CERTIFICATE.json") + need(cert["owner"] == "X0", "owner") + need(cert["dirty_helper_touches_in_window"] == 0, "dirt") + need(cert["endpoint_repay_x0_to_initial"] is False, "repay x0") + need(cert["endpoint_repay_y34_to_initial"] is False, "repay y34") + need(cert["pre_read_x0_restoration_blocks_common_chart"] is True, "obstruction") + need(tree_digest(watched_files()) == before, "agreement mutated files") + + +def test_read_only_default(): + before = tree_digest(watched_files()) + done = subprocess.run( + [sys.executable, "-I", "-B", str(HERE / "verify.py")], + check=False, + capture_output=True, + text=True, + timeout=90, + cwd=str(ROOT), + ) + need(done.returncode == 0, "read-only verify failed: " + done.stderr[-300:]) + need(tree_digest(watched_files()) == before, "read-only verify wrote files") + + +def main(): + groups = ( + test_duplicate_key, + test_temp_copy_corruption, + test_optimized_admission, + test_pre_read_restore_control, + test_scanner_agreement, + test_read_only_default, + ) + for group in groups: + group() + print("PASS_P104_FLAG0_TAIL_OWNER_HOST_TESTS groups=" + str(len(groups))) + + +if __name__ == "__main__": + main() diff --git a/research/p104-flag0-tail-owner-host/verify.py b/research/p104-flag0-tail-owner-host/verify.py new file mode 100644 index 0000000000..14e7635f4d --- /dev/null +++ b/research/p104-flag0-tail-owner-host/verify.py @@ -0,0 +1,279 @@ +#!/usr/bin/env python3 +"""Self-owned host schedule for the flag-0 tail X0 read (answers #3669 OQ2). + +On the published promote/add/restore at 5758/5759/5807, assign owner=X0 on the +full host chart. Prove: the assignment is the unique owner among registers +named by that ADD; the window touches no dirty helper; X0 is never a +destination after the channel prefix; both endpoints stay at their unrestored +channel finals (zero repayment toward initials); restoring X0 to its initial +frame before the ADD breaks the published common-chart annotation. + +Read-only. Admission uses need(); checks stay active under -O. +""" + +from __future__ import annotations + +import gzip +import hashlib +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +MARKER = ( + "PASS_P104_FLAG0_TAIL_OWNER_HOST flag=0 owner=X0 promote=5758 add=5759 " + "restore=5807 dirty_helper_touches=0 endpoint_repay=0 " + "pre_read_restore_blocks=1 unique_owner=1 no_new_kappa" +) +INPUTS = ( + "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "research/p104-tail-side-correction-seed749717/AUGMENTED-WITNESS.json.gz", + "research/p104-tail-side-correction-seed749717/CORRECTION-ROWS.json", + "research/p104-tail-flag0-owner/RESULT.json", + "research/p104-channel-touch-restoration-audit/CERTIFICATE.json", +) +FULL = [1, 2, 4, 8, 16, 32, 64, 128, 256] +RANK8 = [499, 23, 232, 32, 112, 15, 7, 2] +SOURCE_INIT = [232] +TARGET_INIT: list[int] = [] +PROMOTE = 5758 +ADD = 5759 +RESTORE = 5807 +CHANNEL_LEN = 4058 +SELECTED_KAPPA = "0.001672660197076918" + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def pairs_unique(pairs): + value = {} + for key, item in pairs: + need(key not in value, "duplicate JSON key") + value[key] = item + return value + + +def read_json(path): + raw = Path(path).read_bytes() + need(len(raw) <= 8_000_000, "input exceeds 8 MB") + return json.loads(raw, object_pairs_hook=pairs_unique) + + +def read_json_gz(path): + raw = Path(path).read_bytes() + need(len(raw) <= 8_000_000, "gzip input exceeds 8 MB") + return json.loads(gzip.decompress(raw), object_pairs_hook=pairs_unique) + + +def sha256(path): + digest = hashlib.sha256() + with Path(path).open("rb") as handle: + for block in iter(lambda: handle.read(1 << 20), b""): + digest.update(block) + return digest.hexdigest() + + +def is_dirty_helper(name): + if type(name) is not str or len(name) < 2: + return False + head, tail = name[0], name[1:] + if head == "C" and tail == "": + return True + if head not in "DGQ": + return False + return tail.isdigit() and int(tail) <= 103 + + +def walk_frames(program, initial, names): + frames = {name: list(initial[name]) for name in names} + destinations = {name: [] for name in names} + for index, event in enumerate(program): + need(type(event) is list and event, "event shape") + op = event[0] + if op == "transport": + need(len(event) == 5, "transport arity") + _op, reg, old, new, rank = event + if reg in frames: + need(old == frames[reg], "transport left its live frame at " + str(index)) + need(type(rank) is int and rank >= 0, "transport rank") + frames[reg] = list(new) + destinations[reg].append(index) + elif op == "add": + need(len(event) == 5, "add arity") + _op, dest, _src, _coef, _chart = event + if dest in frames: + destinations[dest].append(index) + elif op == "copy": + need(len(event) >= 3, "copy arity") + dest = event[1] + if dest in frames: + destinations[dest].append(index) + return frames, destinations + + +def authenticate(): + sources = read_json(HERE / "SOURCES.json") + pinned = {row["path"]: row for row in sources["files"] if row["usage"] == "input"} + need(set(pinned) == set(INPUTS), "input inventory changed") + for path, row in pinned.items(): + need(sha256(ROOT / path) == row["sha256"], "source hash " + path) + + +def evaluate(): + authenticate() + certificate = read_json(HERE / "CERTIFICATE.json") + channel = read_json(ROOT / INPUTS[0]) + tail = read_json_gz(ROOT / INPUTS[1]) + rows = read_json(ROOT / INPUTS[2]) + owner_receipt = read_json(ROOT / INPUTS[3]) + touch = read_json(ROOT / INPUTS[4]) + + need(tail["program"][:CHANNEL_LEN] == channel["program"], "tail prefix left the channel") + need(channel["final_frames"]["X0"] == FULL, "channel X0 final") + need(channel["final_frames"]["Y34"] == RANK8, "channel Y34 final") + need(channel["initial_frames"]["X0"] == SOURCE_INIT, "channel X0 initial") + need(channel["initial_frames"]["Y34"] == TARGET_INIT, "channel Y34 initial") + need(tail["initial_frames"]["X0"] == SOURCE_INIT, "tail X0 initial") + need(tail["initial_frames"]["Y34"] == TARGET_INIT, "tail Y34 initial") + need(tail["final_frames"]["X0"] == FULL, "tail X0 final") + need(tail["final_frames"]["Y34"] == RANK8, "tail Y34 final") + + # Channel-touch prior: every endpoint unrestored (cited, not re-censused). + need(touch["claim_id"] == "p104-channel-touch-restoration-audit", "touch claim id") + need(touch["frame_restored_sources"] == 0, "touch sources restored") + need(touch["frame_restored_targets"] == 0, "touch targets restored") + need(touch["flag0"]["source_frame_restored"] is False, "touch flag0 source") + need(touch["flag0"]["target_frame_restored"] is False, "touch flag0 target") + # Prior owner package: the tail word names no owner for event 5759. + need(owner_receipt["event"] == ADD, "owner receipt event") + need(owner_receipt["owner_assigned"] is False, "owner already assigned") + need(owner_receipt["owner_field"] is False, "owner field present") + need(owner_receipt["add"] == ["Y34", "X0", "-1/2"], "owner receipt add") + + program = tail["program"] + need(len(program) > RESTORE, "program too short") + need(program[PROMOTE] == ["transport", "Y34", RANK8, FULL, 1], "promote event") + need(program[ADD] == ["add", "Y34", "X0", "-1/2", FULL], "add event") + need(program[RESTORE] == ["transport", "Y34", FULL, RANK8, 1], "restore event") + + frames_at_add, destinations = walk_frames( + program[: ADD + 1], tail["initial_frames"], ("X0", "Y34") + ) + need(frames_at_add["X0"] == FULL, "X0 not on host chart at add") + need(frames_at_add["Y34"] == FULL, "Y34 not on host chart at add") + need(program[ADD][4] == frames_at_add["X0"] == frames_at_add["Y34"], "common chart") + + frames_after, destinations_full = walk_frames( + program[: RESTORE + 1], tail["initial_frames"], ("X0", "Y34") + ) + need(frames_after["X0"] == FULL, "X0 frame after restore") + need(frames_after["Y34"] == RANK8, "Y34 frame after restore") + need(frames_after["X0"] != SOURCE_INIT, "X0 repaid to initial") + need(frames_after["Y34"] != TARGET_INIT, "Y34 repaid to initial") + + x0_dest_after = [i for i in destinations_full["X0"] if i >= CHANNEL_LEN] + need(x0_dest_after == [], "X0 written after channel") + # Last X0 destination in the whole word must be inside the channel. + all_x0_dest = destinations_full["X0"] + need(all_x0_dest and all_x0_dest[-1] == 1486, "X0 last destination") + + y34_tail = [i for i in destinations_full["Y34"] if i >= CHANNEL_LEN] + # Destination list includes ADDs; transports alone are the frame changes. + y34_transports = [ + i + for i, event in enumerate(program) + if event[0] == "transport" and event[1] == "Y34" and i >= CHANNEL_LEN + ] + need(y34_transports == [PROMOTE, RESTORE], "Y34 tail transports") + + window = program[PROMOTE : RESTORE + 1] + dirty_touches = 0 + add_count = 0 + named_on_add = set() + for offset, event in enumerate(window): + index = PROMOTE + offset + for item in event: + if is_dirty_helper(item): + dirty_touches += 1 + if event[0] == "add" and event[1] == "Y34": + add_count += 1 + if index == ADD: + named_on_add = {event[1], event[2]} + need(dirty_touches == 0, "dirty helper touched in window") + need(add_count == 48, "window add count") + need(named_on_add == {"Y34", "X0"}, "add named registers") + # Unique owner among registers named by the ADD, excluding the write target. + source_named = named_on_add - {"Y34"} + need(source_named == {"X0"}, "unique source owner") + + # Coefficient matches the published correction row. + row = rows["rows"][34] + need(row["target"] == 34, "correction target") + hits = [entry for entry in row["nonzero"] if entry["source"] == 0] + need(len(hits) == 1 and hits[0]["coefficient"] == "-1/2", "correction coefficient") + + # Pre-read restoration of X0 to its initial frame blocks the published chart. + blocked = SOURCE_INIT != FULL + need(blocked, "initial equals FULL unexpectedly") + # Simulate: if X0 were forced to SOURCE_INIT at the ADD while the event + # still annotates FULL, the common-chart rule fails. + need(SOURCE_INIT != program[ADD][4], "pre-read restore would match chart") + + expected = { + "schema_version": 1, + "claim_id": "p104-flag0-tail-owner-host", + "pinned_main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "answers": "CrocSwap#3669 OQ2", + "flag_index": 0, + "source": 0, + "target": 34, + "source_register": "X0", + "target_register": "Y34", + "promote_event": PROMOTE, + "add_event": ADD, + "restore_event": RESTORE, + "coefficient": "-1/2", + "host_chart": FULL, + "channel_final_x0": FULL, + "channel_final_y34": RANK8, + "source_initial": SOURCE_INIT, + "target_initial": TARGET_INIT, + "schedule_id": "S0", + "owner": "X0", + "owner_kind": "self", + "unique_owner_among_event_named_registers": True, + "dirty_helper_touches_in_window": 0, + "x0_destination_events_after_channel": 0, + "x0_last_destination_event": 1486, + "endpoint_repay_x0_to_initial": False, + "endpoint_repay_y34_to_initial": False, + "x0_frame_after_restore": FULL, + "y34_frame_after_restore": RANK8, + "y34_tail_transports": [PROMOTE, RESTORE], + "window_add_count": 48, + "pre_read_x0_restoration_blocks_common_chart": True, + "selected_kappa": SELECTED_KAPPA, + "no_new_kappa": True, + } + need(certificate == expected, "certificate mismatch") + need(certificate["selected_kappa"] == SELECTED_KAPPA, "kappa drift") + return { + "owner": "X0", + "dirty_helper_touches": dirty_touches, + "endpoint_repay": 0, + "unique_owner": 1, + "pre_read_restore_blocks": 1, + } + + +def main(): + result = evaluate() + need(result["owner"] == "X0", "owner") + print(MARKER) + + +if __name__ == "__main__": + main() From 9a53c8ad9ac5ba8ad1a77907f66ac2529c947829 Mon Sep 17 00:00:00 2001 From: Wentao Li Date: Sun, 18 Oct 2026 14:10:26 +0000 Subject: [PATCH 2/2] Record content tip SHA in flag-0 tail owner-host MASTER-HANDOFF --- research/p104-flag0-tail-owner-host/MASTER-HANDOFF.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/research/p104-flag0-tail-owner-host/MASTER-HANDOFF.md b/research/p104-flag0-tail-owner-host/MASTER-HANDOFF.md index dfc100fb55..2dd3ad10f8 100644 --- a/research/p104-flag0-tail-owner-host/MASTER-HANDOFF.md +++ b/research/p104-flag0-tail-owner-host/MASTER-HANDOFF.md @@ -3,7 +3,7 @@ ## Candidate - Branch: `cursor/flag0-tail-owner-host-60b9` (VictorLiwentao fork). -- Content tip: scientific package commit (parent = pinned base). +- Content tip: `01cbbe345` (scientific package commit; parent = pinned base). - Packaging tip: branch HEAD (`git rev-parse HEAD` on this branch). - Package: `research/p104-flag0-tail-owner-host/` - Base: CrocSwap main `20ecf2891d80b5acf18d980b2164fb44ea7faa90`