The script src/22-quantum/make_notebook.py of the validation package of the paper 22-qm, rendered with an anchor per line. ▶ run the predicates on Google Colab.
1"""Builds 22-quantum-main.ipynb (the Colab driver of the 22-quantum validation package). Run: python3 make_notebook.py"""2import json3import qmcommon as gc45NB = "22-quantum-main.ipynb"6PKG = "22-quantum"7COLAB = f"https://colab.research.google.com/github/gamayos/finite-ring-space/blob/main/src/{PKG}/{NB}"8cells = []9def md(s): cells.append({"cell_type": "markdown", "metadata": {}, "source": s})10def code(s): cells.append({"cell_type": "code", "metadata": {}, "execution_count": None, "outputs": [], "source": s})1112GROUPS = [13 ("The single-system formalism and its arithmetic", ["validate", "sorkin", "dispersion", "transport", "stratum", "gleason", "granularity"],14 "The forced basis, the selection rule, the Lüders update, the ledger and its reduction on both worked carriers; the Sorkin nullity and wrap quantisation; exact boost transport and the finite double cover; the quarter-turn transport trichotomy; the two probability strata and the readout map; the uniqueness of the pair tally; the depth ceiling."),15 ("Composites and the quantum boundary", ["composite", "synchronisation", "renou", "intersubject"],16 "The composite gate on equal and unequal cycles with exact Tsirelson saturation; the m-body locked cluster; the real-vs-complex network table; the consistency of distinct Subjects."),17 ("The gravitational channel and the floors", ["bmv", "gravfraction", "decoherence", "equivalence", "omega"],18 "Gravitationally induced entanglement at the Newtonian rate; the coherent-fraction channel; forbidden collapse, the dilation floor and its exact revival; the two scaling laws and the equivalence-principle null; the Ω ledger."),19 ("The hardware compilations", ["emulation"],20 "The 12- and 16-level compilations of the forced bases against exact references, and the two experiment cards (numeric, 10⁻¹²)."),21]2223md(f"""[]({COLAB})2425## Quantum Observation over Finite Relational Substrate (Akhtman, 2026)2627**Validation Package.** `finite-ring-space/src/{PKG}` — the paper's seventeen validation suites as written (187 checks), run through one registry: a28family check is one suite's verdict (`qm.<suite>`), its micro-checks the suite's PASS/FAIL lines; each family names the row(s) of the29paper's predicate ledger it witnesses (the paper's Section "Status", subsection "Predicate ledger", rows cited as `22:XN`; public copy at30`docs/22-quantum/22-quantum-ledger.html`), and the ledger's source column cites the family ids in return; the paper's Appendix B carries31the check-level map. Master-ledger rows of the corpus reached through the paper rows: `00:D4`, `00:F1`, `00:C10`, `00:C11`, `00:F2`,32`00:F3`, `00:D1`, `00:D3`, `00:B8`, `00:Y5`.3334**Kinds.** `EXACT`: modular integers, Gaussian integers, cyclotomic rings and exact rationals throughout, exhaustive where the domain is35finite, deterministic. `NUM`: floating point as the numeric image of exact references (the hardware compilations, 10⁻¹²).3637**Run.** Cell by cell, or *Runtime → Run all*; ≈ 1–2 minutes on Colab. The last cell writes `results.json` and fails loudly if any family fails.""")3839code(f"""# --- environment: clone the package if this notebook is not already running inside it (Colab). numpy and sympy are present on Colab.40import os41if not os.path.exists("qmcommon.py"):42 if not os.path.exists("finite-ring-space"):43 !git clone --filter=blob:none --sparse https://github.com/gamayos/finite-ring-space.git44 os.chdir("finite-ring-space")45 !git sparse-checkout set src/{PKG}46 os.chdir("src/{PKG}")47 else:48 os.chdir("finite-ring-space/src/{PKG}")49print("working directory:", os.path.join(*os.getcwd().split(os.sep)[-3:]))""")5051code("""import importlib, qmcommon as gc52importlib.reload(gc) # a fresh registry if the notebook is re-run53print("families registered:", len(gc.LABELS))""")5455def rowkey(r):56 lab = r.split(":")[1]57 return (lab[0], int(re.sub(r"[^0-9]", "", lab) or 0), lab)58import re59for title, stems, desc in GROUPS:60 ids = ["qm." + s for s in stems]61 rows = sorted({r.strip() for i in ids for r in gc.LEDGER[i].split(",")}, key=rowkey)62 table = "| id | script | kind | claim | ledger rows |\n|---|---|---|---|---|\n" + "\n".join(f"| `{i}` | `{gc.script_of(i)}.py` | {gc.KIND[i]} | {gc.LABELS[i]} | {gc.LEDGER[i]} |" for i in ids)63 md(f"## {title}\n{desc}\n\n{table}\n\nLedger rows witnessed: {', '.join(rows)}.")64 code("for fam in " + json.dumps(ids) + ":\n print(f\"\\n— {gc.script_of(fam)}.py\"); gc.run_block(fam)")6566md("""## Summary67Writes `results.json` (one record per family: id, the ledger row(s) witnessed, script, kind, claim, PASS/FAIL, the micro-check count) and raises if any family failed.""")68code("""ok = gc.summary(write=True)69failed = [r["id"] for r in gc.RESULTS if not r["ok"]]70assert ok, f"FAILED families: {failed}"71print(f"all {len(gc.RESULTS)} families pass ({len(gc.MICRO)} micro-checks); records in results.json")""")7273for k, c in enumerate(cells):74 c["id"] = f"cell-{k}"75nb = {"cells": cells, "nbformat": 4, "nbformat_minor": 5,76 "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"},77 "language_info": {"name": "python"}, "colab": {"provenance": [], "toc_visible": True}}}78try:79 import nbformat80 nbf = nbformat.from_dict(nb); nbformat.validate(nbf); nbformat.write(nbf, NB)81except ImportError:82 with open(NB, "w") as f:83 json.dump(nb, f, indent=1, ensure_ascii=False)84print(f"wrote {NB} with {len(cells)} cells")85