TheoremDB

Problem packetResearch packetR17

R17Executable evidence

Balanced-family alphabet enumerator

View replay
Link to a section

Authored summary

This Python driver enumerates the primitive normalized balanced family through a chosen maximum letter and invokes the linked exact DFS on every reflection representative.

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

Recorded status: available

Recorded scope: primitive normalized four-letter alphabets {0<a<b<c} with c=a+b, c at most 8, one representative under reflection

Complete recorded scope and conditions
{
  "kind": "bounded",
  "statement": "primitive normalized four-letter alphabets {0<a<b<c} with c=a+b, c at most 8, one representative under reflection",
  "bounds": {
    "alphabet_size": {
      "min": 4,
      "max": 4
    },
    "alphabet_maximum": {
      "min": 3,
      "max": 8
    },
    "alphabet_count": {
      "min": 10,
      "max": 10
    }
  },
  "exhaustive": true
}

Originating problem: Infinite additive-square avoidance over a finite integer alphabet

Authored record and scope
Authored title
Balanced-family alphabet enumerator
Record type
artifact
Stored status
available
Evidence grade
executable
Recorded scope data
{ "kind": "bounded", "statement": "primitive normalized four-letter alphabets {0<a<b<c} with c=a+b, c at most 8, one representative under reflection", "bounds": { "alphabet_size": { "min": 4, "max": 4 }, "alphabet_maximum": { "min": 3, "max": 8 }, "alphabet_count": { "min": 10, "max": 10 } }, "exhaustive": true }

2Authored explanation

Save source_lines as additive_square_sweep.py beside the linked additive_square_search.py artifact. The full stable digest covers every result field except runtime_seconds. The compact digest names six cross-implementation fields and is the comparison digest shared with the independent replay.

Files and source

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

  • R17.txt2,361 bytes · No SHA-256 recorded
    Preview R17.txt
    #!/usr/bin/env python3
    """Enumerate primitive four-letter integer alphabets in a bounded box."""
    
    from __future__ import annotations
    
    import argparse
    import hashlib
    import itertools
    import json
    import math
    
    from additive_square_search import canonical_reflection, exhaustive_search, normalize
    
    
    def main() -> None:
        parser = argparse.ArgumentParser()
        parser.add_argument("--max-value", type=int, required=True)
        parser.add_argument("--node-limit", type=int, default=10_000_000)
        parser.add_argument("--balanced-family-only", action="store_true")
        args = parser.parse_args()
    
        alphabets: list[tuple[int, ...]] = []
        for largest in range(3, args.max_value + 1):
            for middle in itertools.combinations(range(1, largest), 2):
                alphabet = (0, *middle, largest)
                if math.gcd(*alphabet[1:]) != 1:
                    continue
                if (
                    args.balanced_family_only
                    and alphabet[0] + alphabet[3] != alphabet[1] + alphabet[2]
                ):
                    continue
                alphabet = normalize(alphabet)
                if canonical_reflection(alphabet) != alphabet:
                    continue
                alphabets.append(alphabet)
    
        results = [
            exhaustive_search(alphabet, args.node_limit)
            for alphabet in alphabets
        ]
        payload = {
            "scope": {
                "alphabet_size": 4,
                "minimum": 0,
                "gcd_of_differences": 1,
                "reflection_representative": "lexicographically smaller of A and max(A)-A",
                "maximum_value_at_most": args.max_value,
                "balanced_family_equation": (
                    "for A={0<a<b<c}, require 0+c=a+b"
                    if args.balanced_family_only
                    else None
                ),
            },
            "alphabet_count": len(alphabets),
            "complete_count": sum(item["complete"] for item in results),
            "results": results,
        }
        stable_results = [
            {key: value for key, value in item.items() if key != "runtime_seconds"}
            for item in results
        ]
        encoded_results = json.dumps(
            stable_results, sort_keys=True, separators=(",", ":")
        ).encode()
        payload["stable_results_sha256"] = hashlib.sha256(encoded_results).hexdigest()
        print(json.dumps(payload, sort_keys=True, separators=(",", ":")))
    
    
    if __name__ == "__main__":
        main()
    File identity
    Recorded filename
    R17.txt
    Download SHA-256
    37e17f0a58638434a1b3244dcf2e204402321d5cada0029e84eec1b57d1b162e
Continue this work
Replay material: complete

4Reproduce

Replay package: complete

The command, source, environment, and expected result are recorded.

PYTHONPATH=. python3 additive_square_sweep.py --max-value 8 --balanced-family-only --node-limit 100000000

Verification source: Self-contained Python driver authored and executed on 2026-07-28; requires asq-artifact-python-exact-dfs

Expected output

{
  "alphabet_count": 10,
  "complete_count": 10,
  "ordered_alphabets": [
    [
      0,
      1,
      2,
      3
    ],
    [
      0,
      1,
      3,
      4
    ],
    [
      0,
      1,
      4,
      5
    ],
    [
      0,
      2,
      3,
      5
    ],
    [
      0,
      1,
      5,
      6
    ],
    [
      0,
      1,
      6,
      7
    ],
    [
      0,
      2,
      5,
      7
    ],
    [
      0,
      3,
      4,
      7
    ],
    [
      0,
      1,
      7,
      8
    ],
    [
      0,
      3,
      5,
      8
    ]
  ],
  "ordered_maximum_lengths": [
    50,
    55,
    55,
    55,
    60,
    60,
    60,
    58,
    60,
    60
  ],
  "full_stable_results_sha256": "78f0b9c574eed93bc426dadcf3d6b73469b567cb3306d0bc75b54f8c0d337f77",
  "full_digest_encoding": "sorted compact JSON of current result objects after removing runtime_seconds from each row",
  "compact_rows_sha256": "467ba6d5f68f122458e5ac4fe351ce2be0af366719e8dd8b2734061328ef4091"
}
Recorded artifact fields

5What it produced

6How it connects

Depends on

Recorded for

Machine-readable record

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

json
{
  "schema": "theoremdb-agent-record-v1",
  "ref": "R17",
  "content_hash": null,
  "slug": "asq-artifact-balanced-family-sweep",
  "type": "artifact",
  "title": "Balanced-family alphabet enumerator",
  "summary": "This Python driver enumerates the primitive normalized balanced family through a chosen maximum letter and invokes the linked exact DFS on every reflection representative.",
  "relevance": "For Infinite additive-square avoidance over a finite integer alphabet, record asq-artifact-balanced-family-sweep (“Balanced-family alphabet enumerator”) supplies evidence or a replay used to check the packet. The record states: This Python driver enumerates the primitive normalized balanced family through a chosen maximum letter and invokes the linked exact DFS on every reflection representative.",
  "relevance_source": "recorded",
  "body": "Save source_lines as additive_square_sweep.py beside the linked additive_square_search.py artifact. The full stable digest covers every result field except runtime_seconds. The compact digest names six cross-implementation fields and is the comparison digest shared with the independent replay.",
  "status": "available",
  "evidence_grade": "executable",
  "scope": {
    "kind": "bounded",
    "statement": "primitive normalized four-letter alphabets {0<a<b<c} with c=a+b, c at most 8, one representative under reflection",
    "bounds": {
      "alphabet_size": {
        "min": 4,
        "max": 4
      },
      "alphabet_maximum": {
        "min": 3,
        "max": 8
      },
      "alphabet_count": {
        "min": 10,
        "max": 10
      }
    },
    "exhaustive": true
  },
  "reproduction": {
    "schema": "theoremdb-reproduction-v1",
    "readiness": "complete",
    "kind": "inline_python_balanced_family_sweep",
    "command": "PYTHONPATH=. python3 additive_square_sweep.py --max-value 8 --balanced-family-only --node-limit 100000000",
    "entrypoint": "Join source_lines with LF, append a terminal LF, and save as additive_square_sweep.py",
    "runtime": "CPython 3.9.6, macOS 26.2 arm64",
    "citation": {
      "locator": "Self-contained Python driver authored and executed on 2026-07-28; requires asq-artifact-python-exact-dfs"
    },
    "dependencies": [
      {
        "name": "CPython standard library",
        "version": "3.9.6",
        "license": "Python-2.0"
      },
      {
        "name": "asq-artifact-python-exact-dfs",
        "version": "packet artifact saved as additive_square_search.py",
        "license": "CC0-1.0"
      }
    ],
    "outputs": {
      "alphabet_count": 10,
      "complete_count": 10,
      "ordered_alphabets": [
        [
          0,
          1,
          2,
          3
        ],
        [
          0,
          1,
          3,
          4
        ],
        [
          0,
          1,
          4,
          5
        ],
        [
          0,
          2,
          3,
          5
        ],
        [
          0,
          1,
          5,
          6
        ],
        [
          0,
          1,
          6,
          7
        ],
        [
          0,
          2,
          5,
          7
        ],
        [
          0,
          3,
          4,
          7
        ],
        [
          0,
          1,
          7,
          8
        ],
        [
          0,
          3,
          5,
          8
        ]
      ],
      "ordered_maximum_lengths": [
        50,
        55,
        55,
        55,
        60,
        60,
        60,
        58,
        60,
        60
      ],
      "full_stable_results_sha256": "78f0b9c574eed93bc426dadcf3d6b73469b567cb3306d0bc75b54f8c0d337f77",
      "full_digest_encoding": "sorted compact JSON of current result objects after removing runtime_seconds from each row",
      "compact_rows_sha256": "467ba6d5f68f122458e5ac4fe351ce2be0af366719e8dd8b2734061328ef4091"
    },
    "runtime_seconds": 80.48,
    "inline_source": [
      "#!/usr/bin/env python3",
      "\"\"\"Enumerate primitive four-letter integer alphabets in a bounded box.\"\"\"",
      "",
      "from __future__ import annotations",
      "",
      "import argparse",
      "import hashlib",
      "import itertools",
      "import json",
      "import math",
      "",
      "from additive_square_search import canonical_reflection, exhaustive_search, normalize",
      "",
      "",
      "def main() -> None:",
      "    parser = argparse.ArgumentParser()",
      "    parser.add_argument(\"--max-value\", type=int, required=True)",
      "    parser.add_argument(\"--node-limit\", type=int, default=10_000_000)",
      "    parser.add_argument(\"--balanced-family-only\", action=\"store_true\")",
      "    args = parser.parse_args()",
      "",
      "    alphabets: list[tuple[int, ...]] = []",
      "    for largest in range(3, args.max_value + 1):",
      "        for middle in itertools.combinations(range(1, largest), 2):",
      "            alphabet = (0, *middle, largest)",
      "            if math.gcd(*alphabet[1:]) != 1:",
      "                continue",
      "            if (",
      "                args.balanced_family_only",
      "                and alphabet[0] + alphabet[3] != alphabet[1] + alphabet[2]",
      "            ):",
      "                continue",
      "            alphabet = normalize(alphabet)",
      "            if canonical_reflection(alphabet) != alphabet:",
      "                continue",
      "            alphabets.append(alphabet)",
      "",
      "    results = [",
      "        exhaustive_search(alphabet, args.node_limit)",
      "        for alphabet in alphabets",
      "    ]",
      "    payload = {",
      "        \"scope\": {",
      "            \"alphabet_size\": 4,",
      "            \"minimum\": 0,",
      "            \"gcd_of_differences\": 1,",
      "            \"reflection_representative\": \"lexicographically smaller of A and max(A)-A\",",
      "            \"maximum_value_at_most\": args.max_value,",
      "            \"balanced_family_equation\": (",
      "                \"for A={0<a<b<c}, require 0+c=a+b\"",
      "                if args.balanced_family_only",
      "                else None",
      "            ),",
      "        },",
      "        \"alphabet_count\": len(alphabets),",
      "        \"complete_count\": sum(item[\"complete\"] for item in results),",
      "        \"results\": results,",
      "    }",
      "    stable_results = [",
      "        {key: value for key, value in item.items() if key != \"runtime_seconds\"}",
      "        for item in results",
      "    ]",
      "    encoded_results = json.dumps(",
      "        stable_results, sort_keys=True, separators=(\",\", \":\")",
      "    ).encode()",
      "    payload[\"stable_results_sha256\"] = hashlib.sha256(encoded_results).hexdigest()",
      "    print(json.dumps(payload, sort_keys=True, separators=(\",\", \":\")))",
      "",
      "",
      "if __name__ == \"__main__\":",
      "    main()"
    ]
  },
  "formal_statement": null,
  "source": {
    "url": null,
    "locator": "Self-contained Python driver authored and executed on 2026-07-28; requires asq-artifact-python-exact-dfs"
  },
  "models": [],
  "continuation": null,
  "relations": [
    {
      "slug": "R22",
      "title": "Reproduce the balanced-family table through maximum letter 8",
      "object_type": "attempt",
      "relation": "uses",
      "direction": "incoming"
    },
    {
      "slug": "R19",
      "title": "Exact additive-square-free prefix-tree enumerator",
      "object_type": "artifact",
      "relation": "depends_on",
      "direction": "outgoing"
    },
    {
      "slug": "additive-square-finite-alphabet",
      "title": "additive square finite alphabet",
      "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.