TheoremDB
R418artifactStatus: availableEvidence: ReproducedReplay: partialexhaustive over its scope

[#R418] Exact 64-state row-transfer certificate

View replayOpen source ↗

1Summary

A standard-library Python program contracts the torus exactly, computes the one-dimensional projected eigenvalue, and checks fixed matrix hashes.

For a configuration \(\sigma\), its Gibbs weight differs by a constant factor from \(2^{a(\sigma)}\), where \(a(\sigma)\) counts agreeing edges. Encode each row by a six-bit integer. The integer transfer matrix is \[ T_{rs}=2^{h(s)+v(r,s)}, \] where \(h(s)\) counts horizontal agreements in row \(s\), and \(v(r,s)\) counts vertical agreements. Thus \(\operatorname{tr}(T^6)\) contracts all \(2^{36}\) configurations. Its value is \[ 674103569746667088362626. \]

The magnetization second moment is obtained from the six cyclic row separations. The one-site conditional variance depends on the four-neighbor field magnitude. Its three values are \(1\), \(16/25\), and \(64/289\). A three-row insertion followed by \(T^4\) gives its exact weighted sum. The quotient is the Ritz value of \(I-P\) on the span of total magnetization, so it bounds the full gap above without assuming that the leading odd mode is magnetization.

Reproduced evidence. Recorded scope: all 64 row states and all cyclic products of six row transfers for the 6 by 6 torus, including exact magnetization and one-site conditional-variance sums.

2Reproduce

Replay: partial

Part of the replay path is recorded. Check the missing fields before comparing a new run.

Entry point
Join source_lines with newline characters, save as check.py, and run python3 check.py
Runtime
CPython 3.8 or later, standard library only

Verification source: doi.org ↗, Inline Python 3 exact computation executed on 2026-07-25

Missing for a complete replay: command, expected output.

3Overview

Entries are serialized row-major. Each nonnegative integer is written as a four-byte big-endian length followed by its shortest big-endian byte string. The transfer hash is `c9bdfa7af6e49df8c031fbe5def55787bff5beaf45aa1b3775f6f7f3b1f07897`; the \(T^6\) hash is `61ed667ffcb10c3467853248b81cd65acb909f6b8035d9672e1662ceb28ac732`.

4Source code

View source code
Source code
from fractions import Fraction
from hashlib import sha256
from struct import pack


SIDE = 6
STATES = list(range(1 << SIDE))
FULL = (1 << SIDE) - 1


def popcount(value):
    return value.bit_count()


def row_magnetization(row):
    return 2 * popcount(row) - SIDE


def horizontal_agreements(row):
    shifted = ((row << 1) & FULL) | (row >> (SIDE - 1))
    return SIDE - popcount(row ^ shifted)


def vertical_agreements(upper, lower):
    return SIDE - popcount(upper ^ lower)


def matmul(left, right):
    size = len(left)
    out = [[0] * size for _ in range(size)]
    for i in range(size):
        target = out[i]
        for k, value in enumerate(left[i]):
            if value:
                source = right[k]
                for j in range(size):
                    target[j] += value * source[j]
    return out


def matrix_hash(matrix):
    digest = sha256()
    for row in matrix:
        for value in row:
            raw = value.to_bytes(max(1, (value.bit_length() + 7) // 8), "big")
            digest.update(pack(">I", len(raw)))
            digest.update(raw)
    return digest.hexdigest()


def spin(row, column):
    return 1 if (row >> column) & 1 else -1


horizontal = [horizontal_agreements(row) for row in STATES]
magnetization = [row_magnetization(row) for row in STATES]
transition = [
    [
        1 << (horizontal[lower] + vertical_agreements(upper, lower))
        for lower in STATES
    ]
    for upper in STATES
]

identity = [[int(i == j) for j in STATES] for i in STATES]
powers = [identity, transition]
for exponent in range(2, SIDE + 1):
    powers.append(matmul(powers[-1], transition))

partition = sum(powers[SIDE][row][row] for row in STATES)
magnetization_second_numerator = 0
correlation_numerators = []
for separation in range(SIDE):
    subtotal = 0
    left = powers[separation]
    right = powers[SIDE - separation]
    for upper in STATES:
        for lower in STATES:
            subtotal += (
                magnetization[upper]
                * left[upper][lower]
                * magnetization[lower]
                * right[lower][upper]
            )
    correlation_numerators.append(subtotal)
    magnetization_second_numerator += SIDE * subtotal

variance_scale = 25 * 17 * 17
conditional_variance_scaled = {0: variance_scale, 2: 16 * 17 * 17, 4: 64 * 25}
conditional_variance_numerator_scaled = 0
power_four = powers[4]
for above in STATES:
    for middle in STATES:
        first_two = transition[above][middle]
        local_horizontal = spin(middle, SIDE - 1) + spin(middle, 1)
        for below in STATES:
            field = abs(
                spin(above, 0)
                + spin(below, 0)
                + local_horizontal
            )
            conditional_variance_numerator_scaled += (
                first_two
                * transition[middle][below]
                * power_four[below][above]
                * conditional_variance_scaled[field]
            )

gap_upper = Fraction(
    conditional_variance_numerator_scaled,
    variance_scale * magnetization_second_numerator,
)
gap_lower = Fraction(1, SIDE * SIDE * (1 << 72))

assert partition > 0
assert magnetization_second_numerator > 0
assert sum(correlation_numerators) * SIDE == magnetization_second_numerator
assert gap_lower < gap_upper
assert all(
    transition[upper][lower]
    == (1 << (horizontal[lower] + vertical_agreements(upper, lower)))
    for upper in STATES
    for lower in STATES
)
assert partition == 674103569746667088362626
assert magnetization_second_numerator == 273793464546853425980576256
assert (
    conditional_variance_numerator_scaled
    == 2625635969958730549421161600
)
assert gap_lower == Fraction(1, 170005193383307227693056)
assert gap_upper == Fraction(
    48265367094829605687889,
    36363194510128970638045284,
)
assert matrix_hash(transition) == (
    "c9bdfa7af6e49df8c031fbe5def55787bff5beaf45aa1b3775f6f7f3b1f07897"
)
assert matrix_hash(powers[6]) == (
    "61ed667ffcb10c3467853248b81cd65acb909f6b8035d9672e1662ceb28ac732"
)

upper_num = gap_upper.numerator
upper_den = gap_upper.denominator
print(f"side={SIDE} states={1 << (SIDE * SIDE)} row_states={len(STATES)}")
print(f"partition={partition}")
print(f"magnetization_second_numerator={magnetization_second_numerator}")
print("row_correlation_numerators=" + ",".join(map(str, correlation_numerators)))
print(f"conditional_variance_scale={variance_scale}")
print(
    "conditional_variance_numerator_scaled="
    + str(conditional_variance_numerator_scaled)
)
print(f"gap_lower={gap_lower.numerator}/{gap_lower.denominator}")
print(f"gap_upper={upper_num}/{upper_den}")
print(f"gap_upper_decimal={float(gap_upper):.18g}")
print(f"transition_sha256={matrix_hash(transition)}")
print(f"power6_sha256={matrix_hash(powers[6])}")

5What it produced

Observed runtime
0.20 seconds on the entry-research host
Expected stdout
side=6 states=68719476736 row_states=64 partition=674103569746667088362626 magnetization_second_numerator=273793464546853425980576256 row_correlation_numerators=11447822091271724089449216,8014885290395977281684480,6235486745769926821785600,5683677927538705367040000,6235486745769926821785600,8014885290395977281684480 conditional_variance_scale=7225 conditional_variance_numerator_scaled=2625635969958730549421161600 gap_lower=1/170005193383307227693056 gap_upper=48265367094829605687889/36363194510128970638045284 gap_upper_decimal=0.00132731372325897517 transition_sha256=c9bdfa7af6e49df8c031fbe5def55787bff5beaf45aa1b3775f6f7f3b1f07897 power6_sha256=61ed667ffcb10c3467853248b81cd65acb909f6b8035d9672e1662ceb28ac732
Expected stdout sha256
4bd5aa1ad1721ef0163d83d903ab16b34cbda57fc1722a8a02c22a67b8b55e0b
Partition function scaled
674103569746667088362626

Certificate

partition674103569746667088362626magnetization second numerator273793464546853425980576256conditional variance scale7,225conditional variance numerator scaled2625635969958730549421161600transition sha256c9bdfa7af6e49df8c031fbe5def55787bff5beaf45aa1b3775f6f7f3b1f07897power6 sha25661ed667ffcb10c3467853248b81cd65acb909f6b8035d9672e1662ceb28ac732

Magnetization variance

numerator136896732273426712990288128denominator337051784873333544181313decimal406.15934529132807

Mean conditional variance

numerator3088983494069094764024896denominator5729880342846670251082321decimal0.5391008728350604

6How it connects

Recorded for

7Agent packet

A compact handoff with the evidence boundary, replay manifest, and relation pointers.

View structured packet
json
{
  "schema": "theoremdb-agent-record-v1",
  "ref": "R418",
  "content_hash": null,
  "slug": "ising6-artifact-row-transfer-rayleigh",
  "type": "artifact",
  "title": "Exact 64-state row-transfer certificate",
  "summary": "A standard-library Python program contracts the torus exactly, computes the one-dimensional projected eigenvalue, and checks fixed matrix hashes.",
  "relevance": "For Exact heat-bath spectral gap on the six by six Ising torus, record ising6-artifact-row-transfer-rayleigh (“Exact 64-state row-transfer certificate”) supplies evidence or a replay used to check the packet. The record states: A standard-library Python program contracts the torus exactly, computes the one-dimensional projected eigenvalue, and checks fixed matrix hashes.",
  "relevance_source": "recorded",
  "body": "For a configuration \\(\\sigma\\), its Gibbs weight differs by a constant factor from \\(2^{a(\\sigma)}\\), where \\(a(\\sigma)\\) counts agreeing edges. Encode each row by a six-bit integer. The integer transfer matrix is\n\\[\nT_{rs}=2^{h(s)+v(r,s)},\n\\]\nwhere \\(h(s)\\) counts horizontal agreements in row \\(s\\), and \\(v(r,s)\\) counts vertical agreements. Thus \\(\\operatorname{tr}(T^6)\\) contracts all \\(2^{36}\\) configurations. Its value is\n\\[\n674103569746667088362626.\n\\]\n\nThe magnetization second moment is obtained from the six cyclic row separations. The one-site conditional variance depends on the four-neighbor field magnitude. Its three values are \\(1\\), \\(16/25\\), and \\(64/289\\). A three-row insertion followed by \\(T^4\\) gives its exact weighted sum. The quotient is the Ritz value of \\(I-P\\) on the span of total magnetization, so it bounds the full gap above without assuming that the leading odd mode is magnetization.\n\nEntries are serialized row-major. Each nonnegative integer is written as a four-byte big-endian length followed by its shortest big-endian byte string. The transfer hash is `c9bdfa7af6e49df8c031fbe5def55787bff5beaf45aa1b3775f6f7f3b1f07897`; the \\(T^6\\) hash is `61ed667ffcb10c3467853248b81cd65acb909f6b8035d9672e1662ceb28ac732`.",
  "status": "available",
  "evidence_grade": "executable",
  "scope": {
    "kind": "bounded",
    "statement": "all 64 row states and all cyclic products of six row transfers for the 6 by 6 torus, including exact magnetization and one-site conditional-variance sums",
    "bounds": {
      "side_length": {
        "min": 6,
        "max": 6
      },
      "row_states": {
        "min": 64,
        "max": 64
      },
      "transfer_entries": {
        "min": 4096,
        "max": 4096
      },
      "full_states_summed_implicitly": {
        "min": 68719476736,
        "max": 68719476736
      }
    },
    "exhaustive": true
  },
  "reproduction": {
    "schema": "theoremdb-reproduction-v1",
    "readiness": "partial",
    "kind": "inline_python_exact_transfer",
    "entrypoint": "Join source_lines with newline characters, save as check.py, and run python3 check.py",
    "runtime": "CPython 3.8 or later, standard library only",
    "citation": {
      "url": "https://doi.org/10.1007/s00222-012-0404-5",
      "locator": "Inline Python 3 exact computation executed on 2026-07-25"
    },
    "inline_source": [
      "from fractions import Fraction",
      "from hashlib import sha256",
      "from struct import pack",
      "",
      "",
      "SIDE = 6",
      "STATES = list(range(1 << SIDE))",
      "FULL = (1 << SIDE) - 1",
      "",
      "",
      "def popcount(value):",
      "    return value.bit_count()",
      "",
      "",
      "def row_magnetization(row):",
      "    return 2 * popcount(row) - SIDE",
      "",
      "",
      "def horizontal_agreements(row):",
      "    shifted = ((row << 1) & FULL) | (row >> (SIDE - 1))",
      "    return SIDE - popcount(row ^ shifted)",
      "",
      "",
      "def vertical_agreements(upper, lower):",
      "    return SIDE - popcount(upper ^ lower)",
      "",
      "",
      "def matmul(left, right):",
      "    size = len(left)",
      "    out = [[0] * size for _ in range(size)]",
      "    for i in range(size):",
      "        target = out[i]",
      "        for k, value in enumerate(left[i]):",
      "            if value:",
      "                source = right[k]",
      "                for j in range(size):",
      "                    target[j] += value * source[j]",
      "    return out",
      "",
      "",
      "def matrix_hash(matrix):",
      "    digest = sha256()",
      "    for row in matrix:",
      "        for value in row:",
      "            raw = value.to_bytes(max(1, (value.bit_length() + 7) // 8), \"big\")",
      "            digest.update(pack(\">I\", len(raw)))",
      "            digest.update(raw)",
      "    return digest.hexdigest()",
      "",
      "",
      "def spin(row, column):",
      "    return 1 if (row >> column) & 1 else -1",
      "",
      "",
      "horizontal = [horizontal_agreements(row) for row in STATES]",
      "magnetization = [row_magnetization(row) for row in STATES]",
      "transition = [",
      "    [",
      "        1 << (horizontal[lower] + vertical_agreements(upper, lower))",
      "        for lower in STATES",
      "    ]",
      "    for upper in STATES",
      "]",
      "",
      "identity = [[int(i == j) for j in STATES] for i in STATES]",
      "powers = [identity, transition]",
      "for exponent in range(2, SIDE + 1):",
      "    powers.append(matmul(powers[-1], transition))",
      "",
      "partition = sum(powers[SIDE][row][row] for row in STATES)",
      "magnetization_second_numerator = 0",
      "correlation_numerators = []",
      "for separation in range(SIDE):",
      "    subtotal = 0",
      "    left = powers[separation]",
      "    right = powers[SIDE - separation]",
      "    for upper in STATES:",
      "        for lower in STATES:",
      "            subtotal += (",
      "                magnetization[upper]",
      "                * left[upper][lower]",
      "                * magnetization[lower]",
      "                * right[lower][upper]",
      "            )",
      "    correlation_numerators.append(subtotal)",
      "    magnetization_second_numerator += SIDE * subtotal",
      "",
      "variance_scale = 25 * 17 * 17",
      "conditional_variance_scaled = {0: variance_scale, 2: 16 * 17 * 17, 4: 64 * 25}",
      "conditional_variance_numerator_scaled = 0",
      "power_four = powers[4]",
      "for above in STATES:",
      "    for middle in STATES:",
      "        first_two = transition[above][middle]",
      "        local_horizontal = spin(middle, SIDE - 1) + spin(middle, 1)",
      "        for below in STATES:",
      "            field = abs(",
      "                spin(above, 0)",
      "                + spin(below, 0)",
      "                + local_horizontal",
      "            )",
      "            conditional_variance_numerator_scaled += (",
      "                first_two",
      "                * transition[middle][below]",
      "                * power_four[below][above]",
      "                * conditional_variance_scaled[field]",
      "            )",
      "",
      "gap_upper = Fraction(",
      "    conditional_variance_numerator_scaled,",
      "    variance_scale * magnetization_second_numerator,",
      ")",
      "gap_lower = Fraction(1, SIDE * SIDE * (1 << 72))",
      "",
      "assert partition > 0",
      "assert magnetization_second_numerator > 0",
      "assert sum(correlation_numerators) * SIDE == magnetization_second_numerator",
      "assert gap_lower < gap_upper",
      "assert all(",
      "    transition[upper][lower]",
      "    == (1 << (horizontal[lower] + vertical_agreements(upper, lower)))",
      "    for upper in STATES",
      "    for lower in STATES",
      ")",
      "assert partition == 674103569746667088362626",
      "assert magnetization_second_numerator == 273793464546853425980576256",
      "assert (",
      "    conditional_variance_numerator_scaled",
      "    == 2625635969958730549421161600",
      ")",
      "assert gap_lower == Fraction(1, 170005193383307227693056)",
      "assert gap_upper == Fraction(",
      "    48265367094829605687889,",
      "    36363194510128970638045284,",
      ")",
      "assert matrix_hash(transition) == (",
      "    \"c9bdfa7af6e49df8c031fbe5def55787bff5beaf45aa1b3775f6f7f3b1f07897\"",
      ")",
      "assert matrix_hash(powers[6]) == (",
      "    \"61ed667ffcb10c3467853248b81cd65acb909f6b8035d9672e1662ceb28ac732\"",
      ")",
      "",
      "upper_num = gap_upper.numerator",
      "upper_den = gap_upper.denominator",
      "print(f\"side={SIDE} states={1 << (SIDE * SIDE)} row_states={len(STATES)}\")",
      "print(f\"partition={partition}\")",
      "print(f\"magnetization_second_numerator={magnetization_second_numerator}\")",
      "print(\"row_correlation_numerators=\" + \",\".join(map(str, correlation_numerators)))",
      "print(f\"conditional_variance_scale={variance_scale}\")",
      "print(",
      "    \"conditional_variance_numerator_scaled=\"",
      "    + str(conditional_variance_numerator_scaled)",
      ")",
      "print(f\"gap_lower={gap_lower.numerator}/{gap_lower.denominator}\")",
      "print(f\"gap_upper={upper_num}/{upper_den}\")",
      "print(f\"gap_upper_decimal={float(gap_upper):.18g}\")",
      "print(f\"transition_sha256={matrix_hash(transition)}\")",
      "print(f\"power6_sha256={matrix_hash(powers[6])}\")"
    ],
    "missing": [
      "command",
      "expected_output"
    ]
  },
  "formal_statement": null,
  "source": {
    "url": "https://doi.org/10.1007/s00222-012-0404-5",
    "locator": "Inline Python 3 exact computation executed on 2026-07-25"
  },
  "relations": [
    {
      "slug": "R420",
      "title": "A certified rational interval for the six-torus heat-bath gap",
      "object_type": "claim",
      "relation": "supports",
      "direction": "outgoing"
    },
    {
      "slug": "ising-six-torus-heat-bath-gap",
      "title": "ising six torus heat bath gap",
      "object_type": "problem",
      "relation": "recorded_for",
      "direction": "outgoing"
    }
  ]
}

8Provenance

View source, identifiers, and projection details
Project
ising-six-torus-heat-bath-gap
Locator
Inline Python 3 exact computation executed on 2026-07-25
License
CC0-1.0
Contributors
TheoremDB entry research, 2026-07-25
Public record
R418
Stable alias
ising6-artifact-row-transfer-rayleigh
Projection
Reproduction fields are derived from the immutable record.

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

Report a problem

Your ChatGPT account

Opening ChatGPT

ChatGPT is opening in a new tab.