diff --git a/research/staged544-local-two-add/.gitattributes b/research/staged544-local-two-add/.gitattributes new file mode 100644 index 0000000000..fa1385d99a --- /dev/null +++ b/research/staged544-local-two-add/.gitattributes @@ -0,0 +1 @@ +* -text diff --git a/research/staged544-local-two-add/.gitignore b/research/staged544-local-two-add/.gitignore new file mode 100644 index 0000000000..43ae0e2a6c --- /dev/null +++ b/research/staged544-local-two-add/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +*.py[cod] diff --git a/research/staged544-local-two-add/PROOF.md b/research/staged544-local-two-add/PROOF.md new file mode 100644 index 0000000000..9c44765e69 --- /dev/null +++ b/research/staged544-local-two-add/PROOF.md @@ -0,0 +1,162 @@ +# Local-first two-ADD retiming obstruction + +## Statement and fixed contract + +Fix either literal PR3734 provider retained in `inputs/`. A first existing ADD +may change its common binary frame in place, or move across exactly one adjacent +ADD or nonzero SCALE and change that frame. A second existing ADD may then move +any distance inside its allowed scalar corridor and choose any common binary +frame. Both the intermediate and final words must satisfy the fixed boundaries. +Every other gate, gate frame, entrance, target/centre cut, native warp, and exit +is unchanged. Each move stays within A after its prelude, B between native warp +cuts, or restore. ADD crossings use the sufficient condition +`destination(g) != source(h)` and `destination(h) != source(g)`; SCALE crossings +use exact conjugation. These are the PR3886 move rules, not every possible +semantics-preserving rewrite. The same ADD may be chosen twice. + +**Theorem.** Every word in this class has new-minus-old raw rank moment at least +zero for every real `0 < a < 1`. The raw moment is `sum n_r r^(1-a)`. This is a +finite source-bound theorem conditional on the explicitly stated word/frame +contract, supported by the exact census below. It is not a universal two-gate +barrier or supplier admission. + +The first move need not be neutral. The census also includes every locally +losing first move in this radius-one class. The second move has no radius bound. +A simultaneous edit which needs an illegal intermediate, a longer first move, +a moved SCALE, extra/deleted gates, warp/phase crossings, or another changed +boundary is outside the statement. + +## 1. Reused scalar and single-move facts + +The elementary matrix `I+cE_ds` commutes with `I+bE_uv` under the displayed +sufficient condition. Moving it right across a scale q at d multiplies c by q; +a scale at s divides c by q. Moving left reverses these factors. The source +scales are nonzero powers of two, so coefficients remain dyadic. These are +identities on arbitrary inputs, including dirty helpers. Cleanup is defined as +the literal inverse of the edited forward programme, with the inherited buffer +substitution; it does not require zero dirty state. + +The PR3886 trace, move applier, complete single-move census, and sign criterion +are reused verbatim. The primary replay regenerates all 1,776,295 single-move +cut/dimension cases separately for each provider and compares the entire frozen +receipt, rather than trusting its old PASS flag. That census proves every +single-move delta is nonnegative for all real `0 1+4` and is rejected by a non-improvement certificate. Wrong-scalar +controls rederive inverse cleanup before testing semantics, so stale cleanup +is not the cause of rejection. This control is not a new current improvement. + +## Boundary and cost decision + +The declared milestone is a scoped obstruction, not an implementation admission. +Fixed helper widths, buffer identities, entrances/exits, and unchanged gates are +part of the class. Elementary-matrix identities establish scalar equality on +arbitrary dirty state; inverse cleanup is rederived for literal controls. +Frame invoices are fully reconstructed. Each changed-frame intermediate also +passes the separately retained frame auditor. The negative raw comparison needs +no new allocation, and cannot fund added nonnegative cost under unchanged +normalisers and common bills. + +Native Clifford phase, full physical allocation, uniform coefficients/stock, +precision, all-size compiler, whole supplier admission, and outer/BIT/analytic +chains were not freshly replayed here. Unknown costs are not zero. In particular, +this is not a claim that every candidate has been admitted as a complete +physical supplier. The expansion decision is **narrow this search away from a +local first displacement**. Repeating the same first-move class with more seeds +cannot alter this exact result. + +## Open next questions + +Can a first ADD moving across at least two neighbours, with a concrete changed +intermediate frame, unlock a profitable second move? First freeze one such +literal witness and its complete local invoice. This is the nearest escape from +the proved radius-one premise; long-range exploratory samples in this session +were incomplete and are not a barrier certificate. + +Can a simultaneous two-frame rewrite, or a changed entrance/exit contract, +realise PR3863's `2+2 -> 1+3` target without an individually legal intermediate? +First provide the exact before/after word and dirty restoration contract, then +price all changed children and consumer costs. This is distinct from choosing +compatible-looking ranks from an aggregate histogram. Native and physical +admission remain separate blockers even after a favourable local identity. + +## Sources and credit + +Scientific base is canonical main `20ecf2891d80b5acf18d980b2164fb44ea7faa90`, +priority revision 6. Neither the selected certificate nor frozen packages are +modified. `SOURCES.json` pins every local snapshot by byte count, SHA256, and Git +blob. PR3734/dataisfire supplies the words at +`fa041037a3374eaa08feeca0b26a5d6893194147`. PR3886/Chris R supplies the reused +trace, single-move proof, sign criterion, and applier at +`359fe0fe77d29544972fd22ee674085ed5a3b4d0`. Dugongue's PR3863 supplies the +paid-profile target; Jeremy Kothe's PR2957 supplies the existing swap control. +PR2979 and the staged-entry/retiming lineage retain their construction credit. + +Sagar Thakrar's auditor and roger-sato's semantic adapter are retained unchanged, +including Arham Tahir's frame-contract attribution. They are not newly +independent interpreters. New reductions, paired census, and controls are by +Chris R / Clear1nsight with substantial OpenAI assistance. Apache-2.0 and all +notices in `vendor/SOURCE-CREDITS.md` apply. There is no independent human or +formal-kernel review claim. + +The official overlap helper refreshed 630 open PRs and 2,544 Discussion records +with complete pagination at 2026-10-19 03:39 UTC; local-note coverage was limited +to the exported inputs. PR3890's width-price region is a different contract. +The upstream claim comment was denied with HTTP403; no posted upstream claim is +asserted. Temporary fork-only input-export infrastructure is excluded from this +research PR. Exact execution, exploration limits, and publication checkpoints +are recorded in `VALIDATION.json`. diff --git a/research/staged544-local-two-add/RESULT-base.json b/research/staged544-local-two-add/RESULT-base.json new file mode 100644 index 0000000000..c8e6e2549a --- /dev/null +++ b/research/staged544-local-two-add/RESULT-base.json @@ -0,0 +1 @@ +{"pair_census":{"first_counts":{"adjacent_losing":616,"adjacent_neutral":49,"fixed_adjacent":4709,"frame_only_losing":353,"frame_only_neutral":29},"first_digest":"70a8976a12239dfee212fee47ea09386c17b62f1af44526c4686000c4631adf2","fixed_frame":{"counts":{"bridge_gates":88444,"candidate_dimensions":14693,"first_pairs":4709,"scalar_legal":14966},"nonzero_cases":[["restore",182,178,8,[0,2,-1,0,0,0,0,0,0,0]],["restore",191,178,8,[0,2,-1,0,0,0,0,0,0,0]],["restore",192,178,8,[0,2,-1,0,0,0,0,0,0,0]],["restore",193,178,8,[0,2,-1,0,0,0,0,0,0,0]]],"profiles":[{"caps":[0,0,0,0,0,0,0,0,0],"count":14689,"delta":[0,0,0,0,0,0,0,0,0,0],"prefixes":[0,0,0,0,0,0,0,0]},{"caps":[1,0,0,0,0,0,0,0,0],"count":4,"delta":[0,2,-1,0,0,0,0,0,0,0],"prefixes":[1,1,1,1,1,1,1,1]}]},"max_first_quotient_dimension":3,"variable_frame":{"by_kind":{"adjacent_losing":{"first_words":616,"second_cut_dimensions":7175109},"adjacent_neutral":{"first_words":49,"second_cut_dimensions":381642},"frame_only_losing":{"first_words":353,"second_cut_dimensions":4113091},"frame_only_neutral":{"first_words":29,"second_cut_dimensions":233183}},"profiles":[{"caps":[0,2,0,0,0,0,0,0,0],"count":209878,"delta":[0,-2,4,-2,0,0,0,0,0,0],"prefixes":[0,2,2,2,2,2,2,2]},{"caps":[1,4,1,0,0,0,0,0,0],"count":11655,"delta":[0,-2,6,-2,-1,0,0,0,0,0],"prefixes":[1,5,6,6,6,6,6,6]},{"caps":[0,1,1,0,0,0,0,0,0],"count":220451,"delta":[0,-1,1,1,-1,0,0,0,0,0],"prefixes":[0,1,2,2,2,2,2,2]},{"caps":[1,3,1,1,0,0,0,0,0],"count":1112,"delta":[0,-1,4,-2,1,-1,0,0,0,0],"prefixes":[1,4,5,6,6,6,6,6]},{"caps":[1,3,1,0,0,0,0,0,0],"count":7026,"delta":[0,-1,4,-1,-1,0,0,0,0,0],"prefixes":[1,4,5,5,5,5,5,5]},{"caps":[1,3,0,0,0,0,0,0,0],"count":1088,"delta":[0,-1,5,-3,0,0,0,0,0,0],"prefixes":[1,4,4,4,4,4,4,4]},{"caps":[0,0,0,0,0,0,0,0,0],"count":609532,"delta":[0,0,0,0,0,0,0,0,0,0],"prefixes":[0,0,0,0,0,0,0,0]},{"caps":[1,2,2,0,0,0,0,0,0],"count":23134,"delta":[0,0,1,2,-2,0,0,0,0,0],"prefixes":[1,3,5,5,5,5,5,5]},{"caps":[1,2,1,0,0,0,0,0,0],"count":104966,"delta":[0,0,2,0,-1,0,0,0,0,0],"prefixes":[1,3,4,4,4,4,4,4]},{"caps":[1,2,0,0,0,0,0,0,0],"count":42438,"delta":[0,0,3,-2,0,0,0,0,0,0],"prefixes":[1,3,3,3,3,3,3,3]},{"caps":[2,4,2,0,0,0,0,0,0],"count":1869874,"delta":[0,0,4,0,-2,0,0,0,0,0],"prefixes":[2,6,8,8,8,8,8,8]},{"caps":[2,4,1,0,0,0,0,0,0],"count":9946,"delta":[0,0,5,-2,-1,0,0,0,0,0],"prefixes":[2,6,7,7,7,7,7,7]},{"caps":[3,6,3,0,0,0,0,0,0],"count":30797,"delta":[0,0,6,0,-3,0,0,0,0,0],"prefixes":[3,9,12,12,12,12,12,12]},{"caps":[1,1,2,0,0,0,0,0,0],"count":5190,"delta":[0,1,-1,3,-2,0,0,0,0,0],"prefixes":[1,2,4,4,4,4,4,4]},{"caps":[1,1,1,0,0,0,0,0,0],"count":93176,"delta":[0,1,0,1,-1,0,0,0,0,0],"prefixes":[1,2,3,3,3,3,3,3]},{"caps":[1,1,0,0,0,0,0,0,0],"count":977821,"delta":[0,1,1,-1,0,0,0,0,0,0],"prefixes":[1,2,2,2,2,2,2,2]},{"caps":[1,1,-1,0,0,0,0,0,0],"count":251168,"delta":[0,1,2,-3,1,0,0,0,0,0],"prefixes":[1,2,1,1,1,1,1,1]},{"caps":[2,3,2,0,0,0,0,0,0],"count":74758,"delta":[0,1,2,1,-2,0,0,0,0,0],"prefixes":[2,5,7,7,7,7,7,7]},{"caps":[2,3,1,0,0,0,0,0,0],"count":436346,"delta":[0,1,3,-1,-1,0,0,0,0,0],"prefixes":[2,5,6,6,6,6,6,6]},{"caps":[2,3,0,0,0,0,0,0,0],"count":61407,"delta":[0,1,4,-3,0,0,0,0,0,0],"prefixes":[2,5,5,5,5,5,5,5]},{"caps":[3,5,2,0,0,0,0,0,0],"count":13170,"delta":[0,1,5,-1,-2,0,0,0,0,0],"prefixes":[3,8,10,10,10,10,10,10]},{"caps":[1,0,1,1,0,0,0,0,0],"count":81051,"delta":[0,2,-2,1,1,-1,0,0,0,0],"prefixes":[1,1,2,3,3,3,3,3]},{"caps":[1,0,1,0,0,0,0,0,0],"count":43635,"delta":[0,2,-2,2,-1,0,0,0,0,0],"prefixes":[1,1,2,2,2,2,2,2]},{"caps":[1,0,0,0,0,0,0,0,0],"count":1262300,"delta":[0,2,-1,0,0,0,0,0,0,0],"prefixes":[1,1,1,1,1,1,1,1]},{"caps":[2,2,2,0,0,0,0,0,0],"count":2033432,"delta":[0,2,0,2,-2,0,0,0,0,0],"prefixes":[2,4,6,6,6,6,6,6]},{"caps":[2,2,1,0,0,0,0,0,0],"count":360333,"delta":[0,2,1,0,-1,0,0,0,0,0],"prefixes":[2,4,5,5,5,5,5,5]},{"caps":[2,2,0,0,0,0,0,0,0],"count":1278029,"delta":[0,2,2,-2,0,0,0,0,0,0],"prefixes":[2,4,4,4,4,4,4,4]},{"caps":[3,4,2,0,0,0,0,0,0],"count":22136,"delta":[0,2,3,0,-2,0,0,0,0,0],"prefixes":[3,7,9,9,9,9,9,9]},{"caps":[3,4,1,0,0,0,0,0,0],"count":7754,"delta":[0,2,4,-2,-1,0,0,0,0,0],"prefixes":[3,7,8,8,8,8,8,8]},{"caps":[2,1,1,0,0,0,0,0,0],"count":14923,"delta":[0,3,-1,1,-1,0,0,0,0,0],"prefixes":[2,3,4,4,4,4,4,4]},{"caps":[2,1,0,0,0,0,0,0,0],"count":98846,"delta":[0,3,0,-1,0,0,0,0,0,0],"prefixes":[2,3,3,3,3,3,3,3]},{"caps":[3,3,3,0,0,0,0,0,0],"count":92391,"delta":[0,3,0,3,-3,0,0,0,0,0],"prefixes":[3,6,9,9,9,9,9,9]},{"caps":[3,3,2,0,0,0,0,0,0],"count":91607,"delta":[0,3,1,1,-2,0,0,0,0,0],"prefixes":[3,6,8,8,8,8,8,8]},{"caps":[3,3,1,0,0,0,0,0,0],"count":96530,"delta":[0,3,2,-1,-1,0,0,0,0,0],"prefixes":[3,6,7,7,7,7,7,7]},{"caps":[3,3,0,0,0,0,0,0,0],"count":194130,"delta":[0,3,3,-3,0,0,0,0,0,0],"prefixes":[3,6,6,6,6,6,6,6]},{"caps":[4,5,3,0,0,0,0,0,0],"count":123608,"delta":[0,3,3,1,-3,0,0,0,0,0],"prefixes":[4,9,12,12,12,12,12,12]},{"caps":[4,5,2,0,0,0,0,0,0],"count":20496,"delta":[0,3,4,-1,-2,0,0,0,0,0],"prefixes":[4,9,11,11,11,11,11,11]},{"caps":[2,0,1,1,0,0,0,0,0],"count":2472,"delta":[0,4,-3,1,1,-1,0,0,0,0],"prefixes":[2,2,3,4,4,4,4,4]},{"caps":[2,0,0,0,0,0,0,0,0],"count":303179,"delta":[0,4,-2,0,0,0,0,0,0,0],"prefixes":[2,2,2,2,2,2,2,2]},{"caps":[3,2,2,0,0,0,0,0,0],"count":31264,"delta":[0,4,-1,2,-2,0,0,0,0,0],"prefixes":[3,5,7,7,7,7,7,7]},{"caps":[3,2,1,0,0,0,0,0,0],"count":8226,"delta":[0,4,0,0,-1,0,0,0,0,0],"prefixes":[3,5,6,6,6,6,6,6]},{"caps":[3,2,0,0,0,0,0,0,0],"count":258817,"delta":[0,4,1,-2,0,0,0,0,0,0],"prefixes":[3,5,5,5,5,5,5,5]},{"caps":[4,4,3,0,0,0,0,0,0],"count":92181,"delta":[0,4,1,2,-3,0,0,0,0,0],"prefixes":[4,8,11,11,11,11,11,11]},{"caps":[4,4,2,0,0,0,0,0,0],"count":46350,"delta":[0,4,2,0,-2,0,0,0,0,0],"prefixes":[4,8,10,10,10,10,10,10]},{"caps":[4,4,1,0,0,0,0,0,0],"count":23318,"delta":[0,4,3,-2,-1,0,0,0,0,0],"prefixes":[4,8,9,9,9,9,9,9]},{"caps":[3,1,0,0,0,0,0,0,0],"count":5,"delta":[0,5,-1,-1,0,0,0,0,0,0],"prefixes":[3,4,4,4,4,4,4,4]},{"caps":[4,3,0,0,0,0,0,0,0],"count":238222,"delta":[0,5,2,-3,0,0,0,0,0,0],"prefixes":[4,7,7,7,7,7,7,7]},{"caps":[3,0,0,0,0,0,0,0,0],"count":14838,"delta":[0,6,-3,0,0,0,0,0,0,0],"prefixes":[3,3,3,3,3,3,3,3]},{"caps":[4,1,0,0,0,0,0,0,0],"count":8019,"delta":[0,7,-2,-1,0,0,0,0,0,0],"prefixes":[4,5,5,5,5,5,5,5]}]}},"provider":"base","schema_version":1,"single_census_digest":"cc9511ce95569ba099cd9d8cd28481d9618b2c951e0960dd0fc68736b12468a9","single_move_candidates":1776295,"source_canonical":"a140d980692fb1688b6b85021e06e2aea7d97eb3fd2b09cbd6c47afb0cc7f9da","source_profile":{"1":2440,"2":725,"3":224,"4":102,"5":20,"8":8},"source_semantics":{"buffer_self_map":"identity","buffer_to_live_leaks":0,"cleanup_boundary_forward_and_reverse":"PASS","dirty_buffers":91,"dual":"PASS","forward":"PASS","live_inputs":632,"matrix_dimension":723,"nonzero_endpoint_terms":835,"reverse_pullback_equals_forward":true},"width_inventory":{"4":26,"5":2,"6":18,"7":53,"8":96,"9":213}} diff --git a/research/staged544-local-two-add/RESULT-extra.json b/research/staged544-local-two-add/RESULT-extra.json new file mode 100644 index 0000000000..2479494120 --- /dev/null +++ b/research/staged544-local-two-add/RESULT-extra.json @@ -0,0 +1 @@ +{"pair_census":{"first_counts":{"adjacent_losing":616,"adjacent_neutral":49,"fixed_adjacent":4709,"frame_only_losing":353,"frame_only_neutral":29},"first_digest":"152e6189fe0d82d8b7408473d0a769711d142377353cbc29f72b90419fcbb630","fixed_frame":{"counts":{"bridge_gates":88444,"candidate_dimensions":14693,"first_pairs":4709,"scalar_legal":14966},"nonzero_cases":[["restore",182,178,8,[0,2,-1,0,0,0,0,0,0,0]],["restore",191,178,8,[0,2,-1,0,0,0,0,0,0,0]],["restore",192,178,8,[0,2,-1,0,0,0,0,0,0,0]],["restore",193,178,8,[0,2,-1,0,0,0,0,0,0,0]]],"profiles":[{"caps":[0,0,0,0,0,0,0,0,0],"count":14689,"delta":[0,0,0,0,0,0,0,0,0,0],"prefixes":[0,0,0,0,0,0,0,0]},{"caps":[1,0,0,0,0,0,0,0,0],"count":4,"delta":[0,2,-1,0,0,0,0,0,0,0],"prefixes":[1,1,1,1,1,1,1,1]}]},"max_first_quotient_dimension":3,"variable_frame":{"by_kind":{"adjacent_losing":{"first_words":616,"second_cut_dimensions":7175109},"adjacent_neutral":{"first_words":49,"second_cut_dimensions":381642},"frame_only_losing":{"first_words":353,"second_cut_dimensions":4113091},"frame_only_neutral":{"first_words":29,"second_cut_dimensions":233183}},"profiles":[{"caps":[0,2,0,0,0,0,0,0,0],"count":209878,"delta":[0,-2,4,-2,0,0,0,0,0,0],"prefixes":[0,2,2,2,2,2,2,2]},{"caps":[1,4,1,0,0,0,0,0,0],"count":11655,"delta":[0,-2,6,-2,-1,0,0,0,0,0],"prefixes":[1,5,6,6,6,6,6,6]},{"caps":[0,1,1,0,0,0,0,0,0],"count":220451,"delta":[0,-1,1,1,-1,0,0,0,0,0],"prefixes":[0,1,2,2,2,2,2,2]},{"caps":[1,3,1,1,0,0,0,0,0],"count":1112,"delta":[0,-1,4,-2,1,-1,0,0,0,0],"prefixes":[1,4,5,6,6,6,6,6]},{"caps":[1,3,1,0,0,0,0,0,0],"count":7026,"delta":[0,-1,4,-1,-1,0,0,0,0,0],"prefixes":[1,4,5,5,5,5,5,5]},{"caps":[1,3,0,0,0,0,0,0,0],"count":1088,"delta":[0,-1,5,-3,0,0,0,0,0,0],"prefixes":[1,4,4,4,4,4,4,4]},{"caps":[0,0,0,0,0,0,0,0,0],"count":609532,"delta":[0,0,0,0,0,0,0,0,0,0],"prefixes":[0,0,0,0,0,0,0,0]},{"caps":[1,2,2,0,0,0,0,0,0],"count":23134,"delta":[0,0,1,2,-2,0,0,0,0,0],"prefixes":[1,3,5,5,5,5,5,5]},{"caps":[1,2,1,0,0,0,0,0,0],"count":104966,"delta":[0,0,2,0,-1,0,0,0,0,0],"prefixes":[1,3,4,4,4,4,4,4]},{"caps":[1,2,0,0,0,0,0,0,0],"count":42438,"delta":[0,0,3,-2,0,0,0,0,0,0],"prefixes":[1,3,3,3,3,3,3,3]},{"caps":[2,4,2,0,0,0,0,0,0],"count":1869874,"delta":[0,0,4,0,-2,0,0,0,0,0],"prefixes":[2,6,8,8,8,8,8,8]},{"caps":[2,4,1,0,0,0,0,0,0],"count":9946,"delta":[0,0,5,-2,-1,0,0,0,0,0],"prefixes":[2,6,7,7,7,7,7,7]},{"caps":[3,6,3,0,0,0,0,0,0],"count":30797,"delta":[0,0,6,0,-3,0,0,0,0,0],"prefixes":[3,9,12,12,12,12,12,12]},{"caps":[1,1,2,0,0,0,0,0,0],"count":5190,"delta":[0,1,-1,3,-2,0,0,0,0,0],"prefixes":[1,2,4,4,4,4,4,4]},{"caps":[1,1,1,0,0,0,0,0,0],"count":93176,"delta":[0,1,0,1,-1,0,0,0,0,0],"prefixes":[1,2,3,3,3,3,3,3]},{"caps":[1,1,0,0,0,0,0,0,0],"count":977821,"delta":[0,1,1,-1,0,0,0,0,0,0],"prefixes":[1,2,2,2,2,2,2,2]},{"caps":[1,1,-1,0,0,0,0,0,0],"count":251168,"delta":[0,1,2,-3,1,0,0,0,0,0],"prefixes":[1,2,1,1,1,1,1,1]},{"caps":[2,3,2,0,0,0,0,0,0],"count":74758,"delta":[0,1,2,1,-2,0,0,0,0,0],"prefixes":[2,5,7,7,7,7,7,7]},{"caps":[2,3,1,0,0,0,0,0,0],"count":436346,"delta":[0,1,3,-1,-1,0,0,0,0,0],"prefixes":[2,5,6,6,6,6,6,6]},{"caps":[2,3,0,0,0,0,0,0,0],"count":61407,"delta":[0,1,4,-3,0,0,0,0,0,0],"prefixes":[2,5,5,5,5,5,5,5]},{"caps":[3,5,2,0,0,0,0,0,0],"count":13170,"delta":[0,1,5,-1,-2,0,0,0,0,0],"prefixes":[3,8,10,10,10,10,10,10]},{"caps":[1,0,1,1,0,0,0,0,0],"count":81051,"delta":[0,2,-2,1,1,-1,0,0,0,0],"prefixes":[1,1,2,3,3,3,3,3]},{"caps":[1,0,1,0,0,0,0,0,0],"count":43635,"delta":[0,2,-2,2,-1,0,0,0,0,0],"prefixes":[1,1,2,2,2,2,2,2]},{"caps":[1,0,0,0,0,0,0,0,0],"count":1262300,"delta":[0,2,-1,0,0,0,0,0,0,0],"prefixes":[1,1,1,1,1,1,1,1]},{"caps":[2,2,2,0,0,0,0,0,0],"count":2033432,"delta":[0,2,0,2,-2,0,0,0,0,0],"prefixes":[2,4,6,6,6,6,6,6]},{"caps":[2,2,1,0,0,0,0,0,0],"count":360333,"delta":[0,2,1,0,-1,0,0,0,0,0],"prefixes":[2,4,5,5,5,5,5,5]},{"caps":[2,2,0,0,0,0,0,0,0],"count":1278029,"delta":[0,2,2,-2,0,0,0,0,0,0],"prefixes":[2,4,4,4,4,4,4,4]},{"caps":[3,4,2,0,0,0,0,0,0],"count":22136,"delta":[0,2,3,0,-2,0,0,0,0,0],"prefixes":[3,7,9,9,9,9,9,9]},{"caps":[3,4,1,0,0,0,0,0,0],"count":7754,"delta":[0,2,4,-2,-1,0,0,0,0,0],"prefixes":[3,7,8,8,8,8,8,8]},{"caps":[2,1,1,0,0,0,0,0,0],"count":14923,"delta":[0,3,-1,1,-1,0,0,0,0,0],"prefixes":[2,3,4,4,4,4,4,4]},{"caps":[2,1,0,0,0,0,0,0,0],"count":98846,"delta":[0,3,0,-1,0,0,0,0,0,0],"prefixes":[2,3,3,3,3,3,3,3]},{"caps":[3,3,3,0,0,0,0,0,0],"count":92391,"delta":[0,3,0,3,-3,0,0,0,0,0],"prefixes":[3,6,9,9,9,9,9,9]},{"caps":[3,3,2,0,0,0,0,0,0],"count":91607,"delta":[0,3,1,1,-2,0,0,0,0,0],"prefixes":[3,6,8,8,8,8,8,8]},{"caps":[3,3,1,0,0,0,0,0,0],"count":96530,"delta":[0,3,2,-1,-1,0,0,0,0,0],"prefixes":[3,6,7,7,7,7,7,7]},{"caps":[3,3,0,0,0,0,0,0,0],"count":194130,"delta":[0,3,3,-3,0,0,0,0,0,0],"prefixes":[3,6,6,6,6,6,6,6]},{"caps":[4,5,3,0,0,0,0,0,0],"count":123608,"delta":[0,3,3,1,-3,0,0,0,0,0],"prefixes":[4,9,12,12,12,12,12,12]},{"caps":[4,5,2,0,0,0,0,0,0],"count":20496,"delta":[0,3,4,-1,-2,0,0,0,0,0],"prefixes":[4,9,11,11,11,11,11,11]},{"caps":[2,0,1,1,0,0,0,0,0],"count":2472,"delta":[0,4,-3,1,1,-1,0,0,0,0],"prefixes":[2,2,3,4,4,4,4,4]},{"caps":[2,0,0,0,0,0,0,0,0],"count":303179,"delta":[0,4,-2,0,0,0,0,0,0,0],"prefixes":[2,2,2,2,2,2,2,2]},{"caps":[3,2,2,0,0,0,0,0,0],"count":31264,"delta":[0,4,-1,2,-2,0,0,0,0,0],"prefixes":[3,5,7,7,7,7,7,7]},{"caps":[3,2,1,0,0,0,0,0,0],"count":8226,"delta":[0,4,0,0,-1,0,0,0,0,0],"prefixes":[3,5,6,6,6,6,6,6]},{"caps":[3,2,0,0,0,0,0,0,0],"count":258817,"delta":[0,4,1,-2,0,0,0,0,0,0],"prefixes":[3,5,5,5,5,5,5,5]},{"caps":[4,4,3,0,0,0,0,0,0],"count":92181,"delta":[0,4,1,2,-3,0,0,0,0,0],"prefixes":[4,8,11,11,11,11,11,11]},{"caps":[4,4,2,0,0,0,0,0,0],"count":46350,"delta":[0,4,2,0,-2,0,0,0,0,0],"prefixes":[4,8,10,10,10,10,10,10]},{"caps":[4,4,1,0,0,0,0,0,0],"count":23318,"delta":[0,4,3,-2,-1,0,0,0,0,0],"prefixes":[4,8,9,9,9,9,9,9]},{"caps":[3,1,0,0,0,0,0,0,0],"count":5,"delta":[0,5,-1,-1,0,0,0,0,0,0],"prefixes":[3,4,4,4,4,4,4,4]},{"caps":[4,3,0,0,0,0,0,0,0],"count":238222,"delta":[0,5,2,-3,0,0,0,0,0,0],"prefixes":[4,7,7,7,7,7,7,7]},{"caps":[3,0,0,0,0,0,0,0,0],"count":14838,"delta":[0,6,-3,0,0,0,0,0,0,0],"prefixes":[3,3,3,3,3,3,3,3]},{"caps":[4,1,0,0,0,0,0,0,0],"count":8019,"delta":[0,7,-2,-1,0,0,0,0,0,0],"prefixes":[4,5,5,5,5,5,5,5]}]}},"provider":"extra","schema_version":1,"single_census_digest":"cc9511ce95569ba099cd9d8cd28481d9618b2c951e0960dd0fc68736b12468a9","single_move_candidates":1776295,"source_canonical":"309e6b90bad582081b90cce08f820da62ab11602a8298852cb7ef6f16b8942c8","source_profile":{"1":2440,"2":725,"3":224,"4":102,"5":20,"8":8},"source_semantics":{"buffer_self_map":"identity","buffer_to_live_leaks":0,"cleanup_boundary_forward_and_reverse":"PASS","dirty_buffers":91,"dual":"PASS","forward":"PASS","live_inputs":632,"matrix_dimension":723,"nonzero_endpoint_terms":835,"reverse_pullback_equals_forward":true},"width_inventory":{"4":26,"5":2,"6":18,"7":53,"8":96,"9":213}} diff --git a/research/staged544-local-two-add/SOURCES.json b/research/staged544-local-two-add/SOURCES.json new file mode 100644 index 0000000000..3aceb59cec --- /dev/null +++ b/research/staged544-local-two-add/SOURCES.json @@ -0,0 +1,99 @@ +{ + "schema_version": 1, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0" + } + ], + "snapshots": [ + { + "local": "vendor/audit_core.py", + "source_path": "research/staged544-producer-return/audit_core.py", + "source_repository": "dataisfire/integer-mult-bounds", + "source_commit": "fa041037a3374eaa08feeca0b26a5d6893194147", + "bytes": 19364, + "sha256": "888679ca8502cdcb100420fe5382a052529a494bf76cb332928b86e62612b951", + "git_blob": "8b5e1d5f2a106402f036b63028ecef31a4e4c462" + }, + { + "local": "vendor/audit_verify.py", + "source_path": "research/staged544-producer-return/audit_verify.py", + "source_repository": "dataisfire/integer-mult-bounds", + "source_commit": "fa041037a3374eaa08feeca0b26a5d6893194147", + "bytes": 12382, + "sha256": "99971d3cc143cc894600e08c8cfbad3e8f537a544212f21dfbe4271cfa97354d", + "git_blob": "7f9fc1df424ae1d459616e49bda7a5dd17e40491" + }, + { + "local": "vendor/SOURCE-CREDITS.md", + "source_path": "research/staged544-producer-return/SOURCE-CREDITS.md", + "source_repository": "dataisfire/integer-mult-bounds", + "source_commit": "fa041037a3374eaa08feeca0b26a5d6893194147", + "bytes": 2882, + "sha256": "d4a13d8b8ed9cdb594f00efb3d1a336e09d934423330f02a1514308a720c278b", + "git_blob": "c054fad87eeaa510865e682ee0c976c4cd728da2" + }, + { + "local": "inputs/BORROW-WORD-43base.json.gz", + "source_path": "research/staged544-producer-return/words/BORROW-WORD-43base.json.gz", + "source_repository": "dataisfire/integer-mult-bounds", + "source_commit": "fa041037a3374eaa08feeca0b26a5d6893194147", + "bytes": 72769, + "sha256": "5ca4be99851f8878cbfe0fd6c454df926b11218f17feefa1664721cf03156699", + "git_blob": "674ea18ade4af85ca865fb08dc973637a09e30e6" + }, + { + "local": "inputs/BORROW-WORD-43extra.json.gz", + "source_path": "research/staged544-producer-return/words/BORROW-WORD-43extra.json.gz", + "source_repository": "dataisfire/integer-mult-bounds", + "source_commit": "fa041037a3374eaa08feeca0b26a5d6893194147", + "bytes": 72766, + "sha256": "965268a9be73d3f62e7ef680d18f108cf064bfe1f44b82157baa61443232904e", + "git_blob": "b17e2be67e327f04802fd034c344fe4253c13a4a" + }, + { + "local": "vendor/retiming.py", + "source_path": "research/rank-profile-retiming-obstruction/retiming.py", + "source_repository": "Clear1nsight/integer-mult-bounds", + "source_commit": "359fe0fe77d29544972fd22ee674085ed5a3b4d0", + "bytes": 10391, + "sha256": "591d7278541ac4de9e9b6fc1e17aba23b205ac4b6c81824a28fc08294658ef0d", + "git_blob": "c33d7bbcdf2435056b3a56526e8e43f6513e381b" + }, + { + "local": "inputs/SINGLE-CENSUS.json", + "source_path": "research/rank-profile-retiming-obstruction/CENSUS.json", + "source_repository": "Clear1nsight/integer-mult-bounds", + "source_commit": "359fe0fe77d29544972fd22ee674085ed5a3b4d0", + "bytes": 3745, + "sha256": "deffad70389a25ba5cad5b7168b9a80b9d6ed41fb085aeeeed8ebce2ae9ae1e8", + "git_blob": "c9db55a4779f9385e09e9ef4a1cf929a0fd77232" + } + ], + "method_predecessors": [ + { + "pr": 3886, + "author": "Chris R / Clear1nsight", + "source_commit": "359fe0fe77d29544972fd22ee674085ed5a3b4d0", + "scope": "Single-move theorem, chronological trace, retiming applier, and all-power certificate are reused explicitly." + }, + { + "pr": 3863, + "author": "Dugongue", + "head": "635fe84596c19016f3d0316a5cf7abbe48285490", + "scope": "Uniform rational paid-profile credit and proposed 2+2 to 1+3 target; read, not reimplemented as new mathematics." + }, + { + "pr": 2957, + "author": "Jeremy Kothe", + "retained_record": "research/rank7-joint-endframes/data/REWRITES-2957.json", + "retained_record_base": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "scope": "Already-retained commuting swap used as a counterfactual rollback/recovery positive control." + } + ], + "external_snapshot_contract": "Package-local exact source snapshots are authenticated by byte count, SHA256, and Git blob. Their source heads are attribution pins, not runtime Git ancestry requirements. The standalone verifier is Git-free." +} diff --git a/research/staged544-local-two-add/TASK.json b/research/staged544-local-two-add/TASK.json new file mode 100644 index 0000000000..babcefab61 --- /dev/null +++ b/research/staged544-local-two-add/TASK.json @@ -0,0 +1,73 @@ +{ + "schema_version": 1, + "task_id": "scalar-to-moment", + "priority_revision": 6, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "original_card": { + "id": "scalar-to-moment", + "question": "Can one known scalar simplification be converted into an actual paid-profile improvement?", + "starting_points": [ + "research/r439-bsection-stars-seed01/README.md", + "certificates/selected-result.json" + ], + "methods": [ + "Derive the changed legal frame itinerary and exact child histogram.", + "Prove a scoped obstruction showing why that scalar gain cannot change the paid contract." + ], + "acceptance_gate": "An unchanged histogram is not a kappa gain; record any separate runtime or proof benefit explicitly.", + "first_step": { + "command": [ + "python3", + "-B", + "research/r439-bsection-stars-seed01/verify.py" + ], + "expected": "PASS_R439_BSECTION_STARS", + "inspect": "Observe that the positive control improves scalar counts while retaining the paid histogram.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Choose one simplification and derive the complete changed frame itinerary, or prove why it cannot change the histogram.", + "bottleneck_link": "A legal change to the histogram, not addition count alone, is the bridge to an exponent gain.", + "allowed_variations": [ + "One existing scalar simplification and one proposed frame-path change." + ], + "scope_change_triggers": [ + "Submitting only another scalar count as completion of a paid-profile task." + ], + "overlap_terms": [ + "scalar simplification", + "paid profile", + "R439" + ] + }, + "scope_status": "refined", + "scope_change_reason": "User accepted the PR3886 neutral-first two-ADD handoff. The completed finite domain is any radius-one or stationary first ADD with every legal first frame, including losing first moves, followed by an unrestricted interacting second ADD. Longer first moves were only explored partially and are not excluded.", + "actual_scope": "Source-bound local-first two-ADD all-power non-improvement, with full first-frame enumeration and interaction/new-gap reductions.", + "bottleneck_link": "Identifies which first-move and intermediate-legality premises an actual paid rank-profile transformation must change.", + "budget_minutes": 60, + "author": "Chris R / Clear1nsight", + "outcome": "negative-result", + "evidence": "Exact full source census for both providers, informal reduction proof, independent finite control oracles, and retained arbitrary-dirty source/control semantics. No new circuit gain, supplier or kappa.", + "stop_rule": "Stop after complete declared-class receipts, reduction controls and focused fork PR. Do not automatically expand to nonlocal first moves or alter the selected frontier.", + "ai_assistance": "Substantial OpenAI assistance in mathematics, code, checks and packaging. No independent human or formal-kernel review.", + "open_questions": [ + { + "question": "Can a longer first ADD move unlock a profitable second change?", + "why_it_matters": "Changes the exact radius-one premise now excluded.", + "first_step": "Freeze one literal first move across at least two neighbours and compute both intermediate and complete changed invoices.", + "blocked_by": "A concrete interacting witness, dirty restoration and physical costs." + }, + { + "question": "Can a simultaneous two-frame or boundary-changing word implement the paid rank-two exchange?", + "why_it_matters": "The present theorem requires an individually legal intermediate and fixed boundaries.", + "first_step": "Specify the complete before/after word and consumer contract without choosing children by histogram alone.", + "blocked_by": "Native/physical/stock/precision admission and complete added bill." + } + ], + "upstream_checkpoint": { + "utc": "2026-10-19T03:38:33Z", + "main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "priority_revision": 6, + "changed_frontier": false + }, + "overlap_coverage": "Official find_overlap.py refresh, 630 open PR bodies and 2544 Discussion records with complete pagination; minimal local export only. No exhaustive historical/diff novelty claim. Upstream claim attempt returned HTTP403." +} diff --git a/research/staged544-local-two-add/VALIDATION.json b/research/staged544-local-two-add/VALIDATION.json new file mode 100644 index 0000000000..f7100591f0 --- /dev/null +++ b/research/staged544-local-two-add/VALIDATION.json @@ -0,0 +1,108 @@ +{ + "schema_version": 1, + "status": "author_checked", + "utc": "2026-10-19T04:22:15.590578+00:00", + "environment": { + "python": "3.13.5 (main, Jul 15 2026, 20:25:40) [GCC 14.2.0]", + "platform": "Linux-6.18.55-x86_64-with-glibc2.41", + "dependencies": "standard library only" + }, + "full_censuses": [ + { + "provider": "base", + "returncode": 0, + "seconds": 344.9339397470003 + }, + { + "provider": "extra", + "returncode": 0, + "seconds": 348.6642510649999 + } + ], + "controls": { + "normal": { + "checks": { + "bridge_trace_comparisons": 26, + "credited_positive_control": 2, + "dirty_word_controls": 4, + "frame_intervals": 3118, + "known_lattice": 1, + "literal_undo": 4, + "production_predicate_sensitivity": 2, + "profitable_exchange": 1, + "resource_guard": 1, + "scalar_barrier": 2, + "scale_conjugations": 48, + "source_mutant": 1, + "unpruned_nonbridge_prices": 3804, + "wrong_frame": 2, + "wrong_scalar_fresh_cleanup": 2 + }, + "new_circuit_gain": false, + "status": "PASS_LOCAL_TWO_ADD_CONTROLS" + }, + "assertions_disabled": { + "checks": { + "bridge_trace_comparisons": 26, + "credited_positive_control": 2, + "dirty_word_controls": 4, + "frame_intervals": 3118, + "known_lattice": 1, + "literal_undo": 4, + "production_predicate_sensitivity": 2, + "profitable_exchange": 1, + "resource_guard": 1, + "scalar_barrier": 2, + "scale_conjugations": 48, + "source_mutant": 1, + "unpruned_nonbridge_prices": 3804, + "wrong_frame": 2, + "wrong_scalar_fresh_cleanup": 2 + }, + "new_circuit_gain": false, + "status": "PASS_LOCAL_TWO_ADD_CONTROLS" + } + }, + "metadata": "Pinned registry validate(check_pins=False) passed; exact original_card equals separately authenticated current-base catalogue. Actual Git history/registered Python3.12 deferred to hosted CI.", + "source_acquisition": { + "workflow_run": 39195644596, + "git_fetch_main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "fetch_utc": "2026-10-19T03:38:33Z" + }, + "overlap": { + "open_prs": 630, + "discussion_records": 2544, + "pagination": "complete", + "utc": "2026-10-19T03:39:07.636151Z", + "local_coverage": "exported packages only", + "submission_refresh": "GitHub canonical-main and updated retiming PR query, 2026-10-19 04:20 UTC; main unchanged. No new matching source claim found. No complete historical/diff novelty claim." + }, + "exploration_limits": [ + "Initial long-range first-move samples near A4043..4048 had no observed gain but were incomplete. They are not used in the theorem or its candidate count.", + "Several exploratory subset/reduction checks preceded the two final full runs. Only the retained full receipts constitute the complete source census.", + "The first unpruned-control implementation omitted the duplicate original-position address for an adjacent insertion. It failed, was corrected to include the equivalent stationary cut, and both normal and -O controls passed. The scientific census and proof claim were unchanged." + ], + "coverage": [ + "Full single and paired census on both providers; exact all-power sign certificates, no floating-point screening in the final verifier.", + "All changed-first-frame actual intermediate invoices agree with the retained auditor.", + "Retained source and credited counterfactual control semantics in both orientations on 632 live plus 91 dirty inputs.", + "Independent finite quotient-frame and sampled full-trace/new-gap controls; informal proof, not a separately reviewed theorem." + ], + "not_run": [ + "Complete -O large census", + "Fresh native Clifford/physical allocation/stock/precision/full supplier and outer release", + "Lean/formal kernel proof", + "Independent human review" + ], + "upstream_claim": "Attempt returned HTTP403; no claim post asserted.", + "selected_frontier_changed": false, + "ai_assistance": "Substantial OpenAI assistance at user direction.", + "tested_sources": { + "search.py": "94db5a29ed8fed594491b186f4b713213f32526fe67f666412f930cb324f4f51", + "verify.py": "e6b847c48d1db711b3905721043d0c86cba005a767f324fcb8afe39f4f508a17", + "test_checks.py": "64e60456370b771ee8248f462f33a46a7b93d21b12966e13a1282029c0b7027f", + "vendor/retiming.py": "591d7278541ac4de9e9b6fc1e17aba23b205ac4b6c81824a28fc08294658ef0d", + "vendor/audit_verify.py": "99971d3cc143cc894600e08c8cfbad3e8f537a544212f21dfbe4271cfa97354d", + "vendor/audit_core.py": "888679ca8502cdcb100420fe5382a052529a494bf76cb332928b86e62612b951" + } +} diff --git a/research/staged544-local-two-add/VERIFY.json b/research/staged544-local-two-add/VERIFY.json new file mode 100644 index 0000000000..3d5328aab0 --- /dev/null +++ b/research/staged544-local-two-add/VERIFY.json @@ -0,0 +1,50 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py", + "--provider", + "base" + ], + "timeout_seconds": 540, + "checks": "Regenerate exact base single/paired censuses, source semantics, and full receipt." + }, + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py", + "--provider", + "extra" + ], + "timeout_seconds": 540, + "checks": "Regenerate exact extra single/paired censuses, source semantics, and full receipt." + }, + { + "argv": [ + "{python}", + "-B", + "{package}/test_checks.py" + ], + "timeout_seconds": 60, + "checks": "Independent frame/bridge oracles and production-path semantic/sensitivity controls." + }, + { + "argv": [ + "{python}", + "-O", + "-B", + "{package}/test_checks.py" + ], + "timeout_seconds": 60, + "checks": "Independent frame/bridge oracles and production-path semantic/sensitivity controls." + } + ] +} diff --git a/research/staged544-local-two-add/inputs/BORROW-WORD-43base.json.gz b/research/staged544-local-two-add/inputs/BORROW-WORD-43base.json.gz new file mode 100644 index 0000000000..674ea18ade Binary files /dev/null and b/research/staged544-local-two-add/inputs/BORROW-WORD-43base.json.gz differ diff --git a/research/staged544-local-two-add/inputs/BORROW-WORD-43extra.json.gz b/research/staged544-local-two-add/inputs/BORROW-WORD-43extra.json.gz new file mode 100644 index 0000000000..b17e2be67e Binary files /dev/null and b/research/staged544-local-two-add/inputs/BORROW-WORD-43extra.json.gz differ diff --git a/research/staged544-local-two-add/inputs/SINGLE-CENSUS.json b/research/staged544-local-two-add/inputs/SINGLE-CENSUS.json new file mode 100644 index 0000000000..c9db55a477 --- /dev/null +++ b/research/staged544-local-two-add/inputs/SINGLE-CENSUS.json @@ -0,0 +1 @@ +{"base":{"candidates":1776295,"deltas":[{"caps":[0,2,0,0,0,0,0,0,0],"certificate":true,"count":5404,"delta":{"1":-2,"2":4,"3":-2}},{"caps":[0,1,1,0,0,0,0,0,0],"certificate":true,"count":8908,"delta":{"1":-1,"2":1,"3":1,"4":-1}},{"caps":[0,0,0,0,0,0,0,0,0],"certificate":true,"count":1536697,"delta":{}},{"caps":[1,2,1,0,0,0,0,0,0],"certificate":true,"count":9311,"delta":{"2":2,"4":-1}},{"caps":[1,2,0,0,0,0,0,0,0],"certificate":true,"count":2498,"delta":{"2":3,"3":-2}},{"caps":[2,4,2,0,0,0,0,0,0],"certificate":true,"count":18680,"delta":{"2":4,"4":-2}},{"caps":[1,1,1,0,0,0,0,0,0],"certificate":true,"count":7458,"delta":{"1":1,"3":1,"4":-1}},{"caps":[1,1,0,0,0,0,0,0,0],"certificate":true,"count":31273,"delta":{"1":1,"2":1,"3":-1}},{"caps":[1,1,-1,0,0,0,0,0,0],"certificate":true,"count":2755,"delta":{"1":1,"2":2,"3":-3,"4":1}},{"caps":[2,3,1,0,0,0,0,0,0],"certificate":true,"count":7120,"delta":{"1":1,"2":3,"3":-1,"4":-1}},{"caps":[1,0,1,1,0,0,0,0,0],"certificate":true,"count":1630,"delta":{"1":2,"2":-2,"3":1,"4":1,"5":-1}},{"caps":[1,0,1,0,0,0,0,0,0],"certificate":true,"count":294,"delta":{"1":2,"2":-2,"3":2,"4":-1}},{"caps":[1,0,0,0,0,0,0,0,0],"certificate":true,"count":3762,"delta":{"1":2,"2":-1}},{"caps":[2,2,2,0,0,0,0,0,0],"certificate":true,"count":37360,"delta":{"1":2,"3":2,"4":-2}},{"caps":[2,2,1,0,0,0,0,0,0],"certificate":true,"count":7120,"delta":{"1":2,"2":1,"4":-1}},{"caps":[2,2,0,0,0,0,0,0,0],"certificate":true,"count":40432,"delta":{"1":2,"2":2,"3":-2}},{"caps":[2,1,1,0,0,0,0,0,0],"certificate":true,"count":84,"delta":{"1":3,"2":-1,"3":1,"4":-1}},{"caps":[2,1,0,0,0,0,0,0,0],"certificate":true,"count":5695,"delta":{"1":3,"3":-1}},{"caps":[2,0,0,0,0,0,0,0,0],"certificate":true,"count":49814,"delta":{"1":4,"2":-2}}],"per_section":{"A":1451231,"B":308890,"restore":16174},"source_profile":{"1":2440,"2":725,"3":224,"4":102,"5":20,"8":8}},"extra":{"candidates":1776295,"deltas":[{"caps":[0,2,0,0,0,0,0,0,0],"certificate":true,"count":5404,"delta":{"1":-2,"2":4,"3":-2}},{"caps":[0,1,1,0,0,0,0,0,0],"certificate":true,"count":8908,"delta":{"1":-1,"2":1,"3":1,"4":-1}},{"caps":[0,0,0,0,0,0,0,0,0],"certificate":true,"count":1536697,"delta":{}},{"caps":[1,2,1,0,0,0,0,0,0],"certificate":true,"count":9311,"delta":{"2":2,"4":-1}},{"caps":[1,2,0,0,0,0,0,0,0],"certificate":true,"count":2498,"delta":{"2":3,"3":-2}},{"caps":[2,4,2,0,0,0,0,0,0],"certificate":true,"count":18680,"delta":{"2":4,"4":-2}},{"caps":[1,1,1,0,0,0,0,0,0],"certificate":true,"count":7458,"delta":{"1":1,"3":1,"4":-1}},{"caps":[1,1,0,0,0,0,0,0,0],"certificate":true,"count":31273,"delta":{"1":1,"2":1,"3":-1}},{"caps":[1,1,-1,0,0,0,0,0,0],"certificate":true,"count":2755,"delta":{"1":1,"2":2,"3":-3,"4":1}},{"caps":[2,3,1,0,0,0,0,0,0],"certificate":true,"count":7120,"delta":{"1":1,"2":3,"3":-1,"4":-1}},{"caps":[1,0,1,1,0,0,0,0,0],"certificate":true,"count":1630,"delta":{"1":2,"2":-2,"3":1,"4":1,"5":-1}},{"caps":[1,0,1,0,0,0,0,0,0],"certificate":true,"count":294,"delta":{"1":2,"2":-2,"3":2,"4":-1}},{"caps":[1,0,0,0,0,0,0,0,0],"certificate":true,"count":3762,"delta":{"1":2,"2":-1}},{"caps":[2,2,2,0,0,0,0,0,0],"certificate":true,"count":37360,"delta":{"1":2,"3":2,"4":-2}},{"caps":[2,2,1,0,0,0,0,0,0],"certificate":true,"count":7120,"delta":{"1":2,"2":1,"4":-1}},{"caps":[2,2,0,0,0,0,0,0,0],"certificate":true,"count":40432,"delta":{"1":2,"2":2,"3":-2}},{"caps":[2,1,1,0,0,0,0,0,0],"certificate":true,"count":84,"delta":{"1":3,"2":-1,"3":1,"4":-1}},{"caps":[2,1,0,0,0,0,0,0,0],"certificate":true,"count":5695,"delta":{"1":3,"3":-1}},{"caps":[2,0,0,0,0,0,0,0,0],"certificate":true,"count":49814,"delta":{"1":4,"2":-2}}],"per_section":{"A":1451231,"B":308890,"restore":16174},"source_profile":{"1":2440,"2":725,"3":224,"4":102,"5":20,"8":8}}} diff --git a/research/staged544-local-two-add/search.py b/research/staged544-local-two-add/search.py new file mode 100644 index 0000000000..ba2e1f3fff --- /dev/null +++ b/research/staged544-local-two-add/search.py @@ -0,0 +1,267 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Radius-one first ADD, unrestricted second ADD, exact frame-price census. + +Chris R / Clear1nsight, with substantial OpenAI assistance. The pinned +PR3886 trace, applier and sign criterion are reused, not independently authored. +The interaction and single-new-gap reductions are proved in PROOF.md. +""" +from bisect import bisect_left +from collections import Counter +from functools import lru_cache +import hashlib +import json +from pathlib import Path +import types + +P = Path(__file__).resolve().parent + +def module(name, path): + value = types.ModuleType(name) + value.__file__ = str(path) + exec(compile(path.read_bytes(), str(path), 'exec'), value.__dict__) + return value + +# The entry point authenticates these bytes before loading this module. +R = module('pinned_retiming', P / 'vendor/retiming.py') +PHASES = ('A', 'B', 'restore') +ZERO = (0,) * 10 + +def require(ok, message): + if not ok: + raise ValueError(message) + +def digest(value): + return hashlib.sha256(json.dumps(value, sort_keys=True, separators=(',', ':')).encode()).hexdigest() + +def rows(histogram): + result = [] + for delta, count in sorted(histogram.items()): + caps = R.caps(delta) + prefixes = [sum(caps[:j]) for j in range(1, 9)] + require(R.all_power_nonnegative(delta), 'uncertified signed profile') + result.append({'delta': list(delta), 'count': count, 'caps': caps, + 'prefixes': prefixes}) + return result + +def geometry(word, section): + nodes, where, bill = R.tracing(word) + gates = word[section] + for lo, hi in R.segments(word, section): + occurrences = {} + for i in range(lo, hi): + for r in R.touched(gates[i]): + occurrences.setdefault(r, []).append(i) + entries, exits, removal = {}, {}, {} + for r, indices in occurrences.items(): + entries[r] = nodes[r][where[((section, indices[0]), r)]][2] + exits[r] = nodes[r][where[((section, indices[-1]), r)] + 1][3] + for i in range(lo, hi): + if gates[i][0] != 'add': + continue + delta = [0] * 10 + for r in R.touched(gates[i]): + seq = nodes[r] + pos = where[((section, i), r)] + _, _, before, frame = seq[pos] + require(seq[pos + 1][1] != 'map', 'missing map-entry check') + after = seq[pos + 1][3] + delta[R.rank(frame) - R.rank(before)] -= 1 + delta[R.rank(after) - R.rank(frame)] -= 1 + delta[R.rank(after) - R.rank(before)] += 1 + removal[i] = delta + yield lo, hi, occurrences, entries, exits, removal + +def candidates(word, section, selected, first=False, window=None): + """Exact prices in the predecessor's fixed-check relaxation. + + First moves use cuts i-1, i, i+2. Cut i+1 duplicates the original position. + For second moves all permitted corridor cuts and all frame dimensions occur. + """ + gates = word[section] + for lo, hi, occurrences, entries, exits, removal in geometry(word, section): + for i in selected: + if not lo <= i < hi or gates[i][0] != 'add': + continue + gate = gates[i] + lower, upper = i, i + 1 + while lower > lo and R.crosses(gate, gates[lower - 1]): + lower -= 1 + while upper < hi and R.crosses(gate, gates[upper]): + upper += 1 + if window is not None: + lower, upper = max(lower, window[0]), min(upper, window[1]) + cuts = [c for c in (i - 1, i, i + 2) if lower <= c <= upper] if first else range(lower, upper + 1) + reduced = {r: [x for x in occurrences[r] if x != i] for r in R.touched(gate)} + for cut in cuts: + if cut == i + 1: + continue + bounds = [] + for r in R.touched(gate): + indices = reduced[r] + j = bisect_left(indices, cut) + before = R.span(tuple(gates[indices[j - 1]][-1])) if j else entries[r] + after = R.span(tuple(gates[indices[j]][-1])) if j < len(indices) else exits[r] + bounds.append((before, after)) + low = R.join(bounds[0][0], bounds[1][0]) + high = bounds[0][1] & bounds[1][1] + if not R.contained(low, high): + continue + for dimension in range(R.rank(low), R.rank(high) + 1): + delta = removal[i].copy() + for before, after in bounds: + p, q = R.rank(before), R.rank(after) + delta[q - p] -= 1 + delta[dimension - p] += 1 + delta[q - dimension] += 1 + delta[0] = 0 + require(sum(r * n for r, n in enumerate(delta)) == 0, 'rank mass drift') + yield i, cut, dimension, low, high, tuple(delta) + +@lru_cache(maxsize=None) +def frames(low, high, dimension): + """All intermediate subspaces, not one representative per dimension.""" + require(R.contained(low, high), 'empty frame interval') + require(R.rank(low) <= dimension <= R.rank(high), 'invalid frame dimension') + require(R.rank(high) - R.rank(low) <= 4, 'first-frame resource bound exceeded') + current = {low} + for _ in range(dimension - R.rank(low)): + expanded = set() + for frame in current: + for v in range(1, 512): + if high >> v & 1 and not frame >> v & 1: + expanded.add(R.join(frame, R.span((v,)))) + current = expanded + return tuple(sorted(current)) + +def first_moves(word): + fixed, variable, seen = {}, [], set() + counts = Counter() + interval_checks = set() + for section in PHASES: + gates = word[section] + for i, cut, dimension, low, high, delta in candidates(word, section, range(len(gates)), first=True): + interval_checks.add((low, high, dimension)) + for frame in frames(low, high, dimension): + if frame == R.span(tuple(gates[i][-1])): + if cut == i: + continue + pair = (section, min(i, cut)) + if pair in seen: + continue + seen.add(pair) + require(delta == ZERO, 'fixed-frame swap was not neutral') + fixed[pair] = (i, cut, frame) + counts['fixed_adjacent'] += 1 + else: + kind = ('frame_only' if cut == i else 'adjacent') + ('_neutral' if delta == ZERO else '_losing') + require(R.all_power_nonnegative(delta), 'first move unexpectedly improves') + variable.append((section, i, cut, frame, delta, kind)) + counts[kind] += 1 + # A separate structural enumeration checks completeness of fixed-frame swaps. + direct = set() + for section in PHASES: + gates = word[section] + for lo, hi in R.segments(word, section): + for p in range(lo, hi - 1): + g, h = gates[p:p + 2] + if g[0] != 'add' and h[0] != 'add': + continue + a, b = (g, h) if g[0] == 'add' else (h, g) + if not R.crosses(a, b): + continue + if set(R.touched(g)) & set(R.touched(h)) and R.span(tuple(g[-1])) != R.span(tuple(h[-1])): + continue + direct.add((section, p)) + require(set(fixed) == direct, 'fixed-swap enumerators disagree') + return fixed, variable, counts, interval_checks + +def bridge_census(word, fixed): + """Only the newly opened gap can have a new price after a fixed-frame swap.""" + histogram, counts = Counter(), Counter() + nonzero = [] + for section in PHASES: + gates = word[section] + touched = [set(R.touched(g)) for g in gates] + for lo, hi, occurrences, entries, exits, removal in geometry(word, section): + for p in range(lo, hi - 1): + if (section, p) not in fixed: + continue + counts['first_pairs'] += 1 + g, h = gates[p:p + 2] + selected = sorted({j for r in touched[p] for j in occurrences[r] + if gates[j][0] == 'add' and j not in (p, p + 1) + and touched[j] & touched[p + 1]}) + for j in selected: + counts['bridge_gates'] += 1 + crossed = gates[j + 1:p] + [h] if j < p else [g] + gates[p + 2:j] + if not all(R.crosses(gates[j], e) for e in crossed): + continue + counts['scalar_legal'] += 1 + bounds = [] + for r in R.touched(gates[j]): + indices = occurrences[r] + left = bisect_left(indices, p) - 1 + if left >= 0 and indices[left] == j: + left -= 1 + before = R.span(tuple(gates[indices[left]][-1])) if left >= 0 else entries[r] + right = bisect_left(indices, p + 2) + if right < len(indices) and indices[right] == j: + right += 1 + after = R.span(tuple(gates[indices[right]][-1])) if right < len(indices) else exits[r] + if r in touched[p + 1]: + before = R.span(tuple(h[-1])) + if r in touched[p]: + after = R.span(tuple(g[-1])) + bounds.append((before, after)) + low = R.join(bounds[0][0], bounds[1][0]) + high = bounds[0][1] & bounds[1][1] + if not R.contained(low, high): + continue + for dimension in range(R.rank(low), R.rank(high) + 1): + delta = removal[j].copy() + for before, after in bounds: + a, b = R.rank(before), R.rank(after) + delta[b - a] -= 1 + delta[dimension - a] += 1 + delta[b - dimension] += 1 + delta[0] = 0 + histogram[tuple(delta)] += 1 + if any(delta): + nonzero.append([section, p, j, dimension, delta]) + counts['candidate_dimensions'] += 1 + return {'counts': dict(counts), 'profiles': rows(histogram), 'nonzero_cases': nonzero} + +def variable_census(word, variable, auditor=None, progress=False): + baseline = R.tracing(word)[2] + histogram, by_kind = Counter(), {} + for number, (section, i, cut, frame, first_delta, kind) in enumerate(variable): + middle = R.apply_move(word, section, i, cut, R.basis(frame)) + intermediate = R.tracing(middle)[2] + require(tuple(intermediate.get(r, 0) - baseline.get(r, 0) if r else 0 for r in range(10)) == first_delta, + 'first actual invoice differs from relaxation') + if auditor is not None: + require(auditor.frame_bill(middle)[0] == intermediate, 'retained first-word invoice disagrees') + moved = cut - (cut > i) + registers = set(R.touched(word[section][i])) + counts = by_kind.setdefault(kind, Counter()) + counts['first_words'] += 1 + for second_section in PHASES: + selected = [j for j, g in enumerate(middle[second_section]) + if g[0] == 'add' and registers.intersection(R.touched(g)) + and (second_section, j) != (section, moved)] + for _, _, _, _, _, second_delta in candidates(middle, second_section, selected): + delta = tuple(a + b for a, b in zip(first_delta, second_delta)) + histogram[delta] += 1 + counts['second_cut_dimensions'] += 1 + if progress and number % 100 == 0: + print('Checked first word', number, 'of', len(variable), flush=True) + return {'by_kind': {k: dict(v) for k, v in sorted(by_kind.items())}, 'profiles': rows(histogram)} + +def compute(word, auditor=None, progress=False): + fixed, variable, counts, intervals = first_moves(word) + serial = [[s, p, i, c, list(R.basis(f))] for (s, p), (i, c, f) in sorted(fixed.items())] + serial += [[s, i, c, list(R.basis(f)), list(d), k] for s, i, c, f, d, k in variable] + return {'first_counts': dict(sorted(counts.items())), 'first_digest': digest(serial), + 'max_first_quotient_dimension': max(R.rank(h) - R.rank(l) for l, h, _ in intervals), + 'fixed_frame': bridge_census(word, fixed), + 'variable_frame': variable_census(word, variable, auditor, progress)} diff --git a/research/staged544-local-two-add/test_checks.py b/research/staged544-local-two-add/test_checks.py new file mode 100644 index 0000000000..4e10930214 --- /dev/null +++ b/research/staged544-local-two-add/test_checks.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Independent finite oracles and production-path rejection controls. + +The large census is separate. These checks target the frame lattice, the +new-gap reduction, source binding, scalar conjugation, and sensitivity. +""" +from collections import Counter +from copy import deepcopy +from fractions import Fraction +from itertools import combinations +import json +from pathlib import Path +import types + +P = Path(__file__).resolve().parent +V = types.ModuleType('entry') +V.__file__ = str(P / 'verify.py') +exec(compile((P / 'verify.py').read_bytes(), V.__file__, 'exec'), V.__dict__) +S, C, A = V.setup() +R = S.R +checks = Counter() + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def rejects(fn, name): + try: + fn() + except (ValueError, C.AuditFailure): + checks[name] += 1 + return + raise ValueError('negative control accepted: ' + name) + + +def xor_span(vectors): + """Independent subset-XOR enumeration, not the source join/basis routine.""" + values = {0} + for v in vectors: + values = values | {x ^ v for x in values} + return values + + +def independent_frames(low, high, dimension): + low_points = {x for x in range(512) if low >> x & 1} + high_points = {x for x in range(512) if high >> x & 1} + representatives = [] + covered = set(low_points) + for v in sorted(high_points - low_points): + if v not in covered: + representatives.append(v) + covered.update({v ^ x for x in low_points}) + answer = set() + # Enumerate all independent quotient bases of the required size. + for combo in combinations(representatives, dimension - R.rank(low)): + points = {x ^ y for x in low_points for y in xor_span(combo)} + if len(points) == 1 << dimension: + answer.add(sum(1 << x for x in points)) + return answer + + +def as_hist(rows): + return Counter({tuple(row['delta']): row['count'] for row in rows}) + + +# Source-corruption and sign controls are exercised with assertions disabled too. +sources = json.loads((P / 'SOURCES.json').read_text()) +row = sources['snapshots'][0] +rejects(lambda: V.authenticate((P / row['local']).read_bytes() + b'x', row), 'source_mutant') +rejects(lambda: S.rows(Counter({(0, 1, -2, 1, 0, 0, 0, 0, 0, 0): 1})), 'profitable_exchange') +rejects(lambda: S.frames(1, R.span((1, 2, 4, 8, 16)), 1), 'resource_guard') +require([len(independent_frames(1, R.span((1, 2, 4)), d)) for d in range(4)] == [1, 7, 7, 1], 'F2^3 lattice') +checks['known_lattice'] += 1 + +for tag in ('base', 'extra'): + word = V.load(tag) + fixed, variable, _, intervals = S.first_moves(word) + for low, high, d in sorted(intervals): + require(set(S.frames(low, high, d)) == independent_frames(low, high, d), 'quotient frame enumeration') + checks['frame_intervals'] += 1 + bridge = S.bridge_census(word, fixed) + sample = set((sec, p) for sec, p, *_ in bridge['nonzero_cases']) + for sec in S.PHASES: + keys = sorted(k for k in fixed if k[0] == sec) + sample.update(keys[j] for j in (0, len(keys) // 2, len(keys) - 1)) + for sec, p in sorted(sample): + i, cut, frame = fixed[(sec, p)] + middle = R.apply_move(word, sec, i, cut, R.basis(frame)) + require(C.frame_bill(middle)[0] == C.frame_bill(word)[0], 'fixed swap not neutral') + third = [j for j, g in enumerate(middle[sec]) if g[0] == 'add' and j not in (p, p + 1)] + both = [j for j in third if set(R.touched(word[sec][j])) & set(R.touched(word[sec][p])) + and set(R.touched(word[sec][j])) & set(R.touched(word[sec][p + 1]))] + full = list(S.candidates(middle, sec, third, window=(p + 1, p + 1))) + expected = Counter(d for j, _, _, _, _, d in full if j in both) + fast = S.bridge_census(word, {(sec, p): fixed[(sec, p)]}) + require(as_hist(fast['profiles']) == expected, 'fast bridge versus full trace') + # For a non-bridge gate, a before/between/after baseline placement must + # supply the same exact signed price; do not assume the pruning lemma. + untouched = sorted(set(j for j, *_ in full) - set(both)) + baseline = {} + for j, _, d, _, _, delta in S.candidates(word, sec, untouched, window=(p - 1, p + 2)): + baseline.setdefault(j, set()).add((d, delta)) + for j, _, d, _, _, delta in full: + if j not in both: + require((d, delta) in baseline.get(j, set()), 'non-bridge localisation') + checks['unpruned_nonbridge_prices'] += 1 + checks['bridge_trace_comparisons'] += 1 + # Disable the actual bridge predicate in an isolated module. Its missing + # nonzero cases must be detected by the same complete-bridge comparison. + mutant = types.ModuleType('mutant') + mutant.__file__ = str(P / 'search.py') + source = (P / 'search.py').read_text() + old = 'and touched[j] & touched[p + 1]' + require(source.count(old) == 1, 'production predicate preimage') + exec(compile(source.replace(old, 'and False'), mutant.__file__, 'exec'), mutant.__dict__) + require(mutant.bridge_census(word, fixed) != bridge, 'bridge-disable sensitivity') + checks['production_predicate_sensitivity'] += 1 + # Every changed-frame first word is independently billed in the full + # census. Here one neutral and one losing case receive literal undo checks. + for neutral in (True, False): + sec, i, cut, frame, delta, _ = next(v for v in variable if (v[4] == S.ZERO) == neutral) + middle = R.apply_move(word, sec, i, cut, R.basis(frame)) + moved = cut - (cut > i) + undo_cut = i + (moved < i) + restored = R.apply_move(middle, sec, moved, undo_cut, word[sec][i][-1]) + restored[sec][i][-1] = deepcopy(word[sec][i][-1]) + require(restored == word, 'same-gate collapse/undo') + checks['literal_undo'] += 1 + # Credited counterfactual PR2957 rollback and recovery, not a new gain. + oldword = deepcopy(word) + g, h = oldword['A'][4043:4045] + require(g[:5] == ['add', 81, 40, 1, 1] and h[:5] == ['add', 81, 17, 1, 1], 'control preimages') + oldword['A'][4043:4045] = [h[:-1] + [g[-1]], g] + oldword['cleanup'] = C.derive_cleanup(oldword) + before, widths, *_ = C.frame_bill(oldword) + oldword['report']['local_profile'] = {str(r): n for r, n in before.items()} + recovered = R.apply_move(oldword, 'A', 4043, 4045, h[-1]) + recovered['A'][4044][-1] = deepcopy(h[-1]) + recovered['cleanup'] = C.derive_cleanup(recovered) + after, widths2, *_ = C.frame_bill(recovered) + recovered['report']['local_profile'] = {str(r): n for r, n in after.items()} + require(recovered == word and widths == widths2, 'literal positive-control recovery') + delta = tuple(after.get(r, 0) - before.get(r, 0) if r else 0 for r in range(10)) + require(delta == (0, 1, -1, -1, 1, 0, 0, 0, 0, 0), 'control profile') + rejects(lambda: S.rows(Counter({delta: 1})), 'credited_positive_control') + A.semantics(C, oldword) + A.semantics(C, recovered) + checks['dirty_word_controls'] += 2 + bad = deepcopy(recovered) + bad['A'][4044][3] *= -1 + bad['cleanup'] = C.derive_cleanup(bad) + rejects(lambda: A.semantics(C, bad), 'wrong_scalar_fresh_cleanup') + bad = deepcopy(recovered) + bad['A'][4044][-1] = [] + rejects(lambda: C.frame_bill(bad), 'wrong_frame') + barrier = next(i for i in range(word['prelude_events'], len(word['A']) - 1) + if word['A'][i][0] == 'add' and not R.crosses(word['A'][i], word['A'][i + 1])) + rejects(lambda: R.apply_move(word, 'A', barrier, barrier + 2, word['A'][barrier][-1]), 'scalar_barrier') + +# Independent elementary-matrix calculation for crossing destination/source +# scales in both directions, including negative and fractional powers of two. +def matrix(gates): + state = [[Fraction(i == j) for j in range(3)] for i in range(3)] + for g in gates: + if g[0] == 'add': + q = Fraction(g[3], g[4]) + state[g[1]] = [x + q * y for x, y in zip(state[g[1]], state[g[2]])] + else: + q = Fraction(g[2], g[3]) + state[g[1]] = [q * x for x in state[g[1]]] + return state + +for c in (Fraction(-3, 2), Fraction(1, 4)): + for q in (Fraction(-2), Fraction(2), Fraction(-1, 2), Fraction(1, 2)): + for r in range(3): + for right in (False, True): + add = ['add', 0, 1, c.numerator, c.denominator, []] + scale = ['scale', r, q.numerator, q.denominator, []] + gates = [add, scale] if right else [scale, add] + toy = {'A': gates, 'B': [], 'restore': [], 'prelude_events': 0, 'warps': []} + changed = R.apply_move(toy, 'A', 0 if right else 1, 2 if right else 0, []) + require(matrix(gates) == matrix(changed['A']), 'exact conjugation matrix') + checks['scale_conjugations'] += 1 + +print(json.dumps({'status': 'PASS_LOCAL_TWO_ADD_CONTROLS', 'checks': dict(sorted(checks.items())), + 'new_circuit_gain': False}, sort_keys=True)) diff --git a/research/staged544-local-two-add/vendor/SOURCE-CREDITS.md b/research/staged544-local-two-add/vendor/SOURCE-CREDITS.md new file mode 100644 index 0000000000..c054fad87e --- /dev/null +++ b/research/staged544-local-two-add/vendor/SOURCE-CREDITS.md @@ -0,0 +1,14 @@ +# Source credit and independence + +New work: dataisfire with substantial OpenAI Codex assistance, Apache-2.0. No independent human review, fresh third-party AI review or proof-kernel verification is claimed. + +The construction extends [PR3682](https://github.com/CrocSwap/integer-mult-bounds/pull/3682), head431e6c6023ef352c41696469de7fb614cd4ded8c. Its retimed word, actual T360 source clock and immutable native/parent framework are retained. The complete new source/receipt snapshot is bound by REPLAY-INPUTS.json. The new ordinary source stage is an explicit pinned record applied after the unchanged predecessor reconstruction. + +- [PR3605](https://github.com/CrocSwap/integer-mult-bounds/pull/3605), Ross Richardson, supplies the staged-entrance mechanism, literal cleanup and exact Gaussian residual-check pattern. staged_pair.py is retained; the new544 shear and its proof are separate. +- [PR3638](https://github.com/CrocSwap/integer-mult-bounds/pull/3638), head d62e1acd7518a231440383f0d0dddf54d6edf8c1, supplies the T360 source-window clock, chronological aggregate model and integral-network/literal construction, with its retained PR3605 and earlier credits. The new inventory, integer incumbent and literal fill are recomputed. No predecessor owner receipt is used as proof of the new fill. +- [PR3687](https://github.com/CrocSwap/integer-mult-bounds/pull/3687) and [PR3693](https://github.com/CrocSwap/integer-mult-bounds/pull/3693), Sagar Thakrar and roger-sato with their credited AI assistance, supply audit_core.py and the whole-word semantics adapter audit_verify.py. These bytes are retained and reused. They are independent of the current constructor in the stated interpreter scope, not a newly written independent audit or new reviewer approval. +- The coupled-word source lineage includes PR3133, PR2979, Marius-Paul Dumitrean, dcharb78, Jeremy Kothe and the retained native/owner/block-norm/outer authors. All notices and scientific engines inside the source snapshot remain intact. + +owner_audit.py is a standalone standard-library adaptation of the source-window/family/prefix/invoice predicates in PR3638's independent_literal.py. It imports no producer, optimizer or retained owner checker. Its source template, plan and actual native canonical words are authenticated inputs. Three controls mutate actual literal roles and must fail for the intended reason. It shares the credited contract interpretation; it is not evidence of independent human agreement. + +The rational finite-price enclosure is retained from the PR3682 sources. New script adapters bind it to the actual finite histogram. Native forward/backward scalar replay, wrapper/phase lowering and all-column warp recipes were freshly run for both new words; unchanged native and parent ancestry is explicitly reused. The separate new544 span(414,51) residual check includes global Gaussian phase. diff --git a/research/staged544-local-two-add/vendor/audit_core.py b/research/staged544-local-two-add/vendor/audit_core.py new file mode 100644 index 0000000000..8b5e1d5f2a --- /dev/null +++ b/research/staged544-local-two-add/vendor/audit_core.py @@ -0,0 +1,480 @@ +"""Independent exact semantics and binary-frame bill for the BORROW-WORD format. + +Standard library only. Nothing is imported from the audited authors' code +(PR3133/PR3605 producers, cleanup generator, evaluator or frame solver); the word +format and its semantic contract were read from those pinned sources and are +credited there. The frame-bill and free-word structure (point-set spans, warp +frame and lifted-frame checks, target levels keyed by register, dual symbol +naming) re-implements, without importing, Arham Tahir's +research/coupled-carrier-independent-audit/verify.py (Apache-2.0) and shares its +reading of the contract, so this module is not independent of that audit. + +Sagar Thakrar (thakrarsagar), with substantial AI assistance from Claude +(Anthropic, Claude Opus 5.5). Apache-2.0. +""" +from collections import Counter +from fractions import Fraction as Q + +V, N, H = 112, 704, 9 # sources 0..111, targets 112..223, helpers 224..703 +DUAL = 10 ** 6 # offset naming the independent dual symbols D_k = K_k^(-T) + + +class AuditFailure(Exception): + """Explicit failure; never disabled by python -O.""" + + +def need(ok, *why): + if not ok: + raise AuditFailure(' '.join(map(str, why))) + + +def is_target(r): + return V <= r < 2 * V + + +def touched(g): + return g[1:3] if g[0] == 'add' else g[1:2] + + +# ---------------------------------------------------------------------------- +# Binary frames: a subspace of F_2^9 is stored as a 512-bit point-set mask +# (bit x set iff x lies in the subspace). Containment is mask inclusion. +# ---------------------------------------------------------------------------- +_SPAN = {} + + +def span(vectors): + key = tuple(vectors) + mask = _SPAN.get(key) + if mask is None: + points = {0} + for u in key: + need(type(u) is int and 0 <= u < 512, 'frame vector out of range', u) + if u not in points: + points |= {p ^ u for p in points} + mask = sum(1 << p for p in points) + _SPAN[key] = mask + return mask + + +def points(mask): + return [x for x in range(512) if mask >> x & 1] + + +def dim(mask): + size = bin(mask).count('1') + need(size and size & (size - 1) == 0, 'not a subspace point set') + return size.bit_length() - 1 + + +FULL = (1 << 512) - 1 +ZERO = 1 + + +def hyperplane(port): + return sum(1 << x for x in range(512) if bin(x & port).count('1') % 2 == 0) + + +def warp_images(columns): + """Images of all 512 vectors under the F_2-linear map with columns G e_i.""" + need(len(columns) == H and all(type(c) is int and 0 <= c < 512 for c in columns), 'warp columns') + images = [0] * 512 + for x in range(1, 512): + low = x & -x + images[x] = images[x ^ low] ^ columns[low.bit_length() - 1] + need(len(set(images)) == 512, 'singular warp') + return images + + +def image_mask(images, mask): + return sum(1 << images[x] for x in points(mask)) + + +def lagrangian_action_ok(images, U, E): + """K_G(x,z)=(Gx, Gx+G^{-T}(x+z)) is symplectic and maps L_U to L_E, L_0 and L_FULL to themselves. + + L_U={(x,x+p): x in U, p in U^perp}. This is the binary frame action only; it + is not a Clifford phase or Gaussian-product certificate. For invertible G with + G(U)=E it is implied by the frame-map check ( = ), so it is a + consistency check of the implementation, not extra evidence. + """ + inverse = [0] * 512 + for x, y in enumerate(images): + inverse[y] = x + # G^{-T} z: bit j of the result is . + git = lambda z: sum((bin(inverse[1 << j] & z).count('1') & 1) << j for j in range(H)) + lift = lambda x, z: (images[x], images[x] ^ git(x ^ z)) + pair = lambda a, b: (bin(a[0] & b[1]).count('1') + bin(a[1] & b[0]).count('1')) & 1 + basis = [(1 << i, 0) for i in range(H)] + [(0, 1 << i) for i in range(H)] + lifted = [lift(*b) for b in basis] + if any(pair(lifted[i], lifted[j]) != pair(basis[i], basis[j]) for i in range(18) for j in range(i + 1, 18)): + return False + + def frame(mask): + us = points(mask) + perp = [p for p in range(512) if all(bin(p & u).count('1') % 2 == 0 for u in us)] + return {(u, u ^ p) for u in us for p in perp} + return all({lift(*pt) for pt in frame(a)} == frame(b) for a, b in ((ZERO, ZERO), (FULL, FULL), (U, E))) + + +# ---------------------------------------------------------------------------- +# Chronological binary-frame bill (BORROW-WORD contract) +# ---------------------------------------------------------------------------- +def frame_bill(w, lagrangian=False): + rep = w['report'] + need((rep['v'], 2 * rep['v'] + rep['R'], rep['h']) == (V, N, H), 'word geometry') + removed = set(w['removed']) + need(len(removed) == len(w['removed']) and all(2 * V <= r < N for r in removed), 'removed helpers') + live = [r for r in range(N) if r not in removed] + liveset = set(live) + B, warps = w['B'], w['warps'] + for k, (pos, lender, cols, U, E) in enumerate(warps, 1): + need(0 <= pos <= len(B), 'warp position', k) + need(lender in liveset and not is_target(lender), 'warp lender', k) + images = warp_images(cols) + su, se = span(U), span(E) + need(dim(su) == len(U) == len(E) == dim(se), 'warp frame bases', k) + need(image_mask(images, su) == se, 'warp does not map its frame', k) + if lagrangian: + need(lagrangian_action_ok(images, su, se), 'lifted frame action', k) + for name in ('A', 'B', 'restore'): + for g in w[name]: + if g[0] != 'warp': + need(all(r in liveset for r in touched(g)), 'removed/out-of-range register', name, g) + if g[0] == 'add' and not is_target(g[1]): + need(not is_target(g[2]), 'non-target reads a target', name, g) + need(all(g[-1] is None and is_target(g[1]) and g[0] == 'add' for g in w['cut']), 'cut gates') + need(all(g[-1] == [] and is_target(g[1]) for g in w['precondition'] + w['compensation']), 'zero-frame wrapper writes') + need(all(not is_target(g[1]) for g in w['restore']), 'restore writes a target') + + ports = w['ports'] + start, end = {}, {} + for r in live: + if r < V: + start[r], end[r] = span((ports[r],)), FULL + elif r < 2 * V: + start[r], end[r] = ZERO, hyperplane(ports[r - V]) + else: + start[r], end[r] = ZERO, FULL + for q, U in w['start_extra'].items(): + need(int(q) in liveset and int(q) >= 2 * V, 'entrance names a live helper', q) + start[int(q)] = span(U) + for q, U in w['helper_final'].items(): + need(int(q) in liveset and int(q) >= 2 * V, 'terminal names a live helper', q) + end[int(q)] = span(U) + + current, bill, chain = dict(start), Counter(), {} + + def climb(r, mask, where): + need(current[r] & ~mask == 0, 'frame containment fails', where, r) + d = dim(mask) - dim(current[r]) + if d: + bill[d] += 1 + chain.setdefault(r, []).append((where, d, mask)) + current[r] = mask + + npre = w['prelude_events'] + for i, g in enumerate(w['A']): + if g[0] == 'warp': + need(i < npre and len(g) == 5, 'warp outside the prelude', i) + _, r, op, fr, to = g + need(op != 0 and abs(op) <= len(warps) and warps[abs(op) - 1][1] == r, 'prelude warp lender', i) + images = warp_images(warps[abs(op) - 1][2]) + if op < 0: + inverse = [0] * 512 + for x, y in enumerate(images): + inverse[y] = x + images = inverse + need(image_mask(images, span(fr)) == span(to), 'prelude warp frame action', i) + need(current[r] == span(fr), 'prelude warp entry frame', i, r) + current[r] = span(to) + chain.setdefault(r, []).append((('A', i), 'warp', span(to))) + else: + if i < npre: + need(is_target(g[1]), 'prelude scalar writes a non-target', i) + for r in touched(g): + climb(r, span(g[-1]), ('A', i)) + levels = {V + int(t): span(U) for t, U in w['target_levels'].items()} + need(all(current[t] == levels.get(t, ZERO) for t in range(V, 2 * V)), 'target cut levels') + for q, U in zip(w['centers'], w['center_frames']): + U = span(U) + need(current[q] == U, 'centre entry frame', q) + served = {levels.get(g[1], ZERO) for g in w['cut'] if g[2] == q} + for T in sorted(served, key=lambda m: -dim(m)): + need(T & ~U == 0, 'centre descent not nested', q) + d = dim(U) - dim(T) + if d: + bill[d] += 1 + chain.setdefault(q, []).append((('centre',), d, T)) + U = T + at = {} + for k, rec in enumerate(warps, 1): + at.setdefault(rec[0], []).append(k) + for p in range(len(B) + 1): + for k in at.get(p, ()): + _, lender, _, U, E = warps[k - 1] + need(current[lender] == span(U), 'native warp entry frame', k, lender) + current[lender] = span(E) + chain.setdefault(lender, []).append((('warp', k), 'warp', span(E))) + if p < len(B): + for r in touched(B[p]): + climb(r, span(B[p][-1]), ('B', p)) + for i, g in enumerate(w['restore']): + for r in touched(g): + climb(r, span(g[-1]), ('restore', i)) + for r in live: + climb(r, end[r], ('end',)) + restored = set(map(int, w['helper_final'])) + need(all(end[r] == FULL for r in live if r not in restored and not is_target(r)), 'a FULL-cleanup register ends low') + widths = Counter(dim(end[r]) - dim(start[r]) for r in live if r >= 2 * V) + return dict(sorted(bill.items())), dict(sorted(widths.items())), chain, start, end + + +def hygiene(w): + """Inherited structural contract: dyadic scalars, power-of-two scales, wrapper and correction access.""" + entering = set(map(int, w['start_extra'])) + restored = set(map(int, w['helper_final'])) + live = set(range(N)) - set(w['removed']) + for name in ('precondition', 'compensation', 'A', 'cut', 'B', 'restore', 'cleanup'): + for g in w[name]: + if g[0] == 'warp': + continue + q = Q(g[3], g[4]) if g[0] == 'add' else Q(g[2], g[3]) + need(q != 0 and q.denominator & (q.denominator - 1) == 0, 'non-dyadic scalar', name, g) + if g[0] == 'scale': + need(abs(q.numerator) & (abs(q.numerator) - 1) == 0, 'non power-of-two scale', name, g) + for g in w['precondition'] + w['compensation']: + need(not any(r in entering | restored for r in touched(g)), 'wrapper touches an entering or restored helper', g) + for c in w['initial_corrections']: + word = c['operator_word'] + need(is_target(c['target']) and c['source'] in live and c['source'] >= 2 * V + and c['source'] not in entering, 'correction access', c) + need(word and all(w['warps'][abs(o) - 1][1] == c['source'] for o in word), 'correction operator lender', c) + q = Q(c['coefficient']) + need(q != 0 and q.denominator & (q.denominator - 1) == 0, 'correction coefficient', c) + return True + + +# ---------------------------------------------------------------------------- +# Literal inverse cleanup, derived from the contract +# ---------------------------------------------------------------------------- +def ordinary_forward(w): + """Chronological non-wrapper actions whose inverse forms cleanup.""" + out = [g for g in w['A'][w['prelude_events']:]] + at = {} + for k, rec in enumerate(w['warps'], 1): + at.setdefault(rec[0], []).append(['warp', rec[1], k]) + for p in range(len(w['B']) + 1): + out += at.get(p, []) + if p < len(w['B']): + out.append(w['B'][p]) + return out + list(w['restore']) + + +def derive_cleanup(w): + restored = set(map(int, w['helper_final'])) + buf = lambda r: r + N if r in restored else r + full = [256, 128, 64, 32, 16, 8, 4, 2, 1] + out = [] + for g in reversed(ordinary_forward(w)): + if g[0] == 'warp': + out.append(['warp', buf(g[1]), -g[2], full]) + elif is_target(g[1]): + continue + elif g[0] == 'add': + out.append(['add', buf(g[1]), buf(g[2]), -g[3], g[4], full]) + else: + need(g[0] == 'scale', 'unknown primitive', g) + out.append(['scale', buf(g[1]), g[3], g[2], full]) + return out + + +def same_cleanup(a, b): + norm = lambda c: [(g[:-1], span(g[-1])) for g in c] + return len(a) == len(b) and norm(a) == norm(b) + + +# ---------------------------------------------------------------------------- +# Exact free-operator semantics. A value is a dict {(input, word): Fraction}; +# word is a reduced tuple of signed operator ids (leftmost = applied last). +# ---------------------------------------------------------------------------- +def program(w, cleanup=None): + """Literal executed sequence: corrections, wrapper, A, cut, B+warps, restore | cleanup.""" + items = [('corr', c['target'], c['source'], tuple(c['operator_word']), Q(c['coefficient'])) + for c in w['initial_corrections']] + items += w['precondition'] + w['compensation'] + w['A'] + w['cut'] + at = {} + for k, rec in enumerate(w['warps'], 1): + at.setdefault(rec[0], []).append(['warp', rec[1], k]) + for p in range(len(w['B']) + 1): + items += at.get(p, []) + if p < len(w['B']): + items.append(w['B'][p]) + items += w['restore'] + return items, list(w['cleanup'] if cleanup is None else cleanup) + + +def dual_op(op): + return (1 if op > 0 else -1) * (abs(op) + DUAL) + + +def _left(op, word): + return word[1:] if word and word[0] == -op else (op,) + word + + +def _right(word, op): + return word[:-1] if word and word[-1] == -op else word + (op,) + + +def _axpy(dst, src, q): + for key, x in src.items(): + y = dst.get(key, 0) + q * x + if y: + dst[key] = y + else: + dst.pop(key, None) + + +def forward_rows(w, cleanup=None, dual=False, symbolic_buffers=True, snapshot=None): + """Schrodinger pass: every register's value as a combination of initial inputs. + + Live inputs are independent symbols. Private buffers are independent symbols + when symbolic_buffers is set (dirty), otherwise zero. The optional snapshot + callback sees the rows at the cleanup boundary. + """ + removed = set(w['removed']) + live = [r for r in range(N) if r not in removed] + restored = sorted(map(int, w['helper_final'])) + rows = {r: {(r, ()): Q(1)} for r in live} + for c in restored: + rows[c + N] = {(c + N, ()): Q(1)} if symbolic_buffers else {} + prefix, tail = program(w, cleanup) + + def apply(g): + kind = g[0] + if kind == 'add': + t, s, q = g[1], g[2], Q(g[3], g[4]) + need(t != s and q, 'add gate', g) + if dual: + t, s, q = s, t, -q + _axpy(rows[t], rows[s], q) + elif kind == 'scale': + q = Q(g[2], g[3]) + need(q != 0, 'zero scale', g) + if dual: + q = 1 / q + rows[g[1]] = {k: q * x for k, x in rows[g[1]].items()} + elif kind == 'warp': + op = dual_op(g[2]) if dual else g[2] + rows[g[1]] = {(var, _left(op, word)): x for (var, word), x in rows[g[1]].items()} + elif kind == 'corr': + _, t, s, word, c = g + if dual: + src, ops, dst, c = rows[t], [-dual_op(o) for o in word], s, -c + else: + src, ops, dst = rows[s], list(reversed(word)), t + moved = {} + for (var, wd), x in src.items(): + for o in ops: + wd = _left(o, wd) + moved[var, wd] = x + _axpy(rows[dst], moved, c) + else: + raise AuditFailure('unknown primitive ' + repr(g)) + + for g in prefix: + apply(g) + if snapshot is not None: + snapshot(rows) + for g in tail: + apply(g) + return rows + + +def reverse_columns(w, cleanup=None, upto_cleanup=False): + """Heisenberg pull-back: process the forward program backwards. + + cols[s] = {(output, word): coefficient}: the final output register 'output' + contains coefficient*word*x_s. Words grow on the right. Every live input and + every private buffer is an independent symbol. + """ + removed = set(w['removed']) + live = [r for r in range(N) if r not in removed] + restored = sorted(map(int, w['helper_final'])) + regs = live + [c + N for c in restored] + cols = {r: {(r, ()): Q(1)} for r in regs} + prefix, tail = program(w, cleanup) + seq = prefix if upto_cleanup else prefix + tail + for g in reversed(seq): + kind = g[0] + if kind == 'add': + t, s, q = g[1], g[2], Q(g[3], g[4]) + need(t != s and q, 'add gate', g) + _axpy(cols[s], cols[t], q) + elif kind == 'scale': + q = Q(g[2], g[3]) + need(q != 0, 'zero scale', g) + cols[g[1]] = {k: q * x for k, x in cols[g[1]].items()} + elif kind == 'warp': + op = g[2] + cols[g[1]] = {(out, _right(word, op)): x for (out, word), x in cols[g[1]].items()} + elif kind == 'corr': + _, t, s, word, c = g + moved = {} + for (out, wd), x in cols[t].items(): + for o in word: + wd = _right(wd, o) + moved[out, wd] = x + _axpy(cols[s], moved, c) + else: + raise AuditFailure('unknown primitive ' + repr(g)) + return cols + + +def transpose(cols): + rows = {} + for s, col in cols.items(): + for (r, word), x in col.items(): + rows.setdefault(r, {})[s, word] = x + return rows + + +def endpoint_defects(w, rows, dual=False): + """Compare final rows with the contract on the zero-buffer (live-input) domain. + + Returns (bad live registers, dirty buffers, buffer->live leaks, buffer self-map identity). + """ + removed = set(w['removed']) + live = [r for r in range(N) if r not in removed] + restored = sorted(map(int, w['helper_final'])) + bad = [] + for r in live: + expect = {(r, ()): Q(1)} + if dual and r < V: + expect[r + V, ()] = Q(-1) + if not dual and is_target(r): + expect[r - V, ()] = Q(1) + got = {k: x for k, x in rows.get(r, {}).items() if k[0] < N} + if got != expect: + bad.append(r) + dirty = [c for c in restored if any(k[0] < N for k in rows.get(c + N, {}))] + leaks = sorted({r for r in live for k in rows.get(r, {}) if k[0] >= N}) + buffer_identity = all({k: x for k, x in rows.get(c + N, {}).items() if k[0] >= N} == {(c + N, ()): Q(1)} + for c in restored) + return bad, dirty, leaks, buffer_identity + + +def boundary_defects(w, rows): + """Contract at the cleanup boundary (forward): targets sheared, restored helpers clean and isolated.""" + restored = set(map(int, w['helper_final'])) + out = [] + for t in range(V, 2 * V): + if {k: x for k, x in rows[t].items() if k[0] < N} != {(t, ()): Q(1), (t - V, ()): Q(1)}: + out.append(('target', t)) + for c in restored: + if rows[c] != {(c, ()): Q(1)}: + out.append(('restored', c)) + for r, row in rows.items(): + if r < N and r not in restored and any(k[0] in restored for k in row): + out.append(('restored input read', r)) + return out diff --git a/research/staged544-local-two-add/vendor/audit_verify.py b/research/staged544-local-two-add/vendor/audit_verify.py new file mode 100644 index 0000000000..7f9fc1df42 --- /dev/null +++ b/research/staged544-local-two-add/vendor/audit_verify.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python3 +"""Whole-word cross-check of published RETIMED and DELAYED supplier words. + +Reuses Sagar Thakrar's exact PR3687 audit_core, unchanged and authenticated +before execution. This is not a new interpreter. No construction/native checker +is imported. roger-sato with substantial OpenAI Codex assistance; Apache-2.0. +""" +from collections import Counter +from copy import deepcopy +import gzip +import hashlib +import json +from pathlib import Path +import sys +import types + +HERE = Path(__file__).resolve().parent +STAGED = {1: 2439, 2: 726, 3: 224, 4: 102, 5: 20, 8: 8} +RETIMED = {1: 2437, 2: 724, 3: 226, 4: 102, 5: 20, 8: 8} +WIDTHS = {4: 26, 5: 2, 6: 18, 7: 52, 8: 97, 9: 213} +MOVES = ((591, 1045, 640, 644, 2, [423, 65, 20, 10]), + (641, 1085, 656, 660, -1, [427, 96, 24, 6])) +SOURCE_COMMITS = { + 3605: '3efbb5de06a49ffeea6684482f2d3fe48cdca3fb', + 3642: '044d24f12e74f228dd462c07ae2d7f3ea35e2be9', + 3653: '607a09ff441c79b215a8127a81f4cc70021d0d9b', + 3682: '431e6c6023ef352c41696469de7fb614cd4ded8c', + 3687: 'f798838eb8ede4178e94f240e7b7e54b3f80c82d', +} + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def authenticate(): + rows = json.loads((HERE / 'SOURCES.json').read_text())['snapshots'] + expected = {(3687, 'vendor/audit_core.py')} + for provider in ('base', 'extra'): + expected.update((number, f'inputs/{kind}-{provider}.json.gz') for number, kind in + ((3605, 'STAGED'), (3642, 'RETIMED'), (3653, 'RETIMED'), (3682, 'DELAYED'))) + keys = [(row['source_pr'], row['local']) for row in rows] + need(len(keys) == len(expected) and set(keys) == expected, 'source mapping inventory differs') + for row in rows: + need(row['source_commit'] == SOURCE_COMMITS[row['source_pr']], 'source commit differs') + raw = (HERE / row['local']).read_bytes() + need(len(raw) == row['bytes'], 'source byte length: ' + row['local']) + need(hashlib.sha256(raw).hexdigest() == row['sha256'], 'source SHA256: ' + row['local']) + blob = hashlib.sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() + need(blob == row['git_blob'], 'source Git blob: ' + row['local']) + core = types.ModuleType('retained_audit_core') + path = HERE / 'vendor/audit_core.py' + # Execute the authenticated source bytes, without accepting a .pyc cache. + exec(compile(path.read_bytes(), str(path), 'exec'), core.__dict__) + return core + + +def load(kind, provider): + return json.loads(gzip.decompress((HERE / 'inputs' / f'{kind}-{provider}.json.gz').read_bytes())) + + +def events(w): + result = [] + for pos in range(len(w['B']) + 1): + result += [('warp', k, deepcopy(rec)) for k, rec in enumerate(w['warps']) if rec[0] == pos] + if pos < len(w['B']): + result.append(('gate', pos, deepcopy(w['B'][pos]))) + return result + + +def replace_events(w, seq): + result = deepcopy(w) + body, warps = [], [None] * len(w['warps']) + for kind, label, gate in seq: + gate = deepcopy(gate) + if kind == 'gate': + body.append(gate) + else: + gate[0] = len(body) + warps[label] = gate + need(all(rec is not None for rec in warps), 'lost warp in reconstruction') + result['B'], result['warps'] = body, warps + return result + + +def reconstruct(C, staged, kind): + """Literal prose recipes: adjacent shear swap, or move before first producer. + + This repeats the credited local structural arguments as an input control; + the new evidence is the full word calculation below. + """ + seq = events(staged) + for start, stop, donor, pivot, coefficient, frame in MOVES: + source = next(x for x in seq if x[:2] == ('gate', start)) + need(source[2] == ['add', donor, pivot, coefficient, 1, [429, 30]], 'source release') + if kind == 'RETIMED': + target = next(x for x in seq if x[:2] == ('gate', start + 1)) + need(target[2][0] == 'add' and target[2][2] == pivot, 'adjacent same-pivot shear') + need(not any(rec[0] == start + 1 for rec in staged['warps']), 'unexpected crossed warp') + where = seq.index(target) + 1 + else: + target = next(x for x in seq if x[:2] == ('gate', stop)) + writes = [i for i, g in enumerate(staged['B']) if i > start and g[1] == pivot] + need(writes[0] == stop, 'first producer cut') + where = seq.index(target) + changed = deepcopy(source[2]) + changed[-1] = frame + seq.insert(where, ('gate', -pivot, changed)) + seq.remove(source) + result = replace_events(staged, seq) + result['cleanup'] = C.derive_cleanup(result) + result['report']['local_profile'] = {str(k): v for k, v in RETIMED.items()} + return result + + +def semantics(C, w): + """All live and buffer inputs are symbols, with no zero-buffer assumption.""" + def endpoint(name, result): + bad_live, dirty_buffers, leaks, buffer_identity = result + need(not bad_live and not dirty_buffers and not leaks and buffer_identity, + name + ' endpoint: ' + repr(result)) + boundary = {} + rows = C.forward_rows(w, symbolic_buffers=True, + snapshot=lambda values: boundary.setdefault('defects', C.boundary_defects(w, values))) + endpoint('forward', C.endpoint_defects(w, rows)) + dual_rows = C.forward_rows(w, dual=True, symbolic_buffers=True) + endpoint('dual', C.endpoint_defects(w, dual_rows, dual=True)) + need(not boundary['defects'], 'cleanup boundary: ' + repr(boundary['defects'])) + pulled = C.transpose(C.reverse_columns(w)) + need(pulled == {r: row for r, row in rows.items() if row}, 'reverse pull-back differs from forward') + pre = C.transpose(C.reverse_columns(w, upto_cleanup=True)) + pre = {r: pre.get(r, {}) for r in set(pre) | set(range(C.N))} + need(not C.boundary_defects(w, pre), 'reverse cleanup-boundary contract') + live = C.N - len(w['removed']) + buffers = len(w['helper_final']) + need((live, buffers, len(rows)) == (632, 91, 723), 'complete symbolic domain') + # Endpoint expectations are derived by the retained checker: live x,y,h + # map to x,y+x,h; all private buffer symbols return unchanged. + return {'live_inputs': live, 'dirty_buffers': buffers, 'matrix_dimension': len(rows), + 'forward': 'PASS', 'dual': 'PASS', 'reverse_pullback_equals_forward': True, + 'cleanup_boundary_forward_and_reverse': 'PASS', + 'buffer_to_live_leaks': 0, 'buffer_self_map': 'identity', + 'nonzero_endpoint_terms': sum(len(row) for row in rows.values())} + + +def inspect(C, w, profile): + C.hygiene(w) + bill, widths, chain, _, _ = C.frame_bill(w) + need(bill == profile, 'computed profile differs') + need(w['report']['local_profile'] == {str(k): v for k, v in bill.items()}, 'declared profile differs') + need(widths == WIDTHS, 'helper widths differ') + need(w['cleanup'] == C.derive_cleanup(w), 'literal cleanup differs') + return {'semantics': semantics(C, w), 'profile': bill, 'widths': widths, + 'rank_mass': sum(r * n for r, n in bill.items())}, chain + + +def expect_rejection(C, fn, phrase): + try: + fn() + except (ValueError, C.AuditFailure) as exc: + need(phrase in str(exc), 'wrong rejection: ' + str(exc)) + return phrase + raise ValueError('mutant unexpectedly passed: ' + phrase) + + +def negative_controls(C, staged, w, kind): + controls = [] + for _, _, donor, pivot, _, _ in MOVES: + seq = events(w) + release = next(x for x in seq if x[0] == 'gate' and x[2][0] == 'add' and x[2][1:3] == [donor, pivot]) + for defect in ('omit', 'flip', 'cross_first_producer'): + changed = deepcopy(seq) + index = seq.index(release) + if defect == 'omit': + changed.pop(index) + elif defect == 'flip': + changed[index][2][3] *= -1 + else: + producer = next(x for x in changed[index + 1:] if x[0] == 'gate' and x[2][1] == pivot) + moved = changed.pop(index) + changed.insert(changed.index(producer) + 1, moved) + bad = replace_events(w, changed) + bad['cleanup'] = C.derive_cleanup(bad) + # Repair the literal inverse so stale cleanup is not the rejection. + reason = expect_rejection(C, lambda: semantics(C, bad), 'forward endpoint') + controls.append({'defect': defect, 'pivot': pivot, 'rejected_by': reason}) + old_cleanup = deepcopy(w) + old_cleanup['cleanup'] = staged['cleanup'] + # The inverse shears commute: this is a format failure, not a wrong operator. + semantic_control = semantics(C, old_cleanup) + need(old_cleanup['cleanup'] != C.derive_cleanup(old_cleanup), 'old cleanup unexpectedly literal') + controls.append({'defect': 'old_cleanup_order', 'semantics': semantic_control, + 'rejected_by': expect_rejection(C, lambda: inspect(C, old_cleanup, RETIMED), 'literal cleanup differs')}) + old_frames = deepcopy(w) + for gate in old_frames['B']: + if gate[0] == 'add' and gate[1:3] in ([640, 644], [656, 660]): + gate[-1] = [429, 30] + need(semantics(C, old_frames) == semantic_control, 'frame-only mutation changed operator') + if kind == 'RETIMED': + need(C.frame_bill(old_frames)[0] == STAGED, 'old frame control does not restore staged bill') + controls.append({'defect': 'old_release_frames', 'semantic_operator': 'PASS', + 'profile': STAGED, 'rejected_by': expect_rejection(C, lambda: inspect(C, old_frames, RETIMED), 'computed profile differs')}) + else: + # The later release encounters a donor that has already climbed, so + # the original rank-2 frame is now illegal, despite the same operator. + controls.append({'defect': 'old_release_frames', 'semantic_operator': 'PASS', + 'rejected_by': expect_rejection(C, lambda: inspect(C, old_frames, RETIMED), 'frame containment fails')}) + fake_report = deepcopy(w) + fake_report['report']['local_profile']['1'] += 1 + controls.append({'defect': 'wrong_declared_profile', 'rejected_by': + expect_rejection(C, lambda: inspect(C, fake_report, RETIMED), 'declared profile differs')}) + return controls + + +def run(C): + results = {} + for provider in ('base', 'extra'): + staged = load('STAGED', provider) + control, old_chain = inspect(C, staged, STAGED) + records = {'STAGED': control} + for kind in ('RETIMED', 'DELAYED'): + w = load(kind, provider) + need(reconstruct(C, staged, kind) == w, 'prose reconstruction differs: ' + kind) + record, chain = inspect(C, w, RETIMED) + deltas = {} + for register in set(chain) | set(old_chain): + before = Counter(d for _, d, _ in old_chain.get(register, []) if type(d) is int and d > 0) + after = Counter(d for _, d, _ in chain.get(register, []) if type(d) is int and d > 0) + delta = {r: after[r] - before[r] for r in set(after) | set(before) if after[r] != before[r]} + if delta: + deltas[register] = delta + need(deltas == {640: {1: -1, 2: -1, 3: 1}, 656: {1: -1, 2: -1, 3: 1}}, 'per-register invoice differs') + record['prose_reconstruction'] = 'exact complete JSON equality' + record['changed_register_bills'] = deltas + record['controls'] = negative_controls(C, staged, w, kind) + records[kind] = record + print('CHECKED', provider, kind, '723-register forward/dual/pull-back and 9 controls', flush=True) + results[provider] = records + return {'status': 'PASS_RETIMED_AND_DELAYED_WHOLE_WORD_AUDIT', + 'scope': 'Reused PR3687 interpreter; finite exact operator/frame audit only. No native Gaussian, owner, root, or complete supplier claim.', + 'providers': results} + + +if __name__ == '__main__': + need(sys.argv[1:] in ([], ['--write']), 'usage: verify.py [--write]') + C = authenticate() + result = run(C) + output = json.dumps(result, sort_keys=True, indent=2) + '\n' + if sys.argv[1:] == ['--write']: + (HERE / 'RESULT.json').write_text(output) + else: + need((HERE / 'RESULT.json').read_text() == output, 'committed result differs') + print(result['status']) diff --git a/research/staged544-local-two-add/vendor/retiming.py b/research/staged544-local-two-add/vendor/retiming.py new file mode 100644 index 0000000000..c33d7bbcdf --- /dev/null +++ b/research/staged544-local-two-add/vendor/retiming.py @@ -0,0 +1,269 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Exact, fixed-neighbour single-ADD retiming relaxation. + +Chris R / Clear1nsight, with substantial OpenAI assistance. The BORROW-WORD +frame contract and scalar-retiming mechanism are credited in README.md. +This module does not import the retained auditor or a numerical optimiser. +""" +from bisect import bisect_left +from collections import Counter +from copy import deepcopy +from fractions import Fraction +from functools import lru_cache + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +@lru_cache(maxsize=None) +def span(vectors): + points = {0} + for v in vectors: + need(type(v) is int and 0 <= v < 512, 'invalid frame vector') + points |= {x ^ v for x in tuple(points)} + return sum(1 << x for x in points) + + +@lru_cache(maxsize=None) +def basis(mask): + answer = [] + have = 1 + for v in range(1, 512): + if (mask >> v) & 1 and not (have >> v) & 1: + answer.append(v) + have = span(tuple(answer)) + need(have == mask, 'not a binary subspace') + return tuple(answer) + + +@lru_cache(maxsize=None) +def join(a, b): + return span(basis(a) + basis(b)) + + +@lru_cache(maxsize=None) +def rank(mask): + n = mask.bit_count() + need(n > 0 and n & (n - 1) == 0, 'invalid subspace cardinality') + return n.bit_length() - 1 + + +def contained(a, b): + return not a & ~b + + +def touched(gate): + return gate[1:3] if gate[0] == 'add' else gate[1:2] + + +def tracing(word): + """Own chronological trace; centre descent is NOT persistent state. + + A check node is a fixed boundary, not a charged instruction. The census + relaxes it to a virtual climb. Every legal witness has zero such charge. + """ + full = (1 << 512) - 1 + live = set(range(704)) - set(word['removed']) + start, end = {}, {} + for r in live: + if r < 112: + start[r], end[r] = span((word['ports'][r],)), full + elif r < 224: + p = word['ports'][r - 112] + start[r] = 1 + end[r] = sum(1 << x for x in range(512) if (x & p).bit_count() % 2 == 0) + else: + start[r], end[r] = 1, full + for r, fr in word['start_extra'].items(): + start[int(r)] = span(tuple(fr)) + for r, fr in word['helper_final'].items(): + end[int(r)] = span(tuple(fr)) + current = dict(start) + nodes = {r: [] for r in live} + where = {} + bill = Counter() + + def event(r, frame, address, kind='climb'): + before = current[r] + if kind != 'map': + need(contained(before, frame), 'source frame containment') + d = rank(frame) - rank(before) + if kind == 'check': + need(d == 0, 'source fixed boundary') + elif d: + bill[d] += 1 + if kind == 'climb': + where[(address, r)] = len(nodes[r]) + nodes[r].append((address, kind, before, frame)) + current[r] = frame + + for i, gate in enumerate(word['A']): + if gate[0] == 'warp': + event(gate[1], span(tuple(gate[3])), ('check-A', i), 'check') + event(gate[1], span(tuple(gate[4])), ('map-A', i), 'map') + else: + for r in touched(gate): + event(r, span(tuple(gate[-1])), ('A', i)) + levels = {112 + int(r): span(tuple(fr)) for r, fr in word['target_levels'].items()} + for r in range(112, 224): + event(r, levels.get(r, 1), ('target-cut', r), 'check') + for r, fr in zip(word['centers'], word['center_frames']): + u = span(tuple(fr)) + event(r, u, ('centre-cut', r), 'check') + served = {levels.get(g[1], 1) for g in word['cut'] if g[2] == r} + for v in sorted(served, key=lambda x: -rank(x)): + need(contained(v, u), 'centre nesting') + if rank(u) > rank(v): + bill[rank(u) - rank(v)] += 1 + u = v + # The main forward register remains at its declared centre entry. + warps = {} + for j, rec in enumerate(word['warps']): + warps.setdefault(rec[0], []).append((j, rec)) + for i in range(len(word['B']) + 1): + for j, rec in warps.get(i, []): + event(rec[1], span(tuple(rec[3])), ('check-B', j), 'check') + event(rec[1], span(tuple(rec[4])), ('map-B', j), 'map') + if i < len(word['B']): + gate = word['B'][i] + for r in touched(gate): + event(r, span(tuple(gate[-1])), ('B', i)) + for i, gate in enumerate(word['restore']): + for r in touched(gate): + event(r, span(tuple(gate[-1])), ('restore', i)) + for r in live: + event(r, end[r], ('end',)) + return nodes, where, dict(sorted(bill.items())) + + +def crosses(g, h): + """Sufficient exact scalar normal form, not all algebraic commutations.""" + if h[0] == 'add': + return g[1] != h[2] and h[1] != g[2] + return h[0] == 'scale' and h[2] != 0 + + +def segments(word, section): + if section == 'A': + cuts = [word['prelude_events'], len(word['A'])] + elif section == 'B': + cuts = sorted({0, len(word['B'])} | {rec[0] for rec in word['warps']}) + else: + cuts = [0, len(word[section])] + return list(zip(cuts, cuts[1:])) + + +def caps(delta): + return [sum(n * min(r, k) for r, n in enumerate(delta)) for k in range(1, 10)] + + +def all_power_nonnegative(delta): + """Sufficient exact certificate using decreasing positive curvatures.""" + values = caps(delta) + prefix = 0 + for value in values[:-1]: + prefix += value + if prefix < 0: + return False + return values[-1] == 0 + + +def census(word): + nodes, where, bill = tracing(word) + deltas = Counter() + counts = {} + for section in ('A', 'B', 'restore'): + gates = word[section] + count = 0 + for lo, hi in segments(word, section): + occurrences = {} + for i in range(lo, hi): + need(gates[i][0] in ('add', 'scale'), 'unexpected scalar segment') + for r in touched(gates[i]): + occurrences.setdefault(r, []).append(i) + for i in range(lo, hi): + g = gates[i] + if g[0] != 'add': + continue + lower = i + while lower > lo and crosses(g, gates[lower - 1]): + lower -= 1 + upper = i + 1 + while upper < hi and crosses(g, gates[upper]): + upper += 1 + removal = [0] * 10 + reduced, entries, exits = {}, {}, {} + for r in touched(g): + seq = nodes[r] + pos = where[((section, i), r)] + _, _, p, u = seq[pos] + need(pos + 1 < len(seq) and seq[pos + 1][1] != 'map', 'missing successor') + q = seq[pos + 1][3] + removal[rank(u) - rank(p)] -= 1 + removal[rank(q) - rank(u)] -= 1 + removal[rank(q) - rank(p)] += 1 + indices = occurrences[r] + reduced[r] = [x for x in indices if x != i] + entries[r] = seq[where[((section, indices[0]), r)]][2] + last = where[((section, indices[-1]), r)] + need(seq[last + 1][1] != 'map', 'missing exit check') + exits[r] = seq[last + 1][3] + for cut in range(lower, upper + 1): + if cut == i + 1: # Same placement as cut i, counted once. + continue + boundaries = [] + for r in touched(g): + indices = reduced[r] + j = bisect_left(indices, cut) + p = span(tuple(gates[indices[j - 1]][-1])) if j else entries[r] + q = span(tuple(gates[indices[j]][-1])) if j < len(indices) else exits[r] + boundaries.append((p, q)) + lower_frame = join(boundaries[0][0], boundaries[1][0]) + upper_frame = boundaries[0][1] & boundaries[1][1] + if not contained(lower_frame, upper_frame): + continue + dims = [(rank(p), rank(q)) for p, q in boundaries] + for d in range(rank(lower_frame), rank(upper_frame) + 1): + delta = removal.copy() + for p, q in dims: + delta[q - p] -= 1 + delta[d - p] += 1 + delta[q - d] += 1 + delta[0] = 0 + need(sum(r * n for r, n in enumerate(delta)) == 0, 'rank mass drift') + deltas[tuple(delta)] += 1 + count += 1 + counts[section] = count + return {'per_section': counts, 'candidates': sum(counts.values()), + 'source_profile': bill, + 'deltas': [{'delta': {r: n for r, n in enumerate(d) if n}, 'count': n, + 'caps': caps(d), 'certificate': all_power_nonnegative(d)} + for d, n in sorted(deltas.items())]} + + +def apply_move(word, section, index, cut, frame): + """Apply one exact scalar retiming. Caller must rederive cleanup and audit.""" + need(section in ('A', 'B', 'restore'), 'unknown section') + gates = word[section] + need(type(index) is int and 0 <= index < len(gates), 'bad source index') + need(type(cut) is int and 0 <= cut <= len(gates), 'bad insertion cut') + need(any(lo <= index < hi and lo <= cut <= hi for lo, hi in segments(word, section)), + 'crosses prelude or native warp boundary') + g = deepcopy(gates[index]) + need(g[0] == 'add', 'only ADD moves are covered') + crossed = gates[index + 1:cut] if cut > index else gates[cut:index] + need(all(crosses(g, h) for h in crossed), 'noncommuting scalar barrier') + coefficient = Fraction(g[3], g[4]) + for h in crossed: + if h[0] == 'scale' and h[1] in touched(g): + power = (1 if h[1] == g[1] else -1) * (1 if cut > index else -1) + coefficient *= Fraction(h[2], h[3]) ** power + g[3:5] = [coefficient.numerator, coefficient.denominator] + g[-1] = list(basis(span(tuple(frame)))) + result = deepcopy(word) + result[section].pop(index) + result[section].insert(cut - (cut > index), g) + # Segment length and all warp cuts are unchanged. No warp is crossed. + return result diff --git a/research/staged544-local-two-add/verify.py b/research/staged544-local-two-add/verify.py new file mode 100644 index 0000000000..cf9c6d2984 --- /dev/null +++ b/research/staged544-local-two-add/verify.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Read-only exact replay; --emit explicitly regenerates an external receipt.""" +import argparse +import gzip +import hashlib +import json +from pathlib import Path +import types + +P = Path(__file__).resolve().parent + +def require(ok, message): + if not ok: + raise ValueError(message) + +def module(name, path): + value = types.ModuleType(name) + value.__file__ = str(path) + exec(compile(path.read_bytes(), str(path), 'exec'), value.__dict__) + return value + +def authenticate(raw, row): + require(len(raw) == row['bytes'], 'source length: ' + row['local']) + require(hashlib.sha256(raw).hexdigest() == row['sha256'], 'source SHA256: ' + row['local']) + blob = hashlib.sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() + require(blob == row['git_blob'], 'source Git blob: ' + row['local']) + +def setup(): + sources = json.loads((P / 'SOURCES.json').read_text()) + for row in sources['snapshots']: + authenticate((P / row['local']).read_bytes(), row) + return (module('owned_search', P / 'search.py'), + module('retained_auditor', P / 'vendor/audit_core.py'), + module('retained_semantics', P / 'vendor/audit_verify.py')) + +def load(tag): + return json.loads(gzip.decompress((P / 'inputs' / f'BORROW-WORD-43{tag}.json.gz').read_bytes())) + +def calculate(tag, progress=False): + S, C, A = setup() + word = load(tag) + C.hygiene(word) + bill, inventory, *_ = C.frame_bill(word) + require(bill == {int(r): n for r, n in word['report']['local_profile'].items()}, 'source declared invoice') + require(S.R.tracing(word)[2] == bill, 'source trace disagreement') + require(C.derive_cleanup(word) == word['cleanup'], 'source inverse cleanup') + baseline = S.R.census(word) + expected = json.loads((P / 'inputs/SINGLE-CENSUS.json').read_text())[tag] + require(json.loads(json.dumps(baseline)) == expected, 'predecessor single-move census differs') + require(all(row['certificate'] for row in baseline['deltas']), 'single-move premise failed') + result = S.compute(word, C, progress) + return {'schema_version': 1, 'provider': tag, 'source_canonical': S.digest(word), + 'source_profile': bill, 'width_inventory': inventory, + 'single_move_candidates': baseline['candidates'], + 'single_census_digest': S.digest(baseline), + 'source_semantics': A.semantics(C, word), 'pair_census': result} + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--provider', choices=('base', 'extra'), required=True) + parser.add_argument('--emit', type=Path) + parser.add_argument('--progress', action='store_true') + args = parser.parse_args() + result = calculate(args.provider, args.progress) + if args.emit: + require(not args.emit.resolve().is_relative_to(P), 'write regenerated receipt outside the package') + args.emit.write_text(json.dumps(result, sort_keys=True, separators=(',', ':')) + '\n') + else: + expected = json.loads((P / f'RESULT-{args.provider}.json').read_text()) + require(json.loads(json.dumps(result)) == expected, 'complete pair receipt differs') + print(json.dumps({'status': 'PASS_STAGED544_LOCAL_TWO_ADD', 'provider': args.provider, + 'first_counts': result['pair_census']['first_counts'], + 'result_sha256': hashlib.sha256(json.dumps(result, sort_keys=True, separators=(',', ':')).encode()).hexdigest(), + 'new_supplier': False}, sort_keys=True)) + +if __name__ == '__main__': + main()