TFPT scientific source excerpt Original repository path: experiments/theory-contracts/elliptic-moebius-source-bridge-20261026/check_elliptic_green_rp.py Original file SHA-256: 754d8bf2394b5d62f5226d4326b0423dc198b9662e300d4163c6ef74ff093e4d Inclusive original lines: 1-137 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 | """Small independent checks for ELLIPTIC-GREEN-RP.txt.""" 000003 | 000004 | from __future__ import annotations 000005 | 000006 | import hashlib 000007 | import json 000008 | 000009 | import mpmath as mp 000010 | import sympy as sp 000011 | 000012 | 000013 | def main() -> None: 000014 | E, t, u = sp.symbols("E t u", real=True) 000015 | den = 1 + sp.exp(-E) 000016 | s_plus = sp.exp(-t * E) / den 000017 | s_minus = -sp.exp(-(t + 1) * E) / den 000018 | 000019 | jump = sp.simplify(s_plus.subs(t, 0) - s_minus.subs(t, 0)) == 1 000020 | antiperiodic = sp.simplify( 000021 | s_minus.subs(t, t - 1) + s_plus 000022 | ) == 0 000023 | 000024 | a = t + u 000025 | k_bar = sp.exp(a * E) / (1 + sp.exp(E)) 000026 | x_factor = ( 000027 | sp.exp(t * E) / sp.sqrt(1 + sp.exp(E)) 000028 | * sp.exp(u * E) / sp.sqrt(1 + sp.exp(E)) 000029 | ) 000030 | k_psi = sp.exp(-a * E) / (1 + sp.exp(-E)) 000031 | y_factor = ( 000032 | sp.exp(-t * E) / sp.sqrt(1 + sp.exp(-E)) 000033 | * sp.exp(-u * E) / sp.sqrt(1 + sp.exp(-E)) 000034 | ) 000035 | both_charge_factorizations = ( 000036 | sp.simplify(k_bar - x_factor) == 0 000037 | and sp.simplify(k_psi - y_factor) == 0 000038 | ) 000039 | 000040 | # Exact finite-mode Gram controls. Each mode contributes an outer 000041 | # product, so arbitrary positive sums remain positive. 000042 | time_points = [sp.Rational(1, 10), sp.Rational(1, 4), sp.Rational(2, 5)] 000043 | mode_vectors = [ 000044 | sp.Matrix([sp.Rational(2) ** tt for tt in time_points]), 000045 | sp.Matrix([sp.Rational(3) ** (-tt) for tt in time_points]), 000046 | sp.Matrix([sp.Rational(5) ** tt for tt in time_points]), 000047 | ] 000048 | gram = sum((v * v.T for v in mode_vectors), sp.zeros(3)) 000049 | gram_positive = all( 000050 | sp.simplify(gram[:k, :k].det()) > 0 for k in range(1, 4) 000051 | ) 000052 | 000053 | # Theta reverses a word, charge, time and winding. Its real constant 000054 | # phase is -1 per generator, so applying it twice gives +1. 000055 | word = [ 000056 | ("psi", sp.Rational(1, 7), 2), 000057 | ("bar", sp.Rational(1, 5), -1), 000058 | ("psi", sp.Rational(1, 3), 0), 000059 | ] 000060 | 000061 | def theta_word(items): 000062 | swapped = {"psi": "bar", "bar": "psi"} 000063 | return (-1) ** len(items), [ 000064 | (swapped[charge], -time, -winding) 000065 | for charge, time, winding in reversed(items) 000066 | ] 000067 | 000068 | c1, w1 = theta_word(word) 000069 | c2, w2 = theta_word(w1) 000070 | theta_square = c1 * c2 == 1 and w2 == word 000071 | 000072 | # Mode-label versions of B u=u(B+2pi) and Q transport. 000073 | winding_domain = True 000074 | q_cut_transport = True 000075 | for n in range(-8, 9): 000076 | lam = sp.Rational(2) * sp.pi * (sp.Rational(n) + sp.Rational(1, 2)) 000077 | lam_wound = sp.Rational(2) * sp.pi * (sp.Rational(n + 1) + sp.Rational(1, 2)) 000078 | winding_domain &= sp.simplify(lam_wound - lam - 2 * sp.pi) == 0 000079 | 000080 | q_label = -n - 1 000081 | q_lam = sp.Rational(2) * sp.pi * (sp.Rational(q_label) + sp.Rational(1, 2)) 000082 | q_cut_transport &= sp.simplify(q_lam + lam) == 0 000083 | q_cut_transport &= (-n - 2) == q_label - 1 000084 | 000085 | # Numerical comparison only illustrates the exact theta identity proved 000086 | # by pole, multipliers and H0(E,alpha)=0 in the text. 000087 | mp.mp.dps = 60 000088 | nome = mp.e ** (-mp.pi) 000089 | theta1_prime = mp.diff(lambda x: mp.jtheta(1, x, nome), 0) 000090 | 000091 | def spectral_kernel(tt, ss, cutoff=180): 000092 | total = mp.mpc(0) 000093 | for n in range(-cutoff, cutoff + 1): 000094 | lam = 2 * mp.pi * (n + mp.mpf("0.5")) 000095 | total += ( 000096 | mp.e ** (2j * mp.pi * (n + mp.mpf("0.5")) * ss) 000097 | * mp.e ** (-tt * lam) 000098 | / (1 + mp.e ** (-lam)) 000099 | ) 000100 | return total 000101 | 000102 | def theta_kernel(tt, ss): 000103 | w = ss + 1j * tt 000104 | return ( 000105 | 1j / 2 000106 | * theta1_prime 000107 | * mp.jtheta(3, mp.pi * w, nome) 000108 | / (mp.jtheta(3, 0, nome) * mp.jtheta(1, mp.pi * w, nome)) 000109 | ) 000110 | 000111 | theta_samples = [(mp.mpf("0.2"), mp.mpf("0.13")), 000112 | (mp.mpf("0.37"), mp.mpf("-0.21"))] 000113 | theta_match = all( 000114 | abs(spectral_kernel(tt, ss) - theta_kernel(tt, ss)) < mp.mpf("1e-45") 000115 | for tt, ss in theta_samples 000116 | ) 000117 | 000118 | checks = { 000119 | "green_jump_is_identity": bool(jump), 000120 | "temporal_NS_antiperiodicity": bool(antiperiodic), 000121 | "both_charge_Gram_factorizations": bool(both_charge_factorizations), 000122 | "finite_multimode_Gram_is_positive": bool(gram_positive), 000123 | "field_reflection_squares_to_one": bool(theta_square), 000124 | "winding_preserves_NS_labels_and_shifts_B": bool(winding_domain), 000125 | "Q_maps_cut_spectrum_and_winding_to_inverses": bool(q_cut_transport), 000126 | "spectral_kernel_matches_theta3_Szego_samples": bool(theta_match), 000127 | } 000128 | if not all(checks.values()): 000129 | raise AssertionError([name for name, ok in checks.items() if not ok]) 000130 | 000131 | payload = json.dumps(checks, sort_keys=True) 000132 | print(f"PASS {len(checks)}/{len(checks)}") 000133 | print(f"RESULT_SHA256 {hashlib.sha256(payload.encode()).hexdigest()}") 000134 | 000135 | 000136 | if __name__ == "__main__": 000137 | main()