diff --git a/research/p112-overcomplete-factor-spaces/CERTIFICATE.json b/research/p112-overcomplete-factor-spaces/CERTIFICATE.json new file mode 100644 index 0000000000..03b42e132f --- /dev/null +++ b/research/p112-overcomplete-factor-spaces/CERTIFICATE.json @@ -0,0 +1,985 @@ +{ + "attainer": { + "COPY": 64, + "M": [ + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 1, + -1, + 0, + -1, + 0, + 0, + -1, + 0 + ], + [ + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + "N": [ + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ], + [ + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + "ranks": [ + 8, + 7, + 8, + 8, + 8, + 8, + 8, + 8, + 1 + ] + }, + "character_kernels": { + "left": { + "characters": 511, + "distinct_nonzero_kernels": 10, + "kernels": [ + [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ] + ], + [ + [ + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0 + ] + ], + [ + [ + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0 + ] + ], + [ + [ + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + -4 + ] + ], + [ + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ] + ], + "nullity_histogram": { + "0": 251, + "1": 256, + "2": 4 + }, + "ordered_character_kernel_sha256": "37c4b8c55f0314e06aa423158d51de55ca4c8ba324621e69e717da6250a31c08" + }, + "right": { + "characters": 511, + "distinct_nonzero_kernels": 11, + "kernels": [ + [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ] + ], + [ + [ + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0 + ] + ], + [ + [ + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0 + ] + ], + [ + [ + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + [ + [ + 0, + 1, + 1, + 0, + 1, + 0, + 0, + -1, + -4 + ] + ], + [ + [ + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0 + ] + ], + [ + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ] + ], + "nullity_histogram": { + "0": 378, + "1": 129, + "2": 4 + }, + "ordered_character_kernel_sha256": "bb77bcadfa1f37186d8f0b958e7701300d1882d06fc4dfcde8bdd8cdfc43306d" + } + }, + "majorization": { + "P": [ + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 7, + 1 + ], + "P_partials": [ + 8, + 16, + 24, + 32, + 40, + 48, + 56, + 63, + 64 + ], + "many_mixed_surrogate": [ + 8, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7 + ], + "many_partials": [ + 8, + 15, + 22, + 29, + 36, + 43, + 50, + 57, + 64 + ], + "two_cost7": [ + 8, + 8, + 8, + 8, + 8, + 8, + 7, + 7, + 2 + ], + "two_cost7_partials": [ + 8, + 16, + 24, + 32, + 40, + 48, + 55, + 62, + 64 + ] + }, + "matrix": { + "K_sha256": "dc18cf0af21df0331f9ec261670c61ace0b9a81c71b25c935294f70cf2870114", + "ports": 112, + "rank_L": 9, + "rank_R": 9, + "s": [ + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1 + ], + "s_dot_s": 4, + "s_dot_t": 2, + "t": [ + 0, + 1, + 1, + 0, + 1, + 0, + 0, + -1 + ] + }, + "negative_controls": [ + "altered physical factor rejected", + "omitted compensation rejected", + "V/V undercharge rejected", + "source-byte mutation rejected", + "changed character premise rejected", + "Hermitian-transpose substitution rejected" + ], + "outside_right_space": { + "extended_right_space_rank": 10, + "rank_R_e": 10, + "rank_R_f": 10, + "ranks": [ + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 0, + 0 + ], + "terms": 10 + }, + "overcomplete_in_space": { + "added_coefficient_pairs": [ + [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ], + [ + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0 + ] + ], + [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + -1 + ], + [ + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0 + ] + ] + ], + "ranks": [ + 8, + 7, + 8, + 8, + 8, + 8, + 8, + 8, + 1, + 0, + 0 + ], + "terms": 11 + }, + "pairing_ranks": { + "E0": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 8, + "U": 8, + "V": 8, + "W": 2 + }, + "E1": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 8, + "U": 7, + "V": 7, + "W": 2 + }, + "E2": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 8, + "U": 7, + "V": 7, + "W": 2 + }, + "E3": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 8, + "U": 8, + "V": 8, + "W": 2 + }, + "E4": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 8, + "U": 7, + "V": 7, + "W": 2 + }, + "E5": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 8, + "U": 8, + "V": 8, + "W": 2 + }, + "E6": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 8, + "U": 8, + "V": 8, + "W": 2 + }, + "E7": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 8, + "U": 7, + "V": 7, + "W": 2 + }, + "F": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 9, + "U": 8, + "V": 8, + "W": 2 + }, + "V": { + "E0": 8, + "E1": 7, + "E2": 7, + "E3": 8, + "E4": 7, + "E5": 8, + "E6": 8, + "E7": 7, + "F": 8, + "U": 7, + "V": 8, + "W": 1 + }, + "Z": { + "E0": 1, + "E1": 1, + "E2": 1, + "E3": 1, + "E4": 1, + "E5": 1, + "E6": 1, + "E7": 1, + "F": 1, + "U": 1, + "V": 0, + "W": 1 + } + }, + "positive_controls": [ + "11-term zero-COPY cancellation", + "ordinary transpose nonreal phase", + "outside-right-space boundary" + ], + "schema_version": 1, + "source_sha256": "327d2a868043e846381aa58a33053c24425e8cad522ff401b10ec8af1d649a3f", + "support_span_dimensions": { + "left": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 9, + "V": 8, + "Z": 1 + }, + "right": { + "E0": 8, + "E1": 8, + "E2": 8, + "E3": 8, + "E4": 8, + "E5": 8, + "E6": 8, + "E7": 8, + "F": 9, + "U": 8, + "V": 8, + "W": 2 + } + } +} diff --git a/research/p112-overcomplete-factor-spaces/PROOF.md b/research/p112-overcomplete-factor-spaces/PROOF.md new file mode 100644 index 0000000000..f364bd1632 --- /dev/null +++ b/research/p112-overcomplete-factor-spaces/PROOF.md @@ -0,0 +1,274 @@ +# Arbitrarily many terms inside the two minimal factor spaces + +Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance. + +This extends the **term-count scope** of Hanhong Zhao's [PR #2321](https://github.com/CrocSwap/integer-mult-bounds/pull/2321), +head `0665be26c2db1bd7f393d829e786698b34b626e4`. Its support catalogue and +attainer are credited premises reconstructed here from the root prototype. +The new argument is Sections 3–5: termwise coefficient duality is unavailable +for an overcomplete decomposition. Zero-COPY nonzero terms are allowed. + +## 1. Statement and conventions + +Remove the first eight frame rows from the pinned 120-root prototype. Write +`X` for the resulting 112-by-8 matrix and `lambda_i` for its 112 binary labels +in `F_2^9`. Set `B_ij = lambda_i dot lambda_j` over `F_2`. +The checker binds this convention to `(X_i dot X_j / 2 + 1) mod 2`. +Let `e=e_0`, `f=e_1`, `s=X[0,:]^T`, `t=X[1,:]^T`, and define + +``` +G = X X^T +K = G - (G e - 4 e)e^T + e f^T +L = [X, e] (112 by 9) +R = [(I - e e^T)X, 4e + f] (112 by 9). +``` + +The exact finite checks give `K=L R^T`, `rank(L)=rank(R)=9`, and `K_ij=G_ij` +on every required pair `B_ij=1`. All transposes in this note are **ordinary** +transposes over `C`, never conjugate transposes. In particular, + +``` +s = (0,1,1,0,1,0,0,1), t = (0,1,1,0,1,0,0,-1), +s^T s = 4, s^T t = 2. +``` + +**Theorem.** Consider any finite decomposition + +``` +K = sum_i D_i T_i^T, D_i in col_C(L), T_i in col_C(R). +``` + +For each term separately charge +`rho_i = rank_F2 B[supp(D_i), supp(T_i)]`. For every real `0= 7*8^q + 7^q + 1. (1) +``` + +The minimum is attained by the same rational nine-term factorization for +every `q`. Thus COPY has sharp minimum 64. For `0=5`. +When `n>=9`, the mixed power bill is therefore at least + +``` + 5*8^q + 4*7^q. (4) +``` + +This dominates the bill of `Q_many=(8,7,7,7,7,7,7,7,7)` term by term. +The desired profile `P=(8,8,8,8,8,8,8,7,1)` majorizes `Q_many`: +both sum to 64 and every descending partial sum of `P` is at least the +corresponding partial sum of `Q_many`. Concavity of `x^q` for `0= sum P^q`, proving (1) in this case. Pure terms have +nonnegative bills and cannot lower it. + +## 4. Exactly eight mixed terms: projection duality and compensation + +Index the eight mixed terms by `1,...,8` and put their projections in square +matrices `A=[a_1 ... a_8]`, `B'=[b_1 ... b_8]`. Equation (3) gives +`A B'^T=I_8`, hence + +``` + b_i^T a_j = delta_ij. (5) +``` + +This is **eight-dimensional projection duality**, not the generally false +nine-dimensional claim `n_i^T m_j=delta_ij`. Both projected sets are bases. +There is at most one left V projection (the line `Cs`), at most one right V +projection (`Cs`), and at most one right U projection (`Ct`). If a left V +occurs at index `j`, any right V or U must occur at the same index: otherwise +(5) contradicts `s^T s=4` or `s^T t=2`. As left V/right V costs eight, there +is then at most one cost-7 mixed term. If no left V occurs, at most the two +right exceptional lines can provide cost seven. Thus there are at most two +cost-7 mixed terms in all cases. + +**Compensation costs at least one.** Suppose all pure terms cost zero. +By item 2 each is a multiple of `z v^T` in coefficient coordinates, and +contributes zero to the top-right and bottom-right blocks of (2). The +top-right block then says `A d=0`, where `d=(d_1,...,d_8)^T` lists the mixed +last coordinates. Thus `d=0`. The mixed contribution to the bottom-right +entry is also zero, contradicting that this entry of `I_9` is one. +Consequently the integer sum of the pure COPY ranks is at least one, and +its power bill is at least one. + +**If two mixed terms cost seven, compensation costs at least two.** Suppose +instead the pure COPY sum is at most one. The previous paragraph makes it +exactly one: there is exactly one positive-COPY pure term, costing one, +and all other pure terms have type Z/V. The positive term has one of the +following forms by items 3–4: + +- **Left Z.** Every pure term then has `a=0`. The top-right equation still + gives `A d=0`, hence all mixed `d_i=0`. Mixed right U is impossible, + since its last coordinate is nonzero. The remaining cost-7 possibilities, + left V or right V, yield at most one such term by (5) and the V/V cost. +- **Left V/right W.** Its top-right contribution is `eta s` for some + nonzero `eta`. All zero-COPY pure terms contribute zero there. Thus + `A d=-eta s`, and (5) gives `d_i=-eta b_i^T s`. A mixed right V would + have `b_i=gamma s`, `gamma!=0`, and `d_i=0`, contradicting + `d_i=-4 eta gamma`. Hence right V is absent. Only left V and right U + can give cost seven; if both occur they must share one index by (5) and + `s^T t=2`. Again at most one mixed term costs seven. + +Both alternatives contradict two cost-7 mixed terms. Therefore in that +case the pure COPY sum is at least two. Subadditivity of `x^q` gives +`sum_pure rho_i^q >= (sum_pure rho_i)^q >= 2^q`. This allows arbitrarily +many pure terms, including arbitrarily many nonzero zero-COPY terms. + +## 5. Exhausting the eight-mixed-term cases + +According as there are zero, one, or two cost-7 mixed terms, Section 4 gives +one of the following lower bills: + +``` +8*8^q + 1, +7*8^q + 7^q + 1, +6*8^q + 2*7^q + 2^q. +``` + +The first dominates (1) and the second equals it. For the third, set +`Q_two=(8,8,8,8,8,8,7,7,2)`. The descending partial sums are + +``` +P: 8,16,24,32,40,48,56,63,64 +Q_two: 8,16,24,32,40,48,55,62,64. +``` + +Thus `P` majorizes `Q_two`, and concavity again gives the desired lower bound. +Together with Section 3 this exhausts all finite term counts. The verifier +checks the integer partial sums; no numerical sampling of real `q` is used. + +## 6. Attainment and a genuine overcomplete fixture + +As in PR #2321, let `N` be `I_9` with column 1 replaced by `v=(s,0)`. +Since `s_1=1`, it is invertible. Set `M=N^(-T)`, `D=L M`, `T=R N`. +The checker reconstructs these rational matrices and verifies all 12,544 +entries of `D T^T=K` and the actual support ranks + +``` + (8,7,8,8,8,8,8,8,1). +``` + +For an eleven-term in-space example, append the coefficient pairs +`(z,v)` and `(-z,v)`. They are nonzero, cancel exactly, and both cost zero. +This attains the same bill and shows why excluding every zero-COPY term +by nine-term diagonal duality would be an invalid proof here. It also +shows that the result is not restricted to minimal-length decompositions. +For `08^q`, proving the strict +comparison with eight rank-eight terms. At `q=1`, both totals are 64. + +## 7. The right-space hypothesis is essential + +The defining identity for `K` already gives ten terms: + +``` +K = sum_{r=0}^7 X[:,r] X[:,r]^T + (4e-G e)e^T + e f^T. (6) +``` + +All ten left factors lie in `col(L)`. The two additional terms have COPY +rank zero, and the eight original terms have rank eight. Thus the profile +is `(8,8,8,8,8,8,8,8,0,0)`, whose power bill `8*8^q` is below (1) for +`0 0 else -1 + return [x//g for x in row] + + +def echelon(rows, width): + """Integer fraction-free elimination; retained rows span the exact Q row space.""" + basis = {} + for original in rows: + row = primitive(original) + for p, b in sorted(basis.items()): + if row[p]: + c, d = row[p], b[p] + row = primitive([d*x-c*y for x, y in zip(row, b)]) + p = next((j for j, x in enumerate(row) if x), None) + if p is not None: + basis[p] = primitive(row) + if len(basis) == width: + break + return sorted(basis.items()) + + +def rank(rows): + return len(echelon(rows, len(rows[0]))) if rows else 0 + + +def canonical(rows, width=9): + b = [(p, list(map(Q, row))) for p, row in echelon(rows, width)] + for i in range(len(b)-1, -1, -1): + p, row = b[i] + pivot = row[p] + row[:] = [x/pivot for x in row] + for _, previous in b[:i]: + c = previous[p] + previous[:] = [x-c*y for x, y in zip(previous, row)] + return [row for _, row in b] + + +def kernel(rows, width): + b = canonical(rows, width) + pivots = [next(j for j, x in enumerate(row) if x) for row in b] + result = [] + for free in sorted(set(range(width))-set(pivots)): + v = [Q(0)]*width + v[free] = Q(1) + for p, row in zip(pivots, b): + v[p] = -row[free] + result.append(v) + return result + + +def inverse(a): + n = len(a) + augmented = [list(map(Q, row))+[Q(i == j) for j in range(n)] for i, row in enumerate(a)] + for p in range(n): + k = next(i for i in range(p, n) if augmented[i][p]) + augmented[p], augmented[k] = augmented[k], augmented[p] + c = augmented[p][p] + augmented[p] = [x/c for x in augmented[p]] + for i in range(n): + if i != p: + c = augmented[i][p] + augmented[i] = [x-c*y for x, y in zip(augmented[i], augmented[p])] + return [row[n:] for row in augmented] + + +def gf2_basis(values): + basis = {} + for value in values: + while value: + p = value.bit_length()-1 + if p in basis: + value ^= basis[p] + else: + basis[p] = value + break + return [basis[p] for p in sorted(basis)] + + +def gf2_rank_low(values): + """Independent elimination direction, also used on the unreduced support matrix.""" + rows = list(values) + r = 0 + width = max((x.bit_length() for x in rows), default=0) + for p in range(width): + k = next((i for i in range(r, len(rows)) if (rows[i] >> p) & 1), None) + if k is None: + continue + rows[r], rows[k] = rows[k], rows[r] + for i in range(r+1, len(rows)): + if (rows[i] >> p) & 1: + rows[i] ^= rows[r] + r += 1 + return r + + +def pairing_rows(left, right): + return [sum(((a & b).bit_count() % 2) << j for j, b in enumerate(right)) for a in left] + + +def charge(d, t, labels): + dl = [labels[i] for i, x in enumerate(d) if x != 0] + tl = [labels[i] for i, x in enumerate(t) if x != 0] + reduced = len(gf2_basis(pairing_rows(gf2_basis(dl), gf2_basis(tl)))) + direct = gf2_rank_low(pairing_rows(dl, tl)) + require(reduced == direct, 'binary rank algorithms disagree') + return direct + + +def serial(value): + if isinstance(value, Q): + return int(value) if value.denominator == 1 else str(value) + if isinstance(value, dict): + return {str(k): serial(v) for k, v in value.items()} + if isinstance(value, (list, tuple)): + return [serial(x) for x in value] + return value + + +def digest(value): + return sha256(json.dumps(serial(value), sort_keys=True, separators=(',', ':')).encode()).hexdigest() + + +def identity(n): + return [[int(i == j) for j in range(n)] for i in range(n)] + + +def exact_factor_check(d, t, target, labels): + require(product(d, transpose(t)) == target, 'all-entry factor identity failed') + return [charge(a, b, labels) for a, b in zip(transpose(d), transpose(t))] + + +def majorizes(p, r): + p, r = sorted(p, reverse=True), sorted(r, reverse=True) + return sum(p) == sum(r) and all(sum(p[:i]) >= sum(r[:i]) for i in range(1, len(p)+1)) + + +def reject(action, reason): + try: + action() + except ValueError: + return reason + raise ValueError('negative control accepted: '+reason) + + +def build(): + raw = (ROOT/SOURCE).read_bytes() + require(sha256(raw).hexdigest() == SOURCE_SHA, 'live prototype hash mismatch') + src = json.loads(raw) + roots, all_labels = src['root_lines'], src['binary_ports'] + require(roots[:8] == [[2*int(i == j) for j in range(8)] for i in range(8)], 'frame binding') + x, labels, frame = roots[8:], all_labels[8:], all_labels[:8] + require(len(x) == 112 and len(set(labels)) == 112, 'source dimensions') + s, t = x[0], x[1] + z = [0]*8+[1] + l, v, u = s+[-4], s+[0], t+[-4] + require(sum(a*a for a in s) == 4 and sum(a*b for a, b in zip(s, t)) == 2, 'projection pairings') + require([j for j in range(8) if s[j]] == [j for j in range(8) if t[j]] == [1, 2, 4, 7], 'coordinate support') + g = product(x, transpose(x)) + require(all(g[i][i] == 4 for i in range(112)), 'root norm') + require(all(g[i][j] % 2 == 0 and ((g[i][j]//2+1) % 2) == ((labels[i]&labels[j]).bit_count()%2) + for i in range(112) for j in range(112)), 'Gram/binary convention binding') + left = [row+[int(i == 0)] for i, row in enumerate(x)] + right = [([0]*8 if i == 0 else row)+[4*int(i == 0)+int(i == 1)] for i, row in enumerate(x)] + target = [[g[i][j]-(g[i][0]-4*int(i == 0))*int(j == 0)+int(i == 0 and j == 1) + for j in range(112)] for i in range(112)] + require(rank(left) == rank(right) == 9 and product(left, transpose(right)) == target, 'rank-nine binding') + require(all(target[i][j] == g[i][j] for i in range(112) for j in range(112) + if ((labels[i]&labels[j]).bit_count()%2)), 'masked completion changed a required entry') + + # Complete support theorem: every nonzero binary annihilator is inspected. + kernel_evidence = {} + for side, matrix in [('left', left), ('right', right)]: + found, unique, histogram = [], {}, Counter() + for h in range(1, 512): + rows = [row for row, lab in zip(matrix, labels) if (h & lab).bit_count()%2] + got = canonical(kernel(rows, 9)) + if h in frame: + r = frame.index(h) + expected = [identity(9)[r]]+([z] if s[r] else []) + elif h == labels[0]: + expected = [l if side == 'left' else v] + elif side == 'right' and h == labels[1]: + expected = [u] + elif (h&labels[0]).bit_count()%2 == 0 and (side == 'left' or (h&labels[1]).bit_count()%2 == 0): + expected = [z] + else: + expected = [] + require(got == canonical(expected), f'{side} character {h}: kernel mismatch') + require(all(sum(a*b for a, b in zip(row, vec)) == 0 for row in rows for vec in got), 'kernel residual') + histogram[len(got)] += 1 + found.append([h, got]) + if got: + unique[digest(got)] = got + spaces = list(unique.values()) + require(len(spaces) == (10 if side == 'left' else 11), 'distinct character-kernel count') + for i, a in enumerate(spaces): + for b in spaces[i+1:]: + intersection_dimension = len(a)+len(b)-rank(a+b) + common_z = rank(a+[z]) == len(a) and rank(b+[z]) == len(b) + require(intersection_dimension == int(common_z), 'unexpected character-kernel intersection') + expected_hist = {0:251, 1:256, 2:4} if side == 'left' else {0:378, 1:129, 2:4} + require(dict(histogram) == expected_hist, 'nullity histogram') + kernel_evidence[side] = {'characters':511, 'nullity_histogram': dict(histogram), + 'distinct_nonzero_kernels': len(spaces), 'kernels': sorted(serial(spaces), key=str), + 'ordered_character_kernel_sha256': digest(found)} + + eclasses = {'E'+str(r): identity(9)[r] for r in range(8)} + lc = {'Z':z, **eclasses, 'V':l, 'F':[2**j for j in range(9)]} + rc = {'W':z, **eclasses, 'V':v, 'U':u, 'F':[2**j for j in range(9)]} + physical_left = {name:[sum(a*b for a, b in zip(row, coeff)) for row in left] for name, coeff in lc.items()} + physical_right = {name:[sum(a*b for a, b in zip(row, coeff)) for row in right] for name, coeff in rc.items()} + span_dims = {} + for side, columns, pure in [('left', physical_left, 'Z'), ('right', physical_right, 'W')]: + span_dims[side] = {name:len(gf2_basis([labels[i] for i, value in enumerate(col) if value])) for name, col in columns.items()} + for name, dim in span_dims[side].items(): + expected_dim = (1 if side == 'left' else 2) if name == pure else (9 if name == 'F' else 8) + require(dim == expected_dim, 'class support dimension') + table = {a:{b:charge(da, tb, labels) for b, tb in physical_right.items()} for a, da in physical_left.items()} + for a in lc: + for b in rc: + r = table[a][b] + require((r == 0) == (a == 'Z' and b == 'V'), 'zero-cost catalogue') + if a != 'Z' and b != 'W': + require(r >= 7 and (r != 7 or a == 'V' or b in ('V', 'U')), 'mixed cost catalogue') + if a == 'Z' and b != 'V': + require(r == 1, 'left-pure catalogue') + if b == 'W': + require(r == (1 if a in ('Z', 'V') else 2), 'right-pure catalogue') + require(table['V']['V'] == 8, 'V/V charge') + + n = identity(9) + for i in range(9): + n[i][1] = v[i] + m = transpose(inverse(n)) + require(product(m, transpose(n)) == identity(9), 'attainer coefficients') + d, tt = product(left, m), product(right, n) + attained = exact_factor_check(d, tt, target, labels) + require(attained == [8, 7, 8, 8, 8, 8, 8, 8, 1], 'attaining profile') + + # Genuine overcomplete in-space fixture: two nonzero cancelling zero-COPY terms. + mc, nc = transpose(m)+[z, [-a for a in z]], transpose(n)+[v, v] + require(product(transpose(mc), nc) == identity(9), 'overcomplete coefficients') + over_d, over_t = product(left, transpose(mc)), product(right, transpose(nc)) + over = exact_factor_check(over_d, over_t, target, labels) + require(over == attained+[0, 0], 'zero-cost overcomplete fixture') + require(sum(a*b for a, b in zip(mc[-1], nc[-1])) == 0, 'termwise duality control') + + # Boundary control: removing the right-space restriction admits a ten-term bill64. + e, f = [int(i == 0) for i in range(112)], [int(i == 1) for i in range(112)] + correction = [-g[i][0]+4*e[i] for i in range(112)] + bd = transpose(transpose(x)+[correction, e]) + bt = transpose(transpose(x)+[e, f]) + boundary = exact_factor_check(bd, bt, target, labels) + require(boundary == [8]*8+[0, 0], 'outside-space boundary profile') + require(rank([a+[b] for a, b in zip(left, correction)]) == 9, 'boundary left-space membership') + re, rf = rank([a+[b] for a, b in zip(right, e)]), rank([a+[b] for a, b in zip(right, f)]) + require(re == rf == 10, 'boundary factors must be outside right space') + require(rank([a+b for a, b in zip(right, bt)]) == 10, 'one-dimensional right-space extension') + + p, two_sevens, many = [8]*7+[7, 1], [8]*6+[7, 7, 2], [8]+[7]*8 + require(majorizes(p, two_sevens) and majorizes(p, many), 'concavity integer partial sums') + partials = lambda a: [sum(sorted(a, reverse=True)[:j]) for j in range(1, len(a)+1)] + + controls = [] + bad = [row[:] for row in d] + bad[0][0] += 1 + controls.append(reject(lambda: exact_factor_check(bad, tt, target, labels), 'altered physical factor rejected')) + missing = [row[:-1] for row in d] + controls.append(reject(lambda: exact_factor_check(missing, [row[:-1] for row in tt], target, labels), 'omitted compensation rejected')) + controls.append(reject(lambda: require(table['V']['V'] == 7, 'bad tariff'), 'V/V undercharge rejected')) + controls.append(reject(lambda: require(sha256(raw+b' ').hexdigest() == SOURCE_SHA, 'bad hash'), 'source-byte mutation rejected')) + bad_kernel = [row[:] for row in left] + bad_kernel[0][8] += 1 + h = labels[0] + controls.append(reject(lambda: require(canonical(kernel([row for row, lab in zip(bad_kernel, labels) if (h&lab).bit_count()%2], 9)) == canonical([l]), 'bad kernel'), 'changed character premise rejected')) + # Exact Gaussian integer phases, with no floating-point tolerance. + require(all(Q(value).denominator == 1 for row in d+tt for value in row), 'phase fixture uses integer coefficients') + cd = [[complex(value) for value in row] for row in d] + ct = [[complex(value) for value in row] for row in tt] + for row in cd: + row[0] *= 1j + for row in ct: + row[0] *= -1j + require(exact_factor_check(cd, ct, target, labels) == attained, 'ordinary transpose phase fixture') + controls.append(reject(lambda: exact_factor_check(cd, [[x.conjugate() for x in row] for row in ct], target, labels), 'Hermitian-transpose substitution rejected')) + # Every Gaussian-integer value and sum here is below 2**53; complex arithmetic is exact. + require(max(abs(x.real)+abs(x.imag) for row in cd+ct for x in row) < 100, 'phase exactness range') + + return serial({'schema_version':1, 'source_sha256':SOURCE_SHA, 'matrix':{'ports':112, 'rank_L':9, 'rank_R':9, + 's':s, 't':t, 's_dot_s':4, 's_dot_t':2, 'K_sha256':digest(target)}, + 'character_kernels':kernel_evidence, 'support_span_dimensions':span_dims, 'pairing_ranks':table, + 'attainer':{'M':m, 'N':n, 'ranks':attained, 'COPY':sum(attained)}, + 'overcomplete_in_space':{'terms':11, 'ranks':over, 'added_coefficient_pairs':[[z, v], [[-a for a in z], v]]}, + 'outside_right_space':{'terms':10, 'ranks':boundary, 'rank_R_e':re, 'rank_R_f':rf, 'extended_right_space_rank':10}, + 'majorization':{'P':p, 'two_cost7':two_sevens, 'many_mixed_surrogate':many, + 'P_partials':partials(p), 'two_cost7_partials':partials(two_sevens), 'many_partials':partials(many)}, + 'negative_controls':controls, 'positive_controls':['11-term zero-COPY cancellation', 'ordinary transpose nonreal phase', 'outside-right-space boundary']}) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--write', type=Path, help='create a new certificate exclusively; never overwrite') + args = parser.parse_args() + actual = build() + if args.write: + with args.write.open('x') as stream: + json.dump(actual, stream, indent=2, sort_keys=True) + stream.write('\n') + print('WROTE_P112_OVERCOMPLETE_CERTIFICATE') + else: + expected = json.loads((HERE/'CERTIFICATE.json').read_text()) + require(actual == expected, 'certificate differs from exact recomputation') + altered = json.loads(json.dumps(expected)) + altered['attainer']['ranks'][0] -= 1 + reject(lambda: require(actual == altered, 'altered certificate'), 'certificate undercharge rejected') + print('PASS_P112_OVERCOMPLETE_FACTOR_SPACES kernels=1022 class_pairs=132 entries=12544 COPY=64 controls=7') + + +if __name__ == '__main__': + main()