TFPT scientific source excerpt Original repository path: experiments/theory-contracts/elliptic-moebius-source-bridge-20261026/source_sewing_20261028/polarization/check_spin5_quartic_polarization.py Original file SHA-256: 50f7a3c52f24b1a434b9f1175997c312159b07801921bfe8f541d1bede3b93c5 Inclusive original lines: 1-200 Line numbers below refer to the original source. This bounded excerpt is source evidence; it is not a new proof/checker run. Conversation metadata and personal execution details are omitted where indicated. 000001 | #!/usr/bin/env python3 000002 | """Exact Spin5 Pluecker relation versus the original five quartics.""" 000003 | 000004 | from __future__ import annotations 000005 | 000006 | import argparse 000007 | from itertools import combinations, combinations_with_replacement 000008 | import hashlib 000009 | import importlib.util 000010 | import json 000011 | import math 000012 | from pathlib import Path 000013 | 000014 | import sympy as sp 000015 | 000016 | 000017 | HERE = Path(__file__).resolve().parent 000018 | WORK = HERE.parents[1] 000019 | [OMITTED: non-scientific conversation or execution metadata] 000020 | PROCESS = ROOT / "tfpt_explorer/process.py" 000021 | FUNCTOR = ROOT / "experiments/theory-contracts/elliptic-moebius-source-bridge-20261026/source_recursion_20261028/check_native_spin5_functor.py" 000022 | FUNCTOR_REPORT = ROOT / "experiments/theory-contracts/elliptic-moebius-source-bridge-20261026/source_recursion_20261028/NATIVE-SPIN5-FUNCTOR-AND-KRAUS-SPACE.txt" 000023 | OCTIC_CHECKER = ROOT / "experiments/theory-contracts/native-octic-seam-origin-20261025/native_folded_octic_origin.py" 000024 | CAR_REPORT = ROOT / "experiments/theory-contracts/native-octic-seam-origin-20261025/CAR-OCTIC-DICTIONARY.txt" 000025 | OPE_REPORT = ROOT / "experiments/theory-contracts/joint-native-algebra-selection-20261016/FULL-SOURCE-HULL-AND-QUARTIC-OPE.txt" 000026 | CURRENT_REPORT = ROOT / "experiments/theory-contracts/joint-native-algebra-selection-20261016/ORIGINAL-ORDERED-CURRENT-KERNEL-AND-SEAM-GRADING.txt" 000027 | PINS = { 000028 | str(PROCESS): "e8db5fcd999c9d4c34fbee548aa2c85e1a515cf03663a62355533439ae0f1c94", 000029 | str(FUNCTOR): "86911d6e7634592fe9e61d232535224e9b8148308433a05a8ccf983e5a110fa2", 000030 | str(FUNCTOR_REPORT): "3ffcad772d3f0a8fef31ff000cb716b18668f83d013ebe3a55b055d498080050", 000031 | str(OCTIC_CHECKER): "6b075e8d618d392b0d9846bef69c953a03690cd2ce7af76cac003ca49dd072c9", 000032 | str(CAR_REPORT): "c82fce3ad57904fb7628a1abaf2c6eacd94d230d73f2ac69d8da0fe9d49f22c2", 000033 | str(OPE_REPORT): "1d949c2a77e996e63446255d13f41856a00cde4b4d57c78b4b7766204870b2a0", 000034 | str(CURRENT_REPORT): "62a9eeb4519b59d4514445f9d4dd5d2059e29179956a4c97ec94b7bae9ae3094", 000035 | } 000036 | 000037 | 000038 | checks: list[str] = [] 000039 | 000040 | 000041 | def require(value: bool, label: str) -> None: 000042 | if not bool(value): 000043 | raise AssertionError(label) 000044 | checks.append(label) 000045 | 000046 | 000047 | def load(name: str, path: Path): 000048 | spec = importlib.util.spec_from_file_location(name, path) 000049 | require(spec is not None and spec.loader is not None, f"import specification {name}") 000050 | module = importlib.util.module_from_spec(spec) 000051 | spec.loader.exec_module(module) 000052 | return module 000053 | 000054 | 000055 | def exterior_action(matrix: sp.Matrix, pairs: list[tuple[int, int]]) -> sp.Matrix: 000056 | return sp.Matrix.hstack(*[ 000057 | sp.Matrix([ 000058 | matrix[i, a] * matrix[j, b] - matrix[j, a] * matrix[i, b] 000059 | for i, j in pairs 000060 | ]) 000061 | for a, b in pairs 000062 | ]) 000063 | 000064 | 000065 | def exterior_lie_action(matrix: sp.Matrix, dimension: int, 000066 | pairs: list[tuple[int, int]]) -> sp.Matrix: 000067 | result = sp.zeros(len(pairs)) 000068 | for column, (a, b) in enumerate(pairs): 000069 | for i in range(dimension): 000070 | coefficient = matrix[i, a] 000071 | if coefficient and i != b: 000072 | pair = tuple(sorted((i, b))) 000073 | result[pairs.index(pair), column] += coefficient * (1 if i < b else -1) 000074 | coefficient = matrix[i, b] 000075 | if coefficient and i != a: 000076 | pair = tuple(sorted((a, i))) 000077 | result[pairs.index(pair), column] += coefficient * (1 if a < i else -1) 000078 | return result 000079 | 000080 | 000081 | def symmetric_lie_action(matrix: sp.Matrix, basis: list[sp.Matrix], 000082 | pairs: list[tuple[int, int]]) -> sp.Matrix: 000083 | return sp.Matrix.hstack(*[ 000084 | sp.Matrix([(matrix * tensor + tensor * matrix.T)[i, j] for i, j in pairs]) 000085 | for tensor in basis 000086 | ]) 000087 | 000088 | 000089 | def hodge_amplitudes() -> list[sp.Matrix]: 000090 | pairs = list(combinations(range(5), 2)) 000091 | result = [] 000092 | for m in range(5): 000093 | operator = sp.zeros(10) 000094 | for column, (a, b) in enumerate(pairs): 000095 | if m in (a, b): 000096 | continue 000097 | complement = [j for j in range(5) if j not in (m, a, b)] 000098 | sequence = [m, a, b] + complement 000099 | inversions = sum(sequence[i] > sequence[j] 000100 | for i in range(5) for j in range(i + 1, 5)) 000101 | operator[pairs.index(tuple(complement)), column] = (-1) ** inversions 000102 | result.append(operator) 000103 | return result 000104 | 000105 | 000106 | def symmetric_vector(matrix: sp.Matrix) -> sp.Matrix: 000107 | return sp.Matrix([matrix[a, b] for a, b in 000108 | combinations_with_replacement(range(matrix.rows), 2)]) 000109 | 000110 | 000111 | def quadratic_coefficients(matrix: sp.Matrix) -> sp.Matrix: 000112 | """Coefficients of q^T matrix q in the monomial basis q_a q_b, a<=b.""" 000113 | return sp.Matrix([ 000114 | matrix[a, a] if a == b else 2 * matrix[a, b] 000115 | for a, b in combinations_with_replacement(range(matrix.rows), 2) 000116 | ]) 000117 | 000118 | 000119 | def matrix_from_quadratic(polynomial: sp.Expr, 000120 | variables: tuple[sp.Symbol, ...]) -> sp.Matrix: 000121 | poly = sp.Poly(sp.expand(polynomial), *variables) 000122 | matrix = sp.zeros(len(variables)) 000123 | for a in range(len(variables)): 000124 | matrix[a, a] = poly.coeff_monomial(variables[a] ** 2) 000125 | for b in range(a + 1, len(variables)): 000126 | value = poly.coeff_monomial(variables[a] * variables[b]) / 2 000127 | matrix[a, b] = matrix[b, a] = value 000128 | require(sp.expand((sp.Matrix(variables).T * matrix * sp.Matrix(variables))[0] - polynomial) == 0, 000129 | "quadratic coefficient matrix reconstructs its polynomial") 000130 | return matrix 000131 | 000132 | 000133 | def multiindex(pair: tuple[int, int], dimension: int = 4) -> tuple[int, ...]: 000134 | return tuple(pair.count(j) for j in range(dimension)) 000135 | 000136 | 000137 | def factorial_multi(exponents: tuple[int, ...]) -> int: 000138 | return math.prod(math.factorial(value) for value in exponents) 000139 | 000140 | 000141 | def encode(matrix: sp.Matrix) -> list[list[str]]: 000142 | return [[str(sp.simplify(value)) for value in row] for row in matrix.tolist()] 000143 | 000144 | 000145 | def main(output: Path | None) -> dict: 000146 | checks.clear() 000147 | for path, digest in PINS.items(): 000148 | require(hashlib.sha256(Path(path).read_bytes()).hexdigest() == digest, 000149 | "source pin " + path) 000150 | 000151 | process = load("pinned_original_process_quartics", PROCESS) 000152 | octic = load("pinned_original_car_transport", OCTIC_CHECKER) 000153 | _, word_sets = process._code_basis() 000154 | require([len(words) for words in word_sets] == [4, 12, 12, 12, 24], 000155 | "original process supplies the five stated quartic word sets") 000156 | 000157 | pairs4 = list(combinations(range(4), 2)) 000158 | pairs5 = list(combinations(range(5), 2)) 000159 | sym_pairs = list(combinations_with_replacement(range(4), 2)) 000160 | sqrt2 = sp.sqrt(2) 000161 | ii = sp.I 000162 | omega = sp.Matrix([[0, 1, 0, 0], [-1, 0, 0, 0], 000163 | [0, 0, 0, 1], [0, 0, -1, 0]]) 000164 | primitive = sp.Matrix.hstack( 000165 | sp.Matrix([1/sqrt2, 0, 0, 0, 0, -1/sqrt2]), 000166 | sp.eye(6)[:, 1], sp.eye(6)[:, 2], sp.eye(6)[:, 3], sp.eye(6)[:, 4], 000167 | ) 000168 | wedge_pairing = sp.zeros(6) 000169 | wedge_pairing[0, 5] = wedge_pairing[5, 0] = 1 000170 | wedge_pairing[1, 4] = wedge_pairing[4, 1] = -1 000171 | wedge_pairing[2, 3] = wedge_pairing[3, 2] = 1 000172 | q5 = sp.simplify(primitive.T * wedge_pairing * primitive) 000173 | real_frame = sp.Matrix.hstack( 000174 | ii * sp.eye(5)[:, 0], 000175 | (sp.eye(5)[:, 1] - sp.eye(5)[:, 4]) / sqrt2, 000176 | ii * (sp.eye(5)[:, 1] + sp.eye(5)[:, 4]) / sqrt2, 000177 | (sp.eye(5)[:, 2] + sp.eye(5)[:, 3]) / sqrt2, 000178 | ii * (sp.eye(5)[:, 2] - sp.eye(5)[:, 3]) / sqrt2, 000179 | ) 000180 | require(real_frame.conjugate().T * real_frame == sp.eye(5) and 000181 | q5 * real_frame.conjugate() == real_frame, 000182 | "metric compact real frame is explicit") 000183 | 000184 | sym_basis = [] 000185 | spin5_columns = [] 000186 | for a, b in sym_pairs: 000187 | tensor = sp.zeros(4) 000188 | tensor[a, b] = 1 000189 | tensor[b, a] = 1 000190 | sym_basis.append(tensor) 000191 | lie = tensor * omega 000192 | w_lie = sp.simplify(primitive.conjugate().T * 000193 | exterior_lie_action(lie, 4, pairs4) * primitive) 000194 | bivector = sp.simplify(w_lie * q5) 000195 | spin5_columns.append(sp.Matrix([bivector[i, j] for i, j in pairs5])) 000196 | # Rebuild Lie actions after the complete source basis exists. 000197 | source_lie_actions = [ 000198 | symmetric_lie_action(tensor * omega, sym_basis, sym_pairs) 000199 | for tensor in sym_basis 000200 | ]