#!/usr/bin/env python3 """Exact finite certificates for the 48 coordinate cusps in the rank-27 proof. Standard-library only. Run directly to write the JSON certificate and readable results beside this script, or import verify_coordinate_cusps() from another verifier. The computation checks finite lattice identities; it does not prove the global arithmetic decomposition or the analytic inequalities in the paper. Leech vectors are stored as their integral numerator a in a/sqrt(8). Formal Lorentz vectors (c, a) denote c*k + a/sqrt(8), with k^2=2 and negative Leech form. Their pairing is 2*c*d - sum(a_i*b_i)/8. """ from argparse import ArgumentParser from collections import Counter from fractions import Fraction import json from pathlib import Path DIMENSION = 24 def require(condition, message): if not condition: raise ValueError(message) def golay_code(): """Extended binary Golay code, from its standard length-23 generator.""" generator = sum(1 << i for i in (0, 1, 5, 6, 7, 9, 11)) words = {0} for shift in range(12): words |= {word ^ (generator << shift) for word in tuple(words)} return {word | ((word.bit_count() & 1) << 23) for word in words} CODE = golay_code() def leech_member(numerator): if len(numerator) != DIMENSION: return False parity = numerator[0] % 2 if any(value % 2 != parity for value in numerator): return False if sum(numerator) % 8 != 4 * parity: return False word = sum(((((value - parity) // 2) % 2) << index) for index, value in enumerate(numerator)) return word in CODE def leech_pair(a, b): return Fraction(sum(x * y for x, y in zip(a, b)), 8) def lorentz_pair(a, b): return 2 * a[0] * b[0] - leech_pair(a[1:], b[1:]) def matrix_rank(rows): """Rank by exact Gaussian elimination over Q.""" if not rows: return 0 matrix = [[Fraction(value) for value in row] for row in rows] columns = len(matrix[0]) require(all(len(row) == columns for row in matrix), "Ragged matrix") rank = 0 for column in range(columns): pivot = next((row for row in range(rank, len(matrix)) if matrix[row][column]), None) if pivot is None: continue matrix[rank], matrix[pivot] = matrix[pivot], matrix[rank] divisor = matrix[rank][column] matrix[rank] = [value / divisor for value in matrix[rank]] for row in range(rank + 1, len(matrix)): coefficient = matrix[row][column] if coefficient: matrix[row] = [value - coefficient * pivot_value for value, pivot_value in zip(matrix[row], matrix[rank])] rank += 1 if rank == len(matrix): break return rank def coordinate_vector(index, value): result = [0] * DIMENSION result[index] = value return tuple(result) def root_numerator(index, other, cusp_sign, other_sign): result = [0] * DIMENSION result[index] = 4 * cusp_sign result[other] = 4 * other_sign return tuple(result) def verify_coordinate_cusps(): distribution = Counter(word.bit_count() for word in CODE) expected_distribution = {0: 1, 8: 759, 12: 2576, 16: 759, 24: 1} require(len(CODE) == 4096, "Wrong Golay code size") require(distribution == expected_distribution, "Wrong Golay weight distribution") norm_eight_vectors = [] positive_star_membership_checks = 0 for index in range(DIMENSION): u = coordinate_vector(index, 8) require(leech_member(u), f"u_{index} is not in the Leech lattice") require(leech_pair(u, u) == 8, f"u_{index} has wrong norm") norm_eight_vectors.append(list(u)) for other in range(DIMENSION): if other == index: continue for other_sign in (1, -1): v = root_numerator(index, other, 1, other_sign) require(leech_member(v), "Positive-star vector not in Leech lattice") require(leech_pair(v, v) == 4, "Positive-star vector has wrong norm") positive_star_membership_checks += 1 require(positive_star_membership_checks == 24 * 46, "Wrong positive-star count") cusp_records = [] constraints = [] root_checks = relation_checks = gram_entry_checks = 0 distinct_norm_four_numerators = set() for index in range(DIMENSION): for cusp_sign in (1, -1): u = coordinate_vector(index, 8 * cusp_sign) cusp = (2,) + u require(leech_member(u), "Cusp Leech component is not integral") require(lorentz_pair(cusp, cusp) == 0, "Cusp is not isotropic") quotient_basis = [] other_indices = [] for other in range(DIMENSION): if other == index: continue roots = [] for other_sign in (1, -1): v = root_numerator(index, other, cusp_sign, other_sign) root = (1,) + v require(leech_member(v), "Root Leech component is not integral") require(leech_pair(v, v) == 4, "Root Leech component has wrong norm") require(lorentz_pair(root, root) == -2, "Wrong Lorentz root norm") require(lorentz_pair(root, cusp) == 0, "Root not perpendicular to cusp") roots.append(root) distinct_norm_four_numerators.add(v) root_checks += 1 require(tuple(x + y for x, y in zip(*roots)) == cusp, "Opposite root representatives do not sum to cusp") relation_checks += 1 quotient_basis.append(roots[0]) other_indices.append(other) gram = [[lorentz_pair(a, b) for b in quotient_basis] for a in quotient_basis] for row in range(23): for column in range(23): require(gram[row][column] == (-2 if row == column else 0), "Quotient Gram matrix is not -2 I_23") gram_entry_checks += 1 require(matrix_rank(gram) == 23, "Wrong quotient root rank") span_rank = matrix_rank([cusp] + quotient_basis) require(span_rank == 24, "Wrong rank of cusp-plus-root span") # In the 25-dimensional space Q*k + Lambda_Q, this span is the # hyperplane a_i - cusp_sign*4*c = 0. Its normal has rank one, # and all 24 independent generators satisfy that equation. normal = [-4 * cusp_sign] + [0] * DIMENSION normal[index + 1] = 1 require(matrix_rank([normal]) == 1, "Zero cusp-span constraint") for vector in [cusp] + quotient_basis: require(sum(a * b for a, b in zip(normal, vector)) == 0, "Cusp-span generator violates its defining constraint") constraints.append(normal) cusp_records.append({ "coordinate_index_zero_based": index, "sign": cusp_sign, "formal_cusp": list(cusp), "exhibited_root_count_modulo_cusp": 46, "quotient_basis_other_indices_zero_based": other_indices, "quotient_basis_formula": "(1, 4*sign*e_i + 4*e_j)", "quotient_gram": "-2 I_23", "quotient_gram_determinant": -(2 ** 23), "quotient_root_rank": 23, "cusp_plus_roots_span_rank": span_rank, "span_constraint": normal, }) require(len(cusp_records) == 48, "Wrong cusp count") require(root_checks == 48 * 46, "Wrong root count") require(relation_checks == 48 * 23, "Wrong relation count") require(len(distinct_norm_four_numerators) == 1104, "Wrong number of distinct signed norm-four coordinate vectors") combined_rank = matrix_rank(constraints) require(combined_rank == 25, "Cusp-span constraints have nonzero intersection") return { "status": "PASS", "scope": ( "Exact finite identities for coordinate cusps only. This script " "does not prove cusp nefness, completeness of the root classification, " "or the global arithmetic decomposition; those are proved in the paper." ), "arithmetic": "Python integers and fractions.Fraction; no floating point", "coordinate_convention": { "leech": "a denotes a/sqrt(8)", "formal_lorentz": "(c,a) denotes c*k+a/sqrt(8), with k^2=2 and negative Leech form", "pairing": "2*c*d - sum(a_i*b_i)/8", }, "golay_code_size": len(CODE), "golay_weight_distribution": dict(sorted(distribution.items())), "norm_eight_vectors": norm_eight_vectors, "positive_star_norm_four_membership_checks": positive_star_membership_checks, "distinct_signed_norm_four_coordinate_vectors": len(distinct_norm_four_numerators), "isotropic_cusps": len(cusp_records), "root_norm_and_orthogonality_checks": root_checks, "root_pair_sum_relations": relation_checks, "quotient_gram_entry_checks": gram_entry_checks, "exhibited_quotient_root_system_each_cusp": "23 A1", "combined_constraint_matrix_shape": [48, 25], "combined_constraint_rank": combined_rank, "combined_constraint_kernel_dimension": 25 - combined_rank, "root_deficits_using_papers_completeness_proof_by_rank_of_K": {"3": 2, "4": 3}, "cusps": cusp_records, } def readable_results(result): return "\n".join([ "PASS: extended Golay code has 4096 words and the standard weight distribution.", "PASS: all 24 coordinate vectors u_i belong to the Leech lattice and have norm 8.", "PASS: all 24*46 positive-star vectors 4(e_i +/- e_j)/sqrt(8) have norm 4 and belong to the Leech lattice.", "PASS: all 48 formal coordinate cusps are isotropic.", "PASS: all 2208 indexed root representatives have norm -2 and are perpendicular to their cusp.", "PASS: all 1104 pairs of opposite representatives sum exactly to their cusp.", "PASS: every quotient root basis has Gram matrix -2 I_23; every cusp-plus-root span has rank 24.", "PASS: the 48 equations a_i = +/-4c have combined rank 25 and zero common kernel.", "PASS: using the paper's root-completeness proof, the rank-3 and rank-4 deficits are 2 and 3.", "ALL EXACT FINITE COORDINATE-CUSP IDENTITIES PASSED.", "Scope: finite identities only; nefness, root completeness, and global arithmetic are proved in the paper.", ]) + "\n" def main(): directory = Path(__file__).resolve().parent parser = ArgumentParser(description=__doc__) parser.add_argument("--json", type=Path, default=directory / "coordinate_cusp_certificates.json") parser.add_argument("--results", type=Path, default=directory / "coordinate_cusp_results.txt") arguments = parser.parse_args() result = verify_coordinate_cusps() report = readable_results(result) arguments.json.write_text(json.dumps(result, indent=2) + "\n") arguments.results.write_text(report) print(report, end="") if __name__ == "__main__": main()