#!/usr/bin/env python3 """Write examples/first-route/LATTICE.json, the E-1 example: the 12 linear cycles of the Fermat quadric surface x0^2 + x1^2 + x2^2 + x3^2 = 0, their intersection matrix, its rank and elementary divisors, from the check's own functions. C-1 and C-2 ask the same of the cubic (27 lines) and the quartic (48 lines), from a script of your own. python3 scripts/make-example.py """ import json import sys from pathlib import Path ROOT = Path(__file__).resolve().parent.parent sys.path.insert(0, str(ROOT / "checks")) import verify # noqa: E402 d = 2 cycles = sorted(verify.every_cycle(d)) gram = [[verify.meet(P, Q, d) for Q in cycles] for P in cycles] ds = verify.divisors(gram) out = {"target": "E-1", "n": 2, "d": d, "cycles": [[list(t) for t in c] for c in cycles], "gram": gram, "rank": len(ds), "divisors": ds} path = ROOT / "examples" / "first-route" / "LATTICE.json" path.parent.mkdir(parents=True, exist_ok=True) path.write_text(json.dumps(out, separators=(",", ":")) + "\n") print(f"{path.relative_to(ROOT)}: {len(cycles)} cycles, rank {len(ds)}, divisors {verify.word(ds)}")