Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions research/hypercube-decoder-parity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Why the paired-cube decoder does not extend to 4-dimensional (hyper)cubes (no new κ)

A scoping note on the port dimension of the paired-cube bit word. **No κ is claimed, and nothing existing changes.**

## The identity being generalized

The paired-cube bit word (`research/paired-cube-bit/LEMMA.md`) computes the mod-2 decoder identity

x_T = sum_{c in T} star(c) + sum_{|S cap T| = 1} x_S (mod 2),

over **ports**: triples taking one coordinate from each of three distinct coordinate pairs.
- `star(c)` is the sum of `x_S` over all ports containing coordinate `c`. These are the shared center sums.
- The overlap-1 sums are what the cube's local circuits, modules and partner pairs compute.

A natural question is whether moving to k-dimensional cubes, with ports taking one coordinate from each of k pairs, gives a larger deficit. The source count grows like 2^k·C(p,k), while the center loss grows like p².

## Result

Consider the star family of decoders for k-ports:

x_T = sum_{0<l<k} a_l sum_{L <= T, |L| = l} star_L + sum_{0<j<k} b_j sum_{|S cap T| = j} x_S (mod 2),

with `star_L` the sum of `x_S` over the ports containing the l-set `L`. Coefficients `a_l, b_j` are in F2. The global sum (`l = 0`) and the disjoint class (`j = 0`) are excluded, because together they give only the trivial "everything minus the rest" decoder.

**A decoder of this form exists if and only if k is not a power of two.** In particular, there is none for **k = 4**.

*Proof.* The coefficient of `x_S` in the right-hand side depends only on `j = |S cap T|`. It equals `sum_l a_l C(j,l) + b_j`, where `b_j` is present only for `0 < j < k`.
- For `0 < j < k`, choosing `b_j` makes it 0.
- For `j = 0` it is 0 automatically.
- For `S = T` (`j = k`) it is `sum_{0<l<k} a_l C(k,l)`. This can be 1 exactly when some `C(k,l)` with `0 < l < k` is odd.

By Lucas' theorem, every such `C(k,l)` is even iff `k` is a power of two. ∎

| k | Example | Decoder |
|---|---|---|
| 3 | paired cubes (today) | yes, e.g. level-1 stars plus overlap-1 corrections (the lemma above) |
| **4** | **hypercubes** | **no**: `C(4,1), C(4,2), C(4,3)` are all even |
| 5 | | yes, e.g. level-1 stars plus overlap-1 and overlap-3 corrections |
| 6 | | yes, needs level-2 stars (`C(6,2) = 15`) |
| 8, 16, … | | no |

## Check

```sh
python3 -B research/hypercube-decoder-parity/check.py # standard library, under one second
```

For `(k, p) = (3,6), (4,6), (5,7), (6,7)`, the script tests every coefficient vector `(a, b)` against every column of every port. It confirms that valid decoders exist exactly when `k` is not a power of two, with 2, 0, 8 and 16 decoders respectively. It also confirms that the k = 3 solutions include the paired-cube identity.

## Scope

- The note concerns decoders built from stars and overlap-class corrections. That is the family the paired-cube construction uses, and the one whose terms local circuits and shared center sums can compute.
- It is not an impossibility proof for every decoder over 4-dimensional ports.
- It says nothing yet about whether k = 5 or k = 6 would beat k = 3. That would need new local circuits, partner pairs, caps and a full construction, and those decoders also need correction terms at more overlap sizes.

Credits: icekylinx (#144, paired cubes) and eumemic (paired-cube bit word and its lemma). Prepared by Joel Pulikkan (GamingPuzzled) with Anthropic Claude assistance; Apache-2.0.
58 changes: 58 additions & 0 deletions research/hypercube-decoder-parity/check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""Exhaustive check of the k-port decoder parity obstruction (README.md). Standard library only.

Ports: k-subsets taking one coordinate from each of k distinct pairs among p coordinate pairs (k = 3 is the
paired-cube port of research/paired-cube-bit/LEMMA.md). A decoder in the star family writes, for every port T,

x_T = sum_{0<l<k} a_l sum_{L <= T, |L| = l} star_L + sum_{0<j<k} b_j sum_{|S cap T| = j} x_S (mod 2),

with star_L = sum of x_S over ports S containing L. For each (k, p) below, every coefficient vector (a, b) is
tested against every column of every port, and the count of valid decoders is compared with the closed form:
valid decoders exist iff k is not a power of two.
Copyright 2026 Joel Pulikkan (GamingPuzzled). Apache-2.0. Prepared with Anthropic Claude assistance.
"""
import itertools
import sys
from math import comb

if sys.flags.optimize:
raise SystemExit('refusing -O')


def ports(p, k):
return [frozenset(2 * q + e for q, e in zip(pairs, sel))
for pairs in itertools.combinations(range(p), k) for sel in itertools.product(range(2), repeat=k)]


def valid_decoders(p, k):
P = ports(p, k)
overlap = [[len(S & T) for S in P] for T in P]
found = []
for a in itertools.product(range(2), repeat=k - 1):
for b in itertools.product(range(2), repeat=k - 1):
def coeff(j):
return (sum(al * comb(j, l) for l, al in enumerate(a, 1)) + (b[j - 1] if 0 < j < k else 0)) % 2
table = {j: coeff(j) for j in range(k + 1)}
if all(table[overlap[t][s]] == (1 if s == t else 0) for t in range(len(P)) for s in range(len(P))):
found.append((a, b))
return len(P), found


def power_of_two(k):
return k & (k - 1) == 0


def main():
for k, p in ((3, 6), (4, 6), (5, 7), (6, 7)):
n, found = valid_decoders(p, k)
parity = [comb(k, l) % 2 for l in range(1, k)]
assert (len(found) == 0) == power_of_two(k) == (not any(parity)), (k, p, len(found), parity)
print('PASS k=%d p=%d: %d ports, %d valid star-family decoders; C(k,l) mod 2 for 0<l<k = %s'
% (k, p, n, len(found), parity))
n, found = valid_decoders(6, 3)
assert ((1, 0), (1, 0)) in found, 'the paired-cube identity (level-1 stars, overlap-1 corrections)'
print('PASS k=3 includes the paired-cube identity x_T = sum_{c in T} star(c) + sum_{|S cap T|=1} x_S')


if __name__ == '__main__':
main()