[#R657] Exact quotient and Walsh replay for the distance-88 cubic
1Summary
A deterministic standard-library program enumerates all 8,192 quotient representatives, checks the complete score histogram, and verifies a nearest quadratic by direct truth-table weight.
Join source_lines with LF, append a terminal LF, save the result as `rm28_exact.py` in a disposable directory, and run the recorded command. The program derives the eight-dimensional invariance span, enumerates the 13-dimensional quotient, evaluates both affine distances by exact integer Walsh transforms, and asserts the full histogram. It then evaluates the displayed 8-variable witness and nearest quadratic directly. Truth tables use integer inputs 0 through 255, with bit i assigned to variable i. The independent bitset implementation in rm28-artifact-bitset-crosscheck tests the same result through exhaustive affine masks.
Reproduced evidence. Recorded scope: the displayed 8-variable cubic against the complete space of degree-at-most-two corrections.
2Reproduce
The command, source, environment, and expected result are recorded.
python3 rm28_exact.py- Entry point
- Join source_lines with LF, append one terminal LF, and save as rm28_exact.py
- Runtime
- CPython 3.9.6 standard library, macOS 26.2 arm64
- Dependencies
- [ { "name": "CPython standard library", "version": "3.9.6", "license": "Python-2.0" } ]
- Recorded runtime
- 3.427693
Verification source: Self-contained CPython standard-library program authored and executed on 2026-07-28
Expected output
{
"source_sha256": "48e6b03098d3d9e8bebff7e0ec036aa88cd0fca2aeee329f1c328c3c4da96fd9",
"stdout_sha256": "b49025a58c8a15040dae1584753d54daeee353eb0888af83644d263126c1774f",
"expected_stdout": "span_rank=8\nquotient_dimension=13\nrepresentatives=8192\nhistogram=88:28,92:1016,96:2968,100:3024,104:1092,108:56,112:8\nminimum=88\nnearest_q=ad+bc+bd+bg\ndirect_weight=88\nslice_weights=40,48\nwitness_truth_sha256=47299b7d07c1a0de9de3c88d211b1b39d6d3d45259662df9aa77c9638874cc26\ncorrected_truth_sha256=22c23f99ad7843999487757749e4f4c9b9879151db4d016c5e91597eccccaea6\n",
"span_rank": 8,
"quotient_dimension": 13,
"representatives": 8192,
"minimum": 88,
"histogram": {
"88": 28,
"92": 1016,
"96": 2968,
"100": 3024,
"104": 1092,
"108": 56,
"112": 8
}
}3Source code
View source code
from collections import Counter
from hashlib import sha256
from itertools import combinations
PAIRS = list(combinations(range(7), 2))
PAIR_BIT = {pair: 1 << i for i, pair in enumerate(PAIRS)}
G_TERMS = [(0, 2, 6), (0, 3, 5), (1, 3, 6), (2, 3, 4)]
P_TERMS = [(0, 1), (2, 5), (4, 6), (5, 6)]
F_TERMS = [
(0, 1, 2),
(0, 3, 6),
(0, 5, 7),
(0, 6, 7),
(1, 3, 7),
(1, 4, 6),
(2, 4, 7),
(3, 4, 5),
]
NEAREST_TERMS = [(0, 3), (1, 2), (1, 3), (1, 6)]
def quadratic_mask(terms):
mask = 0
for pair in terms:
mask ^= PAIR_BIT[tuple(sorted(pair))]
return mask
def anf_table(variable_count, terms):
return [
sum(all((x >> i) & 1 for i in term) for term in terms) & 1
for x in range(1 << variable_count)
]
def quadratic_table(mask):
terms = [PAIRS[i] for i in range(len(PAIRS)) if (mask >> i) & 1]
return anf_table(7, terms)
def affine_distance(bits):
walsh = [1 - 2 * bit for bit in bits]
step = 1
while step < len(walsh):
for base in range(0, len(walsh), 2 * step):
for i in range(base, base + step):
left, right = walsh[i], walsh[i + step]
walsh[i], walsh[i + step] = left + right, left - right
step *= 2
return (len(bits) - max(map(abs, walsh))) // 2
p_mask = quadratic_mask(P_TERMS)
derivatives = []
for variable in range(7):
derivative_terms = [
tuple(i for i in term if i != variable)
for term in G_TERMS
if variable in term
]
derivatives.append(quadratic_mask(derivative_terms))
rows = [p_mask, *derivatives]
rank = 0
pivots = []
for column in range(len(PAIRS)):
hit = next(
(i for i in range(rank, len(rows)) if (rows[i] >> column) & 1),
None,
)
if hit is None:
continue
rows[rank], rows[hit] = rows[hit], rows[rank]
for i in range(len(rows)):
if i != rank and ((rows[i] >> column) & 1):
rows[i] ^= rows[rank]
pivots.append(column)
rank += 1
free = [i for i in range(len(PAIRS)) if i not in pivots]
assert rank == 8 and len(free) == 13
g = anf_table(7, G_TERMS)
p = anf_table(7, P_TERMS)
histogram = Counter()
for selector in range(1 << len(free)):
mask = sum(1 << column for j, column in enumerate(free) if (selector >> j) & 1)
h = quadratic_table(mask)
distance = affine_distance([u ^ v for u, v in zip(g, h)])
distance += affine_distance([u ^ v ^ w for u, v, w in zip(g, p, h)])
histogram[distance] += 1
expected = [(88, 28), (92, 1016), (96, 2968), (100, 3024)]
expected += [(104, 1092), (108, 56), (112, 8)]
assert sorted(histogram.items()) == expected
f = anf_table(8, F_TERMS)
q = anf_table(8, NEAREST_TERMS)
corrected = [u ^ v for u, v in zip(f, q)]
assert sum(corrected) == 88
slice_weights = [sum(corrected[0::2]), sum(corrected[1::2])]
assert slice_weights == [40, 48]
output = (
"span_rank=8\n"
"quotient_dimension=13\n"
"representatives=8192\n"
"histogram=88:28,92:1016,96:2968,100:3024,104:1092,108:56,112:8\n"
"minimum=88\n"
"nearest_q=ad+bc+bd+bg\n"
"direct_weight=88\n"
"slice_weights=40,48\n"
f"witness_truth_sha256={sha256(bytes(f)).hexdigest()}\n"
f"corrected_truth_sha256={sha256(bytes(corrected)).hexdigest()}\n"
)
print(output, end="")4What it produced
- Processor
- Apple M4 arm64, one process
- Source license
- CC0-1.0
- Network requirements
- none
- Randomness
- none
- Precision
- exact integer and bit arithmetic
- Arithmetic
- exact arithmetic over F2, exact integer Walsh coefficients, and exact Hamming weights
- Memory bound
- 128 MiB
- Measured max resident bytes
- 10,240,000
- Processor bound
- one CPU process
- Storage bound
- less than 32 KiB for source and stdout; no auxiliary files
- Time bound
- 10 seconds on the recorded processor
- Stopping rule
- enumerate every representative of the 13-dimensional quotient and assert the complete score histogram
- Execution date
- 2026-07-28
Independent replay
5How it connects
Evidence for
- claim
Tested by
- artifact
Recorded for
- problem
6Agent packet
A compact handoff with the evidence boundary, replay manifest, and relation pointers.
View structured packet
{
"schema": "theoremdb-agent-record-v1",
"ref": "R657",
"content_hash": null,
"slug": "rm28-artifact-exact-cubic-distance",
"type": "artifact",
"title": "Exact quotient and Walsh replay for the distance-88 cubic",
"summary": "A deterministic standard-library program enumerates all 8,192 quotient representatives, checks the complete score histogram, and verifies a nearest quadratic by direct truth-table weight.",
"relevance": "For Covering radius of the second-order Reed-Muller code RM(2,8), record rm28-artifact-exact-cubic-distance (“Exact quotient and Walsh replay for the distance-88 cubic”) supplies evidence or a replay used to check the packet. The record states: A deterministic standard-library program enumerates all 8,192 quotient representatives, checks the complete score histogram, and verifies a nearest quadratic by direct truth-table weight.",
"relevance_source": "recorded",
"body": "Join source_lines with LF, append a terminal LF, save the result as `rm28_exact.py` in a disposable directory, and run the recorded command. The program derives the eight-dimensional invariance span, enumerates the 13-dimensional quotient, evaluates both affine distances by exact integer Walsh transforms, and asserts the full histogram. It then evaluates the displayed 8-variable witness and nearest quadratic directly. Truth tables use integer inputs 0 through 255, with bit i assigned to variable i. The independent bitset implementation in rm28-artifact-bitset-crosscheck tests the same result through exhaustive affine masks.",
"status": "available",
"evidence_grade": "executable",
"scope": {
"kind": "bounded",
"statement": "the displayed 8-variable cubic against the complete space of degree-at-most-two corrections",
"bounds": {
"variables": {
"min": 8,
"max": 8
},
"quadratic_coefficients": {
"min": 37,
"max": 37
},
"quotient_representatives": {
"min": 8192,
"max": 8192
},
"truth_table_rows": {
"min": 256,
"max": 256
}
},
"exhaustive": true
},
"reproduction": {
"schema": "theoremdb-reproduction-v1",
"readiness": "complete",
"kind": "inline_python_exact_computation",
"command": "python3 rm28_exact.py",
"entrypoint": "Join source_lines with LF, append one terminal LF, and save as rm28_exact.py",
"runtime": "CPython 3.9.6 standard library, macOS 26.2 arm64",
"citation": {
"locator": "Self-contained CPython standard-library program authored and executed on 2026-07-28"
},
"dependencies": [
{
"name": "CPython standard library",
"version": "3.9.6",
"license": "Python-2.0"
}
],
"outputs": {
"source_sha256": "48e6b03098d3d9e8bebff7e0ec036aa88cd0fca2aeee329f1c328c3c4da96fd9",
"stdout_sha256": "b49025a58c8a15040dae1584753d54daeee353eb0888af83644d263126c1774f",
"expected_stdout": "span_rank=8\nquotient_dimension=13\nrepresentatives=8192\nhistogram=88:28,92:1016,96:2968,100:3024,104:1092,108:56,112:8\nminimum=88\nnearest_q=ad+bc+bd+bg\ndirect_weight=88\nslice_weights=40,48\nwitness_truth_sha256=47299b7d07c1a0de9de3c88d211b1b39d6d3d45259662df9aa77c9638874cc26\ncorrected_truth_sha256=22c23f99ad7843999487757749e4f4c9b9879151db4d016c5e91597eccccaea6\n",
"span_rank": 8,
"quotient_dimension": 13,
"representatives": 8192,
"minimum": 88,
"histogram": {
"88": 28,
"92": 1016,
"96": 2968,
"100": 3024,
"104": 1092,
"108": 56,
"112": 8
}
},
"runtime_seconds": 3.427693,
"inline_source": [
"from collections import Counter",
"from hashlib import sha256",
"from itertools import combinations",
"",
"PAIRS = list(combinations(range(7), 2))",
"PAIR_BIT = {pair: 1 << i for i, pair in enumerate(PAIRS)}",
"G_TERMS = [(0, 2, 6), (0, 3, 5), (1, 3, 6), (2, 3, 4)]",
"P_TERMS = [(0, 1), (2, 5), (4, 6), (5, 6)]",
"F_TERMS = [",
" (0, 1, 2),",
" (0, 3, 6),",
" (0, 5, 7),",
" (0, 6, 7),",
" (1, 3, 7),",
" (1, 4, 6),",
" (2, 4, 7),",
" (3, 4, 5),",
"]",
"NEAREST_TERMS = [(0, 3), (1, 2), (1, 3), (1, 6)]",
"",
"",
"def quadratic_mask(terms):",
" mask = 0",
" for pair in terms:",
" mask ^= PAIR_BIT[tuple(sorted(pair))]",
" return mask",
"",
"",
"def anf_table(variable_count, terms):",
" return [",
" sum(all((x >> i) & 1 for i in term) for term in terms) & 1",
" for x in range(1 << variable_count)",
" ]",
"",
"",
"def quadratic_table(mask):",
" terms = [PAIRS[i] for i in range(len(PAIRS)) if (mask >> i) & 1]",
" return anf_table(7, terms)",
"",
"",
"def affine_distance(bits):",
" walsh = [1 - 2 * bit for bit in bits]",
" step = 1",
" while step < len(walsh):",
" for base in range(0, len(walsh), 2 * step):",
" for i in range(base, base + step):",
" left, right = walsh[i], walsh[i + step]",
" walsh[i], walsh[i + step] = left + right, left - right",
" step *= 2",
" return (len(bits) - max(map(abs, walsh))) // 2",
"",
"",
"p_mask = quadratic_mask(P_TERMS)",
"derivatives = []",
"for variable in range(7):",
" derivative_terms = [",
" tuple(i for i in term if i != variable)",
" for term in G_TERMS",
" if variable in term",
" ]",
" derivatives.append(quadratic_mask(derivative_terms))",
"",
"rows = [p_mask, *derivatives]",
"rank = 0",
"pivots = []",
"for column in range(len(PAIRS)):",
" hit = next(",
" (i for i in range(rank, len(rows)) if (rows[i] >> column) & 1),",
" None,",
" )",
" if hit is None:",
" continue",
" rows[rank], rows[hit] = rows[hit], rows[rank]",
" for i in range(len(rows)):",
" if i != rank and ((rows[i] >> column) & 1):",
" rows[i] ^= rows[rank]",
" pivots.append(column)",
" rank += 1",
"",
"free = [i for i in range(len(PAIRS)) if i not in pivots]",
"assert rank == 8 and len(free) == 13",
"",
"g = anf_table(7, G_TERMS)",
"p = anf_table(7, P_TERMS)",
"histogram = Counter()",
"for selector in range(1 << len(free)):",
" mask = sum(1 << column for j, column in enumerate(free) if (selector >> j) & 1)",
" h = quadratic_table(mask)",
" distance = affine_distance([u ^ v for u, v in zip(g, h)])",
" distance += affine_distance([u ^ v ^ w for u, v, w in zip(g, p, h)])",
" histogram[distance] += 1",
"",
"expected = [(88, 28), (92, 1016), (96, 2968), (100, 3024)]",
"expected += [(104, 1092), (108, 56), (112, 8)]",
"assert sorted(histogram.items()) == expected",
"",
"f = anf_table(8, F_TERMS)",
"q = anf_table(8, NEAREST_TERMS)",
"corrected = [u ^ v for u, v in zip(f, q)]",
"assert sum(corrected) == 88",
"slice_weights = [sum(corrected[0::2]), sum(corrected[1::2])]",
"assert slice_weights == [40, 48]",
"",
"output = (",
" \"span_rank=8\\n\"",
" \"quotient_dimension=13\\n\"",
" \"representatives=8192\\n\"",
" \"histogram=88:28,92:1016,96:2968,100:3024,104:1092,108:56,112:8\\n\"",
" \"minimum=88\\n\"",
" \"nearest_q=ad+bc+bd+bg\\n\"",
" \"direct_weight=88\\n\"",
" \"slice_weights=40,48\\n\"",
" f\"witness_truth_sha256={sha256(bytes(f)).hexdigest()}\\n\"",
" f\"corrected_truth_sha256={sha256(bytes(corrected)).hexdigest()}\\n\"",
")",
"print(output, end=\"\")"
]
},
"formal_statement": null,
"source": {
"url": null,
"locator": "Self-contained CPython standard-library program authored and executed on 2026-07-28"
},
"relations": [
{
"slug": "R663",
"title": "An eight-term cubic has exact second-order nonlinearity 88",
"object_type": "claim",
"relation": "evidences",
"direction": "outgoing"
},
{
"slug": "R656",
"title": "Independent bitset cross-check of the cubic distance",
"object_type": "artifact",
"relation": "tests",
"direction": "incoming"
},
{
"slug": "reed-muller-rm2-8-covering-radius",
"title": "reed muller rm2 8 covering radius",
"object_type": "problem",
"relation": "recorded_for",
"direction": "outgoing"
}
]
}7Provenance
View source, identifiers, and projection details
- Project
- reed-muller-rm2-8-covering-radius-research
- Locator
- Self-contained CPython standard-library program authored and executed on 2026-07-28
- License
- CC0-1.0
- Public record
- R657
- Stable alias
- rm28-artifact-exact-cubic-distance
- Projection
- Reproduction fields are derived from the immutable record.
A program, dataset, or output another agent can run or read.