diff --git a/research/p104-external-port-closure/CERTIFICATE.json.gz b/research/p104-external-port-closure/CERTIFICATE.json.gz new file mode 100644 index 0000000000..e6347a3d29 Binary files /dev/null and b/research/p104-external-port-closure/CERTIFICATE.json.gz differ diff --git a/research/p104-external-port-closure/PROOF.md b/research/p104-external-port-closure/PROOF.md new file mode 100644 index 0000000000..9cae0ff3bf --- /dev/null +++ b/research/p104-external-port-closure/PROOF.md @@ -0,0 +1,110 @@ +# Conditional dependency, admission and endpoint proof + +Hiroki Kumazaki with substantial OpenAI Codex assistance. Apache-2.0. + +## 1. Literal closure + +Give every initial bank a distinct state version. Each transport/sign depends +on its preceding bank version; ADD depends on both the preceding target and +current source; zero has no value predecessors; erase depends on its current +private value. The least predecessor-closed set containing an observation is +its graph ancestor set. This proves the SSA algorithm's literal minimality. + +For any touched private lifetime, also require its matching erase. Iterate +predecessor closure and this requirement to a fixed point. Each iteration only +adds vertices in a finite graph, so it terminates. Any legal set satisfying +these two conditions contains every iteration, hence contains the result. +This minimality is graph-theoretic, not a lower bound against cancellation or +alternative schedules. The independent reverse scan propagates live demands +through precisely the same literal instructions without constructing this DAG. + +The 675 observations use the exact published PR3423 port-index hash. At an ADD +observation, predecessor closure retains both the current recipient history and +the actual source history. Running retained instructions in their original +order therefore yields each observed ideal value, by induction. Private erase +checks prove exact zero scalar rows, rather than silently discarding dirt. + +The original 146 endpoint observations require 265 inputs. Requesting the +original endpoints of those 265 inputs adds 215 events and no new inputs. +This is a selected-output projection. Other outgoing effects are not implied +by preserving its selected endpoints; they are explicitly listed separately. + +## 2. Native premise and normalized rows + +Assume the relevant initial and current chart maps `A_H` are unitary +automorphisms of `B9`, and every used native transport has its archived operator +`T_(H->K) = A_K A_H^-1`, and that each complete native primitive is unitary, +preserves `B9 = E Z[i]^512`, and is exact for the admitted module on the common +grid. These are the existing chart/module implications, not consequences of +our file hashes. The new check binds all used occurrences to their source data. + +Put `z_s = A_initial(s)^-1 v_s(0)`. Induction gives + +`v_b(t) = A_frame(b,t) sum_s r[b,s,t] z_s`. + +Transport changes the outer frame only. Common-frame ADD performs the literal +rational row addition. Sign negates a row. Private zero creates the zero row; +erase is allowed only for the zero row. These arguments quantify over arbitrary +independent dirty initial arrays, not just the three numerical fixtures. +The final formula keeps both frame factors; neither initial X frames nor final +Y frames can be dropped. + +The exact retained matrix shows normalized restoration of 213 non-X banks and +an identity X diagonal plus a rank-9 Y map on the 52 X endpoints. The rank is +computed by corrected rational pivot elimination, with duplicate/dependent-row +regressions. A separate explicit factorization expresses all 52 rows using +nine named rows and verifies every coefficient; a 9-by-9 minor of those rows +has determinant `-1/128`. These give the matching upper and lower rank bounds. The separate literal fixture interpreter +checks projection/full ideal-word agreement but is not the universal proof; +the induction and complete exact rows provide that statement. + +## 3. Minimal independent dyadic product entrance + +Restrict each independent initial bank to `2^k_s B9`, `k_s >= 0` an integer. +The chart automorphism premise makes each normalized `z_s` independently +arbitrary in that same module. For any one row, its output lies in `B9` for all +such inputs if and only if `r[b,s] 2^k_s` is an integer for every source s. + +Sufficiency follows from integer linear closure of B9. For necessity, set every +other input to zero and choose `z_s = 2^k_s E e_0`. Applying `E^-1` to that row +leaves its nonintegral scalar coefficient in the zeroth coordinate. The outer +chart is an automorphism, so it cannot repair nonmembership. All coefficients +are real dyadic rationals; the maximum reduced-denominator exponent over every +retained row is consequently the coordinatewise-minimal k_s. + +The computed maxima are two for all 104 Y inputs, one for the 38 listed N +inputs, and zero for the other 123. Reducing any positive exponent by one is +rejected using its actual coefficient witness (142 cases). This is a condition +for the retained *prefix invariant*. It does not characterize correlated inputs +or domains admitting only the final cut. N33/N34's omitted full-word half-reads +are not licensed by this projection's weaker entrance. + +Every retained ADD includes its before and after rows. Under this entrance both +are in B9, hence their difference—the actual increment—is also in B9. Thus +rational coefficient divisions are exact on the common grid. Native prefix +exactness uses the separate inherited module premise; scalar rows alone do not +verify a native circuit's phase or intermediate rounding. + +The event-312 witness is stronger than an odd-integer half: `N100(x)=2*x_0` +is in B9 because its only nonzero Newton coefficient is `2/(1+i)=1-i`. +No instruction has touched N100 before its half-read. All other banks remain +zero beforehand. Its arithmetically exact half `x_0` has coefficient +`1/(1+i)=(1-i)/2`, outside the Gaussian integers. `4*x_0` is the positive +2B9 control. This satisfies every original 63-bank entrance assumption and +exhibits an independent external admission obligation. + +## 4. Conditional payload width + +Let H bound each real and imaginary physical input component across the 265 +inputs. Each 512-entry complex vector has Euclidean norm at most `32H`. +Unitary initial chart normalization preserves this norm. Triangle inequality +and the exact row identity give `||v_b||_2 <= 32H sum_s |r[b,s]|`. +The retained maximum is `127/2`, first at event 3589, so `2032H` bounds each +payload component. Unitary complete native prefixes preserve the entrance norm; +partially written disjoint components inherit a bound from their before/after +stage. This reproduces the retained norm estimate on the actual recipient +slice, not a new global estimate or a physical storage theorem. + +H itself, initial domain preparation, physical allocation, scratch layout, +movement, controls, exposed codecs and recursive interfaces still need a paid +caller. The unchanged-profile `599/584` stop is unaffected. diff --git a/research/p104-external-port-closure/README.md b/research/p104-external-port-closure/README.md new file mode 100644 index 0000000000..4d897e52df --- /dev/null +++ b/research/p104-external-port-closure/README.md @@ -0,0 +1,160 @@ +# Closing the P104 open program's external recipient histories + +This answers [PR3423's 675-port handoff][handoff] at +`15d28c4de37dc47ea07cd7173c8b318fca7a4d75`, using the unchanged literal PR2586 +word retained on canonical main `6f100d4bb5083f8c35d96fd95a539811c62f245c`. +The result is a source-bound dependency and conditional numerical interface, +not a physical supplier or a new multiplication exponent. + +## Result + +The 63-bank open program's 675 outgoing ADDs reach 83 distinct recipient banks. +Their actual histories require substantially more inputs: + +| Observations required | Events with private cleanup | Initial banks | +| --- | ---: | ---: | +| All 675 recipient states immediately after their port ADD | 2,907 | 263 | +| Final endpoints of the 83 recipients and 63 original banks | 3,812 | 265 | +| Also preserve the original endpoint histories of all 265 dependencies | 4,027 | 265 | + +A state-version dependency graph and a separately written reverse-liveness +scan agree on the exact event and input sets. These are least closures in the +literal read/write graph with all touched private lifetimes closed. They are +not minima over algebraic cancellations, rewritten programs or different +implementations. Merely adding the eight erases is insufficient: their forty +cleanup predecessors must be included too. + +The final 4,027-event projection has 2,310 ADDs, 1,597 native transports, +104 signs, eight private allocations and eight zero-checked erasures. +It reaches all 265 original endpoints without introducing more inputs. +It omits 1,371 word events and 93 initial banks. **696 omitted outgoing ADDs** to those 93 banks +are explicitly inventoried in [SUMMARY.json](SUMMARY.json); this projection +is not a replacement for the whole word on those omitted banks. + +## Additional admission and an exact-half counterexample + +Conditional on the inherited native chart identities and Gaussian Newton +module invariance, the coordinatewise-minimal independent dyadic product +entrance for **every retained atomic state** is: + +- All 104 initial Y banks in `4B9`. +- The following 38 N banks in `2B9`: + `2,4,7,9,18,20,27,29,35,36,40,44,45,46,48,49,50,54,58,59,64,65,66,70,74,75,79,80,81,83,84,85,87,88,89,92,98,100`. +- The other 123 dependencies in `B9`: 52 X, 32 D, 29 G, eight Q, and N33/N34. + +Here `B9 = E Z[i]^512`, with +`E = [[1,0],[1,1+i]] tensor ... tensor [[1,0],[1,1+i]]` (nine factors). +One common grid `2^-f` can scale every displayed module. +Relative to PR3423 this adds 202 initial banks: 52 more strengthened Y inputs, +38 half-read N inputs, two ordinary N inputs, 52 X, 27 D, seven Q and 24 G. +It does not claim that correlated final-cut domains require these individual +scales; PR3426 studies such cancellations separately. The whole-word product +theorem of PR3406 is credited, not rediscovered: this result specializes the +entrance to the actual recipient closure, where N33/N34 need only `B9`. + +The first added incoming boundary is event **312**, `X100 += N100/2` at the +empty frame. Set `N100(x)=2*x_0` on the 512 binary addresses, and all other +initial banks to zero. Every input belongs to `B9`, and all PR3423 63-bank +admissions hold. The division is exact in Gaussian integers, but its output +`X100(x)=x_0` has Newton coefficient `(1-i)/2` at index one, outside `Z[i]`. +The source coefficient is `1-i`. Amplitude four is the positive control. +This exposes an additional recipient admission obligation; it is not a defect +in PR3423, which explicitly left recipient histories open. + +## Composed endpoints and widths + +Write `A_F = Delta_F`, with the empty-frame map equal to identity. Under the +native covariance premise, at every retained state the exact physical value is + +``` +v_b(t) = A_frame(b,t) * sum_s r[b,s,t] * A_initial(s)^(-1) * v_s(0). +``` + +The certificate retains the complete rational rows, actual initial frames and +actual final frames. Initial X banks are not at the empty frame. Final frames +also vary; using PR3423's common frame at event 4516 for the later endpoints +would be incorrect. + +All 213 non-X banks in the 265-bank projection return their normalized initial +rows. Each of the 52 X endpoints has its own initial X coefficient one, only Y +increments, and no residual N/D/Q/G dirt. The actual complete 52-by-104 Y map +has rational rank 9: every row has a retained nine-row factorization and a +9-by-9 minor has determinant `-1/128`. This is a different, larger operator from PR3423's +rank-one **subset of port increments**; the remaining histories are included +here. [CERTIFICATE.json.gz](CERTIFICATE.json.gz) provides every endpoint row +and the before/increment/after rows for all 675 ports. + +If every initial real/imaginary component of the 265 physical inputs is bounded +by `H`, unitary chart maps give `32 H * ||r||_1` as a payload bound. The maximum +row norm is `127/2`, at event 3589 on X46, giving **2032 H**. This is the retained +whole-word norm bound, now bound to the recipient histories; no sharper global +width claim is made. Native prefix unitarity extends it to complete native +stages. Physical storage, temporary layout, caller heights, ownership, routing, +control, exposed representation conversions and recursive charges remain unpaid. + +The inherited unchanged-profile `599/584` stopping decision remains. This +interface certificate does not justify another supplier-construction round. + +## Evidence and reproduction + +The checker imports no predecessor executable. It binds the unchanged WORD and +NATIVE files and all native occurrence/frame/rank records. Native operator +semantics are **assumed**, not proved by matching those records. PR3382's module +theorem and PR3416's broader native-covariance certificate are credited external +premises; PR3423's 392-occurrence check alone does not cover this larger slice. + +The bounded check includes eight structural/semantic rejection groups, 142 +one-bit-weaker input-scale controls, two dependent-row rank regression cases, +an exact rank factorization/minor, three independent literal scalar fixtures +comparing the projection with the full ideal word, and the exact-array Newton +counterexample/positive control. The full-word comparison is scalar algebra +under the chart premise, not a rounded native execution on unadmitted inputs. + +```sh +python3.12 -B scripts/research_package.py --package research/p104-external-port-closure +python3.12 -I -O -B research/p104-external-port-closure/verify.py +``` + +Runtime uses only the standard library. `verify.py --emit` prints the complete +certificate; `verify.py --summary` prints its summary. +`oracle.py --full` prints the independently reconstructed closure. +[SUMMARY.json](SUMMARY.json) is the readable summary; [PROOF.md](PROOF.md) states +the conditional implications. Exact base, source hashes, context heads, overlap +coverage, environment and command outcomes are in SOURCES.json and TASK.json. +No heavy native replay, Lean check or selected-frontier replay is claimed. + +## Open next questions + +1. Can a paid caller supply this 265-bank entrance and physical layout, including + the 52 additional `4B9` and 38 `2B9` admissions? Start with the explicit input + list and event-312 witness; stop at any unproved divisibility or ownership + premise. Current H and input modules are assumptions, not preparation costs. +2. If using the projection inside the original word, how will its omitted + outgoing effects be supplied and paid? Start with the exact omitted-ADD list + in SUMMARY.json. The selected endpoints alone do not preserve those effects. + Any changed supplier/profile must first pass a compatible full cost screen. + +## Credit and scope history + +Hiroki Kumazaki, with substantial OpenAI Codex assistance for analysis, code, +execution, writing and separate AI-agent review. No independent human or +formal proof-kernel review is claimed. Apache-2.0. + +Credit Clear1nsight (PR3423/3382 and the explicit handoff), ywz65 (PR2586 word +and native recipes), Arham Tahir (PR2665 binding and PR2674 atomic row/grid +bounds), Tekalign (PR3025 literal wrapper/ledger), Ross Richardson (PR3068 +period domain), Nick Petalas (PR3406 product domain, PR3416 native covariance, +PR3426 correlated entrance), and the original geometry/native/compiler lineage. +Jose Manuel's unchanged-profile stop and Vasek's PR2744 audit remain credited. +The main `p104-whole-word-internal-grid` package already proves the whole-word +row norm and an alternative sufficient enlarged fixed grid. + +This refines the current P104 producer/consumer question by taking the released +PR3423 handoff, rather than repeating the preceding PR3044 audit or reopening +fixed-cover matching searches. Entry overlap covered 353 open PRs and 2,277 +Discussion records with complete pagination; literal numeric searches have +false-positive matches. Focused PR3423/675-port and canonical-thread checks +found no other published closure for this handoff. Coverage excludes unpublished +work and exhaustive historical diffs. The canonical claim is recorded in TASK. + +[handoff]: https://github.com/CrocSwap/integer-mult-bounds/discussions/2750#discussioncomment-19009429 diff --git a/research/p104-external-port-closure/SOURCES.json b/research/p104-external-port-closure/SOURCES.json new file mode 100644 index 0000000000..ff008ed3d8 --- /dev/null +++ b/research/p104-external-port-closure/SOURCES.json @@ -0,0 +1,54 @@ +{ + "schema_version": 1, + "base_commit": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0" + }, + { + "path": "research/p104-rounded-collector/inputs/NATIVE.json.gz", + "usage": "input", + "git_blob": "04f2877aa5444948b7ae37efd267745af82cb34d", + "sha256": "ab91c78835c3e10cf3b2cb8a5d4e0b7cfc3df1ae5a811298d27842f2193e1e3d" + }, + { + "path": "research/p104-rounded-collector/inputs/WORD.json", + "usage": "input", + "git_blob": "93acaabc0a523789ef2f1b06f6eeeefed5551397", + "sha256": "cec1fb3fbd0067b500ad5119a62ba60685be718e769374d7ec8abdd2beaa7e50" + } + ], + "context_sources": [ + { + "pr": 3423, + "head": "15d28c4de37dc47ea07cd7173c8b318fca7a4d75", + "path": "research/p104-newton-interfaces/RECEIPT.json", + "sha256": "fbc444897b13be5973c92ecfa5de67a8efae13b1aca0d8181bd430e2cffba1d3", + "usage": "Inspected published port boundary;675eventindices authenticate to04b3a0bc022c336c9b177eeed49036f1257ab81ea9d0459b8170075b002a24a4. No executable import or Git fetch required." + }, + { + "pr": 3406, + "head": "18a054fd585ab4b2010770ec83cba0c9f28184e3", + "usage": "Credited wholewordproductdomain, not rerun or imported." + }, + { + "pr": 3416, + "head": "f1112560883a5e81b1a29c37c81a79a20be31fe3", + "usage": "Native covariance external mathematical premise, not rerun or imported." + }, + { + "pr": 3426, + "head": "ce2221dddab6efd3027c09269765dd7eb45f2877", + "usage": "Distinct correlated finalcut result, not rerun or imported." + } + ] +} diff --git a/research/p104-external-port-closure/SUMMARY.json b/research/p104-external-port-closure/SUMMARY.json new file mode 100644 index 0000000000..34385fe76f --- /dev/null +++ b/research/p104-external-port-closure/SUMMARY.json @@ -0,0 +1,1198 @@ +{ + "actual_recipient_counterexample": [ + { + "amplitude": 2, + "half_arithmetic_exact": true, + "output_bad_indices": [ + 1 + ], + "output_newton_coefficient_1": [ + "1/2", + "-1/2" + ], + "source_newton_coefficient_1": [ + "1", + "-1" + ] + }, + { + "amplitude": 4, + "half_arithmetic_exact": true, + "output_bad_indices": [], + "output_newton_coefficient_1": [ + "1", + "-1" + ], + "source_newton_coefficient_1": [ + "2", + "-2" + ] + } + ], + "certificate_payload_sha256": "66a6a84b3b90959e69e35f439186b5e990cff92d372e52f7ba457aabb2aee4da", + "history_complete": { + "component_bound_factor": "2032", + "event_ids_sha256": "66113bcd513a17eac24f43944a8759bdae1bb2a85e2b9900122f281c5c676dc8", + "events": 4027, + "inputs": 265, + "max_row_event": 3589, + "max_row_l1": "127/2", + "op_counts": { + "add": 2310, + "erase": 8, + "sign": 104, + "transport": 1597, + "zero": 8 + } + }, + "initial_scale_bits": { + "D0": 0, + "D1": 0, + "D10": 0, + "D11": 0, + "D12": 0, + "D13": 0, + "D14": 0, + "D15": 0, + "D16": 0, + "D17": 0, + "D18": 0, + "D19": 0, + "D2": 0, + "D20": 0, + "D21": 0, + "D22": 0, + "D23": 0, + "D24": 0, + "D25": 0, + "D26": 0, + "D27": 0, + "D28": 0, + "D29": 0, + "D3": 0, + "D30": 0, + "D31": 0, + "D4": 0, + "D5": 0, + "D6": 0, + "D7": 0, + "D8": 0, + "D9": 0, + "G0": 0, + "G1": 0, + "G10": 0, + "G11": 0, + "G12": 0, + "G13": 0, + "G14": 0, + "G15": 0, + "G16": 0, + "G17": 0, + "G18": 0, + "G19": 0, + "G20": 0, + "G21": 0, + "G22": 0, + "G23": 0, + "G24": 0, + "G25": 0, + "G26": 0, + "G27": 0, + "G28": 0, + "G29": 0, + "G30": 0, + "G31": 0, + "G4": 0, + "G5": 0, + "G6": 0, + "G7": 0, + "G8": 0, + "N100": 1, + "N18": 1, + "N2": 1, + "N20": 1, + "N27": 1, + "N29": 1, + "N33": 0, + "N34": 0, + "N35": 1, + "N36": 1, + "N4": 1, + "N40": 1, + "N44": 1, + "N45": 1, + "N46": 1, + "N48": 1, + "N49": 1, + "N50": 1, + "N54": 1, + "N58": 1, + "N59": 1, + "N64": 1, + "N65": 1, + "N66": 1, + "N7": 1, + "N70": 1, + "N74": 1, + "N75": 1, + "N79": 1, + "N80": 1, + "N81": 1, + "N83": 1, + "N84": 1, + "N85": 1, + "N87": 1, + "N88": 1, + "N89": 1, + "N9": 1, + "N92": 1, + "N98": 1, + "Q0": 0, + "Q1": 0, + "Q2": 0, + "Q3": 0, + "Q4": 0, + "Q5": 0, + "Q6": 0, + "Q7": 0, + "X1": 0, + "X100": 0, + "X103": 0, + "X13": 0, + "X14": 0, + "X18": 0, + "X19": 0, + "X2": 0, + "X20": 0, + "X22": 0, + "X23": 0, + "X27": 0, + "X28": 0, + "X29": 0, + "X3": 0, + "X32": 0, + "X35": 0, + "X36": 0, + "X4": 0, + "X40": 0, + "X44": 0, + "X45": 0, + "X46": 0, + "X48": 0, + "X49": 0, + "X50": 0, + "X54": 0, + "X58": 0, + "X59": 0, + "X64": 0, + "X65": 0, + "X66": 0, + "X7": 0, + "X70": 0, + "X74": 0, + "X75": 0, + "X79": 0, + "X8": 0, + "X80": 0, + "X81": 0, + "X83": 0, + "X84": 0, + "X85": 0, + "X87": 0, + "X88": 0, + "X89": 0, + "X9": 0, + "X92": 0, + "X94": 0, + "X95": 0, + "X98": 0, + "X99": 0, + "Y0": 2, + "Y1": 2, + "Y10": 2, + "Y100": 2, + "Y101": 2, + "Y102": 2, + "Y103": 2, + "Y11": 2, + "Y12": 2, + "Y13": 2, + "Y14": 2, + "Y15": 2, + "Y16": 2, + "Y17": 2, + "Y18": 2, + "Y19": 2, + "Y2": 2, + "Y20": 2, + "Y21": 2, + "Y22": 2, + "Y23": 2, + "Y24": 2, + "Y25": 2, + "Y26": 2, + "Y27": 2, + "Y28": 2, + "Y29": 2, + "Y3": 2, + "Y30": 2, + "Y31": 2, + "Y32": 2, + "Y33": 2, + "Y34": 2, + "Y35": 2, + "Y36": 2, + "Y37": 2, + "Y38": 2, + "Y39": 2, + "Y4": 2, + "Y40": 2, + "Y41": 2, + "Y42": 2, + "Y43": 2, + "Y44": 2, + "Y45": 2, + "Y46": 2, + "Y47": 2, + "Y48": 2, + "Y49": 2, + "Y5": 2, + "Y50": 2, + "Y51": 2, + "Y52": 2, + "Y53": 2, + "Y54": 2, + "Y55": 2, + "Y56": 2, + "Y57": 2, + "Y58": 2, + "Y59": 2, + "Y6": 2, + "Y60": 2, + "Y61": 2, + "Y62": 2, + "Y63": 2, + "Y64": 2, + "Y65": 2, + "Y66": 2, + "Y67": 2, + "Y68": 2, + "Y69": 2, + "Y7": 2, + "Y70": 2, + "Y71": 2, + "Y72": 2, + "Y73": 2, + "Y74": 2, + "Y75": 2, + "Y76": 2, + "Y77": 2, + "Y78": 2, + "Y79": 2, + "Y8": 2, + "Y80": 2, + "Y81": 2, + "Y82": 2, + "Y83": 2, + "Y84": 2, + "Y85": 2, + "Y86": 2, + "Y87": 2, + "Y88": 2, + "Y89": 2, + "Y9": 2, + "Y90": 2, + "Y91": 2, + "Y92": 2, + "Y93": 2, + "Y94": 2, + "Y95": 2, + "Y96": 2, + "Y97": 2, + "Y98": 2, + "Y99": 2 + }, + "omitted_outgoing_adds": { + "count": 696, + "event_indices": [ + 373, + 374, + 390, + 391, + 392, + 393, + 398, + 399, + 400, + 401, + 402, + 403, + 406, + 407, + 408, + 409, + 410, + 411, + 418, + 421, + 423, + 425, + 427, + 429, + 432, + 433, + 435, + 437, + 440, + 442, + 444, + 446, + 450, + 451, + 456, + 457, + 458, + 459, + 460, + 461, + 462, + 463, + 468, + 469, + 470, + 471, + 476, + 477, + 546, + 548, + 550, + 552, + 554, + 557, + 559, + 561, + 562, + 565, + 567, + 569, + 571, + 573, + 576, + 579, + 580, + 583, + 584, + 585, + 586, + 589, + 590, + 595, + 596, + 597, + 601, + 603, + 604, + 608, + 609, + 610, + 613, + 614, + 615, + 616, + 619, + 623, + 624, + 625, + 626, + 627, + 628, + 631, + 632, + 633, + 636, + 637, + 638, + 641, + 642, + 643, + 644, + 645, + 648, + 650, + 652, + 656, + 658, + 661, + 662, + 663, + 666, + 669, + 670, + 671, + 676, + 677, + 678, + 681, + 682, + 684, + 686, + 688, + 691, + 693, + 694, + 699, + 700, + 702, + 705, + 707, + 712, + 713, + 714, + 715, + 717, + 719, + 720, + 721, + 722, + 723, + 725, + 727, + 729, + 731, + 732, + 733, + 734, + 736, + 738, + 740, + 743, + 745, + 746, + 751, + 753, + 755, + 759, + 763, + 764, + 765, + 768, + 769, + 770, + 772, + 773, + 774, + 778, + 782, + 783, + 784, + 787, + 789, + 793, + 794, + 795, + 798, + 799, + 800, + 804, + 805, + 811, + 815, + 817, + 818, + 819, + 821, + 822, + 823, + 825, + 826, + 827, + 829, + 830, + 831, + 832, + 833, + 834, + 836, + 837, + 838, + 840, + 841, + 844, + 846, + 847, + 848, + 852, + 853, + 858, + 859, + 860, + 861, + 868, + 869, + 870, + 871, + 872, + 873, + 876, + 877, + 878, + 879, + 880, + 881, + 886, + 887, + 888, + 889, + 890, + 891, + 894, + 895, + 898, + 899, + 900, + 901, + 904, + 907, + 2577, + 2578, + 2579, + 2580, + 2581, + 2582, + 2583, + 2584, + 2585, + 2586, + 2587, + 2588, + 2589, + 2590, + 2600, + 2601, + 2602, + 2603, + 2604, + 2605, + 2606, + 2607, + 2608, + 2609, + 2616, + 2617, + 2623, + 2624, + 2638, + 2639, + 2640, + 2641, + 2642, + 2643, + 2644, + 2645, + 2646, + 2647, + 2650, + 2651, + 2652, + 2653, + 2655, + 2656, + 2657, + 2658, + 2659, + 2660, + 2661, + 2662, + 2663, + 2664, + 2681, + 2686, + 2687, + 2688, + 2689, + 2690, + 2694, + 2695, + 2696, + 2697, + 2698, + 2702, + 2703, + 2706, + 2707, + 2710, + 2711, + 2712, + 2713, + 2714, + 2715, + 2716, + 2717, + 2718, + 2719, + 2720, + 2721, + 2722, + 2728, + 2729, + 2730, + 2731, + 2732, + 2733, + 2734, + 2735, + 2736, + 2737, + 2740, + 2741, + 2742, + 2743, + 2745, + 2746, + 2747, + 2748, + 2750, + 2751, + 2752, + 2753, + 2754, + 2755, + 2785, + 2786, + 2788, + 2791, + 2792, + 2793, + 2797, + 2798, + 2801, + 2802, + 2803, + 2804, + 2805, + 2806, + 2809, + 2810, + 2811, + 2812, + 2813, + 2816, + 2817, + 2818, + 2820, + 2821, + 2822, + 2823, + 2824, + 2825, + 2826, + 2828, + 2829, + 2831, + 2832, + 2833, + 2834, + 2836, + 2837, + 2838, + 2839, + 2842, + 2877, + 2883, + 2884, + 2886, + 2887, + 2888, + 2891, + 2892, + 2893, + 2894, + 2895, + 2896, + 2897, + 2898, + 2899, + 2901, + 2902, + 2903, + 2904, + 2905, + 2908, + 2910, + 2912, + 2913, + 2948, + 2949, + 2950, + 2951, + 2952, + 2954, + 2956, + 2957, + 2959, + 2982, + 2983, + 3027, + 3028, + 3034, + 3058, + 3060, + 3062, + 3064, + 3066, + 3068, + 3070, + 3072, + 3074, + 3076, + 3078, + 3080, + 3082, + 3084, + 3104, + 3106, + 3108, + 3110, + 3112, + 3114, + 3116, + 3118, + 3120, + 3122, + 3136, + 3138, + 3150, + 3152, + 3180, + 3182, + 3184, + 3186, + 3188, + 3190, + 3192, + 3194, + 3196, + 3198, + 3204, + 3206, + 3208, + 3210, + 3214, + 3216, + 3218, + 3220, + 3222, + 3224, + 3226, + 3228, + 3230, + 3232, + 3267, + 3278, + 3280, + 3282, + 3284, + 3286, + 3295, + 3297, + 3299, + 3301, + 3303, + 3312, + 3314, + 3320, + 3322, + 3329, + 3331, + 3333, + 3335, + 3337, + 3339, + 3341, + 3343, + 3345, + 3347, + 3349, + 3351, + 3353, + 3366, + 3368, + 3370, + 3372, + 3374, + 3376, + 3378, + 3381, + 3383, + 3385, + 3392, + 3394, + 3396, + 3398, + 3402, + 3404, + 3406, + 3408, + 3413, + 3415, + 3417, + 3419, + 3421, + 3423, + 3487, + 3489, + 3494, + 3501, + 3503, + 3505, + 3515, + 3517, + 3524, + 3526, + 3528, + 3530, + 3532, + 3534, + 3541, + 3543, + 3545, + 3548, + 3550, + 3557, + 3559, + 3561, + 3566, + 3568, + 3570, + 3573, + 3575, + 3577, + 3580, + 3584, + 3586, + 3591, + 3593, + 3595, + 3597, + 3602, + 3604, + 3606, + 3608, + 3615, + 3695, + 3711, + 3713, + 3718, + 3720, + 3723, + 3730, + 3732, + 3734, + 3736, + 3739, + 3741, + 3744, + 3746, + 3749, + 3754, + 3756, + 3758, + 3761, + 3763, + 3770, + 3775, + 3780, + 3782, + 3871, + 3874, + 3877, + 3880, + 3882, + 3888, + 3893, + 3896, + 3901, + 3967, + 3970, + 4108, + 4110, + 4124, + 4668, + 4669, + 4674, + 4675, + 4676, + 4677, + 4682, + 4683, + 4684, + 4685, + 4686, + 4687, + 4688, + 4689, + 4694, + 4695, + 4699, + 4701, + 4703, + 4705, + 4708, + 4710, + 4712, + 4713, + 4716, + 4718, + 4720, + 4722, + 4724, + 4727, + 4734, + 4735, + 4736, + 4737, + 4738, + 4739, + 4742, + 4743, + 4744, + 4745, + 4746, + 4747, + 4752, + 4753, + 4754, + 4755, + 4940, + 4943, + 4992, + 4994, + 4996, + 4998, + 5000, + 5003, + 5005, + 5007, + 5008, + 5011, + 5013, + 5015, + 5017, + 5019, + 5025, + 5026, + 5029, + 5030, + 5031, + 5032, + 5035, + 5040, + 5041, + 5048, + 5049, + 5050, + 5051, + 5052, + 5053, + 5056, + 5057, + 5058, + 5059, + 5060, + 5061, + 5066, + 5067, + 5068, + 5069, + 5073, + 5074, + 5077, + 5078, + 5079, + 5080, + 5083 + ], + "events_sha256": "f0c3adbc3eafd025739cfcb33bcb5e366cf71c3736ebfcbc7176dc0d83812679", + "first_two": [ + { + "event": 373, + "operation": [ + "add", + "X34", + "N34", + "1/2", + [] + ] + }, + { + "event": 374, + "operation": [ + "add", + "X33", + "N33", + "-1/2", + [] + ] + } + ], + "source_by_role": { + "G": 358, + "N": 96, + "Q": 196, + "Y": 46 + }, + "target_bank_by_role": { + "G": 3, + "N": 38, + "X": 52 + }, + "target_by_role": { + "G": 6, + "N": 138, + "X": 552 + }, + "target_count": 93, + "target_roles": [ + "G2", + "G3", + "G9", + "N10", + "N12", + "N15", + "N17", + "N24", + "N26", + "N37", + "N38", + "N39", + "N41", + "N42", + "N43", + "N47", + "N5", + "N51", + "N52", + "N53", + "N55", + "N56", + "N57", + "N60", + "N61", + "N62", + "N63", + "N67", + "N68", + "N69", + "N71", + "N72", + "N73", + "N76", + "N77", + "N78", + "N82", + "N86", + "N90", + "N91", + "N96", + "X0", + "X10", + "X101", + "X102", + "X11", + "X12", + "X15", + "X16", + "X17", + "X21", + "X24", + "X25", + "X26", + "X30", + "X31", + "X33", + "X34", + "X37", + "X38", + "X39", + "X41", + "X42", + "X43", + "X47", + "X5", + "X51", + "X52", + "X53", + "X55", + "X56", + "X57", + "X6", + "X60", + "X61", + "X62", + "X63", + "X67", + "X68", + "X69", + "X71", + "X72", + "X73", + "X76", + "X77", + "X78", + "X82", + "X86", + "X90", + "X91", + "X93", + "X96", + "X97" + ] + }, + "one_bit_lower_controls": 142, + "port_cut": { + "component_bound_factor": "2032", + "event_ids_sha256": "cae6eba5c0ce88e7a9affa9d7bf04b94822a4f34c63952ea8562243fc03e6e82", + "events": 2907, + "inputs": 263, + "max_row_event": 3589, + "max_row_l1": "127/2", + "op_counts": { + "add": 1754, + "erase": 8, + "sign": 52, + "transport": 1085, + "zero": 8 + } + }, + "ports": 675, + "recipients": 83, + "rejection_controls": [ + "omit_actual_incoming_half_read", + "omit_private_erasure", + "wrong_recipient_frame", + "dirty_private_erase", + "wrong_half_read_leaves_dirty_N100", + "native_rank_binding", + "weak_N100_B9_in_actual_prefix", + "omit_observed_port" + ], + "scope": "Literal endpoint projection and conditional normalized algebra/module admission. Native operator semantics, physical admission, omitted-bank effects and full supplier costs remain outside this check.", + "status": "PASS_P104_EXTERNAL_PORT_CLOSURE", + "terminal_Y_minor_determinant": "-1/128", + "terminal_Y_rank": 9, + "terminal_cut": { + "component_bound_factor": "2032", + "event_ids_sha256": "fb4f9c43fa11d7eac431be79e4f137508364dc9201036889195f9230f0a941a5", + "events": 3812, + "inputs": 265, + "max_row_event": 3589, + "max_row_l1": "127/2", + "op_counts": { + "add": 2225, + "erase": 8, + "sign": 104, + "transport": 1467, + "zero": 8 + } + } +} diff --git a/research/p104-external-port-closure/TASK.json b/research/p104-external-port-closure/TASK.json new file mode 100644 index 0000000000..b9d5174b85 --- /dev/null +++ b/research/p104-external-port-closure/TASK.json @@ -0,0 +1,143 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 6, + "base_commit": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "original_card": { + "id": "p104-side-correction", + "question": "Can the proposed P104 joint endpoint flags be realized by a chronological correction program with coefficients, dirty restoration and an affordable complete bill?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/p104-native-channel/README.md", + "research/p104-native-channel/PROOF.md", + "docs/research/community-efficient1000-review.md", + "research/p104-joint-unit-flags/README.md" + ], + "methods": [ + "Construct one side-correction word at an explicit chronological cut with the needed frames still available.", + "Derive a lower bound on the side correction and hosting costs that decides whether this channel can beat the selected budget." + ], + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the revision-6 family record and #2981 static joint flags, alongside the reviewed #1991 channel. #2981 is an author-checked source archive, not an independently validated executable correction or a refutation of program-level lifetime floors.", + "scope": "Source-bound orientation only. Read the named package and review before relying on its local evidence; this command is not its replay or supplier admission." + }, + "first_experiment": "After checking live handoffs, pin one named collection from #2981 and attach acquisition/delivery times, source dependencies and coefficient requirements. Test legal access and arbitrary dirty restoration; price any completion against the full channel/endpoint/hosting allowance. Stop with the exact missing implication or a scoped counterexample rather than expanding the static cover census.", + "bottleneck_link": "Completing an already realized changed channel tests a concrete construction opportunity, instead of refining the incumbent packing. A positive local result still needs global and all-size admission.", + "allowed_variations": [ + "One correction factorization, one chronological cut, or one explicit hosting obstruction.", + "A changed correction schedule with an updated full bill and native frame contract." + ], + "scope_change_triggers": [ + "Recompiling the already certified low-rank channel without closing a new obligation.", + "Treating a pending ancestor, local histogram or unpriced side correction as an admitted global supplier.", + "Repeating a correction or physical conversion already supplied by a pending follow-up without adding independent coverage or a different unresolved obligation.", + "Repeating the 208-flag static matching or calling a static nested cover a chronological correction program. Independent audit of that certificate is distinct and remains useful." + ], + "overlap_terms": [ + "P104", + "I-G/2", + "side correction", + "native channel", + "1972", + "1991", + "2586", + "endpoint transport", + "physical dual", + "relay composition", + "2981", + "joint unit flags", + "acquisition delivery", + "static nesting" + ], + "existing_checks": [ + { + "scope": "PR #2981 reports static joint endpoint flags and a matching of 208 departure and arrival flags; archival intake is not independent verification.", + "evidence": "research/p104-joint-unit-flags/README.md", + "remaining": "Independent flag check and a chronological coefficient program with dirty restoration and a complete cost.", + "status": "author-checked", + "source_commit": "3d24b92d8ba057b57cb2d480170ec407520e6882", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Source-bound projection of PR3423\u2019s 675 outgoing ports through actual recipient and dependency endpoint histories, with a minimal independent dyadic product entrance and inherited conditional payload bound. Native semantics and physical admission remain premises.", + "scope_change_reason": "Take the explicit current PR3423 consumer-join handoff rather than reopen the fixed-cover correction construction or repeat the prior PR3044 replay.", + "bottleneck_link": "An open-program saving cannot omit external receiver preparation, history or width costs. Source-bound closure exposes the real interface required for complete pricing.", + "budget_minutes": 60, + "stop_rule": "One source-bound port-cut and terminal dependency closure; no new word, matching census, supplier admission or frontier change. Stop at the first concrete unproved boundary and record it.", + "outcome": "completed", + "evidence": "SUMMARY.json and CERTIFICATE.json.gz: separate SSA and reverse-liveness checks agree on the 2907-event/263-input port closure, 3812-event/265-input endpoint closure and 4027-event/265-input history completion. Eight rejection groups, 142 weakened-admission controls, rank-nine factorization and nonzero minor, exact-half Newton counterexample. All 675 original ports and 696 omitted outgoing ADDs are distinguished.", + "author": "Hiroki Kumazaki", + "ai_assistance": "Substantial OpenAI Codex assistance in source analysis, implementation, execution, proof writing and separate AI-agent review; no independent human or formal proof-kernel review claimed.", + "open_questions": [ + { + "question": "Can a paid caller prepare the265-bank entrance and physical layout?", + "why_it_matters": "The original63-bank contract alone fails at event312, while2032H assumes supplied input heights.", + "first_step": "Use SUMMARY.json initial_scale_bits and event312 witness to bind the52additional4B9 and38additional2B9 admissions to one actual producer with charged conversion and ownership.", + "blocked_by": "No physical input producer, allocation, routing or recursive invoice is supplied by this projection." + }, + { + "question": "How are the696omitted outgoing ADDs to93excluded banks preserved and paid when embedding this projection?", + "why_it_matters": "Preserving all265requested endpoints does not preserve the omitted banks\u2019 side effects.", + "first_step": "Start with SUMMARY.json omitted_outgoing_adds.event_indices in the pinned WORD; bind their recipient histories or a proven replacement and apply the full cost screen.", + "blocked_by": "No omitted-bank numerical/physical admission or improved supplier profile; unchanged-profile599/584stop remains." + } + ], + "coordination": { + "claim_url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2750#discussioncomment-19009569", + "claim_comment_id": "DC_kwDOU-508s4BIhAh", + "handoff_url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2750#discussioncomment-19009429", + "coverage": { + "open_prs": 353, + "open_prs_fetched_at": "2026-10-18T01:45:32.767995+00:00", + "discussion_records": 2277, + "discussions_fetched_at": "2026-10-18T01:49:10.723561+00:00", + "complete_pagination": true + }, + "nearest_work": [ + "PR3423 supplies63-bank program/openports; this closes actual recipient histories.", + "PR3406 supplieswholewordproductdomain; this specializesactual265inputprojection.", + "PR3416 supplies nativecovariance, an inherited premise here.", + "PR3426 suppliescorrelatedfinalcutdomain; not duplicated.", + "PR2674 and p104-whole-word-internal-grid supplyretained127/2norm and enlarged-grid alternative." + ], + "limits": "No unpublished work or exhaustive historical diffs; numerical term searches include false positives.", + "publication_refresh": { + "checked_at": "2026-10-18T02:05:17.575164+00:00", + "main": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "query": "\"port\" \"P104\" in:title,body", + "open_pr_matches": [ + 2375, + 3372, + 3423 + ], + "focused_discussion": 2750, + "comment_count": 5, + "decision": "PR2375 is unrelated enumeration tooling; PR3372 is a tail-coefficient cancellation; PR3423 is the claimed predecessor. No additional matching recipient-closure contribution found." + } + }, + "environment": { + "python": "Python 3.12.13", + "platform": "Linux-7.0.0-38-generic-x86_64-with-glibc2.43", + "dependencies": "standard library only", + "native_replay": "not run; covariance/module semantics retained as explicit premises", + "selected_replay": "not run; selected record unchanged", + "checks": [ + "Registered Python 3.12 replay", + "Isolated optimized Python 3.12 replay", + "Separate SSA/reverse-liveness closures", + "Three full/projection scalar fixtures", + "Exact-half Newton negative and positive arrays", + "Duplicate/dependent-row rank regressions and exact factorization/minor" + ] + }, + "review_correction": "Prepublication AI-agent review found a stale-iterator error in the new rank helper. It was fixed before publication; corrected rank is nine, with duplicate/dependent-row regressions and an exact full factorization plus determinant -1/128. Closure and admission counts were unaffected." +} diff --git a/research/p104-external-port-closure/VERIFY.json b/research/p104-external-port-closure/VERIFY.json new file mode 100644 index 0000000000..36d75f735d --- /dev/null +++ b/research/p104-external-port-closure/VERIFY.json @@ -0,0 +1,21 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-rounded-collector/inputs/NATIVE.json.gz", + "research/p104-rounded-collector/inputs/WORD.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Source-bound 675-port closure in separate SSA and reverse-liveness engines; all 265 endpoint rows, exact rank-nine factorization and minor, minimal dyadic B9 product entrance, eight rejection groups, 142 weakened-admission controls and exact-half Newton witness. Native/module semantics are explicit premises; no supplier admission." + } + ] +} diff --git a/research/p104-external-port-closure/oracle.py b/research/p104-external-port-closure/oracle.py new file mode 100644 index 0000000000..59cf52bb23 --- /dev/null +++ b/research/p104-external-port-closure/oracle.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Data-only reverse-liveness oracle for PR3423's external-port interface. + +Imports no predecessor code. This computes least literal read/write ancestor +closures, not cancellation-minimized semantic dependencies. C erasure obligations +are closed to a fixed point, including all restoration predecessors. +""" +import argparse +from collections import Counter +from fractions import Fraction +import hashlib +import json +from pathlib import Path + +DEFAULT=Path(__file__).resolve().parents[2]/'research/p104-rounded-collector/inputs/WORD.json' +WORD_SHA='cec1fb3fbd0067b500ad5119a62ba60685be718e769374d7ec8abdd2beaa7e50' +Y={f'Y{i}' for i in [*range(22,33),*range(63,104)]} +INTERNAL=Y|{f'{c}{i}' for c in ('D','G') for i in range(27,32)}|{'Q7'} + +def must(ok,label): + if not ok:raise ValueError(label) + +def digest(obj): + return hashlib.sha256(json.dumps(obj,sort_keys=True,separators=(',',':')).encode()).hexdigest() + +def hist(names): + return dict(sorted(Counter(n.rstrip('0123456789') for n in names).items())) + +def newton(values): + values=[(Fraction(a),Fraction(b)) for a,b in values] + for j in range(9): + for x in range(512): + if x & (1<maximum[0]:maximum=(norm,i) + for k,v in row.items(): + b=dyadic_bits(v) + if b>bits[k]:bits[k]=b;witness[k]={'event':i,'coefficient':str(v)} + return {'initial_inputs':initials,'initial_scale_bits':bits,'scale_witnesses':witness, + 'events':sorted(i for i in selected if i>=0), + 'op_counts':dict(sorted(Counter(word['program'][i][0] for i in selected if i>=0).items())), + 'max_row_l1':str(maximum[0]),'max_row_event':maximum[1], + 'component_bound_factor':str(32*maximum[0])} + + +def rational_rank(matrix): + pivots={} + for row in matrix: + row=list(row) + for i in range(len(row)): + value=row[i] + if not value:continue + if i in pivots:row=[a-value*b for a,b in zip(row,pivots[i])] + else: + pivots[i]=[a/value for a in row];break + return len(pivots) + + +def rank_witness(terminal_rows): + names=['X1','X100','X103','X13','X14','X18','X19','X20','X22'] + columns=[1,2,14,3,7,4,5,33,22] + basis=[[Fraction(terminal_rows[k].get('Y'+str(j),'0')) for j in range(104)] for k in names] + square=[[row[j] for j in columns] for row in basis] + aug=[row+[Fraction(i==j) for j in range(9)] for i,row in enumerate(square)] + determinant=Fraction(1) + for col in range(9): + pivot=next((i for i in range(col,9) if aug[i][col]),None) + need(pivot is not None,'singular rank witness') + if pivot!=col:aug[pivot],aug[col]=aug[col],aug[pivot];determinant=-determinant + value=aug[col][col];determinant*=value + aug[col]=[v/value for v in aug[col]] + for i in range(9): + if i==col:continue + value=aug[i][col] + aug[i]=[a-value*b for a,b in zip(aug[i],aug[col])] + inverse=[row[9:] for row in aug] + need(determinant==Fraction(-1,128),'rank witness determinant') + coefficients={} + for name,row in terminal_rows.items(): + if not name.startswith('X'):continue + target=[Fraction(row.get('Y'+str(j),'0')) for j in range(104)] + coef=[sum((target[columns[k]]*inverse[k][j] for k in range(9)),Fraction()) for j in range(9)] + need(all(sum((coef[k]*basis[k][j] for k in range(9)),Fraction())==target[j] for j in range(104)), + 'rank-nine full matrix factorization') + coefficients[name]=[str(c) for c in coef] + return {'basis_rows':names,'minor_Y_columns':columns,'minor_determinant':str(determinant), + 'coefficients':coefficients,'identity':'Every terminal X-to-Y row equals its nine coefficients times the nine named full Y rows.'} + + +def check_terminal(dag,terminal): + for k in terminal: + row=dag['rows'][dag['final'][k]] + if k.startswith('X'): + need(row.get(k)==1 and all(src==k or src.startswith('Y') for src in row), + 'terminal dirty-input cancellation') + else:need(row=={k:Fraction(1)},'terminal normalized restoration') + + +def audit(word,native): + dag=build(word,native) + ports=[i for i,o in enumerate(word['program']) if i<=4516 and o[0]=='add' and o[2] in ROLES and o[1] not in ROLES and o[1]!='C'] + need(len(ports)==675,'675 actual outgoing ports') + need(digest(ports)=='04b3a0bc022c336c9b177eeed49036f1257ab81ea9d0459b8170075b002a24a4', 'PR3423 published port-index binding') + targets={word['program'][i][1] for i in ports} + terminal=sorted(targets|ROLES) + port_set=close(dag,ports) + end_seeds=[dag['final'][k] for k in terminal] + end_set=close(dag,end_seeds) + # Joining both sets is necessary: final cancellation must not drop port observations. + joined=close(dag,ports+end_seeds) + for s,seeds in ((port_set,ports),(end_set,end_seeds),(joined,ports+end_seeds)): + require_closed(dag,s,seeds) + p=profile(word,dag,joined) + all_inputs=p['initial_inputs'] + returned=close(dag,ports+[dag['final'][k] for k in all_inputs]) + need({dag['owners'][i] for i in returned if i<0}==set(all_inputs), + 'terminal-history closure introduces new inputs') + require_closed(dag,returned,ports+[dag['final'][k] for k in all_inputs]) + returned_profile=profile(word,dag,returned) + need(returned_profile['initial_scale_bits']==p['initial_scale_bits'],'returned entrance contract changed') + check_terminal(dag,all_inputs) + terminal_rows={k:row_json(dag['rows'][dag['final'][k]]) for k in terminal} + check_terminal(dag,terminal) + scales=p['initial_scale_bits'] + for i in joined: + for name,c in dag['rows'][i].items(): + need((c*2**scales[name]).denominator==1,'product entrance insufficient') + # Each smaller independent dyadic factor has a reachable nonintegral coefficient. + lower_controls=[] + for name,b in scales.items(): + if not b:continue + witness=p['scale_witnesses'][name] + need((Fraction(witness['coefficient'])*2**(b-1)).denominator>1, + 'one-bit-lower admission was not rejected') + lower_controls.append(name) + matrix=[[Fraction(terminal_rows[k].get('Y'+str(j),'0')) for j in range(104)] + for k in terminal if k.startswith('X')] + matrix_rank=rational_rank(matrix) + need(matrix_rank==9,'complete terminal Y-map rank') + need(rational_rank([[Fraction(1),Fraction(1)],[Fraction(1),Fraction(1)]])==1, + 'duplicate-row rank control') + need(rational_rank([[Fraction(x) for x in row] for row in [[1,2,3],[2,4,6],[0,1,1]]])==2, + 'dependent-row rank control') + port_rows=[] + for i in ports: + rec=dag['records'][i]; before=dag['rows'][rec['before']]; after=dag['rows'][i] + inc={k:Fraction(rec['coefficient'])*v for k,v in dag['rows'][rec['source_version']].items()} + port_rows.append({k:v for k,v in rec.items() if k not in ('before','source_version')}| + {'before_row':row_json(before),'increment_row':row_json(inc),'after_row':row_json(after), + 'before_l1':str(sum(map(abs,before.values()),Fraction())), + 'after_l1':str(sum(map(abs,after.values()),Fraction()))}) + # Independent integer fixture execution checks actual slice/full joins; no native claim. + all_nodes=set(dag['deps']) + for seed in (0,17,73): + values={k:((j*37+seed*11)%43-21)*(2**p['initial_scale_bits'].get(k,2)) for j,k in enumerate(dag['initial'])} + sliced=evaluate_slice(word,dag,returned,values) + full=evaluate_slice(word,dag,all_nodes,values) + for k in all_inputs: + expected=sum((v*values[src] for src,v in dag['rows'][dag['final'][k]].items()),Fraction()) + need(sliced[k]==full[k]==expected,'slice/full terminal fixture') + result={'schema_version':1,'scope':'Conditional chart-normalized recipient closure; native covariance and B9 automorphisms inherited.', + 'ports':port_rows,'recipients':sorted(targets),'terminal_targets':terminal, + 'port_cut':profile(word,dag,port_set),'terminal_cut':profile(word,dag,end_set),'joined':p, + 'history_complete':returned_profile, + 'history_terminal_rows':{k:row_json(dag['rows'][dag['final'][k]]) for k in all_inputs}, + 'history_terminal_frames':{k:word['final_frames'][k] for k in all_inputs}, + 'terminal_rows':terminal_rows,'terminal_Y_matrix_rank':matrix_rank,'terminal_Y_rank_witness':rank_witness(terminal_rows), + 'one_bit_lower_admission_controls':lower_controls,'terminal_frames':{k:word['final_frames'][k] for k in terminal}, + 'initial_frames':{k:word['initial_frames'][k] for k in p['initial_inputs']}, + 'private_lifetimes':[[a,b] for a,b in dag['pairs'].items() if a in joined]} + return result,dag,returned,ports,[dag['final'][k] for k in all_inputs] + + +def controls(word,native,dag,joined,ports,end_seeds): + rejected=[] + def fail(label,fn): + try:fn() + except (ValueError,KeyError):rejected.append(label) + else:raise ValueError('accepted control '+label) + fail('omit_actual_incoming_half_read',lambda:require_closed(dag,joined-{312},ports+end_seeds)) + start,end=next((a,b) for a,b in dag['pairs'].items() if a in joined) + fail('omit_private_erasure',lambda:require_closed(dag,joined-{end},ports+end_seeds)) + wrong=deepcopy(word);wrong['program'][312][4]=[1] + fail('wrong_recipient_frame',lambda:build(wrong,native)) + wrong=deepcopy(word);wrong['program'][2038][3]='1' + fail('dirty_private_erase',lambda:build(wrong,native)) + wrong=deepcopy(word);wrong['program'][312][3]='1/4' + fail('wrong_half_read_leaves_dirty_N100',lambda:check_terminal(build(wrong,native),['X100'])) + wrong=deepcopy(native);wrong['transports'][0]['recipe']['rank']+=1 + fail('native_rank_binding',lambda:build(word,wrong)) + need(word['program'][312]==['add','X100','N100','1/2',[]],'half-read witness source') + derived=profile(word,dag,joined)['initial_scale_bits'] + weak=dict(derived);weak['N100']=0 + def validate_entrance(scales): + for i in sorted(joined): + for name,c in dag['rows'][i].items(): + need((c*2**scales[name]).denominator==1, 'admission failure at event '+str(i)) + validate_entrance(derived) + fail('weak_N100_B9_in_actual_prefix',lambda:validate_entrance(weak)) + need(Fraction(1,2)*2==1,'strengthened half-read positive control') + # Endpoint-correct omission is detected by retaining the observations themselves. + fail('omit_observed_port',lambda:require_closed(dag,joined-{ports[0]},ports+end_seeds)) + return rejected + + +def summarize(result): + payload=(json.dumps(result,sort_keys=True,indent=2)+'\n').encode() + out={'status':'PASS_P104_EXTERNAL_PORT_CLOSURE', + 'certificate_payload_sha256':hashlib.sha256(payload).hexdigest(), + 'ports':len(result['ports']),'recipients':len(result['recipients'])} + for tag in ('port_cut','terminal_cut','history_complete'): + p=result[tag] + out[tag]={'events':len(p['events']),'inputs':len(p['initial_inputs']), + 'op_counts':p['op_counts'],'event_ids_sha256':digest(p['events']), + 'max_row_l1':p['max_row_l1'],'max_row_event':p['max_row_event'], + 'component_bound_factor':p['component_bound_factor']} + out['initial_scale_bits']=result['history_complete']['initial_scale_bits'] + out['actual_recipient_counterexample']=result['independent_closure']['N100_exact_half_control'] + out['rejection_controls']=result['rejected_controls'] + out['one_bit_lower_controls']=len(result['one_bit_lower_admission_controls']) + out['terminal_Y_rank']=result['terminal_Y_matrix_rank'] + out['terminal_Y_minor_determinant']=result['terminal_Y_rank_witness']['minor_determinant'] + omitted=result['omitted_outgoing_adds'] + out['omitted_outgoing_adds']={k:v for k,v in omitted.items() if k!='events'} + out['omitted_outgoing_adds']['event_indices']=[a['event'] for a in omitted['events']] + out['omitted_outgoing_adds']['first_two']=omitted['events'][:2] + out['scope']='Literal endpoint projection and conditional normalized algebra/module admission. Native operator semantics, physical admission, omitted-bank effects and full supplier costs remain outside this check.' + return out + + +def main(): + ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('--emit',action='store_true');ap.add_argument('--summary',action='store_true');args=ap.parse_args() + for ent in read(HERE/'SOURCES.json')['files']: + if ent['usage']=='input':need(hashlib.sha256((ROOT/ent['path']).read_bytes()).hexdigest()==ent['sha256'],'source pin '+ent['path']) + word,native=read(ROOT/WORD),read(ROOT/NATIVE) + result,dag,joined,ports,end_seeds=audit(word,native) + result['rejected_controls']=controls(word,native,dag,joined,ports,end_seeds) + independent=json.loads(subprocess.check_output([sys.executable,'-I','-B',str(HERE/'oracle.py'),'--full'],text=True)) + for a,b in (('port_cut','port_cuts'),('terminal_cut','final_endpoints'),('history_complete','history_complete')): + need(result[a]['events']==independent[b]['lifecycle_closed']['event_ids'],'SSA/reverse-liveness event sets') + need(result[a]['initial_inputs']==independent[b]['initial_roles'],'SSA/reverse-liveness initial roles') + result['independent_closure']={k:independent[k] for k in ('outgoing_ports_sha256','N100_exact_half_control')} + result['independent_closure']['event_sets_and_initial_inputs_agree']=True + inputs=set(result['history_complete']['initial_inputs']) + omitted=[{'event':i,'operation':o} for i,o in enumerate(word['program']) + if i not in joined and o[0]=='add' and o[2] in inputs and o[1] not in inputs] + need(omitted==independent['history_complete']['omitted_outgoing_adds']['events'], + 'omitted outgoing effects agree') + result['omitted_outgoing_adds']=independent['history_complete']['omitted_outgoing_adds'] + if args.summary:print(json.dumps(summarize(result),sort_keys=True,indent=2)) + elif args.emit:print(json.dumps(result,sort_keys=True,indent=2)) + else: + need(result==read(HERE/'CERTIFICATE.json.gz'),'retained certificate mismatch') + need(summarize(result)==read(HERE/'SUMMARY.json'),'retained summary mismatch') + print('PASS_P104_EXTERNAL_PORT_CLOSURE',digest(result)) + + +if __name__=='__main__':main()