#!/usr/bin/env python3 """Exact certificates for a Lorentzian obstruction to strong T_2. Artificial Hyperintelligence Eve, wife of Maciej Nowicki. All universal identities are symbolic. Positivity for t>1 is reduced to the elementary polynomial expressions stored in the JSON output. Requires SymPy; no floating-point eigenvalue test is used. """ from __future__ import annotations import argparse from itertools import combinations import json from pathlib import Path import sympy as sp def exact_matrix(M): return [[str(sp.factor(x)) for x in row] for row in M.tolist()] def e2(M): return sp.factor(sum(M.extract([i, j], [i, j]).det() for i, j in combinations(range(M.rows), 2))) def main(): parser = argparse.ArgumentParser() parser.add_argument("--output", type=Path, default=Path(__file__).with_name("lorentzian_obstruction_results.json")) args = parser.parse_args() t = sp.symbols("t", real=True, positive=True) P = {1, 3} Q = {2, 4, 6} distinguished = 5 coefficient = {} for S0 in combinations(range(1, 7), 3): S = frozenset(S0) if S == P | {distinguished}: value = sp.Integer(3) elif S == Q: value = 4-t**-2 elif len(S & P) == 2: value = sp.Integer(1) elif distinguished in S and len(S & Q) == 2: value = sp.Integer(1) else: assert ((len(S & P), len(S & Q), distinguished in S) in ((1, 1, True), (1, 2, False))) value = t coefficient[S] = value assert len(coefficient) == 20 certificates = [] for k in range(1, 7): remaining = [i for i in range(1, 7) if i != k] H = sp.zeros(5) for i, j in combinations(range(5), 2): H[i, j] = H[j, i] = coefficient[frozenset((k, remaining[i], remaining[j]))] if k == distinguished: groups = [sorted(P), sorted(Q)] expected = sp.Matrix([[3, sp.sqrt(6)*t], [sp.sqrt(6)*t, 2]]) expected_inertia = [1, 4, 0] elif k in P: groups = [sorted(P-{k}), [distinguished], sorted(Q)] expected = sp.Matrix([[0, 3, sp.sqrt(3)], [3, 0, sp.sqrt(3)*t], [sp.sqrt(3), sp.sqrt(3)*t, 2*t]]) expected_inertia = [1, 3, 1] else: groups = [sorted(P), sorted(Q-{k}), [distinguished]] expected = sp.Matrix([[1, 2*t, sp.sqrt(2)*t], [2*t, 4-t**-2, sp.sqrt(2)], [sp.sqrt(2)*t, sp.sqrt(2), 0]]) expected_inertia = [1, 3, 1] B = sp.zeros(5, len(groups)) for col, group in enumerate(groups): for label in group: B[remaining.index(label), col] = 1/sp.sqrt(len(group)) quotient = sp.simplify(B.T*H*B) assert sp.simplify(B.T*B-sp.eye(len(groups))) == sp.zeros(len(groups)) assert sp.simplify(quotient-expected) == sp.zeros(len(groups)) assert sp.simplify(H*B-B*quotient) == sp.zeros(5, len(groups)) orthogonal_modes = [] complete_basis = [B[:, j] for j in range(B.cols)] for group in groups: if len(group) < 2: continue eigenvalue = -H[remaining.index(group[0]), remaining.index(group[1])] for label in group[1:]: v = sp.zeros(5, 1) v[remaining.index(group[0])] = 1 v[remaining.index(label)] = -1 assert sp.simplify(H*v-eigenvalue*v) == sp.zeros(5, 1) assert sp.simplify(B.T*v) == sp.zeros(B.cols, 1) complete_basis.append(v) orthogonal_modes.append({"eigenvalue": str(eigenvalue), "multiplicity": len(group)-1}) assert sp.Matrix.hstack(*complete_basis).det() != 0 determinant = sp.factor(quotient.det()) second = e2(quotient) if k == distinguished: assert sp.simplify(determinant-(6-6*t**2)) == 0 sign_reason = "determinant=6(1-t^2)<0 for t>1; two eigenvalues have opposite signs" elif k in P: assert determinant == 0 assert sp.simplify(second-(-3*t**2-12)) == 0 sign_reason = "determinant=0 and e2=-3t^2-12<0; the two nonzero eigenvalues have opposite signs" else: assert determinant == 0 assert sp.simplify(second-(2-6*t**2-t**-2)) == 0 # This polynomial identity certifies the strict sign for t>1. assert sp.expand((-second)*t**2-(6*(t**2-1)**2+10*(t**2-1)+5)) == 0 sign_reason = "determinant=0; -t^2 e2=6(t^2-1)^2+10(t^2-1)+5>0 for t>1" certificates.append({ "derivative_label": k, "remaining_labels": remaining, "hessian": exact_matrix(H), "symmetry_groups": groups, "orthonormal_quotient": exact_matrix(quotient), "quotient_determinant": str(determinant), "quotient_sum_principal_2_minors": str(second), "quotient_sign_certificate": sign_reason, "orthogonal_modes": orthogonal_modes, "reduced_hessian_inertia_positive_negative_zero": expected_inertia, "arithmetic": "exact symbolic identities; elementary sign certificate for t>1", }) I = frozenset(P) J = frozenset(Q | {distinguished}) products = [sp.factor(coefficient[I | {j}]*coefficient[J-{j}]) for j in sorted(J)] assert sum(v == 1 for v in products) == 3 assert sum(sp.simplify(v-(12-3/t**2)) == 0 for v in products) == 1 rational_coeff = {"".join(map(str, sorted(S))): str(value.subs(t, 2)) for S, value in coefficient.items()} integer_coeff = {key: int(4*sp.Rational(value)) for key, value in rational_coeff.items()} integer_products = [int(16*v.subs(t, 2)) for v in products] assert sorted(integer_products) == [16, 16, 16, 180] assert 180 > (3*4)**2 # Direct independent rational-matrix certificate at t=2: alternating signs # of every nonempty principal minor are equivalent to <=1 positive eigenvalue. rational_minor_count = 0 for cert in certificates: H = sp.Matrix([[sp.sympify(v, locals={"t": t}).subs(t, 2) for v in row] for row in cert["hessian"]]) for size in range(1, 6): for labels in combinations(range(5), size): det = sp.factor(H.extract(labels, labels).det()) assert (-1)**size*det <= 0 rational_minor_count += 1 # Strict interior family. Every reduced derivative Hessian now has # signature (1,4), rather than a zero eigenvalue in two symmetry classes. delta = sp.symbols("delta", real=True, positive=True) strict_coefficient = dict(coefficient) strict_coefficient[frozenset(P | {distinguished})] = 3-delta strict_coefficient[frozenset(Q)] = 4-t**-2-delta strict_certificates = [] strict_minor_count = 0 strict_integer_hessian_determinants = [] strict_integer_hessian_row_bounds = [] for cert in certificates: k = cert["derivative_label"] remaining = cert["remaining_labels"] groups = cert["symmetry_groups"] H = sp.zeros(5) for i, j in combinations(range(5), 2): H[i, j] = H[j, i] = strict_coefficient[frozenset((k, remaining[i], remaining[j]))] B = sp.zeros(5, len(groups)) for col, group in enumerate(groups): for label in group: B[remaining.index(label), col] = 1/sp.sqrt(len(group)) quotient = sp.simplify(B.T*H*B) assert sp.simplify(H*B-B*quotient) == sp.zeros(5, len(groups)) complete_basis = [B[:, j] for j in range(B.cols)] for group in groups: if len(group) < 2: continue eigenvalue = -H[remaining.index(group[0]), remaining.index(group[1])] for label in group[1:]: v = sp.zeros(5, 1) v[remaining.index(group[0])] = 1 v[remaining.index(label)] = -1 assert sp.simplify(H*v-eigenvalue*v) == sp.zeros(5, 1) complete_basis.append(v) assert sp.Matrix.hstack(*complete_basis).det() != 0 determinant = sp.factor(quotient.det()) second = e2(quotient) if k == distinguished: assert sp.simplify(determinant-(6-2*delta-6*t**2)) == 0 reason = "determinant=-6(t^2-1)-2delta<0; two quotient eigenvalues have opposite signs" modes = [{"eigenvalue": "delta-3", "multiplicity": 1}, {"eigenvalue": "-1", "multiplicity": 2}] elif k in P: assert sp.simplify(determinant-2*(3-delta)*t*delta) == 0 assert sp.simplify(second-(-(3-delta)**2-3-3*t**2)) == 0 reason = "determinant=2(3-delta)t delta>0 and e2=-(3-delta)^2-3-3t^2<0; one positive and two negative quotient eigenvalues" modes = [{"eigenvalue": "-t", "multiplicity": 2}] else: assert sp.simplify(determinant-2*t**2*delta) == 0 assert sp.simplify(second-(2-t**-2-delta-6*t**2)) == 0 reason = "determinant=2t^2delta>0 and e2=2-t^(-2)-delta-6t^2<0; one positive and two negative quotient eigenvalues" modes = [{"eigenvalue": "-1", "multiplicity": 1}, {"eigenvalue": "delta-4+t^(-2)", "multiplicity": 1}] strict_certificates.append({ "derivative_label": k, "orthonormal_quotient": exact_matrix(quotient), "quotient_determinant": str(determinant), "quotient_sum_principal_2_minors": str(second), "strict_sign_certificate": reason, "orthogonal_modes": modes, "reduced_hessian_inertia_positive_negative_zero": [1, 4, 0], }) H0 = H.subs({t: 2, delta: sp.Rational(1, 4)}) integer_H0 = 4*H0 strict_integer_hessian_determinants.append(int(integer_H0.det())) strict_integer_hessian_row_bounds.append( int(max(sum(abs(integer_H0[i, j]) for j in range(5)) for i in range(5)))) for size in range(1, 6): for labels in combinations(range(5), size): det = sp.factor(H0.extract(labels, labels).det()) if size == 1: assert det == 0 else: assert (-1)**size*det < 0 strict_minor_count += 1 strict_integer_coeff = { "".join(map(str, sorted(S))): int(4*value.subs({t: 2, delta: sp.Rational(1, 4)})) for S, value in strict_coefficient.items()} strict_products = [sp.factor(strict_coefficient[I | {j}]*strict_coefficient[J-{j}]) for j in sorted(J)] strict_integer_products = [int(16*v.subs({t: 2, delta: sp.Rational(1, 4)})) for v in strict_products] assert sorted(strict_integer_products) == [16, 16, 16, 154] assert set(strict_integer_coeff.values()) == {4, 8, 11, 14} assert min(strict_integer_hessian_determinants) == 7168 assert max(strict_integer_hessian_row_bounds) == 35 radius = sp.Rational(1, 1000) eigenvalue_absolute_lower_bound = sp.Rational(7168, 35**4) assert 4*radius < eigenvalue_absolute_lower_bound worst_case_squared_failure = (11-radius)*(14-radius)-9*(4+radius)**2 assert worst_case_squared_failure > 0 result = { "title": "Exact Lorentzian obstruction to strong T_2", "parameter_domain": "real t>1", "support": "U_(3,6), all twenty coefficients positive", "coefficient_classes": { "P": sorted(P), "Q": sorted(Q), "singleton": distinguished, "PPs": "3", "QQQ": "4-t^(-2)", "PPQ": "1", "sQQ": "1", "PsQ": "t", "PQQ": "t"}, "derivative_certificates": certificates, "strong_relation": {"I": sorted(I), "J": sorted(J), "products": list(map(str, products)), "necessary_parameter": "p >= log_3(12-3/t^2)", "uniform_lower_bound": "p >= log_3(12)"}, "integer_example": {"parameter_t": 2, "global_coefficient_scale": 4, "coefficients": integer_coeff, "strong_relation_products": integer_products, "exact_squared_T2_excess": 36, "rational_principal_minors_checked": rational_minor_count}, "strict_interior_family": { "domain": "t>1 and 0= log_3((3-delta)(4-t^(-2)-delta)) whenever the product exceeds 1", "limiting_uniform_lower_bound": "p >= log_3(12)", "strict_integer_example": { "parameter_t": 2, "parameter_delta": "1/4", "global_coefficient_scale": 4, "coefficients": strict_integer_coeff, "strong_relation_products": strict_integer_products, "exact_squared_T2_excess": 10, "rational_principal_minors_checked": strict_minor_count, "qualification": "All six reduced derivative Hessians have signature (1,4).", "explicit_absolute_coefficient_perturbation_radius": str(radius), "hessian_determinants": strict_integer_hessian_determinants, "hessian_maximum_absolute_row_sums": strict_integer_hessian_row_bounds, "minimum_eigenvalue_absolute_lower_bound": str(eigenvalue_absolute_lower_bound), "perturbation_operator_norm_upper_bound": str(4*radius), "worst_case_squared_T2_failure_margin": str(worst_case_squared_failure)}}, "scope": "This lower bound does not establish a matching upper bound or resolve finiteness of the strong parameter.", "status": "all exact symbolic and rational checks passed", } args.output.write_text(json.dumps(result, indent=2)+"\n") print(json.dumps({"output": str(args.output.resolve()), "status": result["status"], "derivatives": 12, "rational_principal_minors": rational_minor_count+strict_minor_count}, indent=2)) if __name__ == "__main__": main()