From 5889fe1591f689c3003e2f92c9258d79c97bdee3 Mon Sep 17 00:00:00 2001 From: Wentao Li Date: Sun, 18 Oct 2026 02:29:46 +0000 Subject: [PATCH 1/2] Research: present-head flag 43 hosts its tail before its head, and the head only after the last update Pin matched flag 43 (X21 -> Y59, basis head 15) on the published P104 channel. The head enters Y59's frame, listed and in GF(2) span, only at the terminal rank-3 transport after-frame (event 3525), after all fifteen Y59 adds have run in head-free charts. X21's literal drop at event 570 is a nested chart change that keeps 15 in span (3 ^ 4 ^ 8). Y59's last two updates (3231, 3364) already run in charts spanning the flag's non-head basis vectors {32} and {6, 18, 32}, which X21's live rank-9 frame also spans, so the missing co-hosted direction is the head alone. No Y59 event occurs while both endpoints host the head direction. Both scanners refuse a drop/arrive/gap tuple equal to the published flag-1 or flag-9 tuples. No new kappa. Prepared with substantial AI assistance. --- .../CERTIFICATE.json | 378 +++++++++++++ .../p104-present-head-flag43-audit/NOTICE.md | 9 + .../p104-present-head-flag43-audit/PROOF.md | 148 +++++ .../p104-present-head-flag43-audit/README.md | 79 +++ .../SOURCES.json | 44 ++ .../p104-present-head-flag43-audit/TASK.json | 96 ++++ .../VERIFY.json | 28 + .../independent.py | 442 +++++++++++++++ .../test_package.py | 254 +++++++++ .../p104-present-head-flag43-audit/verify.py | 520 ++++++++++++++++++ 10 files changed, 1998 insertions(+) create mode 100644 research/p104-present-head-flag43-audit/CERTIFICATE.json create mode 100644 research/p104-present-head-flag43-audit/NOTICE.md create mode 100644 research/p104-present-head-flag43-audit/PROOF.md create mode 100644 research/p104-present-head-flag43-audit/README.md create mode 100644 research/p104-present-head-flag43-audit/SOURCES.json create mode 100644 research/p104-present-head-flag43-audit/TASK.json create mode 100644 research/p104-present-head-flag43-audit/VERIFY.json create mode 100644 research/p104-present-head-flag43-audit/independent.py create mode 100644 research/p104-present-head-flag43-audit/test_package.py create mode 100644 research/p104-present-head-flag43-audit/verify.py diff --git a/research/p104-present-head-flag43-audit/CERTIFICATE.json b/research/p104-present-head-flag43-audit/CERTIFICATE.json new file mode 100644 index 0000000000..cc3e0622aa --- /dev/null +++ b/research/p104-present-head-flag43-audit/CERTIFICATE.json @@ -0,0 +1,378 @@ +{ + "schema_version": 1, + "claim_id": "p104-present-head-flag43-audit", + "pinned_main": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "flag_index": 43, + "source": 21, + "target": 59, + "basis_head": 15, + "departure_choice": 1, + "arrival_choice": 0, + "basis": [ + 15, + 387, + 6, + 18, + 32, + 67, + 128, + 1, + 2 + ], + "source_register": "X21", + "target_register": "Y59", + "source_initial": [ + 15 + ], + "source_final": [ + 1, + 2, + 4, + 8, + 16, + 32, + 64, + 128, + 256 + ], + "target_initial": [], + "target_final": [ + 499, + 27, + 228, + 32, + 112, + 15, + 7, + 1 + ], + "source_initial_is_basis_head": true, + "target_final_contains_basis_head": true, + "source_frame_restored": false, + "target_frame_restored": false, + "source_rank_initial": 1, + "source_rank_final": 9, + "target_rank_initial": 0, + "target_rank_final": 8, + "source_first_event": 570, + "source_last_event": 3863, + "target_first_event": 223, + "target_last_event": 3525, + "source_event_count": 17, + "target_event_count": 21, + "joint_source_target_events": 0, + "endpoint_non_frame_events": 0, + "basis_head_drop_event": 570, + "basis_head_drop_before": [ + 15 + ], + "basis_head_drop_after": [ + 3, + 4, + 8, + 128, + 256 + ], + "basis_head_arrive_event": 3525, + "basis_head_arrive_before": [ + 6, + 20, + 32, + 95, + 447 + ], + "basis_head_arrive_after": [ + 1, + 7, + 15, + 27, + 32, + 112, + 228, + 499 + ], + "hosting_gap_events": 2955, + "source_annotations_containing_basis_head": 1, + "target_annotations_containing_basis_head": 1, + "target_preterminal_annotations_containing_basis_head": 0, + "source_head_annotations": [ + { + "event": 570, + "opcode": "transport", + "role": "before", + "frame": [ + 15 + ] + } + ], + "target_head_annotations": [ + { + "event": 3525, + "opcode": "transport", + "role": "after", + "frame": [ + 1, + 7, + 15, + 27, + 32, + 112, + 228, + 499 + ] + } + ], + "target_annotated_vectors": [ + 1, + 6, + 7, + 15, + 20, + 27, + 32, + 52, + 95, + 112, + 127, + 228, + 447, + 499, + 500 + ], + "basis_head_in_any_target_annotation": true, + "basis_head_in_source_after_drop": false, + "drop_after_span_decomposition_of_head": [ + 3, + 4, + 8 + ], + "drop_transport_span_nested": true, + "source_annotation_count": 22, + "source_annotations_span_hosting_basis_head": 22, + "source_span_drop_events": [], + "source_row_update_events": [], + "source_read_event_count": 12, + "target_span_first_hosting_event": 3525, + "target_span_first_hosting_role": "after", + "target_preterminal_annotations_span_hosting_basis_head": 0, + "target_arrive_before_span": [ + 0, + 6, + 18, + 20, + 32, + 38, + 50, + 52, + 75, + 77, + 89, + 95, + 107, + 109, + 121, + 127, + 395, + 397, + 409, + 415, + 427, + 429, + 441, + 447, + 448, + 454, + 466, + 468, + 480, + 486, + 498, + 500 + ], + "target_update_events": [ + 223, + 224, + 225, + 226, + 227, + 2099, + 2191, + 2275, + 2341, + 2393, + 2698, + 2891, + 3076, + 3231, + 3364 + ], + "target_updates_in_head_free_span": 15, + "target_updates_in_empty_chart": 10, + "target_updates_in_nonempty_head_free_chart": 5, + "target_last_update_event": 3364, + "target_transport_rank_steps": [ + 1, + 1, + 1, + 1, + 1, + 3 + ], + "target_terminal_rank_step": 3, + "basis_tail": [ + 387, + 6, + 18, + 32, + 67, + 128, + 1, + 2 + ], + "target_tail_first_span_event": 3230, + "target_tail_first_span_role": "after", + "target_tail_span_annotations": [ + { + "event": 3230, + "role": "after", + "tail": [ + 32 + ] + }, + { + "event": 3231, + "role": "add", + "tail": [ + 32 + ] + }, + { + "event": 3363, + "role": "before", + "tail": [ + 32 + ] + }, + { + "event": 3363, + "role": "after", + "tail": [ + 6, + 18, + 32 + ] + }, + { + "event": 3364, + "role": "add", + "tail": [ + 6, + 18, + 32 + ] + }, + { + "event": 3525, + "role": "before", + "tail": [ + 6, + 18, + 32 + ] + }, + { + "event": 3525, + "role": "after", + "tail": [ + 387, + 6, + 18, + 32, + 67, + 128, + 1 + ] + } + ], + "target_tail_in_arrive_before_span": [ + 6, + 18, + 32 + ], + "target_tail_in_final_span": [ + 387, + 6, + 18, + 32, + 67, + 128, + 1 + ], + "target_updates_cohosting_tail_without_head": [ + 3231, + 3364 + ], + "target_tail_cohosting_update_detail": [ + { + "event": 3231, + "target_chart_rank": 4, + "source_live_rank": 9, + "source_live_spans_head": true, + "tail_cohosted_by_both_endpoints": [ + 32 + ] + }, + { + "event": 3364, + "target_chart_rank": 5, + "source_live_rank": 9, + "source_live_spans_head": true, + "tail_cohosted_by_both_endpoints": [ + 6, + 18, + 32 + ] + } + ], + "source_live_final_matches_witness": true, + "target_events_after_span_cohost_open": 0, + "source_events_after_span_cohost_open": [ + 3705, + 3760, + 3811, + 3863 + ], + "source_events_after_span_cohost_open_are_reads": true, + "endpoint_transport_count": 11, + "endpoint_transports_span_nested_upward": true, + "endpoint_transport_rank_steps_match": true, + "targets_whose_final_contains_basis_head_among_all": 24, + "hit_flags_from_census": [ + 0, + 1, + 9, + 43 + ], + "flag_is_present_head_case": true, + "chronology_drop_arrive_gap": [ + 570, + 3525, + 2955 + ], + "published_prior_present_head_tuples": { + "3451_flag1": [ + 591, + 3473, + 2882 + ], + "3443_flag9": [ + 500, + 3489, + 2989 + ] + }, + "chronology_distinct_from_published_priors": true, + "obstruction": "published_channel_hosts_basis_head_on_matched_target_only_at_terminal_transport_literally_and_in_span_after_every_target_update_while_preterminal_target_charts_already_span_non_head_basis_vectors", + "no_new_kappa": true, + "selected_kappa": "0.001672660197076918" +} diff --git a/research/p104-present-head-flag43-audit/NOTICE.md b/research/p104-present-head-flag43-audit/NOTICE.md new file mode 100644 index 0000000000..02ff76da57 --- /dev/null +++ b/research/p104-present-head-flag43-audit/NOTICE.md @@ -0,0 +1,9 @@ +# Notice + +This package is a finite annotated-frame audit of one published P104 matched +flag, read both as listed frame vectors and as GF(2) spans. It does not modify +frozen upstream sources. + +Prepared by Wentao Li with substantial AI assistance. +Apache-2.0; predecessor notices and exact source pins are retained in +`SOURCES.json`. diff --git a/research/p104-present-head-flag43-audit/PROOF.md b/research/p104-present-head-flag43-audit/PROOF.md new file mode 100644 index 0000000000..3ffc362713 --- /dev/null +++ b/research/p104-present-head-flag43-audit/PROOF.md @@ -0,0 +1,148 @@ +# Proof: present-head flag 43 late-only target hosting, with tail co-hosting + +## Setup + +Pin CrocSwap main `6f100d4bb5083f8c35d96fd95a539811c62f245c`, the #2981 +208-flag matching (`research/p104-joint-unit-flags/CERTIFICATE.json`), and the +reviewed #1991 channel witness +(`research/p104-native-channel/inputs/LOWRANK-WITNESS.json`, 4,058 events). + +A register annotation is a transport before- or after-frame, or an add frame, +naming that register. The basis head of a matched flag is the first vector of its +basis; the other eight vectors are its *tail*. Open #3349 records that the target +final contains the head for exactly flags `(0, 1, 9, 43)`. This note audits +flag 43. + +Labels are vectors in the nine-dimensional binary space, written as integers +below 512. `research/p104-native-channel/PROOF.md` §2–§3 treats each frame as a +binary frame `W` with canonical chart `Gamma_W`: every transport is nested and +changes only `W`, and a scalar addition is allowed only in a common chart and is +the only operation that changes the destination's row. A register *lists* a +vector when it is one of the frame's vectors. It *spans* the vector when the +vector is a GF(2) sum of frame vectors. Listing depends on the chosen +generators. Spanning does not. + +## Statement + +Flag 43 has source `X21`, target `Y59`, basis head `15` and tail +`[387, 6, 18, 32, 67, 128, 1, 2]`. On the published word: + +1. `X21` begins at `[15]`. Its first event, transport 570, goes from `[15]` to + `[3, 4, 8, 128, 256]`. This removes `15` from the list. No later `X21` + annotation lists `15`. +2. The event-570 after-frame spans `15` through the unique decomposition + `3 ^ 4 ^ 8`. All 22 `X21` annotations span `15`, so in span the source never + drops the head. `X21` is never an add destination; 12 of its 17 events are + reads (adds with `X21` as the second register). +3. `Y59` starts empty. Its preterminal frames are `[]`, `[500]`, `[127, 500]`, + `[447, 127, 52]`, `[95, 447, 32, 20]` and `[95, 447, 6, 32, 20]`. None of + their spans contains `15`; the largest has rank 5 (32 elements). +4. Event 3525 is the last `Y59` event. It is a rank-3 transport from + `[95, 447, 6, 32, 20]` to the target final `[499, 27, 228, 32, 112, 15, 7, 1]`. + This after-frame is the first `Y59` annotation that lists or spans `15`. The + literal gap from the source drop is 2,955 events. +5. `Y59`'s row changes only at its 15 adds as destination. Ten (events 223–227, + 2099, 2191, 2275, 2341 and 2393) run in the empty chart. Five (2698, 2891, + 3076, 3231 and 3364) run in non-empty charts of ranks 1 to 5. All 15 charts + exclude `15` from their span. +6. **Tail co-hosting.** `Y59`'s span first contains a tail vector at the + after-frame of event 3230 (`32`). From the after-frame of event 3363 it + contains `6`, `18 = 6 ^ 20` and `32`. The adds at 3231 (chart rank 4) and + 3364 (chart rank 5) therefore run in charts that span `{32}` and + `{6, 18, 32}` but not `15`. At both adds, `X21`'s live frame (replayed from + its initial frame through its transports) is the rank-9 coordinate frame, so + it spans the head and every tail vector. Both endpoints co-host part of the + flag's basis geometry at `Y59`'s last two updates, but never the head. +7. No event names both `X21` and `Y59`, and no `zero`, `copy` or `erase` event + names either. `X21` has four events after 3525 (3705, 3760, 3811 and 3863); + all are reads and none names `Y59`. +8. All 11 endpoint transports (five on `X21`, six on `Y59`) are nested upward. + Each transport's paid rank (its fifth field, which + `research/p104-native-channel/check_native.py` binds to the compiled recipe + rank) equals the rank increase. `Y59`'s steps are `1, 1, 1, 1, 1, 3`. +9. Neither endpoint frame returns to its initial frame. `X21` goes from rank 1 + to rank 9 and `Y59` from rank 0 to rank 8. + +By items 2 and 4, the first chronological cut at which both endpoint frames +host the head direction is the after-frame of event 3525. By items 4, 5 and 7, +the published word has no `Y59` event after that cut and no `Y59` update at or +after it. So no target update, and no event touching the target, happens while +both endpoints host the basis-head direction. Logical dirty restoration of the +source line into `Y59` along co-hosted basis-head geometry is unavailable on +this word. Under listing alone the same conclusion holds with a 2,955-event gap. + +Item 6 sharpens this. The obstruction is not that `Y59` is geometrically empty +of the flag while it is updated: at its last two updates both endpoints already +co-host up to three tail directions. Only the head direction is missing, and it +arrives in the single terminal step. + +This answers #3451's second open question for flag 43: in span the source keeps +the head direction throughout, and the target gains it only at its terminal +transport. + +## Not a reprint + +Both scanners carry the drop/arrive/gap tuples published by open #3451 (flag 1: +591/3473/2882) and #3443 (flag 9: 500/3489/2989) and refuse to admit a flag-43 +chronology equal to either. Flag 43's tuple is 570/3525/2955. Its target `Y59` +has 15 updates and 6 transports; #3451's certificate records 6 updates and 3 +target transports for `Y7`. Item 6 has no counterpart in either prior: #3451's +certificate records `Y7`'s largest preterminal span as `{0, 95, 441, 486}`, +which contains none of flag 1's basis vectors. + +The source side is a near-template repeat. `X21` has the same event shape as +#3451's `X0` (17 events, 22 annotations, five transports, rank 1 to 9, four +events after the target's terminal event); only the frames and the decomposition +`3 ^ 4 ^ 8` differ. The new content is on the target side. + +## Checking method + +Two scanners read the same pinned inputs. The primary scanner walks annotations +in program order, decides span membership by pivot-indexed row reduction, tracks +combinations to return the head's decomposition, and carries `X21`'s live frame +forward, checking that each transport's before-frame equals it. The second +scanner indexes events per endpoint first, builds each span as an explicit XOR +closure (at most 512 labels), finds the decomposition by exhaustive subset +search, and reads `X21`'s live frame at a target event by bisecting its +transport list. Both reject duplicate JSON keys and dependent frames, enforce +the SHA-256 source pins, and admit through `need()` under `python -O`. Their +receipts must equal the committed certificate. + +`test_package.py` copies the package and its inputs into a temporary tree. It +mutates six certificate fields, injects a duplicate key and flips one byte of +the witness. Both scanners must reject each change under `-O`. A negative +control edits an in-memory witness so that `Y59`'s frame from event 3363 onward +is `[95, 447, 27, 32, 20]`, which spans `15 = 20 ^ 27` without listing it while +keeping every transport nested with the same rank steps. The listing count stays +at zero, but the span fields move: hosting starts at 3363, the add at 3364 now +runs in a head-hosting chart, and it leaves the tail-without-head list. A +reprint guard injects flag 43's own tuple as a prior and checks that both +scanners stop with `reprint of a prior`. + +## Soft overlap + +Open #3349 already names `(21, Y59, 15)` as a present-head triple and records +that every endpoint frame is unrestored (item 9). Merged #3242 records that no +matched pair shares an event (item 7's joint count). This package reuses those +facts and adds the span chronology of `X21` and `Y59`, the update-chart split +and the tail co-hosting. + +Open #3363 records relay delivery for all 208 flags, which implicitly includes +flag 43's delivery coefficient. This package recomputes no coefficient and does +not identify the delivering add. Conditional on #3363, the delivery into `Y59` +changes `Y59`'s row, so by the channel's addition rule it occurs at one of the 15 +adds of item 5 and hence in a head-free chart. That remark is not certified here. +Open #3365/#3371/#3372 work on flag 0 and `Y34`; this package says nothing about +either. Open #3392 (flag 2), #3443 (flag 9) and #3451 (flag 1) are not +recomputed. + +## Limits + +This is a statement about the published frames of one matched flag. "Hosting" +means the vector is listed in, or spanned by, an annotated endpoint frame. The +package does not model what the head direction means inside the relay registers +(`G`, `Q`, `D`, `C`). It does not price a repair, construct a changed schedule, +or claim a new κ. Because the 3525 transport is nested and `15` is listed in the +final frame, the rank-6 frame `[95, 447, 6, 32, 20, 15]` lies inside `Y59`'s +final span; whether a schedule can use it before event 3364, and at what cost, is +outside this certificate. diff --git a/research/p104-present-head-flag43-audit/README.md b/research/p104-present-head-flag43-audit/README.md new file mode 100644 index 0000000000..0901bd238c --- /dev/null +++ b/research/p104-present-head-flag43-audit/README.md @@ -0,0 +1,79 @@ +# Present-head flag 43: the target hosts the flag's tail before its head, and the head only after the last update + +**Scoped obstruction. No new exponent.** + +Open [#3349](https://github.com/CrocSwap/integer-mult-bounds/pull/3349) shows the +basis head is in the target final on only four of the 208 matched flags: +`(0, 1, 9, 43)`. Open [#3443](https://github.com/CrocSwap/integer-mult-bounds/pull/3443) +pins flag 9 and open [#3451](https://github.com/CrocSwap/integer-mult-bounds/pull/3451) +pins flag 1. This package pins flag 43 (`X21` → `Y59`, basis head `15`), the +last present-head flag outside the flag-0 coefficient cascade. + +On the published 4,058-event word, `Y59` passes through six preterminal frames, +from `[]` to `[95, 447, 6, 32, 20]`. None lists `15` and none spans it over +GF(2). The head enters `Y59` only in the after-frame of the terminal rank-3 +transport at event 3525. All 15 adds into `Y59` (events 223 through 3364) run in +charts that exclude the head direction; ten of them run in the empty chart. No +event names both `X21` and `Y59`, and neither frame is restored. + +The new fact is on the target side. `Y59`'s last two updates (events 3231 and +3364) run in charts that already span tail vectors of the same flag, `{32}` and +then `{6, 18, 32}`. At both updates `X21`'s live frame has rank 9 and spans them +too. So both endpoints co-host part of the flag's basis geometry while `Y59` is +still being updated, but the head direction is missing until the single terminal +step. The obstruction is specific to the head, not a consequence of the target +filling late. + +On the source side, `X21` starts at `[15]`, and its first transport (event 570) +lists `[3, 4, 8, 128, 256]`. That drops `15` from the list but not from the +span, because `15 = 3 ^ 4 ^ 8`. All 22 `X21` annotations span the head. This +answers #3451's second open question for flag 43: in span the source keeps the +head direction and the target gains it only at its terminal transport. + +Both endpoints first host the head direction together at event 3525, and `Y59` +has no event after that. The published channel therefore never updates or +touches the matched target while both endpoints host the basis-head direction. +Chronological dirty restoration along co-hosted basis-head geometry is +unavailable on this word. + +Flag 43 is not a reprint of flags 1 or 9 (drop/arrive/gap 570/3525/2955 against +591/3473/2882 and 500/3489/2989); both scanners refuse a tuple equal to either. +The source-side schedule shape does repeat #3451's `X0`, so the new content is +the target chronology and the tail co-hosting. + +Selected κ stays 0.001672660197076918. Details and limits are in +[PROOF.md](PROOF.md). + +## Reproduce + +```sh +python3.12 -I -B research/p104-present-head-flag43-audit/verify.py +python3.12 -I -O -Werror -B research/p104-present-head-flag43-audit/verify.py +python3.12 -I -O -Werror -B research/p104-present-head-flag43-audit/independent.py +python3.12 -I -O -Werror -B research/p104-present-head-flag43-audit/test_package.py +python3.12 -B scripts/research_package.py --package research/p104-present-head-flag43-audit +``` + +`verify.py` is read-only. Admission goes through `need()` and still fires under +`-O`. `test_package.py` corrupts temporary copies of the certificate and of one +pinned input and checks that both scanners reject them under `-O`. + +## Credit + +Credit Nick Petalas / #2981 for the flag matching, the reviewed #1991 channel +lineage for the witness, jwr404 / #3242 for the schedule receipt and #3363 for +the relay census, #3349 for the present-head census, #3443 and #3451 for the +flag-9 and flag-1 methods, and #3392 for the absent-head counterpart. Prepared +by Wentao Li with substantial AI assistance. + +## Open next questions + +1. Can a changed schedule put `15` into `Y59`'s span at or before its last add + (event 3364) while `X21` is still live, and what does that cost against the + channel bill? The terminal step has rank 3 and the chart at 3364 already + hosts `{6, 18, 32}`, so the head is one rank step away. +2. Is tail-before-head hosting specific to flag 43 among the present-head flags, + and does it occur on absent-head flags? #3451's certificate shows no flag-1 + basis vector in `Y7`'s preterminal span. + +[TASK.json](TASK.json) gives first steps and blockers for both. diff --git a/research/p104-present-head-flag43-audit/SOURCES.json b/research/p104-present-head-flag43-audit/SOURCES.json new file mode 100644 index 0000000000..161fd70a47 --- /dev/null +++ b/research/p104-present-head-flag43-audit/SOURCES.json @@ -0,0 +1,44 @@ +{ + "schema_version": 1, + "base_commit": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "upstream": "CrocSwap/integer-mult-bounds", + "files": [ + { + "path": "research/p104-joint-unit-flags/CERTIFICATE.json", + "usage": "input", + "git_blob": "0fa7d2d40566e92f3ea1539723abf438ba65adb8", + "sha256": "a98126428a8da6eae91c50afcc42e014a284c82b554ef77e5b3a34fc6d228128", + "credit": "Nick Petalas, PR #2981" + }, + { + "path": "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "usage": "input", + "git_blob": "86beaf424e9f0f800ae3a62797d94ec9386b7706", + "sha256": "0f541bef7f19fdeffd67157684e9f03d785f42c89973632f508fc1a0452b580e", + "credit": "Reviewed #1991 native channel witness" + }, + { + "path": "research/p104-endpoint-geometric-budget/geometry.py", + "usage": "input", + "git_blob": "f49752bcfc321a6129186d4daa774b2c3fdb84f1", + "sha256": "1a2792189beaf15aa8180136ca007cd2301992a62e77ba72edea99b298e4148f", + "credit": "X/Y naming lines for the 104 sources and 104 targets" + }, + { + "path": "research/p104-native-channel/PROOF.md", + "usage": "provenance", + "git_blob": "a69311b74f74a2f8e8f411c1451baacd9bacddce", + "sha256": "5d743145d389ffdfaffc66096fa7e32c7155b18f73d74755403151d0435bb94c", + "pin": "base_commit:research/p104-native-channel/PROOF.md", + "credit": "Binary-frame semantics: nine-dimensional binary label space, nested transports, adds only in a common chart" + }, + { + "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 at the pinned base" + } + ] +} diff --git a/research/p104-present-head-flag43-audit/TASK.json b/research/p104-present-head-flag43-audit/TASK.json new file mode 100644 index 0000000000..ab0af4a81d --- /dev/null +++ b/research/p104-present-head-flag43-audit/TASK.json @@ -0,0 +1,96 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 6, + "selected_kappa": "0.001672660197076918", + "base_commit": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "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": "Pin matched present-head flag 43 (X21 to Y59, basis head 15) from the #2981 certificate and prove on the published #1991 channel that the basis head enters Y59's frame, both as a listed vector and in the GF(2) span, only at Y59's terminal transport after-frame (event 3525), after all fifteen Y59 row updates have run in head-free charts, while X21's span keeps the head at every annotation. Also certify that Y59's last two updates (events 3231 and 3364) run in charts that already span non-head basis vectors of the same flag ({32}, then {6, 18, 32}) while X21's live rank-9 frame spans them too. No Y59 event occurs while both endpoint frames host the head direction, so chronological dirty restoration cannot use co-hosted basis-head geometry on this word, even though co-hosted non-head basis geometry exists at the last two updates.", + "scope_change_reason": "Open #3349 registers the 208-flag restoration census and names the present-head class (0, 1, 9, 43). Open #3443 pins flag 9 literally; open #3451 pins flag 1 literally and in span and asks, as its second open question, whether flag 43 follows the same span pattern. Open #3392 pins absent-head flag 2. Open #3363 and its follow-ups cover algebraic coefficient delivery, concentrated on flag 0, which is excluded. Flag 43 is the last uncertified present-head member outside the coefficient cascade. Its chronology (drop 570, arrive 3525, gap 2955) differs from flag 1 (591, 3473, 2882) and flag 9 (500, 3489, 2989), its target has fifteen updates and six transports, and its preterminal target charts host part of the flag basis, which neither prior records. Both scanners refuse to admit a chronology equal to either published prior.", + "bottleneck_link": "A present-head target final does not host the basis-head direction while the target is still being updated, even when the target's charts already host other basis directions of the same flag. On flag 43 every Y59 row update precedes the head's entry into Y59's span, and Y59 has no event after that entry, so a dirty restoration using co-hosted head geometry needs new target events or an earlier head step.", + "budget_minutes": 60, + "stop_rule": "Stop after flag 43's late-only hosting obstruction and its tail co-hosting are pinned literally and in span and dual-scanned. Do not build a correction word, recompute algebraic relays or coefficients, or re-certify flags 0, 1 or 9.", + "outcome": "completed", + "evidence": "Flag 43 is source 21, target 59, basis head 15. X21 starts at [15]; its first transport at event 570 goes to [3, 4, 8, 128, 256], removing 15 from the list but not from the span (15 = 3 xor 4 xor 8). All 22 X21 annotations span the head and X21 is never an add destination. Y59's preterminal frames are [], [500], [127, 500], [447, 127, 52], [95, 447, 32, 20] and [95, 447, 6, 32, 20], whose spans exclude 15. The head enters Y59 only in the after-frame of event 3525, Y59's last event, with a rank-3 step (literal gap 2955 after event 570). Y59's fifteen adds (events 223-227, 2099, 2191, 2275, 2341, 2393, 2698, 2891, 3076, 3231, 3364) all run in head-free charts, ten of them in the empty chart. The adds at 3231 and 3364 run in charts spanning the non-head basis vectors {32} and {6, 18, 32}, which X21's live rank-9 frame also spans. No joint X21/Y59 event and no endpoint zero/copy/erase event exist; X21's four events after 3525 are reads. All eleven endpoint transports are nested upward with rank steps equal to their recorded costs. Neither endpoint frame is restored (ranks 1 to 9 and 0 to 8). Selected kappa is unchanged.", + "author": "Wentao Li", + "ai_assistance": "Substantial AI assistance for derivation, implementation, checking and writing.", + "no_new_kappa": true, + "open_questions": [ + { + "question": "Can a changed schedule place 15 in Y59's span at or before Y59's last row update (event 3364), while X21 is still live, and what does that add to the channel bill?", + "why_it_matters": "On flag 43 the head is one rank step from the last preterminal chart: Y59's terminal step at event 3525 has rank 3, and the chart at 3364 already hosts the tail directions {6, 18, 32}. Moving one direction of the terminal step earlier is the smallest schedule change that would give a co-hosted head chart at a target update.", + "first_step": "Replace the rank-1 transport at event 3363 by a rank-2 transport whose after-frame spans 15 inside Y59's final span, keep the 3525 transport nested with rank step 2, and check the common-chart requirement against D17's frame at the add at event 3364.", + "blocked_by": "This package reads only the published frames of flag 43. It does not construct a repair, price one, or check D17's frame contract or any coefficient." + }, + { + "question": "Is tail-before-head hosting (a target update whose chart spans non-head basis vectors of the matched flag but not its head) specific to flag 43 among the four present-head flags, and does it occur on absent-head flags?", + "why_it_matters": "If the target typically hosts part of the flag basis before the head, the present-head obstruction is a head-specific scheduling property rather than a consequence of the target filling late; a repair then only needs to move the head step, not build the target chart.", + "first_step": "Run this package's tail_in_span scan on the target updates of flags 1 and 9 and of absent-head flag 2 as a separate census, citing #3451, #3443 and #3392 rather than re-certifying their chronology. #3451's certificate already records Y7's largest preterminal span {0, 95, 441, 486}, which contains none of flag 1's basis vectors.", + "blocked_by": "This package certifies flag 43 only. Flags 1, 9 and 2 are the subjects of open #3451, #3443 and #3392." + } + ] +} diff --git a/research/p104-present-head-flag43-audit/VERIFY.json b/research/p104-present-head-flag43-audit/VERIFY.json new file mode 100644 index 0000000000..bb3981c286 --- /dev/null +++ b/research/p104-present-head-flag43-audit/VERIFY.json @@ -0,0 +1,28 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-joint-unit-flags/CERTIFICATE.json", + "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "research/p104-endpoint-geometric-budget/geometry.py" + ], + "commands": [ + { + "argv": ["{python}", "-I", "-O", "-Werror", "-B", "{package}/verify.py"], + "timeout_seconds": 60, + "checks": "Program-order scan of flag 43 hosting on X21 and Y59: literal frames, GF(2) span of the head and of the non-head basis vectors by row reduction, live source frame at each target update" + }, + { + "argv": ["{python}", "-I", "-O", "-Werror", "-B", "{package}/independent.py"], + "timeout_seconds": 60, + "checks": "Per-register scan of the same flag-43 obstruction with explicit XOR-closure spans, subset search and bisected source-frame lookup" + }, + { + "argv": ["{python}", "-I", "-O", "-Werror", "-B", "{package}/test_package.py"], + "timeout_seconds": 120, + "checks": "Duplicate JSON keys, temp-tree certificate and input corruption under -O, optimized admission, span negative control, reprint guard, scanner agreement, read-only replay" + } + ] +} diff --git a/research/p104-present-head-flag43-audit/independent.py b/research/p104-present-head-flag43-audit/independent.py new file mode 100644 index 0000000000..faaf22e401 --- /dev/null +++ b/research/p104-present-head-flag43-audit/independent.py @@ -0,0 +1,442 @@ +#!/usr/bin/env python3 +"""Second flag-43 present-head scanner. It does not import verify.py. + +Events are first indexed per endpoint register. Literal frames are frozensets; +spans are explicit XOR closures (at most 512 labels), so membership, rank and +nesting are set operations rather than row reduction. The head decomposition +is found by exhaustive subset search, and the source's live frame at a target +event is read back from the last earlier source transport. Admission uses +need() under -O. +""" + +import bisect +import hashlib +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +MARKER = ( + "PASS_P104_PRESENT_HEAD_FLAG43_INDEPENDENT flag=43 head=15 " + "preterminal_hosting=0 preterminal_span_hosting=0 drop_event=570 " + "arrive_event=3525 source_span_drops=0 head_free_target_updates=15/15 " + "tail_cohosting_updates=2 no_new_kappa" +) +INPUTS = ( + "research/p104-joint-unit-flags/CERTIFICATE.json", + "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "research/p104-endpoint-geometric-budget/geometry.py", +) +SOURCE_LINE = "sources = [paths[f'X{s}'] for s in range(104)]" +TARGET_LINE = "targets = [paths[f'Y{t}'] for t in range(104)]" +FLAG_INDEX = 43 +HIT_FLAGS = (0, 1, 9, 43) +PRIORS = (("3451_flag1", (591, 3473, 2882)), ("3443_flag9", (500, 3489, 2989))) + + +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) <= 2_000_000, "input exceeds 2 MB") + return json.loads(raw, object_pairs_hook=pairs_unique) + + +def frame_set(frame): + need(type(frame) is list, "frame") + values = [] + for entry in frame: + need(type(entry) is int and 0 < entry < 512, "frame entry") + values.append(entry) + folded = frozenset(values) + need(len(folded) == len(values), "duplicate frame vector") + return folded + + +def closure(frame): + """Explicit GF(2) span of an independent frame.""" + span = {0} + for vector in frame_set(frame): + span = span | {vector ^ old for old in span} + need(len(span) == 1 << len(frame), "dependent frame") + return frozenset(span) + + +def dimension(frame): + return len(closure(frame)).bit_length() - 1 + + +def subset_xor(vector, frame): + found = [] + for mask in range(1 << len(frame)): + acc = 0 + chosen = [] + for position, entry in enumerate(frame): + if mask & (1 << position): + acc ^= entry + chosen.append(entry) + if acc == vector: + found.append(sorted(chosen)) + need(len(found) <= 1, "non-unique decomposition") + return found[0] if found else None + + +def index_registers(program, wanted): + table = {name: [] for name in wanted} + joint = 0 + for index, event in enumerate(program): + need(type(event) is list and 1 <= len(event) <= 8, "event shape") + present = {item for item in event if type(item) is str and item in table} + if len(present) == len(table): + joint += 1 + for name in present: + table[name].append(index) + return table, joint + + +def frames_of(event, name): + if event[0] == "transport" and event[1] == name: + return [("before", event[2]), ("after", event[3])] + if event[0] == "add" and name in (event[1], event[2]): + return [("add", event[-1])] + return [] + + +def pin_sources(): + manifest = read_json(HERE / "SOURCES.json") + rows = [row for row in manifest["files"] if row["usage"] == "input"] + need(tuple(row["path"] for row in rows) == INPUTS, "input inventory") + pinned = {} + for row in rows: + raw = (ROOT / row["path"]).read_bytes() + need(hashlib.sha256(raw).hexdigest() == row["sha256"], "source hash: " + row["path"]) + pinned[row["path"]] = raw + return pinned + + +def evaluate(): + pinned = pin_sources() + geometry = pinned[ + "research/p104-endpoint-geometric-budget/geometry.py" + ].decode("utf-8") + need(SOURCE_LINE in geometry and TARGET_LINE in geometry, "geometry naming") + helpers = json.loads( + pinned["research/p104-joint-unit-flags/CERTIFICATE.json"], + object_pairs_hook=pairs_unique, + )["helpers"] + witness = json.loads( + pinned["research/p104-native-channel/inputs/LOWRANK-WITNESS.json"], + object_pairs_hook=pairs_unique, + ) + program = witness["program"] + need(len(helpers) == 208 and len(program) == 4058, "sizes") + hits = [ + index + for index, row in enumerate(helpers) + if row["basis"][0] in witness["final_frames"][f"Y{row['target']}"] + ] + need(hits == list(HIT_FLAGS), "hit-flag census drift") + need(FLAG_INDEX in hits, "flag 43 left the present-head class") + helper = helpers[FLAG_INDEX] + head = helper["basis"][0] + tail = list(helper["basis"][1:]) + source = f"X{helper['source']}" + target = f"Y{helper['target']}" + table, joint = index_registers(program, (source, target)) + source_indices = table[source] + target_indices = table[target] + need(source_indices and target_indices, "endpoint silence") + non_frame = len( + [i for i in set(source_indices) | set(target_indices) + if program[i][0] not in ("add", "transport")] + ) + + source_hits = [] + source_frames = 0 + source_span_frames = 0 + source_span_drops = [] + source_writes = [] + source_reads = set() + source_transport_at = [] + source_frame_after = [] + transports = [] + for index in source_indices: + event = program[index] + if event[0] == "transport" and event[1] == source: + transports.append(event) + source_transport_at.append(index) + source_frame_after.append(list(event[3])) + if event[0] == "add" and event[1] == source: + source_writes.append(index) + if event[0] == "add" and event[2] == source: + source_reads.add(index) + for role, frame in frames_of(event, source): + literal = frame_set(frame) + source_frames += 1 + if head in closure(frame): + source_span_frames += 1 + else: + source_span_drops.append(index) + if head in literal: + source_hits.append( + { + "event": index, + "opcode": event[0], + "role": role, + "frame": sorted(literal), + } + ) + befores = [program[i][2] for i in source_transport_at] + previous = [witness["initial_frames"][source]] + source_frame_after[:-1] + need( + all(frame_set(a) == frame_set(b) for a, b in zip(befores, previous)), + "source frame continuity", + ) + + def source_live_at(index): + position = bisect.bisect_left(source_transport_at, index) + if position == 0: + return witness["initial_frames"][source] + return source_frame_after[position - 1] + + target_hits = [] + target_span_hits = [] + target_tail_hits = [] + target_pool = set() + updates = [] + head_free_updates = 0 + empty_updates = 0 + tail_updates = [] + tail_detail = [] + steps = [] + for index in target_indices: + event = program[index] + if event[0] == "transport" and event[1] == target: + transports.append(event) + steps.append(event[4]) + if event[0] == "add" and event[1] == target: + updates.append(index) + chart = closure(event[-1]) + if head not in chart: + head_free_updates += 1 + if not frame_set(event[-1]): + empty_updates += 1 + hosted = [vector for vector in tail if vector in chart] + if hosted: + tail_updates.append(index) + live = closure(source_live_at(index)) + tail_detail.append( + { + "event": index, + "target_chart_rank": dimension(event[-1]), + "source_live_rank": len(live).bit_length() - 1, + "source_live_spans_head": head in live, + "tail_cohosted_by_both_endpoints": [ + vector for vector in hosted if vector in live + ], + } + ) + for role, frame in frames_of(event, target): + literal = frame_set(frame) + span = closure(frame) + target_pool |= literal + if head in span: + target_span_hits.append((index, role)) + hosted = [vector for vector in tail if vector in span] + if hosted: + target_tail_hits.append({"event": index, "role": role, "tail": hosted}) + if head in literal: + target_hits.append( + { + "event": index, + "opcode": event[0], + "role": role, + "frame": sorted(literal), + } + ) + + drop = source_indices[0] + drop_event = program[drop] + need(drop_event[0] == "transport" and drop_event[1] == source, "first source op") + drop_before = sorted(frame_set(drop_event[2])) + drop_after = sorted(frame_set(drop_event[3])) + need(drop_before == [head], "drop before") + need(head not in drop_after, "drop after") + need(len(target_hits) == 1, "unexpected target head hosting count") + arrive = target_hits[0] + need(arrive["opcode"] == "transport" and arrive["role"] == "after", "arrive shape") + need(arrive["event"] == target_indices[-1], "arrive not terminal") + arrive_event = program[arrive["event"]] + arrive_before = sorted(frame_set(arrive_event[2])) + arrive_after = sorted(frame_set(arrive_event[3])) + need(head not in arrive_before and head in arrive_after, "arrive frames") + preterminal = [row for row in target_hits if row["event"] < arrive["event"]] + need(target_span_hits, "no span hosting on target") + span_open, span_role = target_span_hits[0] + span_preterminal = [row for row in target_span_hits if row[0] < arrive["event"]] + need(target_tail_hits, "no tail vector on target") + after_drop = any( + row["event"] > drop or (row["event"] == drop and row["role"] == "after") + for row in source_hits + ) + nested = all(closure(event[2]) <= closure(event[3]) for event in transports) + rank_steps = all( + event[4] == dimension(event[3]) - dimension(event[2]) for event in transports + ) + source_initial = witness["initial_frames"][source] + source_final = witness["final_frames"][source] + target_initial = witness["initial_frames"][target] + target_final = witness["final_frames"][target] + finals_with_head = len( + [name for name, frame in witness["final_frames"].items() + if name.startswith("Y") and head in frame] + ) + before_span = closure(arrive_event[2]) + final_span = closure(target_final) + gap = arrive["event"] - drop + chronology = (drop, arrive["event"], gap) + late_source = [index for index in source_indices if index > span_open] + receipt = { + "schema_version": 1, + "claim_id": "p104-present-head-flag43-audit", + "pinned_main": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "flag_index": FLAG_INDEX, + "source": helper["source"], + "target": helper["target"], + "basis_head": head, + "departure_choice": helper["departure_choice"], + "arrival_choice": helper["arrival_choice"], + "basis": helper["basis"], + "source_register": source, + "target_register": target, + "source_initial": source_initial, + "source_final": source_final, + "target_initial": target_initial, + "target_final": target_final, + "source_initial_is_basis_head": source_initial == [head], + "target_final_contains_basis_head": head in target_final, + "source_frame_restored": frame_set(source_initial) == frame_set(source_final), + "target_frame_restored": frame_set(target_initial) == frame_set(target_final), + "source_rank_initial": dimension(source_initial), + "source_rank_final": dimension(source_final), + "target_rank_initial": dimension(target_initial), + "target_rank_final": dimension(target_final), + "source_first_event": source_indices[0], + "source_last_event": source_indices[-1], + "target_first_event": target_indices[0], + "target_last_event": target_indices[-1], + "source_event_count": len(source_indices), + "target_event_count": len(target_indices), + "joint_source_target_events": joint, + "endpoint_non_frame_events": non_frame, + "basis_head_drop_event": drop, + "basis_head_drop_before": drop_before, + "basis_head_drop_after": drop_after, + "basis_head_arrive_event": arrive["event"], + "basis_head_arrive_before": arrive_before, + "basis_head_arrive_after": arrive_after, + "hosting_gap_events": gap, + "source_annotations_containing_basis_head": len(source_hits), + "target_annotations_containing_basis_head": len(target_hits), + "target_preterminal_annotations_containing_basis_head": len(preterminal), + "source_head_annotations": source_hits, + "target_head_annotations": target_hits, + "target_annotated_vectors": sorted(target_pool), + "basis_head_in_any_target_annotation": head in target_pool, + "basis_head_in_source_after_drop": after_drop, + "drop_after_span_decomposition_of_head": subset_xor(head, drop_event[3]), + "drop_transport_span_nested": closure(drop_event[2]) <= closure(drop_event[3]), + "source_annotation_count": source_frames, + "source_annotations_span_hosting_basis_head": source_span_frames, + "source_span_drop_events": source_span_drops, + "source_row_update_events": source_writes, + "source_read_event_count": len(source_reads), + "target_span_first_hosting_event": span_open, + "target_span_first_hosting_role": span_role, + "target_preterminal_annotations_span_hosting_basis_head": len(span_preterminal), + "target_arrive_before_span": sorted(before_span), + "target_update_events": updates, + "target_updates_in_head_free_span": head_free_updates, + "target_updates_in_empty_chart": empty_updates, + "target_updates_in_nonempty_head_free_chart": head_free_updates - empty_updates, + "target_last_update_event": updates[-1], + "target_transport_rank_steps": steps, + "target_terminal_rank_step": arrive_event[4], + "basis_tail": tail, + "target_tail_first_span_event": target_tail_hits[0]["event"], + "target_tail_first_span_role": target_tail_hits[0]["role"], + "target_tail_span_annotations": target_tail_hits, + "target_tail_in_arrive_before_span": [v for v in tail if v in before_span], + "target_tail_in_final_span": [v for v in tail if v in final_span], + "target_updates_cohosting_tail_without_head": tail_updates, + "target_tail_cohosting_update_detail": tail_detail, + "source_live_final_matches_witness": ( + frame_set(source_live_at(len(program))) == frame_set(source_final) + ), + "target_events_after_span_cohost_open": len( + [index for index in target_indices if index > span_open] + ), + "source_events_after_span_cohost_open": late_source, + "source_events_after_span_cohost_open_are_reads": set(late_source) <= source_reads, + "endpoint_transport_count": len(transports), + "endpoint_transports_span_nested_upward": nested, + "endpoint_transport_rank_steps_match": rank_steps, + "targets_whose_final_contains_basis_head_among_all": finals_with_head, + "hit_flags_from_census": list(HIT_FLAGS), + "flag_is_present_head_case": True, + "chronology_drop_arrive_gap": list(chronology), + "published_prior_present_head_tuples": { + name: list(values) for name, values in PRIORS + }, + "chronology_distinct_from_published_priors": chronology not in { + values for _, values in PRIORS + }, + "obstruction": ( + "published_channel_hosts_basis_head_on_matched_target_only_at_" + "terminal_transport_literally_and_in_span_after_every_target_update_" + "while_preterminal_target_charts_already_span_non_head_basis_vectors" + ), + "no_new_kappa": True, + "selected_kappa": "0.001672660197076918", + } + need(receipt["target_final_contains_basis_head"] is True, "left present-head class") + need(receipt["target_preterminal_annotations_containing_basis_head"] == 0, "preterminal") + need(receipt["target_preterminal_annotations_span_hosting_basis_head"] == 0, "span preterminal") + need(receipt["chronology_distinct_from_published_priors"] is True, "reprint of a prior") + need(receipt["source_span_drop_events"] == [], "source lost head direction") + need(receipt["source_row_update_events"] == [], "source row updated") + need(receipt["target_updates_in_head_free_span"] == len(updates), "head-hosting update") + need( + all(row["source_live_spans_head"] and row["tail_cohosted_by_both_endpoints"] + for row in tail_detail), + "tail co-hosting detail", + ) + need(receipt["target_events_after_span_cohost_open"] == 0, "target event after cohost") + need(receipt["source_events_after_span_cohost_open_are_reads"] is True, "late source write") + need(receipt["basis_head_in_source_after_drop"] is False, "source relisted head") + need(receipt["joint_source_target_events"] == 0, "joint endpoint event") + need(receipt["endpoint_non_frame_events"] == 0, "endpoint zero/copy/erase event") + need(nested and rank_steps, "transport semantics") + return receipt + + +def main(): + observed = evaluate() + expected = read_json(HERE / "CERTIFICATE.json") + need(observed == expected, "certificate mismatch") + print(MARKER) + + +if __name__ == "__main__": + main() diff --git a/research/p104-present-head-flag43-audit/test_package.py b/research/p104-present-head-flag43-audit/test_package.py new file mode 100644 index 0000000000..9f7b57ade2 --- /dev/null +++ b/research/p104-present-head-flag43-audit/test_package.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python3 +"""Admission, corruption, span/reprint controls and scanner agreement. No asserts.""" + +import copy +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): + """Copy the package and its pinned inputs into a throwaway repository root.""" + 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=60, + ) + + +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[-200:]) + + +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[-200:]) + cert = package / "CERTIFICATE.json" + clean = cert.read_bytes() + mutations = ( + ("basis_head_drop_event", 0), + ("target_span_first_hosting_event", 3364), + ("source_span_drop_events", [570]), + ("target_updates_in_head_free_span", 14), + ("target_updates_cohosting_tail_without_head", [3364]), + ("chronology_distinct_from_published_priors", False), + ) + for key, value in mutations: + blob = json.loads(clean) + need(key in blob, "mutation key missing: " + key) + 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) + witness = root / verify.INPUTS[1] + raw = bytearray(witness.read_bytes()) + position = raw.index(b'"X21"') + raw[position:position + 5] = b'"X22"' + witness.write_bytes(bytes(raw)) + expect_rejection(package / "verify.py", "source hash") + expect_rejection(package / "independent.py", "source hash") + need(tree_digest(watched_files()) == before, "live files mutated by corruption test") + + +def test_optimized_admission(): + script = ( + "import sys\n" + f"sys.path.insert(0, {str(HERE)!r})\n" + "import verify, independent\n" + "verify.need(__debug__ is False, 'optimization off')\n" + "for module in (verify, independent):\n" + " try:\n" + " module.need(False, 'admission')\n" + " except ValueError as exc:\n" + " if str(exc) != 'admission':\n" + " raise SystemExit('wrong admission')\n" + " else:\n" + " raise SystemExit('admission skipped')\n" + "print('PASS_OPTIMIZED_ADMISSION')\n" + ) + done = subprocess.run( + [sys.executable, "-O", "-I", "-B", "-c", script], + check=False, + capture_output=True, + text=True, + timeout=60, + ) + need(done.returncode == 0, "optimized admission failed: " + done.stderr) + need("PASS_OPTIMIZED_ADMISSION" in done.stdout, "optimized marker") + + +def test_sample_span_geometry(): + drop = ["transport", "X21", [15], [3, 4, 8, 128, 256], 4] + frames = verify.annotated_frames(drop, "X21") + need(frames[0] == ("before", [15]), "sample before") + need(15 not in frames[1][1], "sample literal drop") + need(verify.span_combination(15, drop[3]) == [3, 4, 8], "primary decomposition") + need(independent.subset_xor(15, drop[3]) == [3, 4, 8], "subset decomposition") + need(3 ^ 4 ^ 8 == 15, "head arithmetic") + need(verify.span_contains(drop[3], drop[2]), "primary nesting") + need(independent.closure(drop[2]) <= independent.closure(drop[3]), "closure nesting") + need(verify.rank(drop[3]) - verify.rank(drop[2]) == drop[4], "rank step") + late = [95, 447, 6, 32, 20] + need(not verify.in_span(15, late), "primary late span") + need(15 not in independent.closure(late), "closure late span") + need(len(verify.span_elements(late)) == 32, "late span size") + need(sorted(independent.closure(late)) == verify.span_elements(late), "late closure") + tail = [387, 6, 18, 32, 67, 128, 1, 2] + need(verify.tail_in_span(tail, late) == [6, 18, 32], "late tail") + need(6 ^ 20 == 18, "tail arithmetic") + for bad in ([15, 15], [3, 4, 7]): + for check in (verify.rank, independent.dimension): + try: + check(bad) + except ValueError: + pass + else: + need(False, "dependent frame accepted") + + +def test_span_negative_control(): + pinned = verify.pin_sources() + helpers = json.loads(pinned[verify.INPUTS[0]])["helpers"] + witness = json.loads(pinned[verify.INPUTS[1]]) + clean = verify.build_receipt(witness, helpers) + need(clean["target_updates_in_head_free_span"] == 15, "clean update count") + mutated = copy.deepcopy(witness) + program = mutated["program"] + need( + program[3363][:2] == ["transport", "Y59"] + and program[3363][3] == [95, 447, 6, 32, 20], + "anchor 3363", + ) + need(program[3364][:3] == ["add", "Y59", "D17"], "anchor 3364") + hosted = [95, 447, 15 ^ 20, 32, 20] + program[3363][3] = list(hosted) + program[3364][-1] = list(hosted) + program[3525][2] = list(hosted) + shifted = verify.build_receipt(mutated, helpers) + need(shifted["target_preterminal_annotations_containing_basis_head"] == 0, "literal blind") + need(shifted["target_preterminal_annotations_span_hosting_basis_head"] == 2, "span sees head") + need(15 in shifted["target_arrive_before_span"], "arrive before now hosts head") + need(shifted["target_span_first_hosting_event"] == 3363, "span arrive moved") + need(shifted["target_updates_in_head_free_span"] == 14, "update now hosts head") + need( + shifted["target_updates_cohosting_tail_without_head"] == [3231], + "tail-without-head list follows the head", + ) + need(shifted["endpoint_transports_span_nested_upward"] is True, "control broke nesting") + need(shifted["endpoint_transport_rank_steps_match"] is True, "control broke rank steps") + need(shifted != clean, "control did not change receipt") + + +def test_reprint_guard(): + """A prior with flag 43's own chronology must trip both scanners' DEFER guard.""" + own = [570, 3525, 2955] + saved_verify = verify.PRIOR_TUPLES + saved_independent = independent.PRIORS + try: + verify.PRIOR_TUPLES = dict(saved_verify, reprint_probe=own) + independent.PRIORS = saved_independent + (("reprint_probe", tuple(own)),) + for module in (verify, independent): + try: + module.evaluate() + except ValueError as exc: + need(str(exc) == "reprint of a prior", "wrong reprint rejection") + else: + need(False, "reprint accepted by " + module.__name__) + finally: + verify.PRIOR_TUPLES = saved_verify + independent.PRIORS = saved_independent + + +def test_scanners_agree(): + before = tree_digest(watched_files()) + left = verify.evaluate() + right = independent.evaluate() + need(left == right, "scanner disagreement") + verify.admit(left, verify.read_json(HERE / "CERTIFICATE.json")) + need(tree_digest(watched_files()) == before, "package or input files mutated") + + +def main(): + test_duplicate_key() + test_temp_copy_corruption() + test_optimized_admission() + test_sample_span_geometry() + test_span_negative_control() + test_reprint_guard() + test_scanners_agree() + print("PASS_P104_PRESENT_HEAD_FLAG43_TESTS groups=7") + + +if __name__ == "__main__": + main() diff --git a/research/p104-present-head-flag43-audit/verify.py b/research/p104-present-head-flag43-audit/verify.py new file mode 100644 index 0000000000..7197a59a6f --- /dev/null +++ b/research/p104-present-head-flag43-audit/verify.py @@ -0,0 +1,520 @@ +#!/usr/bin/env python3 +"""Read-only present-head dirty-restoration audit for matched flag 43. + +Flag 43 is one of the four published flags whose target final contains the +basis head. Frames are binary subspaces of the nine-dimensional label space, +so hosting is checked both as literal frame membership and as membership in +the GF(2) span of the frame. The target side is also scanned for the flag's +non-head basis vectors. Admission uses need() and remains active under +python -O. This module does not import independent.py or any predecessor +verifier. +""" + +import hashlib +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +MARKER = ( + "PASS_P104_PRESENT_HEAD_FLAG43 flag=43 head=15 preterminal_hosting=0 " + "preterminal_span_hosting=0 drop_event=570 arrive_event=3525 " + "source_span_drops=0 head_free_target_updates=15/15 " + "tail_cohosting_updates=2 no_new_kappa" +) +INPUTS = ( + "research/p104-joint-unit-flags/CERTIFICATE.json", + "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "research/p104-endpoint-geometric-budget/geometry.py", +) +SOURCE_LINE = "sources = [paths[f'X{s}'] for s in range(104)]" +TARGET_LINE = "targets = [paths[f'Y{t}'] for t in range(104)]" +FLAG_INDEX = 43 +HIT_FLAGS = (0, 1, 9, 43) +LABEL_BITS = 9 +# (drop, arrive, gap) as published by open #3451 (flag 1) and #3443 (flag 9). +PRIOR_TUPLES = {"3451_flag1": [591, 3473, 2882], "3443_flag9": [500, 3489, 2989]} + + +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) <= 2_000_000, "input exceeds 2 MB") + return json.loads(raw, object_pairs_hook=pairs_unique) + + +def register_name(item): + if type(item) is not str or len(item) < 2 or item[0] not in "XY": + return None + if not item[1:].isdigit() or int(item[1:]) > 103: + return None + return item + + +def annotated_frames(event, name): + frames = [] + if event[0] == "transport" and event[1] == name: + need(type(event[2]) is list and type(event[3]) is list, "transport frames") + frames.append(("before", list(event[2]))) + frames.append(("after", list(event[3]))) + elif event[0] == "add" and name in (event[1], event[2]): + need(type(event[-1]) is list, "add frame") + frames.append(("add", list(event[-1]))) + return frames + + +def echelon(frame): + """Pivot-indexed GF(2) row echelon form; each row tracks its frame subset.""" + rows = {} + for vector in frame: + need(type(vector) is int and 0 < vector < (1 << LABEL_BITS), "label range") + value = vector + combo = 1 << frame.index(vector) + while value: + pivot = value.bit_length() - 1 + if pivot not in rows: + rows[pivot] = (value, combo) + break + value ^= rows[pivot][0] + combo ^= rows[pivot][1] + need(value != 0, "dependent frame vector") + return rows + + +def span_combination(vector, frame): + """Return the frame subset whose XOR is vector, or None if outside the span.""" + rows = echelon(frame) + value = vector + combo = 0 + while value: + pivot = value.bit_length() - 1 + if pivot not in rows: + return None + value ^= rows[pivot][0] + combo ^= rows[pivot][1] + return sorted(frame[i] for i in range(len(frame)) if combo >> i & 1) + + +def in_span(vector, frame): + return span_combination(vector, frame) is not None + + +def rank(frame): + return len(echelon(frame)) + + +def span_elements(frame): + rows = [row for row, _ in echelon(frame).values()] + out = [] + for mask in range(1 << len(rows)): + value = 0 + for i, row in enumerate(rows): + if mask >> i & 1: + value ^= row + out.append(value) + return sorted(out) + + +def span_contains(big, small): + return all(in_span(vector, big) for vector in small) + + +def tail_in_span(tail, frame): + return [vector for vector in tail if in_span(vector, frame)] + + +def pin_sources(root=ROOT, here=HERE): + manifest = read_json(here / "SOURCES.json") + rows = manifest["files"] + inputs = [row for row in rows if row["usage"] == "input"] + need(tuple(row["path"] for row in inputs) == INPUTS, "input inventory") + pinned = {} + for row in inputs: + path = root / row["path"] + raw = path.read_bytes() + need(len(raw) <= 2_000_000, "source size") + digest = hashlib.sha256(raw).hexdigest() + need(digest == row["sha256"], "source hash: " + row["path"]) + pinned[row["path"]] = raw + return pinned + + +def hit_flag_indices(helpers, witness): + hits = [] + for index, row in enumerate(helpers): + head = row["basis"][0] + target = f"Y{row['target']}" + if head in witness["final_frames"][target]: + hits.append(index) + return hits + + +def build_receipt(witness, helpers): + need(len(helpers) == 208, "flag count") + need(len(witness["program"]) == 4058, "word length") + hits = hit_flag_indices(helpers, witness) + need(hits == list(HIT_FLAGS), "hit-flag census drift") + need(FLAG_INDEX in hits, "flag 43 left the present-head class") + helper = helpers[FLAG_INDEX] + head = helper["basis"][0] + tail = list(helper["basis"][1:]) + source = f"X{helper['source']}" + target = f"Y{helper['target']}" + program = witness["program"] + source_events = [] + target_events = [] + joint = 0 + source_head = [] + target_head = [] + target_vectors = set() + source_frames = 0 + source_span_frames = 0 + source_span_drops = [] + source_row_updates = [] + source_reads = [] + target_span_head = [] + target_span_tail = [] + target_updates = [] + target_updates_head_free = [] + target_updates_empty_chart = [] + target_updates_tail_cohosting = [] + tail_cohosting_detail = [] + target_transport_steps = [] + endpoint_non_frame_events = 0 + transports = [] + source_live = list(witness["initial_frames"][source]) + for index, event in enumerate(program): + need(type(event) is list and 1 <= len(event) <= 8, "event shape") + names = [] + for item in event: + name = register_name(item) + if name is not None: + names.append(name) + if source in names and target in names: + joint += 1 + if (source in names or target in names) and event[0] not in ("add", "transport"): + endpoint_non_frame_events += 1 + if source in names: + source_events.append(index) + for role, frame in annotated_frames(event, source): + source_frames += 1 + if in_span(head, frame): + source_span_frames += 1 + else: + source_span_drops.append(index) + if head in frame: + source_head.append( + { + "event": index, + "opcode": event[0], + "role": role, + "frame": sorted(frame), + } + ) + if event[0] == "transport" and event[1] == source: + transports.append(event) + need(sorted(event[2]) == sorted(source_live), "source frame continuity") + source_live = list(event[3]) + if event[0] == "add" and event[1] == source: + source_row_updates.append(index) + if event[0] == "add" and event[2] == source: + source_reads.append(index) + if target in names: + target_events.append(index) + for role, frame in annotated_frames(event, target): + target_vectors.update(frame) + if in_span(head, frame): + target_span_head.append({"event": index, "role": role}) + hosted_tail = tail_in_span(tail, frame) + if hosted_tail: + target_span_tail.append( + {"event": index, "role": role, "tail": hosted_tail} + ) + if head in frame: + target_head.append( + { + "event": index, + "opcode": event[0], + "role": role, + "frame": sorted(frame), + } + ) + if event[0] == "add" and event[1] == target: + target_updates.append(index) + chart = event[-1] + if not in_span(head, chart): + target_updates_head_free.append(index) + if chart == []: + target_updates_empty_chart.append(index) + if tail_in_span(tail, chart): + target_updates_tail_cohosting.append(index) + tail_cohosting_detail.append( + { + "event": index, + "target_chart_rank": rank(chart), + "source_live_rank": rank(source_live), + "source_live_spans_head": in_span(head, source_live), + "tail_cohosted_by_both_endpoints": [ + vector + for vector in tail_in_span(tail, chart) + if in_span(vector, source_live) + ], + } + ) + if event[0] == "transport" and event[1] == target: + transports.append(event) + target_transport_steps.append(event[4]) + need(source_events and target_events, "endpoint silence") + drop = source_events[0] + drop_event = program[drop] + need(drop_event[0] == "transport" and drop_event[1] == source, "first source op") + need(drop_event[2] == [head], "drop before-frame") + need(head not in drop_event[3], "drop after-frame still lists head") + after_drop = False + for row in source_head: + if row["event"] > drop: + after_drop = True + if row["event"] == drop and row["role"] == "after": + after_drop = True + need(len(target_head) == 1, "unexpected target head hosting count") + arrive = target_head[0] + need(arrive["opcode"] == "transport", "arrive opcode") + need(arrive["role"] == "after", "arrive role") + need(arrive["event"] == target_events[-1], "arrive is not terminal target event") + preterminal = [row for row in target_head if row["event"] < arrive["event"]] + need(preterminal == [], "preterminal target hosting") + arrive_event = program[arrive["event"]] + need(arrive_event[0] == "transport" and arrive_event[1] == target, "arrive transport") + need(head not in arrive_event[2], "arrive before-frame already lists head") + need(head in arrive_event[3], "arrive after-frame missing head") + hosting_gap = arrive["event"] - drop + need(hosting_gap > 0, "arrive precedes drop") + need(target_span_head, "target never span-hosts head") + span_arrive = target_span_head[0] + span_preterminal = [ + row for row in target_span_head if row["event"] < arrive["event"] + ] + need(target_span_tail, "target never spans a tail vector") + tail_open = target_span_tail[0] + nested = all(span_contains(event[3], event[2]) for event in transports) + rank_steps = all( + event[4] == rank(event[3]) - rank(event[2]) for event in transports + ) + decomposition = span_combination(head, list(drop_event[3])) + finals_with_head = sum( + 1 for index in range(104) if head in witness["final_frames"][f"Y{index}"] + ) + source_initial = witness["initial_frames"][source] + source_final = witness["final_frames"][source] + target_initial = witness["initial_frames"][target] + target_final = witness["final_frames"][target] + cohost_open = span_arrive["event"] + chronology = [drop, arrive["event"], hosting_gap] + return { + "schema_version": 1, + "claim_id": "p104-present-head-flag43-audit", + "pinned_main": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "flag_index": FLAG_INDEX, + "source": helper["source"], + "target": helper["target"], + "basis_head": head, + "departure_choice": helper["departure_choice"], + "arrival_choice": helper["arrival_choice"], + "basis": helper["basis"], + "source_register": source, + "target_register": target, + "source_initial": source_initial, + "source_final": source_final, + "target_initial": target_initial, + "target_final": target_final, + "source_initial_is_basis_head": source_initial == [head], + "target_final_contains_basis_head": head in target_final, + "source_frame_restored": sorted(source_initial) == sorted(source_final), + "target_frame_restored": sorted(target_initial) == sorted(target_final), + "source_rank_initial": rank(source_initial), + "source_rank_final": rank(source_final), + "target_rank_initial": rank(target_initial), + "target_rank_final": rank(target_final), + "source_first_event": source_events[0], + "source_last_event": source_events[-1], + "target_first_event": target_events[0], + "target_last_event": target_events[-1], + "source_event_count": len(source_events), + "target_event_count": len(target_events), + "joint_source_target_events": joint, + "endpoint_non_frame_events": endpoint_non_frame_events, + "basis_head_drop_event": drop, + "basis_head_drop_before": sorted(drop_event[2]), + "basis_head_drop_after": sorted(drop_event[3]), + "basis_head_arrive_event": arrive["event"], + "basis_head_arrive_before": sorted(arrive_event[2]), + "basis_head_arrive_after": sorted(arrive_event[3]), + "hosting_gap_events": hosting_gap, + "source_annotations_containing_basis_head": len(source_head), + "target_annotations_containing_basis_head": len(target_head), + "target_preterminal_annotations_containing_basis_head": len(preterminal), + "source_head_annotations": source_head, + "target_head_annotations": target_head, + "target_annotated_vectors": sorted(target_vectors), + "basis_head_in_any_target_annotation": head in target_vectors, + "basis_head_in_source_after_drop": after_drop, + "drop_after_span_decomposition_of_head": decomposition, + "drop_transport_span_nested": span_contains(drop_event[3], drop_event[2]), + "source_annotation_count": source_frames, + "source_annotations_span_hosting_basis_head": source_span_frames, + "source_span_drop_events": source_span_drops, + "source_row_update_events": source_row_updates, + "source_read_event_count": len(source_reads), + "target_span_first_hosting_event": span_arrive["event"], + "target_span_first_hosting_role": span_arrive["role"], + "target_preterminal_annotations_span_hosting_basis_head": len(span_preterminal), + "target_arrive_before_span": span_elements(list(arrive_event[2])), + "target_update_events": target_updates, + "target_updates_in_head_free_span": len(target_updates_head_free), + "target_updates_in_empty_chart": len(target_updates_empty_chart), + "target_updates_in_nonempty_head_free_chart": ( + len(target_updates_head_free) - len(target_updates_empty_chart) + ), + "target_last_update_event": target_updates[-1], + "target_transport_rank_steps": target_transport_steps, + "target_terminal_rank_step": arrive_event[4], + "basis_tail": tail, + "target_tail_first_span_event": tail_open["event"], + "target_tail_first_span_role": tail_open["role"], + "target_tail_span_annotations": target_span_tail, + "target_tail_in_arrive_before_span": tail_in_span(tail, list(arrive_event[2])), + "target_tail_in_final_span": tail_in_span(tail, list(target_final)), + "target_updates_cohosting_tail_without_head": target_updates_tail_cohosting, + "target_tail_cohosting_update_detail": tail_cohosting_detail, + "source_live_final_matches_witness": sorted(source_live) == sorted(source_final), + "target_events_after_span_cohost_open": sum( + 1 for index in target_events if index > cohost_open + ), + "source_events_after_span_cohost_open": [ + index for index in source_events if index > cohost_open + ], + "source_events_after_span_cohost_open_are_reads": all( + index in source_reads for index in source_events if index > cohost_open + ), + "endpoint_transport_count": len(transports), + "endpoint_transports_span_nested_upward": nested, + "endpoint_transport_rank_steps_match": rank_steps, + "targets_whose_final_contains_basis_head_among_all": finals_with_head, + "hit_flags_from_census": list(HIT_FLAGS), + "flag_is_present_head_case": True, + "chronology_drop_arrive_gap": chronology, + "published_prior_present_head_tuples": PRIOR_TUPLES, + "chronology_distinct_from_published_priors": all( + chronology != prior for prior in PRIOR_TUPLES.values() + ), + "obstruction": ( + "published_channel_hosts_basis_head_on_matched_target_only_at_" + "terminal_transport_literally_and_in_span_after_every_target_update_" + "while_preterminal_target_charts_already_span_non_head_basis_vectors" + ), + "no_new_kappa": True, + "selected_kappa": "0.001672660197076918", + } + + +def evaluate(root=ROOT, here=HERE): + pinned = pin_sources(root, here) + geometry = pinned[ + "research/p104-endpoint-geometric-budget/geometry.py" + ].decode("utf-8") + need(SOURCE_LINE in geometry, "source naming left the geometry") + need(TARGET_LINE in geometry, "target naming left the geometry") + certificate = json.loads( + pinned["research/p104-joint-unit-flags/CERTIFICATE.json"], + object_pairs_hook=pairs_unique, + ) + witness = json.loads( + pinned["research/p104-native-channel/inputs/LOWRANK-WITNESS.json"], + object_pairs_hook=pairs_unique, + ) + receipt = build_receipt(witness, certificate["helpers"]) + need(receipt["target_final_contains_basis_head"] is True, "left present-head class") + need(receipt["target_preterminal_annotations_containing_basis_head"] == 0, "preterminal") + need(receipt["target_annotations_containing_basis_head"] == 1, "target hosting count") + need(receipt["basis_head_drop_event"] == 570, "drop event drift") + need(receipt["basis_head_arrive_event"] == 3525, "arrive event drift") + need(receipt["hosting_gap_events"] == 2955, "gap drift") + need(receipt["chronology_distinct_from_published_priors"] is True, "reprint of a prior") + need(receipt["basis_head_in_source_after_drop"] is False, "source relisted head") + need(receipt["joint_source_target_events"] == 0, "joint endpoint event") + need(receipt["endpoint_non_frame_events"] == 0, "endpoint zero/copy/erase event") + need(receipt["source_frame_restored"] is False, "source restored") + need(receipt["target_frame_restored"] is False, "target restored") + need(receipt["source_span_drop_events"] == [], "source lost head direction") + need( + receipt["source_annotations_span_hosting_basis_head"] + == receipt["source_annotation_count"], + "source span hosting gap", + ) + need(receipt["source_row_update_events"] == [], "source row updated") + need(receipt["target_span_first_hosting_event"] == 3525, "span arrive drift") + need(receipt["target_span_first_hosting_role"] == "after", "span arrive role") + need( + receipt["target_preterminal_annotations_span_hosting_basis_head"] == 0, + "preterminal span hosting", + ) + need( + receipt["target_updates_in_head_free_span"] + == len(receipt["target_update_events"]) + == 15, + "target update in head-hosting chart", + ) + need(receipt["target_updates_in_empty_chart"] == 10, "empty-chart update count") + need( + receipt["target_updates_cohosting_tail_without_head"] == [3231, 3364], + "tail co-hosting updates", + ) + need(receipt["target_tail_in_arrive_before_span"] == [6, 18, 32], "preterminal tail") + need(receipt["source_live_final_matches_witness"] is True, "source frame replay") + need( + [row["tail_cohosted_by_both_endpoints"] + for row in receipt["target_tail_cohosting_update_detail"]] + == [[32], [6, 18, 32]], + "tail co-hosted by both endpoints", + ) + need( + all(row["source_live_spans_head"] + for row in receipt["target_tail_cohosting_update_detail"]), + "source lost head at a tail co-hosting update", + ) + need(receipt["target_events_after_span_cohost_open"] == 0, "target event after cohost") + need( + receipt["source_events_after_span_cohost_open_are_reads"] is True, + "source written after cohost", + ) + need(receipt["endpoint_transports_span_nested_upward"] is True, "non-nested transport") + need(receipt["endpoint_transport_rank_steps_match"] is True, "rank step mismatch") + need(receipt["no_new_kappa"] is True, "kappa claim crept in") + return receipt + + +def admit(observed, expected): + need(observed == expected, "certificate mismatch") + + +def main(): + observed = evaluate() + expected = read_json(HERE / "CERTIFICATE.json") + admit(observed, expected) + print(MARKER) + + +if __name__ == "__main__": + main() From d29a0834ff1705e320d828a0fe538e1efc7ddfdf Mon Sep 17 00:00:00 2001 From: Wentao Li Date: Sun, 18 Oct 2026 02:31:16 +0000 Subject: [PATCH 2/2] Record master handoff for present-head flag 43 package Content tip 5889fe1591f689c3003e2f92c9258d79c97bdee3 holds the package. This commit adds only the handoff note. Prepared with substantial AI assistance. --- .../MASTER-HANDOFF.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 research/p104-present-head-flag43-audit/MASTER-HANDOFF.md diff --git a/research/p104-present-head-flag43-audit/MASTER-HANDOFF.md b/research/p104-present-head-flag43-audit/MASTER-HANDOFF.md new file mode 100644 index 0000000000..0f70a19019 --- /dev/null +++ b/research/p104-present-head-flag43-audit/MASTER-HANDOFF.md @@ -0,0 +1,133 @@ +# Master handoff — `research/p104-present-head-flag43-audit/` + +## Candidate + +- Branch: `cursor/p104-present-head-flag43-1d68` (VictorLiwentao fork). The + suffix is this worker's required branch suffix, not `-60b9`. +- Content tip: `5889fe1591f689c3003e2f92c9258d79c97bdee3` (scientific package + commit; parent is the pinned base) +- Packaging tip: the child commit that adds only this handoff file. Read its SHA + from `git rev-parse origin/cursor/p104-present-head-flag43-1d68`. +- Package: `research/p104-present-head-flag43-audit/` +- Base: CrocSwap main `6f100d4bb5083f8c35d96fd95a539811c62f245c` +- Card: `p104-side-correction` (refined), priority revision 6 +- κ: unchanged `0.001672660197076918` + +## Claim + +On published present-head flag 43 (`X21` → `Y59`, basis head `15`), the head +enters `Y59`'s frame, listed and in GF(2) span, only at `Y59`'s terminal rank-3 +transport after-frame (event 3525). All 15 `Y59` adds (last one at event 3364) +run in head-free charts; ten run in the empty chart. `X21`'s literal drop at +event 570 is a nested chart change that keeps `15` in span (`3 ^ 4 ^ 8`). No +`Y59` event occurs while both endpoints host the head direction, so +chronological dirty restoration cannot use co-hosted basis-head geometry on this +word. + +New on this flag: `Y59`'s last two updates (3231, 3364) run in charts that +already span the flag's non-head basis vectors `{32}` and `{6, 18, 32}`, and +`X21`'s live rank-9 frame spans them too. Both endpoints co-host part of the +flag basis while the target is still updated; only the head is missing. + +## Why flag 43 and no DEFER + +The brief said to defer to the ordinary-leaf fallback only if flag 43 reprinted +flag 1 or flag 9. It does not: drop/arrive/gap is 570/3525/2955 against +591/3473/2882 (#3451) and 500/3489/2989 (#3443). Both scanners carry those two +tuples and refuse to admit an equal one (`test_reprint_guard` checks this). The +target has 15 updates and 6 transports (flag 1's `Y7`: 6 and 3). Flag 43 is also +the only present-head flag with `arrival_choice = 0` in the #2981 certificate +(flags 0, 1 and 9 have 1); this is context and is not certified here. + +Honest caveat: `X21`'s source schedule has the same shape as #3451's `X0` +(17 events, 22 annotations, five transports, rank 1 to 9). The source-span fact +is therefore close to a template repeat; the new content is the target-side +chronology and the tail co-hosting. + +## New checkable facts beyond #3451's method + +- Span-level hosting: zero source span drops (22 of 22 `X21` annotations span + `15`), zero preterminal `Y59` span hosting (largest preterminal span has 32 + elements and excludes `15`). +- Target-update chronology: 15 of 15 `Y59` updates in head-free charts (10 empty, + 5 non-empty of ranks 1–5), 0 `Y59` events after the head enters `Y59`'s span. +- Tail co-hosting: first tail vector in `Y59`'s span at event 3230 (after); + updates 3231 and 3364 co-host `{32}` and `{6, 18, 32}` with `X21`'s live + frame, which is replayed with a before-frame continuity check. +- Source discipline: `X21` is never an add destination; its four events after + 3525 are reads; no endpoint `zero`/`copy`/`erase` event. +- Frame semantics: all 11 endpoint transports nested upward with paid rank equal + to the rank increase; `Y59` steps `1, 1, 1, 1, 1, 3`. +- Reprint guard: both scanners need the flag-43 tuple to differ from the + published flag-1 and flag-9 tuples. + +## Evidence commands + +```sh +python3.12 -I -B research/p104-present-head-flag43-audit/verify.py +python3.12 -I -O -Werror -B research/p104-present-head-flag43-audit/verify.py +python3.12 -I -O -Werror -B research/p104-present-head-flag43-audit/independent.py +python3.12 -I -O -Werror -B research/p104-present-head-flag43-audit/test_package.py +python3.12 -B scripts/research_package.py --package research/p104-present-head-flag43-audit +``` + +Expected markers: + +```text +PASS_P104_PRESENT_HEAD_FLAG43 flag=43 head=15 preterminal_hosting=0 preterminal_span_hosting=0 drop_event=570 arrive_event=3525 source_span_drops=0 head_free_target_updates=15/15 tail_cohosting_updates=2 no_new_kappa +PASS_P104_PRESENT_HEAD_FLAG43_INDEPENDENT flag=43 head=15 preterminal_hosting=0 preterminal_span_hosting=0 drop_event=570 arrive_event=3525 source_span_drops=0 head_free_target_updates=15/15 tail_cohosting_updates=2 no_new_kappa +PASS_P104_PRESENT_HEAD_FLAG43_TESTS groups=7 +PASS_REGISTERED_RESEARCH_PACKAGE research/p104-present-head-flag43-audit outcome=completed +``` + +The worker ran all five on the content tip in the working tree and again in a +fresh detached checkout of the pushed branch. Runs leave the package and pinned +inputs byte-identical. `research_package.py --changed-since ` selects only +this package. + +## Closest priors + +- #3451 `p104-present-head-flag1-audit`: the span method mirrored here, on flag 1 + (leave alone). Its second open question asked whether flag 43 follows the same + span pattern; this package answers yes for flag 43. +- #3443 `p104-present-head-flag9-audit`: the literal method, on flag 9 (leave + alone). +- #3349 `p104-channel-touch-restoration-audit`: names `(21, Y59, 15)` as a + present-head triple and records unrestored endpoint frames. It gives no `Y59` + chronology. +- #3392 `p104-absent-head-flag2-audit`: the complementary absent-head case + (leave alone). +- Merged #3242 `p104-flag-channel-schedule`: zero joint events for every matched + pair; its worked receipt is flag 0 only. + +## Soft-overlap risks + +- #3363 (relay census over all 208 flags) implicitly includes flag 43's delivery + coefficient. This package recomputes no coefficient and does not name the + delivering add. PROOF.md states, conditionally and uncertified, that any + delivery into `Y59` must occur at one of the 15 head-free adds. A reviewer may + prefer that remark removed. +- #3365/#3371/#3372/#3412 (flag-0 cascade on `Y34`): untouched; flag 43 shares + neither source nor target with flag 0. +- #3349: items on unrestored frames and the present-head triple are reused, not + re-derived as new. +- #3451/#3443: the reprint guard hard-codes their published tuples as constants. + It does not recompute flags 1 or 9. The tail-co-hosting contrast with flag 1 + reads #3451's certificate (`{0, 95, 441, 486}`) and is not re-derived. +- Do not extend this to flags 0, 1 or 9 in the same PR. + +## Open questions + +1. Can a changed schedule bring `15` into `Y59`'s span at or before the add at + event 3364, while `X21` is still live, and what does that add to the channel + bill? The head is one rank step from the chart at 3364, and the common-chart + rule means `D17`'s frame at that add must move too. +2. Is tail-before-head hosting specific to flag 43 among the present-head flags, + and does it occur on absent-head flags? A separate census should cite + #3451/#3443/#3392 rather than re-certify them. + +## Disposition note for master + +The worker produces a fork branch and package only. Do **not** open a CrocSwap +PR from this worker. Master decides publish or defer after independent +skeptical review.