TheoremDB

Problem packetResearch packetR377

R377Executable evidence

Exact replay of the 64-modular order-668 matrix

View replayOpen source ↗
Link to a section

Authored summary

Standard-library Python reconstructs the published matrix, checks every row pair, and reproduces the paper's autocorrelation exceptions and Gram distribution.

Executable material is recorded. Successful replay is a separate check.

Recorded status: available

Recorded scope: all entries and all unordered row pairs of Eliahou's 64-modular matrix of order 668

Complete recorded scope and conditions
{
  "kind": "bounded",
  "statement": "all entries and all unordered row pairs of Eliahou's 64-modular matrix of order 668",
  "bounds": {
    "order": {
      "min": 668,
      "max": 668
    },
    "row_pairs": {
      "min": 222778,
      "max": 222778
    }
  },
  "exhaustive": true
}

Originating problem: A Hadamard matrix of order 668

Recorded relationships: The 2025 modular construction fails exact orthogonality

Authored record and scope
Authored title
Exact replay of the 64-modular order-668 matrix
Record type
artifact
Stored status
available
Evidence grade
executable
Recorded scope data
{ "kind": "bounded", "statement": "all entries and all unordered row pairs of Eliahou's 64-modular matrix of order 668", "bounds": { "order": { "min": 668, "max": 668 }, "row_pairs": { "min": 222778, "max": 222778 } }, "exhaustive": true }
Linked research record IDs
R380

2Authored explanation

The script expands the two run-length encodings in Fact 3.1, applies the stated half-sign switch, builds four circulant matrices, and assembles the Goethals-Seidel blocks. Each row is packed into a Python integer. XOR population counts then evaluate every row product exactly.

The replay reproduces all thirteen nonzero summed aperiodic autocorrelations in the paper. It verifies the congruence modulo 64 and finds the published 641 zero and 26 nonzero off-diagonal products in every row. The packed matrix uses 84 little-endian bytes per row, with bit \(j\) equal to 1 exactly when column \(j\) contains \(+1\). The concatenated bytes have SHA-256 digest `b9316f8fb407552f6c1301b027e8cddab64796d543801d0005d043cc61a668a1`.

The six-line stdout has SHA-256 digest `915e94a3afae5b1b4f29f7c59e5fe47f55a13c9ed2d1532eeb13ecc43bbccb55`.

Files and source

Files embedded in this record. Matching a file hash confirms its identity.

  • R377.txt2,789 bytes · No SHA-256 recorded
    Preview R377.txt
    from collections import Counter
    from hashlib import sha256
    
    N = 167
    
    def expand(runs):
        out = []
        sign = 1
        for length in runs:
            out.extend([sign] * length)
            sign = -sign
        return out
    
    q = expand([83, 2, 81, 1])
    s_runs = [4]*5 + [2,1,1]*5 + [1,5] + [4]*4 + [2,1,1]*6 + [4]*4 + [3] + [1,2,1]*5 + [3] + [4]*4 + [3] + [1,2,1]*5
    s = expand(s_runs)
    assert len(q) == len(s) == N
    
    def prime(v):
        h = (len(v) + 1)//2
        return v[:h] + [-x for x in v[h:]]
    
    def circ(v):
        return [v[-i:] + v[:-i] if i else v[:] for i in range(len(v))]
    
    def tr(M):
        return [list(row) for row in zip(*M)]
    
    def xr(M):
        return [row[::-1] for row in M]
    
    def neg(M):
        return [[-x for x in row] for row in M]
    
    A0, B0 = s, prime(s)
    C0 = [x*y for x,y in zip(s,q)]
    D0 = prime(C0)
    A,B,C,D = map(circ, (A0,B0,C0,D0))
    BR,CR,DR = map(xr, (B,C,D))
    BTR,CTR,DTR = map(lambda M: xr(tr(M)), (B,C,D))
    block_rows = [
        (A, neg(BR), neg(CR), neg(DR)),
        (BR, A, neg(DTR), CTR),
        (CR, DTR, A, neg(BTR)),
        (DR, neg(CTR), BTR, A),
    ]
    H = []
    for blocks in block_rows:
        for i in range(N):
            H.append(sum((block[i] for block in blocks), []))
    order = len(H)
    assert order == 668 and all(len(row) == order for row in H)
    packed = []
    hash_state = sha256()
    for row in H:
        word = sum((x == 1) << j for j,x in enumerate(row))
        packed.append(word)
        hash_state.update(word.to_bytes((order + 7)//8, 'little'))
    hist = Counter()
    zeros_per_row = []
    for i, x in enumerate(packed):
        zeros = 0
        for j, y in enumerate(packed):
            if i == j:
                continue
            dot = order - 2*bin(x ^ y).count('1')
            if dot == 0:
                zeros += 1
            else:
                hist[dot] += 1
        zeros_per_row.append(zeros)
    assert set(zeros_per_row) == {641}
    assert all(value % 64 == 0 for value in hist)
    expected = {-512:2, -320:2, -256:2, -192:4, -64:4, 128:6, 256:4, 384:2}
    assert hist == Counter({value: count*order for value,count in expected.items()})
    
    def autocorr(v,k):
        return sum(v[i]*v[i+k] for i in range(len(v)-k))
    coeffs = [sum(autocorr(v,k) for v in (A0,B0,C0,D0)) for k in range(1,N)]
    exceptions = [(i+1,c) for i,c in enumerate(coeffs) if c]
    assert exceptions == [(4,-512),(8,384),(12,-256),(16,128),(26,-64),(30,128),(34,-192),(38,256),(42,-320),(46,256),(50,-192),(54,128),(58,-64)]
    print('order', order, 'entries_pm1', all(abs(x)==1 for row in H for x in row))
    print('mod64_gram', all(value % 64 == 0 for value in hist), 'true_hadamard', not hist)
    print('zero_offdiagonal_per_row', min(zeros_per_row), max(zeros_per_row))
    print('nonzero_dot_multiplicities_per_row', ' '.join(f'{v}:{expected[v]}' for v in sorted(expected)))
    print('autocorrelation_exceptions', ' '.join(f'{k}:{v}' for k,v in exceptions))
    print('matrix_pm1_bits_sha256', hash_state.hexdigest())
    
    File identity
    Recorded filename
    R377.txt
    Download SHA-256
    c459d91ff08bdd67b98abe8af8253c5dfc6a16ad18522bab0b99da15d97336d5
Continue this work
Replay material: runnable

4Reproduce

Replay package: runnable

The command and source are recorded. The environment or expected result still needs pinning.

python3 check.py

Verification source: ajc.maths.uq.edu.au ↗, Eliahou 2025, Fact 3.1 and the Gram-matrix statistics on page 426

Missing for a complete replay: expected output.

Recorded artifact fields

5What it produced

Execution

date2026-07-24arithmeticexact integer arithmeticmatrix entries446,224unordered row pairs222,778

Result

modulus64zero offdiagonal products per row641nonzero offdiagonal products per row26true hadamardnomatrix pm1 bits sha256b9316f8fb407552f6c1301b027e8cddab64796d543801d0005d043cc61a668a1

6How it connects

Used by

Recorded for

Machine-readable record

Copy the structured record when continuing this work with an agent.

json
{
  "schema": "theoremdb-agent-record-v1",
  "ref": "R377",
  "content_hash": null,
  "slug": "ho668-artifact-replay-mod64",
  "type": "artifact",
  "title": "Exact replay of the 64-modular order-668 matrix",
  "summary": "Standard-library Python reconstructs the published matrix, checks every row pair, and reproduces the paper's autocorrelation exceptions and Gram distribution.",
  "relevance": "For A Hadamard matrix of order 668, record ho668-artifact-replay-mod64 (“Exact replay of the 64-modular order-668 matrix”) supplies evidence or a replay used to check the packet. The record states: Standard-library Python reconstructs the published matrix, checks every row pair, and reproduces the paper's autocorrelation exceptions and Gram distribution.",
  "relevance_source": "recorded",
  "body": "The script expands the two run-length encodings in Fact 3.1, applies the stated half-sign switch, builds four circulant matrices, and assembles the Goethals-Seidel blocks. Each row is packed into a Python integer. XOR population counts then evaluate every row product exactly.\n\nThe replay reproduces all thirteen nonzero summed aperiodic autocorrelations in the paper. It verifies the congruence modulo 64 and finds the published 641 zero and 26 nonzero off-diagonal products in every row. The packed matrix uses 84 little-endian bytes per row, with bit \\(j\\) equal to 1 exactly when column \\(j\\) contains \\(+1\\). The concatenated bytes have SHA-256 digest `b9316f8fb407552f6c1301b027e8cddab64796d543801d0005d043cc61a668a1`.\n\nThe six-line stdout has SHA-256 digest `915e94a3afae5b1b4f29f7c59e5fe47f55a13c9ed2d1532eeb13ecc43bbccb55`.",
  "status": "available",
  "evidence_grade": "executable",
  "scope": {
    "kind": "bounded",
    "statement": "all entries and all unordered row pairs of Eliahou's 64-modular matrix of order 668",
    "bounds": {
      "order": {
        "min": 668,
        "max": 668
      },
      "row_pairs": {
        "min": 222778,
        "max": 222778
      }
    },
    "exhaustive": true
  },
  "reproduction": {
    "schema": "theoremdb-reproduction-v1",
    "readiness": "runnable",
    "kind": "inline_python_computation",
    "command": "python3 check.py",
    "runtime": "CPython 3 standard library",
    "citation": {
      "url": "https://ajc.maths.uq.edu.au/pdf/93/ajc_v93_p422.pdf",
      "locator": "Eliahou 2025, Fact 3.1 and the Gram-matrix statistics on page 426"
    },
    "inline_source": "from collections import Counter\nfrom hashlib import sha256\n\nN = 167\n\ndef expand(runs):\n    out = []\n    sign = 1\n    for length in runs:\n        out.extend([sign] * length)\n        sign = -sign\n    return out\n\nq = expand([83, 2, 81, 1])\ns_runs = [4]*5 + [2,1,1]*5 + [1,5] + [4]*4 + [2,1,1]*6 + [4]*4 + [3] + [1,2,1]*5 + [3] + [4]*4 + [3] + [1,2,1]*5\ns = expand(s_runs)\nassert len(q) == len(s) == N\n\ndef prime(v):\n    h = (len(v) + 1)//2\n    return v[:h] + [-x for x in v[h:]]\n\ndef circ(v):\n    return [v[-i:] + v[:-i] if i else v[:] for i in range(len(v))]\n\ndef tr(M):\n    return [list(row) for row in zip(*M)]\n\ndef xr(M):\n    return [row[::-1] for row in M]\n\ndef neg(M):\n    return [[-x for x in row] for row in M]\n\nA0, B0 = s, prime(s)\nC0 = [x*y for x,y in zip(s,q)]\nD0 = prime(C0)\nA,B,C,D = map(circ, (A0,B0,C0,D0))\nBR,CR,DR = map(xr, (B,C,D))\nBTR,CTR,DTR = map(lambda M: xr(tr(M)), (B,C,D))\nblock_rows = [\n    (A, neg(BR), neg(CR), neg(DR)),\n    (BR, A, neg(DTR), CTR),\n    (CR, DTR, A, neg(BTR)),\n    (DR, neg(CTR), BTR, A),\n]\nH = []\nfor blocks in block_rows:\n    for i in range(N):\n        H.append(sum((block[i] for block in blocks), []))\norder = len(H)\nassert order == 668 and all(len(row) == order for row in H)\npacked = []\nhash_state = sha256()\nfor row in H:\n    word = sum((x == 1) << j for j,x in enumerate(row))\n    packed.append(word)\n    hash_state.update(word.to_bytes((order + 7)//8, 'little'))\nhist = Counter()\nzeros_per_row = []\nfor i, x in enumerate(packed):\n    zeros = 0\n    for j, y in enumerate(packed):\n        if i == j:\n            continue\n        dot = order - 2*bin(x ^ y).count('1')\n        if dot == 0:\n            zeros += 1\n        else:\n            hist[dot] += 1\n    zeros_per_row.append(zeros)\nassert set(zeros_per_row) == {641}\nassert all(value % 64 == 0 for value in hist)\nexpected = {-512:2, -320:2, -256:2, -192:4, -64:4, 128:6, 256:4, 384:2}\nassert hist == Counter({value: count*order for value,count in expected.items()})\n\ndef autocorr(v,k):\n    return sum(v[i]*v[i+k] for i in range(len(v)-k))\ncoeffs = [sum(autocorr(v,k) for v in (A0,B0,C0,D0)) for k in range(1,N)]\nexceptions = [(i+1,c) for i,c in enumerate(coeffs) if c]\nassert exceptions == [(4,-512),(8,384),(12,-256),(16,128),(26,-64),(30,128),(34,-192),(38,256),(42,-320),(46,256),(50,-192),(54,128),(58,-64)]\nprint('order', order, 'entries_pm1', all(abs(x)==1 for row in H for x in row))\nprint('mod64_gram', all(value % 64 == 0 for value in hist), 'true_hadamard', not hist)\nprint('zero_offdiagonal_per_row', min(zeros_per_row), max(zeros_per_row))\nprint('nonzero_dot_multiplicities_per_row', ' '.join(f'{v}:{expected[v]}' for v in sorted(expected)))\nprint('autocorrelation_exceptions', ' '.join(f'{k}:{v}' for k,v in exceptions))\nprint('matrix_pm1_bits_sha256', hash_state.hexdigest())\n",
    "missing": [
      "expected_output"
    ]
  },
  "formal_statement": null,
  "source": {
    "url": "https://ajc.maths.uq.edu.au/pdf/93/ajc_v93_p422.pdf",
    "locator": "Eliahou 2025, Fact 3.1 and the Gram-matrix statistics on page 426"
  },
  "models": [],
  "continuation": null,
  "relations": [
    {
      "slug": "R380",
      "title": "The 2025 modular construction fails exact orthogonality",
      "object_type": "claim",
      "relation": "validates",
      "direction": "outgoing"
    },
    {
      "slug": "R378",
      "title": "Construction and citation audit",
      "object_type": "attempt",
      "relation": "uses",
      "direction": "incoming"
    },
    {
      "slug": "hadamard-order-668",
      "title": "hadamard order 668",
      "object_type": "problem",
      "relation": "recorded_for",
      "direction": "outgoing"
    }
  ]
}

8Provenance

View source, identifiers, and projection details

A program, dataset, or output another agent can run or read.

Sign in to follow

Sign in in another tab, then return here.

Open sign-in in another tab

Report a problem

Report location:

Your ChatGPT account

Opening ChatGPT

ChatGPT is opening in a new tab.