diff --git a/research/p104-two-axis-compatibility/PREDECESSORS.json b/research/p104-two-axis-compatibility/PREDECESSORS.json new file mode 100644 index 0000000000..9a45ef4309 --- /dev/null +++ b/research/p104-two-axis-compatibility/PREDECESSORS.json @@ -0,0 +1,47 @@ +{ + "schema_version": 1, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "pending_work": [ + { + "pr": 3882, + "head": "9d56eeedbed5e3e9bbbc8c189d66f14cf15b6067", + "publication_head": "d76586303e7036baa74f8deb2155038290174ffd", + "credit": "Clear1nsight", + "used": "Residual equations, orthogonal pivots and sharp eight-residual theorem; independently reconstructed from canonical roots. No pending executable imported." + }, + { + "pr": 3894, + "head": "13b397e36d43f2a91b9e6d42b3ca67f0ec50cea7", + "credit": "1337isnot1337", + "used": "Direct source-preserving correction and 208-H1 invoice, shared with PR3940; new full native replay not claimed." + }, + { + "pr": 3940, + "head": "51ba88c007cfbcc3d9cf22dd321f5224be3a5bb1", + "credit": "Clear1nsight", + "used": "Caller-cut study and complete-cost discipline; neither its 1544 threshold nor its free logical caller is treated as the physical two-axis embedding." + }, + { + "pr": 3943, + "head": "2cba526a4ebe0ef6c3c0143498adcf67dca97941", + "credit": "Clear1nsight", + "used": "Parallel actual internal cleanup consumer and separate return/paired-chain results. Explicit overlap credit only; not replayed or reimplemented." + } + ], + "canonical_lineage": [ + "Rohan Arun/PR1972", + "Chafik Boukhalfa/PR1991", + "Adam Gall/PR1940", + "Josie Elliston/PR1071", + "Aurel Prosz/Paureel", + "Zhihao Chen", + "Rohan Arun", + "Dominik Scholz", + "icekylinx", + "Sagar Thakrar/PR1012", + "Douglas Colkitt", + "Jose Manuel", + "Vasek/PR2744" + ], + "license": "Apache-2.0; canonical and predecessor notices retained" +} diff --git a/research/p104-two-axis-compatibility/PROOF.md b/research/p104-two-axis-compatibility/PROOF.md new file mode 100644 index 0000000000..1d84b2a118 --- /dev/null +++ b/research/p104-two-axis-compatibility/PROOF.md @@ -0,0 +1,271 @@ +# Physical two-axis compatibility and the named cost gate + +## 1. Scope and source meanings + +This is a boundary theorem and conditional rejection for one explicitly described +two-axis P104 scaffold. It is not an embedding of P104 into the existing h=28 +mixed-center producer, not a new native compiler replay, and not a supplier. +The retained caller in notes/copied-centers-complex.tex supplies the physical +two-stage equations and separately paid endpoint correction. PR3882/3940 +supply the residual representation. PR3943 supplies a distinct actual internal +cleanup consumer; no new claim is made for that cleanup or the shared +192-transport return floor. + +All operators below act on arbitrary Gaussian-dyadic address functions. The +physical statements are ideal exact identities; signed-floor, finite-width and +recursive admission do not follow from them. + +Order the 104 ports as J followed by N, where +J=(0,1,3,6,22,31,93,103). Let B=A[J,N] for A=G/2. The pinned roots give +A[J,J]=I, A[N,N]=B^t B and BB^t=12I. Put +``` +D = [ I B ] H = diag(0_8,I_96) + [ B^t B^t B - I ] + +D^-1 = [ -11 I B ] + [ B^t -I ]. +``` +Multiplication proves the inverse. With w=u+y, PR3882's residual vector is +r=(q,v_N)=D u+H w. Thus the common-chart encoding and its inverse are +``` +E0 = [D H; 0 I], E0^-1 = [D^-1 -D^-1 H; 0 I]. +``` +Extend every compatibility map by identity on the 72 arbitrary dirty roles. +This extension preserves all their information; it does not supply the +unexecuted physical native return of a completed global caller. + +The ordered (r,w) notation is not the literal register occupancy. PR3882 +places r_J in X_J and r_N in Y_N, and w_J in Y_J and w_N in X_N. Put +J0=I-H and Pi=[[J0,H],[H,J0]]. Pi swaps the two slots exactly at the 96 N +ports; Pi^-1=Pi. The literal slot encoding is Pi E0, not E0. Pi is an +explicit bookkeeping permutation in the equations below, NOT a free physical +move or a proved compatible owner reassignment. Its realization, chart +alignment and fixed return locations belong in the complete boundary bill. + +## 2. Logical inverse shear and the physical caller + +The original inverse shear R=[I -I;0 I] on (u,w) has encoded form +``` +R_encoded = E0 R E0^-1 = [I -D;0 I]. +``` +Hence an encoded source may be carried by the exact update r <- r-Dw, with +w unchanged. D has 5,000 nonzero entries: eight unit diagonal entries and +4,992 signed half entries. A direct common-FULL-chart implementation applies +the eight unit terms, halves all 104 temporarily writable w donors once, +performs the 4,992 signed unit updates, and doubles all w back. This is +5,000 unit array ADD/SUBs plus 104 halves and 104 restoring doubles. It is +a constructive common-chart scalar invoice, not a scalar optimum and not a +physical implementation with free chart/owner changes. It is not the +source-preserving 1,736-ADD fused schedule of PR3940. + +For each physical data pair use a nondegenerate tensor line U=P tensor Q, +T=C_U, F=C_I, and E=F T^-1. Let bold T be the diagonal family over the ports. +For the proposed P104 ports we explicitly choose T=C_u with the positive +rank-one operator formula in section 3, and define E=F T^-1. This specifies +the physical operators rather than assuming every ambient-projector or +historical chart orientation has the same phase. Any orientation/monomial +adjustment needed to embed these choices into a producer belongs in the +additional boundary bill; no free identification with the h=28 producer is +asserted. A different orientation must rebind the finite phase census. +The retained caller has source charts (T,I) and terminal charts (F,E). +Writing u=T^-1 x, its two stages are exactly +``` +(A,B) = diag(F,E) R S diag(T^-1,I) (x,y) + = (-F y, F T^-2 x + E y), +S=[I 0;I I]. +``` +This is the actual retained endpoint equation, not merely the scalar +(-y,x+y) equation. The paid correction is +P=[I 0;T^-1 I], so P(A,B)=(A,F T^-2 x). + +In ordered (r,w) coordinates at the terminal charts the encoding is not E0. Conjugating by +G=diag(F,E) gives the physical encoding +``` +L_T = G E0 G^-1 = [D H T;0 I]. +``` +F is common and commutes with the rank-one C_U operators; H is diagonal +and commutes with T. D need not commute with T. +In the literal register order the physical encoding is A_T=Pi L_T. + +To preserve this explicitly fixed physical encoding on both sides of the +paid correction, the exact operator is +``` +P_encoded = L_T P L_T^-1 + = [ I+H D^-1 -H D^-1 H T ] + [ T^-1 D^-1 I-T^-1 D^-1 H T ]. +``` +Equivalently, delta=D^-1(r-H T B), followed by +r'=r+H delta and B'=B+T^-1 delta. This is an operator identity with the +displayed order; it grants neither matrix reads nor chart transport for free. +Its r-to-r increment H D^-1 has rational rank 96, or 96 times the address-space +dimension on arrays. That is an information/linear-map rank, NOT a lower bound +of 96 native tariff units. + +The correction in literal slots is therefore +P_literal_encoded=Pi P_encoded Pi, rather than P_encoded alone. Keeping the +permutation symbolic exposes the required ownership/return obligation without +silently donating moves between the actual X/Y banks. + +Applying the old correction unchanged to encoded fields is wrong: +``` +P L_T - L_T P = [-H 0] + [T^-1(D-I) H]. +``` +For B=0 and A a nonzero N-port input, the first-bank error is -A. +This counterexample survives even homogeneous T. A corrected physical caller +must implement the conjugated correction, choose a different explicitly +intertwined output encoding, or decode. None is priced as zero. + +There is also a direct literal-slot counterexample, without granting a gather: +with K=T^-1, +``` +P A_T - A_T P = [-H K 0] + [K J0(D-I)-H K H]. +``` +The first-bank defect on an N-port A input is -K A, again nonzero and of +rank 96 times the address dimension. The separate noncommutative checker +verifies Pi^2=I, both literal-slot identities and the ordered-coordinate +identities. No rank here is identified with a native conversion tariff. + +After the correction, the retained phase/sign/exchange wrappers finish the +unencoded caller. In the fixed literal A_T contract they must be preceded by +A_T^-1=L_T^-1 Pi (or by L_T^-1 after a separately realized ordered gather), +or replaced jointly by a proved and priced encoded endpoint. This study does +not assert that every possible co-designed final encoding must decode there. + +## 3. Explicit two-axis physical lines and a noncommuting read + +Independently reconstruct the doubled E8 roots, the rank-nine binary pairing +and an explicit orthonormal isometry. Check all 120^2 pairings, then remove the +two pinned frames to obtain 104 odd distinct physical labels p_i in F2^9. +The receipt records the complete isometry and ordered labels. This is an +explicit coordinate gauge; it need not spell the historical compiler's gauge. + +For the proposed replacement scaffold take V=F2^9 tensor F2^9, m=81, and +U_ij=span(p_i tensor p_j). All 10,816 lines are distinct and nondegenerate. +For a fixed Q=p_j the first-stage active space is F2^9 tensor Q; the +second-stage active space is P tensor F2^9. This supplies actual binary +subspaces for the boundary calculation, not the chronological global owner +map or the old triple-center producer. Opposite-orientation P104 execution +in this scaffold is deliberately granted only as a favorable cost hypothesis. + +The native-boundary proof pins +C_u=((1+i)I+(1-i)X_u)/2. Consequently +``` +C_u^-1-C_v^-1 = (1+i)(X_u-X_v)/2. +``` +For distinct nonzero binary u,v, X_u-X_v has rank 2^(m-1), since exactly +half the Fourier characters separate their parities. A nonzero B entry +therefore cannot move unchanged through the port-dependent T^-1 family: +[D,T^-1]_ij=D_ij(T_j^-1-T_i^-1) is nonzero. + +The receipt gives original ports 0 and 2 as one explicit half-coefficient +edge, along with their physical labels, tensor vectors and a separating +frequency. On the four-address span {0,u,v,u+v}, a 4-delta input produces +opposite nonzero Gaussian values +(1+i) and -(1+i), up to the sign of B. +The separate checker reconstructs the literal four-address translation +matrices and their rank two difference. + +For a fixed nonzero Q, contraction of an 81-bit Fourier character with Q +ranges over all 512 vectors in F2^9, each equally often. The complete +512-pattern check finds that D commutes with T^-1 only for the homogeneous +patterns z=0 and z=511; the other 510 fail. This is exact for this finite +P104 encoding and gauge. It is not a no-intertwiner theorem for changed +encodings, paid cross-port operators or other geometries. + +Positive control: any common completed operator C on every role commutes with +E0, since its entries are scalar bank coefficients. Thus a matched entrance +and exit encoding can pass through an already completed uniform tensor call. +This is why the present boundary obstruction does not close every jointly +designed encoded caller. + +## 4. Port-dependent endpoint normalization + +For any binary u, C_u^2=X_u and the retained normalization generalizes to +``` +i^wt(u) Z_u (F C_u^-2) Z_u = F. +``` +On Fourier character z the exponent difference is +wt(u)+wt(z xor u)+2*(z xor u).u-wt(z), a multiple of four. +This proves the identity on all address functions. The checker additionally +evaluates 5,537,792 explicit (tensor line, character) pairs. + +The old triple generators have weight nine. In this explicit P104 product +gauge, 5,440 lines have weight 1 mod 4 and 5,376 have weight 3 mod 4. +For one parallel column, using the old constant i^9 on the latter gives the +wrong global sign. For f parallel columns the correct scalar is i^(f*wt(u)); +this particular sign error disappears when f is even. The corrected phase is +explicit and introduces no positive-rank child, but its +phase/address passes remain paid physical work. These counts are +gauge-specific; no obstruction to choosing a better physical gauge is claimed. + +## 5. Complete conditional cost gate for this scaffold + +Enumerate n=104 row fibers and n column fibers. The persistent owner inventory +is two n-by-n data banks plus two DISJOINT banks of 72 helpers per fiber: +``` +N=n^2=10816, W=2n^2+2n*72=36608, m=9*9=81. +``` +Each data pair begins with source chart C_U of rank one and target identity. +All other persistent entrances are identity. The retained completed all-role +contract is full F on every one of the W physical roles. Therefore required +persistent progress is P_total=81W-N=2,954,432. + +The rejection has the following explicit hypotheses: +(a) 2n=208 whole local calls, each granted the same favorable corrected P104 +profile of mass M=2576, even in the unproved opposite orientation; +(b) each local block supplies at most P=2312 of that persistent progress; +(c) disjoint persistent helpers as enumerated, the above entrance/exit contract, +and no uncharged frame preparation; +(d) all remaining native work has rank tariff at least its net persistent +dimension progress; all child ranks are at most 81; +(e) the retained equal physical-role volume factor 1/W. +These are a named proposed replacement model, not a proved global P104 embedding. + +The original 4,058-event witness is used only to recount mass 2368 and +persistent progress 2312; adding the retained 208-H1 correction gives 2576. +Neither its full endpoint nor its native recipes are freshly replayed here. +The local I-G/2 correction does not earn the same progress a second time. +The most favorable remaining rank is consequently +``` +P_total - 208*2312 = 2473536, +lower mass = 208*2576 + 2473536 = 3009344, +capacity = 81*36608 = 2965248, +excess = 44096 > 0. +``` +This deliberately most favorable bound permits a new joint implementation to +absorb the old physical endpoint correction. If instead one retains the +literal decode / old-P / encode route, the caller's separately paid rank-one +copy transforms contribute another N=10,816 units with no persistent progress: +the lower mass is then 3,020,160 and the excess is 54,912, before decoding, +encoding, scalar copy/add/disposal or any other new work. This second number +is a bound for that literal route, not a lower bound on arbitrary resynthesis. +For 0<=a<1, (r/81)^(1-a)>=r/81. Hence the complete favorable moment is +at least 3,009,344/2,965,248 > 1 before any new encoded boundary work. +Adding b fully paid persistent banks adds 81b to both bill and capacity, +preserving the 44,096 excess. This is a different scaffold from PR3940's +width-73 nine-call law and PR3943's hypothetical paired chain. Their 1,544, +425/426 and other thresholds are not transferred here. + +The full gate is +``` +M_complete(a) >= [sum_local_children (r/81)^(1-a) + + sum_remaining_children (r/81)^(1-a)] / W + + A_intertwiners(a)+A_scalar(a)+A_physical(a) < 1. +``` +The A terms include acquisition/encoding/decoding, the explicit Pi occupancy +map and fixed-slot return, both changed-bank updates, +endpoint work not already counted in the chosen native route, new wrappers, +routing/holding/control/tape, finite +width/precision/recovery and recursive admission as applicable. They are +unknown nonnegative costs, not zero. No numerical physical total is supplied. +Even granting them all zero, the native lower bill already fails. Under this +unchanged invoice at least 44,097 net rank units of improvement are necessary +at a=0, and are not sufficient at positive a or with added costs. +A changed owner inventory, coverage law, net progress or local profile needs +a newly derived gate. + +Decision: NARROW. Publish the compatibility equations, explicit counterexamples +and conditional complete-cost rejection. Do not expand native/supplier +construction for this scaffold. A genuinely different joint encoding or owner/ +coverage contract remains open. diff --git a/research/p104-two-axis-compatibility/README.md b/research/p104-two-axis-compatibility/README.md new file mode 100644 index 0000000000..c722f200b5 --- /dev/null +++ b/research/p104-two-axis-compatibility/README.md @@ -0,0 +1,141 @@ +# P104 residuals at a two-axis physical endpoint + +**Scoped physical compatibility theorem and conditional cost rejection. +No supplier, new kappa or selected-frontier change.** + +PR3940 established a common-chart inverse-shear comparison. This successor +derives the actual terminal-chart encoding, its conjugated paid correction, +an explicit physical counterexample to unchanged correction, and a complete +conditional gate for a specified 9-by-9 tensor-line replacement scaffold. + +The named caller is canonical notes/copied-centers-complex.tex. For its +A=-Fy, B=F T^-2 x+E y endpoint, write r=D u+H w, with +D=[[I,B_0],[B_0^t,B_0^t B_0-I]], H=diag(0_8,I_96). +Here B_0 is the P104 pivot matrix; it is distinct from the caller's B output. + +Established results, with full proofs in [PROOF.md](PROOF.md): + +- Carrying the common-chart encoding through the inverse shear requires + r <- r-Dw. Its direct scalar word has 5,000 unit ADD/SUBs, 104 halves and + 104 restoring doubles under the stated common-FULL/writable-donor contract. + This is not an optimum or an improvement on PR3940's fused word. +- At the physical terminal charts the encoding is + L_T=[[D,H T],[0,I]], not the scalar E0. The exact conjugated correction is + supplied. Reusing the old correction gives the explicit defect + [[-H,0],[T^-1(D-I),H]]. The required first-bank increment has linear rank + 96 per address. This is NOT a 96-unit native-cost lower bound. +- Literal occupancy is retained explicitly: Pi swaps the two data slots at + N, so the physical encoding is A_T=Pi L_T and its correction is + Pi P_encoded Pi. Applying the old correction directly in those literal + slots has first-bank defect -H T^-1. Pi, chart alignment and fixed-slot + return are not granted as free physical moves or owner relabelings. +- The 104 physical root labels give 10,816 distinct nondegenerate lines + p_i tensor p_j in dimension 81. All 512 phase patterns of a fixed fiber + are checked: only the two homogeneous patterns commute with D; 510 fail. + A literal four-address translation witness is supplied. A completed + common transform on every role is a positive commuting control. +- The retained constant weight-nine endpoint phase needs adjustment in this + explicit gauge: for one parallel column, 5,376 of the 10,816 tensor lines + require the opposite sign (this sign mismatch cancels for even column count). + The actual i^wt(u) phase is supplied and proved for every address. + This finite census is gauge-specific, not a general obstruction. +- Under the expressly favorable unchanged local profile/progress, separate + helper banks, original physical entrance/exit and equal-volume assumptions, + the proposed two-axis scaffold needs at least 3,009,344 rank units against + capacity 2,965,248. The 44,096 excess survives any finite number of fully + paid extra banks. The moment fails for 0<=a<1 before new boundary work. + This is its own gate; PR3940's 1,544 deficit and PR3620's thresholds are + not transferred. + +**Decision: NARROW.** The equations identify the precise changed operations; +the named favorable cost model already rejects implementation expansion. +Unknown encoder/decoder, intertwiners, endpoint copy/add/disposal, owners, +routing/holding/control/tape, width/precision/recovery and recursive costs +are listed in the proof and not set to zero. + +The product-line scaffold is a concrete proposed replacement geometry, not an +embedding into the old h=28 mixed-center producer or an implemented global +owner schedule. Its opposite-orientation local calls are granted for the +conditional screen, not proved executable. Native recipes, signed-floor +execution, the old channel's full endpoint replay, selected cold replay, +all-size transfer, independent human review and formal-kernel acceptance +are not claimed. + +Port transforms are explicitly oriented by the native boundary formula +C_u=((1+i)I+(1-i)X_u)/2, with E=F C_u^-1. Any adjustment to another +ambient-projector/chart orientation must be proved and paid; the finite +phase census is bound to these stated operators and this coordinate gauge. + +## Reproduce + +Standard-library CPython 3.12, from a genuine complete-history checkout: + +```sh +python3.12 -I -B scripts/research_package.py --package research/p104-two-axis-compatibility +python3.12 -B scripts/check_research_commit.py --package research/p104-two-axis-compatibility --check-source-history +``` + +Direct commands also work from a source-complete Git-free export: + +```sh +python3.12 -I -B research/p104-two-axis-compatibility/verify.py +python3.12 -I -O -B research/p104-two-axis-compatibility/independent.py +python3.12 -I -O -B research/p104-two-axis-compatibility/test_verify.py +``` + +The primary reconstructs a physical root isometry and all 14,400 pairings, +D and its inverse, all 512 fiber phase patterns, 1,024 exact dense Gaussian +conjugation fixtures, all 208 data columns at four patterns, 5,537,792 +normalization-character checks and the cost gate. The original channel is +used to recount its profile and persistent progress, not freshly replayed +as a native program. The separate checker imports no primary/predecessor +executable; it uses all 240 roots, rational elimination, a noncommutative +operator algebra, literal four-address translations and explicit owner-name +sets. Both share one AI-assisted source context. + +Eight behavioral groups include wrong reader, omitted changed-bank update, +wrong phase, homogeneous positive controls, undercharged/fully-paid-bank +budgets, operator-order controls, and actual optimized Git-free read-only +CLI checks with Boolean receipt, falsified bill, altered and missing inputs. +RESULT.json is compared by complete canonical typed JSON. Normal verification +does not regenerate it; --write-result is an explicit development option +which refuses to overwrite a receipt. + +## Open next questions + +A useful changed proposal must identify a concrete hypothesis it changes: +a joint entrance/exit encoding across already completed uniform calls, a +different physical gauge, or genuine owner/coverage/profile relief. First +supply its all-role intertwiner and a complete favorable budget. A new scalar +word alone does not repair the rejected scaffold. TASK.json gives the first +step and stopping rule. No further native search is reserved. + +## Sources, overlap and credit + +Canonical base 20ecf2891d80b5acf18d980b2164fb44ea7faa90, priority revision 6. +SOURCES.json pins only canonical live inputs and original catalogue/selected +provenance. The algebra is reconstructed here; no foreign pending executable +is imported. Exact pending predecessor meanings/heads are in PREDECESSORS.json. + +Credit Clear1nsight/PR3882 and PR3940 for the residual boundary and caller-cut +audit; 1337isnot1337/PR3894 for the direct correction; Rohan Arun/PR1972, +Chafik Boukhalfa/PR1991, Adam Gall/PR1940, Josie Elliston/PR1071 and the +retained E8/native lineage. The physical isometry method and C_u boundary +formula are inherited from Chafik's native package and independently +reconstructed, not claimed new. Credit Aurel Prosz/Paureel, Zhihao Chen, +Rohan Arun, Dominik Scholz and icekylinx for the actual caller/normalization; +Sagar Thakrar/PR1012, Douglas Colkitt, Jose Manuel and Vasek/PR2744 for +coverage and complete-budget discipline. PR3609/3620 retain their different +dual and threshold scopes. + +Credit parallel PR3943 (2cba526a4ebe0ef6c3c0143498adcf67dca97941) for the +actual internal Q-cleanup consumer, parallel return analysis and its separate +hypothetical-chain rejection. This package does not repeat that consumer, +compare 960 versus 1152 adapter counts or claim a new 192-transport floor. +Entry overlap covered 650 open PR bodies including drafts over seven pages, +the repository helper, and bounded live #1166 handoffs. No complete +Discussion cache, exhaustive diff survey or novelty guarantee is claimed. + +Clear1nsight, with substantial OpenAI Codex assistance. New work Apache-2.0; +all predecessor attribution retained. The two implementations are distinct +checks in one assisted session, not independent human review. diff --git a/research/p104-two-axis-compatibility/RESULT.json b/research/p104-two-axis-compatibility/RESULT.json new file mode 100644 index 0000000000..c7ed0ea02e --- /dev/null +++ b/research/p104-two-axis-compatibility/RESULT.json @@ -0,0 +1 @@ +{"D_entries":5000,"D_inverse_checked_entries":10816,"commutator_nonzero_blocks":1277952,"commuting_patterns":[0,511],"constant_weight_nine_phase_failures":5376,"decision":"NARROW; no native/supplier expansion within the rejected scaffold","dense_conjugation_fixtures":1024,"dirty_action":"identity in compatibility maps; completed physical F is inherited, not freshly executed","dirty_roles":72,"encoded_residual_change_rank_per_address":96,"gate":{"W":36608,"capacity":2965248,"data_pairs":10816,"excess":44096,"local_calls":208,"lower_mass":3009344,"m":81,"remaining_rank":2473536,"required_progress":2954432},"independent_data_columns":832,"label_isometry":{"dual":[453,420,199,200,160,18,141,95,3],"orth":[1,8,257,259,260,291,307,351,447],"pivots":[0,1,2,3,6,12,20,30,42]},"literal_reader":{"coefficient_sha256":"aefbaffc2d02f240d640e69357322d871bbb95f8325cae07efed52c9b206cd3a","counts":{"add":5000,"double":104,"half":104},"events":5208,"input_columns":280},"noncommuting_patterns":510,"normalization_character_checks":5537792,"phase_patterns":512,"physical_labels":[386,391,431,426,127,122,82,87,405,445,440,351,304,290,295,309,346,357,31,32,79,93,88,74,37,26,224,223,176,162,167,181,218,229,261,494,385,406,446,425,454,468,289,310,345,331,358,372,283,94,73,38,52,25,11,100,115,134,148,251,236,196,211,188,174,161,182,217,203,230,244,155,140,121,107,4,19,59,44,67,81,262,276,379,324,339,316,302,475,460,419,433,398,481,502,301,434,397,482,501,487,392,439,296],"root_pairings":14400,"schema_version":1,"scope":"Physical endpoint equations and explicit tensor-line scaffold; conditional unchanged-profile cost rejection, not a global owner embedding or supplier.","status":"PASS_P104_TWO_AXIS_COMPATIBILITY","tensor_dimension":81,"tensor_lines":10816,"tensor_weights_mod_four":{"1":5440,"3":5376},"witness":{"D_twice_coefficient":1,"donor_port":2,"frequency":1,"p_donor":405,"p_row":386,"physical_difference_rank":"2^(m-1)","q":386,"row_port":0,"u_donor":1826393684020434815156610,"u_row":1826393683993908996146176}} diff --git a/research/p104-two-axis-compatibility/SOURCES.json b/research/p104-two-axis-compatibility/SOURCES.json new file mode 100644 index 0000000000..41aa38137b --- /dev/null +++ b/research/p104-two-axis-compatibility/SOURCES.json @@ -0,0 +1,42 @@ +{ + "schema_version": 1, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "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": "notes/copied-centers-complex.tex", + "usage": "input", + "git_blob": "fddd7bc7f2a2f749ba6eada19d153bf9243ee31c", + "sha256": "18eac6d5c5755e53230c0c12a633f38b6ce9666ef0322c1aff79394f2952af72" + }, + { + "path": "research/p104-native-channel/PROOF.md", + "usage": "input", + "git_blob": "a69311b74f74a2f8e8f411c1451baacd9bacddce", + "sha256": "5d743145d389ffdfaffc66096fa7e32c7155b18f73d74755403151d0435bb94c" + }, + { + "path": "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "usage": "input", + "git_blob": "86beaf424e9f0f800ae3a62797d94ec9386b7706", + "sha256": "0f541bef7f19fdeffd67157684e9f03d785f42c89973632f508fc1a0452b580e" + }, + { + "path": "research/p104-native-channel/inputs/P104-FIXTURE.json", + "usage": "input", + "git_blob": "2e16f99b295bb386fd13bd8fbd57b42ef54143a9", + "sha256": "516c06f6ec3cb84be588c546108de897650288576dd5fbf5fe44b9c5546ad8a4" + } + ] +} diff --git a/research/p104-two-axis-compatibility/TASK.json b/research/p104-two-axis-compatibility/TASK.json new file mode 100644 index 0000000000..1431923aab --- /dev/null +++ b/research/p104-two-axis-compatibility/TASK.json @@ -0,0 +1,135 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 6, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "original_card": { + "id": "p104-side-correction", + "question": "Can the proposed P104 joint endpoint flags be realized by a chronological correction program with coefficients, dirty restoration and an affordable complete bill?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/p104-native-channel/README.md", + "research/p104-native-channel/PROOF.md", + "docs/research/community-efficient1000-review.md", + "research/p104-joint-unit-flags/README.md" + ], + "methods": [ + "Construct one side-correction word at an explicit chronological cut with the needed frames still available.", + "Derive a lower bound on the side correction and hosting costs that decides whether this channel can beat the selected budget." + ], + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the revision-6 family record and #2981 static joint flags, alongside the reviewed #1991 channel. #2981 is an author-checked source archive, not an independently validated executable correction or a refutation of program-level lifetime floors.", + "scope": "Source-bound orientation only. Read the named package and review before relying on its local evidence; this command is not its replay or supplier admission." + }, + "first_experiment": "After checking live handoffs, pin one named collection from #2981 and attach acquisition/delivery times, source dependencies and coefficient requirements. Test legal access and arbitrary dirty restoration; price any completion against the full channel/endpoint/hosting allowance. Stop with the exact missing implication or a scoped counterexample rather than expanding the static cover census.", + "bottleneck_link": "Completing an already realized changed channel tests a concrete construction opportunity, instead of refining the incumbent packing. A positive local result still needs global and all-size admission.", + "allowed_variations": [ + "One correction factorization, one chronological cut, or one explicit hosting obstruction.", + "A changed correction schedule with an updated full bill and native frame contract." + ], + "scope_change_triggers": [ + "Recompiling the already certified low-rank channel without closing a new obligation.", + "Treating a pending ancestor, local histogram or unpriced side correction as an admitted global supplier.", + "Repeating a correction or physical conversion already supplied by a pending follow-up without adding independent coverage or a different unresolved obligation.", + "Repeating the 208-flag static matching or calling a static nested cover a chronological correction program. Independent audit of that certificate is distinct and remains useful." + ], + "overlap_terms": [ + "P104", + "I-G/2", + "side correction", + "native channel", + "1972", + "1991", + "2586", + "endpoint transport", + "physical dual", + "relay composition", + "2981", + "joint unit flags", + "acquisition delivery", + "static nesting" + ], + "existing_checks": [ + { + "scope": "PR #2981 reports static joint endpoint flags and a matching of 208 departure and arrival flags; archival intake is not independent verification.", + "evidence": "research/p104-joint-unit-flags/README.md", + "remaining": "Independent flag check and a chronological coefficient program with dirty restoration and a complete cost.", + "status": "author-checked", + "source_commit": "3d24b92d8ba057b57cb2d480170ec407520e6882", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Retained ordered and literal-slot physical endpoint/correction conjugation, including Pi occupancy; explicit 104x104 P104 tensor-line scaffold and phase controls; unchanged-profile conditional rejection. Not the h=28 producer embedding, native admission or a global owner schedule.", + "scope_change_reason": "Explicit donor assignment follows PR3940: replace the logical caller-cut question by one physical two-axis residual-compatibility theorem and complete conditional cost gate.", + "bottleneck_link": "Decides whether carrying the encoded residuals through an actual physical two-axis endpoint can avoid repaying source-return work; the exact conjugated operations and favorable cost gate are supplied.", + "budget_minutes": 60, + "stop_rule": "Stop native/supplier construction when the named complete favorable screen fails; retain exact compatibility result and release changed-contract questions.", + "outcome": "partial", + "evidence": "Written operator proof, exact physical labels, all 512 fiber phase patterns, literal 280-input reader, independent noncommutative/rational/translation checker, meaningful CLI controls.", + "author": "Clear1nsight", + "ai_assistance": "Substantial OpenAI Codex assistance in one session. Separate implementations share the assisted context; not independent human review.", + "open_questions": [ + { + "question": "Can a changed joint entrance/exit encoding or physical owner/coverage law give a favorable complete bill?", + "why_it_matters": "The fixed encoding requires a changed correction on both banks and the explicitly granted 9x9 scaffold fails before new overhead.", + "first_step": "Supply one all-role intertwiner and exact owner/progress/profile ledger; account for all added conversions, copy/disposal, precision and routing before any native expansion.", + "blocked_by": "No proved favorable replacement coverage, opposite-orientation local implementation or global owner map." + } + ], + "family_decision": "NARROW", + "selection": "Explicit assignment; no picker reroll.", + "checkpoints": [ + { + "utc": "2026-10-19T06:09:58Z", + "main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "priority_revision": 6, + "decision": "Assigned bounded physical caller study" + }, + { + "utc": "2026-10-19T06:28:00Z", + "main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "priority_revision": 6, + "decision": "NARROW: derive and verify physical equations and rejected favorable scaffold; no native expansion" + }, + { + "utc": "2026-10-19T06:34:05Z", + "main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "priority_revision": 6, + "decision": "NARROW; prepublication refresh unchanged; latest-100 PR delta and active Discussion guidance checked" + }, + { + "utc": "2026-10-19T06:42:59Z", + "main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "priority_revision": 6, + "decision": "Final boundary review made the literal Pi occupancy explicit and independently verified its conjugated correction and direct counterexample; scientific numerical gate unchanged." + } + ], + "overlap": { + "open_pr_records": 650, + "pages": 7, + "complete_pagination": true, + "atomic": false, + "helper": "scripts/find_overlap.py --offline --cache /tmp/p104-two-axis-overlap.json --task p104-side-correction two-axis intertwiner", + "discussions": "Bounded live #1166 handoffs and existing #3940 canonical investigation; #1163/active page rechecked before publication.", + "nearest": [ + 3882, + 3894, + 3940, + 3943, + 3609, + 3620 + ], + "limits": "No complete Discussion cache, exhaustive historical/diff search or novelty guarantee.", + "prepublication_delta": "Latest 100 updated open PR bodies; new QQ16/P112/retiming proposals have distinct contracts. PR3943 science head unchanged; fresh #1163 and active Discussion page read. No full Discussion cache." + }, + "canonical_investigation": "https://github.com/CrocSwap/integer-mult-bounds/pull/3940#issuecomment-6260960927" +} diff --git a/research/p104-two-axis-compatibility/VALIDATION.json b/research/p104-two-axis-compatibility/VALIDATION.json new file mode 100644 index 0000000000..34171318ce --- /dev/null +++ b/research/p104-two-axis-compatibility/VALIDATION.json @@ -0,0 +1,48 @@ +{ + "schema_version": 1, + "scope": "Author/AI-assisted exact boundary proof and conditional cost gate; no physical supplier", + "environment": "CPython 3.12.3, Linux, standard library", + "checks": [ + { + "check": "package metadata and canonical source pins", + "status": "PASS" + }, + { + "check": "primary root/frame/operator/reader/phase/gate replay", + "status": "PASS" + }, + { + "check": "separate noncommutative, rational-rank, translation and owner-set checker", + "status": "PASS" + }, + { + "check": "eight behavioral groups with actual optimized Git-free and corrupt/missing source/receipt/bill controls", + "status": "PASS" + }, + { + "check": "optimized primary", + "status": "PASS; rechecked before publication" + }, + { + "check": "registered three-command replay", + "status": "PASS; repeated after final edits" + } + ], + "baseline": { + "status": "NOT_COMPLETED", + "reason": "The source-bound selected baseline stopped because research/community-frontier1094-audit/ASSEMBLY.json and the full selected package closure are outside the sparse checkout. The selected record itself is pinned unchanged; no baseline or selected cold pass is claimed." + }, + "publication": { + "status": "Checks require the genuine published HEAD; subsequent byte/source-history/export and hosted evidence is recorded in the PR and external publication receipt, not retroactively attributed to this source-time record." + }, + "unrun": [ + "Full existing native channel and changed native recipes", + "Literal signed-floor and finite-width execution", + "Physical opposite-orientation P104 caller/global owner schedule", + "Full selected cold replay and all-size supplier transfer", + "Independent human review and formal-kernel acceptance" + ], + "lint": "No lint pass claimed", + "attribution": "Clear1nsight, substantial OpenAI Codex assistance; separate algorithms share one assisted context.", + "boundary_review": "Final review explicitly adds literal mixed-slot occupancy A_T=Pi L_T, Pi P_encoded Pi and the direct literal-slot defect. The separate noncommutative checker verifies those identities. Numerical results, source inputs and cost gate are unchanged." +} diff --git a/research/p104-two-axis-compatibility/VERIFY.json b/research/p104-two-axis-compatibility/VERIFY.json new file mode 100644 index 0000000000..eae66c505e --- /dev/null +++ b/research/p104-two-axis-compatibility/VERIFY.json @@ -0,0 +1,46 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "notes/copied-centers-complex.tex", + "research/p104-native-channel/PROOF.md", + "research/p104-native-channel/inputs/LOWRANK-WITNESS.json", + "research/p104-native-channel/inputs/P104-FIXTURE.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Source authentication, root isometry, literal 280-input reader, physical conjugation, all fiber phases, normalization and complete conditional gate." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/independent.py" + ], + "timeout_seconds": 120, + "checks": "Separate noncommutative physical endpoint/correction proof, 240-root/rational ranks, literal translation witness, phase and owner-set cost recount." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/test_verify.py" + ], + "timeout_seconds": 180, + "checks": "Eight behavioral groups including actual optimized read-only Git-free export, altered/missing input, typed receipt and false bill CLI rejection." + } + ] +} diff --git a/research/p104-two-axis-compatibility/independent.py b/research/p104-two-axis-compatibility/independent.py new file mode 100644 index 0000000000..15f37c90e7 --- /dev/null +++ b/research/p104-two-axis-compatibility/independent.py @@ -0,0 +1,172 @@ +#!/usr/bin/env python3 +"""Separate symbolic/physical check; imports no primary or predecessor code.""" +from collections import Counter +from fractions import Fraction +import hashlib +import itertools +import json +from pathlib import Path +P=Path(__file__).resolve().parent +R=P.parents[1] + +def require(x, why): + if not x: + raise ValueError(why) + +def norm(word): + word=list(word) + changed=True + while changed: + changed=False + for i in range(len(word)-1): + a,b=word[i:i+2] + if (a,b) in [('D','d'),('d','D'),('T','t'),('t','T')]: + word[i:i+2]=[]; changed=True; break + if (a,b)==('H','H'): + word[i:i+2]=['H'];changed=True;break + if a in ('T','t') and b=='H': + word[i:i+2]=['H',a];changed=True;break + if a in ('D','d','H','T','t') and b=='F': + word[i:i+2]=['F',a];changed=True;break + return tuple(word) + +def plus(*xs): + out=Counter() + for x in xs: + for k,v in x.items(): + out[k]+=v + return {k:v for k,v in out.items() if v} + +def times(a,b): + out=Counter() + for k,v in a.items(): + for l,w in b.items(): + out[norm(k+l)]+=v*w + return {k:v for k,v in out.items() if v} + +def scale(a,k): + return {w:k*v for w,v in a.items() if k*v} + +def mm(a,b): + return [[plus(*(times(a[i][k],b[k][j]) for k in range(2))) for j in range(2)] for i in range(2)] + +def atom(*w): + return {tuple(w):1} + +def algebra(): + one,zero=atom(),{} + D,d,H,T,t=(atom(v) for v in ['D','d','H','T','t']) + ht=times(H,T) + e=[[D,ht],[zero,one]] + ei=[[d,scale(times(d,ht),-1)],[zero,one]] + p=[[one,zero],[t,one]] + require(mm(e,ei)==[[one,zero],[zero,one]],'symbolic inverse') + hd=times(H,d) + want=[[plus(one,hd),scale(times(hd,ht),-1)], + [times(t,d),plus(one,scale(times(times(t,d),ht),-1))]] + require(mm(mm(e,p),ei)==want,'noncommutative physical correction') + e0=[[D,H],[zero,one]] + ei0=[[d,scale(times(d,H),-1)],[zero,one]] + shear=[[one,scale(one,-1)],[zero,one]] + require(mm(mm(e0,shear),ei0)==[[one,scale(D,-1)],[zero,one]],'encoded inverse shear') + F=atom('F') + common=[[F,zero],[zero,F]] + require(mm(e0,common)==mm(common,e0),'completed common-axis positive control') + forward=[[one,zero],[one,one]] + entrance=[[t,zero],[zero,one]] + G=[[F,zero],[zero,times(F,t)]] + physical=mm(mm(mm(G,shear),forward),entrance) + require(physical==[[zero,scale(F,-1)],[atom('F','t','t'),atom('F','t')]],'retained physical endpoint') + require(mm(p,physical)==[[zero,scale(F,-1)],[atom('F','t','t'),zero]],'paid endpoint correction') + comm=[[scale(H,-1),zero],[times(t,plus(D,scale(one,-1))),H]] + diff=[[plus(mm(p,e)[i][j],scale(mm(e,p)[i][j],-1)) for j in range(2)] for i in range(2)] + require(diff==comm,'blind correction defect') + J0=plus(one,scale(H,-1)) + Pi=[[J0,H],[H,J0]] + require(mm(Pi,Pi)==[[one,zero],[zero,one]],'literal slot permutation') + actual=mm(Pi,e) + actual_inverse=mm(ei,Pi) + require(mm(mm(actual,p),actual_inverse)==mm(mm(Pi,want),Pi),'literal encoded correction') + actual_defect=[[scale(times(H,t),-1),zero], + [plus(times(times(t,J0),plus(D,scale(one,-1))),scale(H,-1)),times(t,H)]] + defect=[[plus(mm(p,actual)[i][j],scale(mm(actual,p)[i][j],-1)) for j in range(2)] for i in range(2)] + require(defect==actual_defect,'literal slot blind-correction defect') + # Nonzero Hd cannot be suppressed merely because it is a residual output. + require(hd!=zero,'residual update control') + return want + +def rankq(a): + a=[[Fraction(v) for v in row] for row in a] + r=0 + for c in range(len(a[0])): + i=next((i for i in range(r,len(a)) if a[i][c]),None) + if i is None: + continue + a[r],a[i]=a[i],a[r] + q=a[r][c];a[r]=[v/q for v in a[r]] + for i in range(len(a)): + if i!=r and a[i][c]: + q=a[i][c];a[i]=[v-q*w for v,w in zip(a[i],a[r])] + r+=1 + return r + +def check(): + receipt=json.loads((P/'RESULT.json').read_text()) + require(type(receipt['schema_version']) is int and receipt['schema_version']==1,'typed receipt') + sources=json.loads((P/'SOURCES.json').read_text()) + for x in sources['files']: + if x['usage']=='input': + require(hashlib.sha256((R/x['path']).read_bytes()).hexdigest()==x['sha256'],'input SHA') + algebra() + # Enumerate all 240 E8 roots, then quotient signs by first nonzero entry. + rr=[] + for i in range(8): + for j in range(i+1,8): + for s,t in itertools.product((-2,2),repeat=2): + v=[0]*8;v[i]=s;v[j]=t;rr.append(tuple(v)) + rr += [v for v in itertools.product((-1,1),repeat=8) if sum(x<0 for x in v)%2==0] + lines=sorted({v if next(x for x in v if x)>0 else tuple(-x for x in v) for v in rr}) + require(len(rr)==240 and len(lines)==120,'separate root enumeration') + f=json.loads((R/'research/p104-native-channel/inputs/P104-FIXTURE.json').read_text())['section4_explicit_P104'] + removed=set(map(tuple,f['F0']+f['C'])) + ports=[v for v in lines if v not in removed] + pivot=[0,1,3,6,22,31,93,103] + order=pivot+[i for i in range(104) if i not in pivot] + ports=[ports[i] for i in order] + ip=lambda u,v:sum(a*b for a,b in zip(u,v)) + A=[[ip(u,v)//4 for v in ports] for u in ports] + D=[[2*(i==j) if i<8 and j<8 else A[i][j]-2*(i==j) for j in range(104)] for i in range(104)] + inv=[[-22*(i==j) if i<8 and j<8 else -2*(i==j) if i>=8 and j>=8 else A[i][j] for j in range(104)] for i in range(104)] + require(rankq(D)==104 and rankq(inv[8:])==96,'independent rational ranks') + labels=receipt['physical_labels'] + require(len(labels)==104 and len(set(labels))==104,'physical labels') + require(all(((labels[i]&labels[j]).bit_count()%2)==((A[i][j]+1)%2) for i in range(104) for j in range(104)),'independent label Gram') + commute=[] + for z in range(512): + signs=[(u&z).bit_count()%2 for u in labels] + if all(not D[i][j] or signs[i]==signs[j] for i in range(104) for j in range(104)): + commute.append(z) + require(commute==[0,511],'all phase patterns') + # Literal four-address translation matrices. 2*(C_u^-1-C_v^-1) + # equals (1+i)*(X_u-X_v); its rank is two, with nonzero global phase. + X=lambda u:[[int(i==(j^u)) for j in range(4)] for i in range(4)] + xu,xv=X(1),X(2) + diff=[[xu[i][j]-xv[i][j] for j in range(4)] for i in range(4)] + require(rankq(diff)==2 and [diff[i][0] for i in range(4)]==[0,1,-1,0],'literal physical witness') + weights=Counter((a.bit_count()*b.bit_count())%4 for a in labels for b in labels) + require({str(k):v for k,v in weights.items()}==receipt['tensor_weights_mod_four'],'normalization phase census') + require(weights[3]>0 and (9-3)%4==2,'fixed weight-nine phase counterexample') + profile=Counter(e[4] for e in json.loads((R/'research/p104-native-channel/inputs/LOWRANK-WITNESS.json').read_text())['program'] if e[0]=='transport') + require(sum(k*v for k,v in profile.items())==2368,'inherited mass recount') + # Recount occupied roles from explicit row/column owner names. + data={(bank,i,j) for bank in ['X','Y'] for i in range(104) for j in range(104)} + helper={(axis,fiber,h) for axis in [0,1] for fiber in range(104) for h in range(72)} + W=len(data)+len(helper) + progress=W*81-104**2 + bill=208*(2368+208)+progress-208*2312 + require((W,progress,bill,bill-W*81)==(36608,2954432,3009344,44096),'independent complete gate') + require(receipt['gate']['lower_mass']==bill and receipt['gate']['excess']==44096,'gate receipt') + print('PASS_SEPARATE_TWO_AXIS_SYMBOLIC physical_patterns=512 residual_rank=96 deficit=44096') + +if __name__=='__main__': + check() diff --git a/research/p104-two-axis-compatibility/test_verify.py b/research/p104-two-axis-compatibility/test_verify.py new file mode 100644 index 0000000000..051ade4e18 --- /dev/null +++ b/research/p104-two-axis-compatibility/test_verify.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +"""Behavioral and isolated CLI controls for the scoped two-axis audit.""" +import hashlib +import importlib.util +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile +import unittest +P=Path(__file__).resolve().parent +spec=importlib.util.spec_from_file_location('axis_primary',P/'verify.py') +V=importlib.util.module_from_spec(spec) +spec.loader.exec_module(V) + +class Controls(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.labels,cls.D,cls.Di,_=V.geometry() + + def test_omitted_residual_update_rejects(self): + r,b=[(0,0)]*104,[(0,0)]*104 + r[8]=(16,0) + t=[0]*104 + self.assertNotEqual(V.physical_correct(r,b,self.D,self.Di,t), + V.conjugated(r,b,self.Di,t,wrong=True)) + + def test_identity_inverse_reader_rejects(self): + w=[(0,0)]*104 + w[8]=(16,0) + self.assertNotEqual(V.halfmat(self.D,w),w) + with self.assertRaises(ValueError): + V.check_reader(self.D,V.reader_word(self.D)[:-1]) + + def test_wrong_port_phase_rejects(self): + r,b=[(0,0)]*104,[(0,0)]*104 + r[8]=(16,0) + t=[(q&1).bit_count()%2 for q in self.labels] + self.assertNotEqual(V.conjugated(r,b,self.Di,t), + V.conjugated(r,b,self.Di,[-v for v in t])) + + def test_homogeneous_axis_positive_control(self): + # A common Fourier phase acts on every role, so any dyadic + # bank matrix commutes with it. This is deliberately a positive case. + a=[(16*i,-16*(i%3)) for i in range(104)] + for k in range(4): + self.assertEqual(V.halfmat(self.D,V.phase(a,[k]*104)), + V.phase(V.halfmat(self.D,a),[k]*104)) + + def test_cost_and_fully_paid_banks(self): + profile={1:1282,2:58,3:86,4:104,5:48,6:24,7:8,8:8} + for b in (0,1,104,10000): + self.assertEqual(V.cost_gate(profile,paid_banks=b)['excess'],44096) + self.assertEqual(V.cost_gate(profile,extras=23)['excess'],44119) + with self.assertRaises(ValueError): + V.cost_gate(profile,extras=-1) + with self.assertRaises(ValueError): + V.cost_gate(profile,paid_banks=-1) + + def test_fixed_weight_nine_phase_rejects(self): + counts=json.loads((P/'RESULT.json').read_text())['tensor_weights_mod_four'] + self.assertEqual(counts,{'1':5440,'3':5376}) + self.assertEqual((9-3)%4,2) + self.assertEqual((2*(9-3))%4,0) + + def test_noncommutative_order(self): + spec=importlib.util.spec_from_file_location('axis_independent',P/'independent.py') + I=importlib.util.module_from_spec(spec);spec.loader.exec_module(I) + I.algebra() + self.assertNotEqual(I.norm(('D','T')),I.norm(('T','D'))) + self.assertNotEqual(I.atom('H','d'),{}) + + def test_git_free_read_only_and_real_cli_faults(self): + sources=json.loads((P/'SOURCES.json').read_text())['files'] + with tempfile.TemporaryDirectory(prefix='two-axis-cli-') as d: + root=Path(d) + dest=root/'research'/P.name + shutil.copytree(P,dest,ignore=shutil.ignore_patterns('__pycache__')) + for row in sources: + if row['usage']=='input': + q=root/row['path'];q.parent.mkdir(parents=True,exist_ok=True) + shutil.copyfile(V.ROOT/row['path'],q) + originals={p:hashlib.sha256(p.read_bytes()).hexdigest() for p in root.rglob('*') if p.is_file()} + for p in originals:p.chmod(0o444) + cmd=[sys.executable,'-I','-O','-B',str(dest/'verify.py')] + def run(): + return subprocess.run(cmd,cwd=root,capture_output=True,text=True,timeout=120) + result=run() + self.assertEqual(result.returncode,0,result.stderr) + self.assertTrue(all(hashlib.sha256(p.read_bytes()).hexdigest()==h for p,h in originals.items())) + receipt=dest/'RESULT.json';saved=receipt.read_bytes();receipt.chmod(0o644) + x=json.loads(saved);x['schema_version']=True;receipt.write_text(json.dumps(x)) + self.assertNotEqual(run().returncode,0) + receipt.write_bytes(saved) + x=json.loads(saved);x['gate']['excess']-=1;receipt.write_text(json.dumps(x)) + self.assertNotEqual(run().returncode,0) + receipt.write_bytes(saved) + q=root/next(row['path'] for row in sources if row['usage']=='input') + q.chmod(0o644);saved=q.read_bytes();q.write_bytes(saved+b'\n') + self.assertNotEqual(run().returncode,0) + q.write_bytes(saved);q.rename(q.with_suffix(q.suffix+'.missing')) + self.assertNotEqual(run().returncode,0) + +if __name__=='__main__': + unittest.main() diff --git a/research/p104-two-axis-compatibility/verify.py b/research/p104-two-axis-compatibility/verify.py new file mode 100644 index 0000000000..c6accf6a72 --- /dev/null +++ b/research/p104-two-axis-compatibility/verify.py @@ -0,0 +1,292 @@ +#!/usr/bin/env python3 +"""Exact two-axis boundary audit. Apache-2.0; scope and credit in README.""" +import argparse +from collections import Counter +import hashlib +import itertools +import json +from pathlib import Path +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +J = [0, 1, 3, 6, 22, 31, 93, 103] + +def need(ok, why): + if not ok: + raise ValueError(why) + +def read(path): + def unique(pairs): + d = {} + for k, v in pairs: + need(k not in d, 'duplicate JSON key') + d[k] = v + return d + return json.loads(path.read_text(encoding='utf-8'), object_pairs_hook=unique) + +def canonical(x): + return (json.dumps(x, sort_keys=True, separators=(',', ':')) + '\n').encode() + +def authenticate(): + for row in read(HERE / 'SOURCES.json')['files']: + if row['usage'] != 'input': + continue + p = ROOT / row['path'] + need(not p.is_symlink(), 'source symlink') + raw = p.read_bytes() + need(hashlib.sha256(raw).hexdigest() == row['sha256'], 'source hash: ' + row['path']) + need(hashlib.sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() == row['git_blob'], 'source blob') + +def rank_binary(rows): + basis = {} + for v in rows: + while v: + b = v.bit_length() - 1 + if b in basis: + v ^= basis[b] + else: + basis[b] = v + break + return len(basis) + +def inverse_binary(rows): + n = len(rows) + a = [r | (1 << (n + i)) for i, r in enumerate(rows)] + for j in range(n): + k = next(i for i in range(j, n) if a[i] >> j & 1) + a[j], a[k] = a[k], a[j] + for i in range(n): + if i != j and a[i] >> j & 1: + a[i] ^= a[j] + need([v & ((1 << n) - 1) for v in a] == [1 << i for i in range(n)], 'binary inverse') + return [v >> n for v in a] + +def geometry(): + roots = set() + for i, j in itertools.combinations(range(8), 2): + for s in (-1, 1): + r = [0] * 8 + r[i], r[j] = 2, 2 * s + roots.add(tuple(r)) + for signs in itertools.product((-1, 1), repeat=7): + if signs.count(-1) % 2 == 0: + roots.add((1,) + signs) + roots = sorted(roots) + dot = lambda a, b: sum(x * y for x, y in zip(a, b)) + rows = [sum((((dot(a, b) // 4) + 1) & 1) << j for j, b in enumerate(roots)) for a in roots] + ix, base = [], [] + for i, r in enumerate(rows): + if rank_binary(base + [r]) > len(base): + ix.append(i) + base.append(r) + need(len(ix) == 9, 'root-code rank') + labels = [sum(((r >> j) & 1) << k for k, j in enumerate(ix)) for r in rows] + dual = inverse_binary([labels[i] for i in ix]) + def pairing(a, b): + db = sum(((r & b).bit_count() % 2) << i for i, r in enumerate(dual)) + return (a & db).bit_count() % 2 + space, orth = list(range(512)), [] + for dim in range(9, 0, -1): + for v in space: + if not pairing(v, v): + continue + rest = [w for w in space if not pairing(v, w)] + if dim == 1 or any(pairing(w, w) for w in rest): + orth.append(v) + space = rest + break + else: + raise ValueError('orthonormal basis') + physical = [sum(pairing(l, v) << j for j, v in enumerate(orth)) for l in labels] + need(len(set(physical)) == 120, 'distinct physical roots') + need(all(((physical[i] & physical[j]).bit_count() % 2) == ((rows[i] >> j) & 1) + for i in range(120) for j in range(120)), 'all physical pairings') + fixture = read(ROOT / 'research/p104-native-channel/inputs/P104-FIXTURE.json')['section4_explicit_P104'] + removed = {tuple(r) for r in fixture['F0'] + fixture['C']} + original_ports = [r for r in roots if r not in removed] + order = J + [i for i in range(104) if i not in J] + ports = [original_ports[i] for i in order] + p = [physical[roots.index(r)] for r in ports] + need(len(p) == 104 and all(v.bit_count() % 2 for v in p), 'odd P104 roots') + A2 = [[dot(r, s) // 4 for s in ports] for r in ports] + B2 = [row[8:] for row in A2[:8]] + need(sum(bool(v) for row in B2 for v in row) == 384, 'B support') + need(all(sum(B2[i][t] * B2[j][t] for t in range(96)) == 48 * (i == j) + for i in range(8) for j in range(8)), 'BBt = 12I') + D2 = [[(2 * (i == j) if i < 8 and j < 8 else A2[i][j] - 2 * (i == j)) + for j in range(104)] for i in range(104)] + Di2 = [[(-22 * (i == j) if i < 8 and j < 8 else + -2 * (i == j) if i >= 8 and j >= 8 else A2[i][j]) + for j in range(104)] for i in range(104)] + need(all(sum(D2[i][k] * Di2[k][j] for k in range(104)) == 4 * (i == j) + for i in range(104) for j in range(104)), 'D inverse') + return p, D2, Di2, {'pivots': ix, 'dual': dual, 'orth': orth} + +def add(a, b): + return [(x[0] + y[0], x[1] + y[1]) for x, y in zip(a, b)] + +def neg(a): + return [(-x, -y) for x, y in a] + +def phase(a, powers): + return [((x, y), (-y, x), (-x, -y), (y, -x))[k % 4] for (x, y), k in zip(a, powers)] + +def halfmat(rows, vec): + out = [] + for row in rows: + a = sum(c * vec[j][0] for j, c in enumerate(row) if c) + b = sum(c * vec[j][1] for j, c in enumerate(row) if c) + need(a % 2 == b % 2 == 0, 'integer replay scale') + out.append((a // 2, b // 2)) + return out + +def mask(a): + return [(0, 0)] * 8 + a[8:] + +def encode(a, b, D, t): + return add(halfmat(D, a), phase(mask(b), t)), b + +def decode(r, b, Di, t): + return halfmat(Di, add(r, neg(phase(mask(b), t)))), b + +def physical_correct(r, b, D, Di, t): + a, _ = decode(r, b, Di, t) + return encode(a, add(b, phase(a, [-v for v in t])), D, t) + +def conjugated(r, b, Di, t, wrong=False): + delta = add(halfmat(Di, r), neg(halfmat(Di, phase(mask(b), t)))) + return (r if wrong else add(r, mask(delta))), add(b, phase(delta, [-v for v in t])) + +def reader_word(D): + word = [('add', i, 104+i, -1) for i in range(8)] + word += [('half', 104+i) for i in range(104)] + word += [('add', i, 104+j, -D[i][j]) for i in range(104) for j in range(104) + if D[i][j] and not (i < 8 and i == j)] + word += [('double', 104+i) for i in range(104)] + return word + +def check_reader(D, word): + state = [[2 * (i == j) for j in range(280)] for i in range(280)] + counts = Counter() + for op in word: + counts[op[0]] += 1 + t = op[1] + if op[0] == 'add': + _, t, s, c = op + need(t < 104 and 104 <= s < 208 and c in (-1, 1), 'strict unit reader') + state[t] = [a+c*b for a, b in zip(state[t], state[s])] + elif op[0] == 'half': + need(all(v % 2 == 0 for v in state[t]), 'reader exact half') + state[t] = [v//2 for v in state[t]] + elif op[0] == 'double': + state[t] = [2*v for v in state[t]] + else: + raise ValueError('reader instruction') + for i in range(280): + want = [2 * (i == j) for j in range(280)] + if i < 104: + for j in range(104): + want[104+j] -= D[i][j] + need(state[i] == want, 'complete reader endpoint/donor/dirty return') + need(dict(counts) == {'add': 5000, 'half': 104, 'double': 104}, 'reader bill') + return {'events': len(word), 'counts': dict(counts), 'input_columns': 280, + 'coefficient_sha256': hashlib.sha256(canonical(state)).hexdigest()} + +def cost_gate(profile, progress=2312, stages=208, ports=104, axes=9, extras=0, paid_banks=0): + need(all(type(k) is int and type(v) is int and 0 < k <= axes * axes and v >= 0 + for k, v in profile.items()), 'cost profile') + need(type(paid_banks) is int and paid_banks >= 0 and extras >= 0, 'nonnegative added costs') + W = 2 * ports * ports + 2 * ports * 72 + paid_banks + m = axes * axes + required_progress = W * m - ports * ports + remaining = required_progress - stages * progress + need(remaining >= 0, 'coverage premise') + bill = stages * sum(r * n for r, n in profile.items()) + remaining + extras + return {'m': m, 'W': W, 'data_pairs': ports * ports, 'local_calls': stages, + 'required_progress': required_progress, 'remaining_rank': remaining, + 'lower_mass': bill, 'capacity': W * m, 'excess': bill - W * m} + +def compute(): + authenticate() + p, D, Di, iso = geometry() + need(sum(bool(x) for row in D for x in row) == 5000, 'direct encoded reader count') + reader = check_reader(D, reader_word(D)) + tensor = lambda a, b: sum((b << (9 * k)) for k in range(9) if (a >> k) & 1) + product_lines = [tensor(a, b) for a in p for b in p] + need(len(set(product_lines)) == 10816 and all(u.bit_count() % 2 for u in product_lines), + 'explicit nondegenerate tensor lines') + weights = Counter(u.bit_count() % 4 for u in product_lines) + # The old triple generators have weight nine; these product root lines + # need their actual port-dependent phase, not the inherited constant i^9. + need(set(weights) <= {1, 3}, 'odd tensor weights') + for z in range(512): + Z = sum((1 << (9 * k)) for k in range(9) if z >> k & 1) + need(all((u.bit_count() + (Z ^ u).bit_count() + + 2 * ((Z ^ u) & u).bit_count() - Z.bit_count()) % 4 == 0 + for u in product_lines), 'physical endpoint normalization') + commuting, defect_blocks = [], 0 + for z in range(512): + t = [(v & z).bit_count() % 2 for v in p] + mismatch = sum(bool(D[i][j]) and t[i] != t[j] for i in range(104) for j in range(104)) + defect_blocks += mismatch + if not mismatch: + commuting.append(z) + for seed in (1, 7): + r = [(16 * (((i * seed + 3) % 13) - 6), 16 * (((i + seed) % 7) - 3)) for i in range(104)] + b = [(16 * (((i + seed) % 11) - 5), 16 * (((i * seed) % 5) - 2)) for i in range(104)] + need(physical_correct(r, b, D, Di, t) == conjugated(r, b, Di, t), 'physical conjugation') + need(commuting == [0, 511], 'homogeneous phase controls') + columns = 0 + for z in (0, 1, 232, 511): + t = [(v & z).bit_count() % 2 for v in p] + for j in range(208): + r, b = [(0, 0)] * 104, [(0, 0)] * 104 + (r if j < 104 else b)[j % 104] = (16, 0) + need(physical_correct(r, b, D, Di, t) == conjugated(r, b, Di, t), 'all-column conjugation') + columns += 1 + i, j = next((i, j) for i in range(8) for j in range(8, 104) if D[i][j]) + z = next(z for z in range(512) if ((p[i] ^ p[j]) & z).bit_count() % 2) + order = J + [k for k in range(104) if k not in J] + witness = {'row_port': order[i], 'donor_port': order[j], + 'p_row': p[i], 'p_donor': p[j], 'frequency': z, + 'q': p[0], 'u_row': tensor(p[i], p[0]), 'u_donor': tensor(p[j], p[0]), + 'D_twice_coefficient': D[i][j], 'physical_difference_rank': '2^(m-1)'} + word = read(ROOT / 'research/p104-native-channel/inputs/LOWRANK-WITNESS.json') + profile = Counter(op[4] for op in word['program'] if op[0] == 'transport') + persistent = sum(len(word['final_frames'][r]) - len(v) for r, v in word['initial_frames'].items()) + need(persistent == 2312 and sum(r * n for r, n in profile.items()) == 2368, 'inherited channel invoice') + profile[1] += 208 + gate = cost_gate(profile, persistent) + need(gate['excess'] == 44096 and gate['lower_mass'] == 3009344, 'two-axis stop') + need(cost_gate(profile, paid_banks=123)['excess'] == gate['excess'], 'fully paid banks') + return {'schema_version': 1, 'status': 'PASS_P104_TWO_AXIS_COMPATIBILITY', + 'scope': 'Physical endpoint equations and explicit tensor-line scaffold; conditional unchanged-profile cost rejection, not a global owner embedding or supplier.', + 'root_pairings': 14400, 'physical_labels': p, 'label_isometry': iso, + 'tensor_lines': 10816, 'tensor_dimension': 81, + 'tensor_weights_mod_four': dict(sorted(weights.items())), + 'constant_weight_nine_phase_failures': weights[3], + 'normalization_character_checks': 512 * 10816, + 'D_entries': 5000, 'D_inverse_checked_entries': 10816, + 'literal_reader': reader, + 'phase_patterns': 512, 'commuting_patterns': commuting, + 'noncommuting_patterns': 510, 'commutator_nonzero_blocks': defect_blocks, + 'dense_conjugation_fixtures': 1024, 'independent_data_columns': columns, + 'encoded_residual_change_rank_per_address': 96, + 'dirty_roles': 72, 'dirty_action': 'identity in compatibility maps; completed physical F is inherited, not freshly executed', + 'witness': witness, 'gate': gate, + 'decision': 'NARROW; no native/supplier expansion within the rejected scaffold'} + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('--write-result', action='store_true') + args = ap.parse_args() + result = compute() + if args.write_result: + need(not (HERE / 'RESULT.json').exists(), 'refuse receipt overwrite') + (HERE / 'RESULT.json').write_bytes(canonical(result)) + else: + expected = read(HERE / 'RESULT.json') + need(type(expected.get('schema_version')) is int and canonical(expected) == canonical(result), 'exact typed result') + print(result['status']) + +if __name__ == '__main__': + main()