#!/usr/bin/env python3 """Exact algebra checks for OMEGA--Navier--Stokes geometric transport. Requires Python 3.9+ and SymPy (tested with 1.14.0). Run: python verify_omega_ns.py Acceptance uses explicit exceptions, including under python -O. This checks symbolic identities, not a PDE discretization, a Lean proof, or the external Navier--Stokes blowup manuscript. Smooth localization and global existence for the explicitly prescribed forced fields are proved in the accompanying PDF. No numerical solution is claimed. """ import sympy as s def require(condition, name): if not condition: raise ValueError(name) def zero(expr, name): entries = list(expr) if isinstance(expr, s.MatrixBase) else [expr] require(all(s.simplify(v) == 0 for v in entries), name) def audit(): names = [] def check(expr, name): zero(expr, name) names.append(name) x, y, z = s.symbols('x y z', real=True) gamma, beta, dg, db = s.symbols('gamma beta dg db', real=True) X = s.Matrix([x, y, z]) H = s.Matrix([[1, s.Rational(1, 2)], [s.Rational(1, 2), -1]]) M = s.Matrix([[0, 1], [1, 1]]) K = (2*M-s.eye(2))/s.sqrt(5) phi = (1+s.sqrt(5))/2 phibar = (1-s.sqrt(5))/2 tau = s.symbols('tau', positive=True) A = tau*M check(K*K-s.eye(2), 'K squared equals identity') check(K.T-K, 'K is symmetric') check(s.trace(K), 'K is traceless') check(K.T*H+H*K, 'K preserves the golden quadratic form infinitesimally') check(M.T*H*M+H, 'Fibonacci matrix reverses the golden norm') check(A.T*H*A+tau**2*H, 'normalized matrix norm identity') ep = (s.eye(2)+K)/2 em = (s.eye(2)-K)/2 check(ep*em, 'spectral projectors are orthogonal') check(ep*ep-ep, 'positive spectral projector is idempotent') check(em*em-em, 'negative spectral projector is idempotent') lp = s.Matrix([[1, phi]]) lm = s.Matrix([[1, phibar]]) check(lp*K-lp, 'positive golden observation has eigenvalue one') check(lm*K+lm, 'conjugate observation has eigenvalue minus one') eta, theta = s.symbols('eta theta', real=True) c, d = s.symbols('c d', positive=True) def E(a): return s.exp(a)*ep+s.exp(-a)*em def flow(scale, shape): ans = s.zeros(3) ans[:2, :2] = scale*E(shape) ans[2, 2] = scale**-2 return ans P = flow(c, eta) check(E(eta).T*H*E(eta)-H, 'golden hyperbolic flow preserves norm') check(P.det()-1, 'three dimensional flow preserves volume') check(flow(c, eta)*flow(d, theta)-flow(c*d, eta+theta), 'two parameter group law') check(lp*P[:2, :2]-c*s.exp(eta)*lp, 'scalar observation of the deformation') N = x*x+x*y-y*y J = z*N transported = P*X check(J.subs(dict(zip((x, y, z), transported)), simultaneous=True)-J, 'cubic material invariant under the finite deformation') B = s.zeros(3) B[:2, :2] = gamma*s.eye(2)+beta*K B[2, 2] = -2*gamma Bd = B.diff(gamma)*dg+B.diff(beta)*db velocity = B*X pressure = -(X.T*(Bd+B*B)*X)[0]/2 gradient = lambda f: s.Matrix([s.diff(f, xi) for xi in X]) divergence = lambda v: sum(s.diff(v[i], X[i]) for i in range(3)) laplace = lambda v: s.Matrix([sum(s.diff(vi, xi, 2) for xi in X) for vi in v]) def curl(v): return s.Matrix([s.diff(v[2], y)-s.diff(v[1], z), s.diff(v[0], z)-s.diff(v[2], x), s.diff(v[1], x)-s.diff(v[0], y)]) nu = s.symbols('nu', positive=True) check(divergence(velocity), 'affine incompressibility') check(laplace(velocity), 'affine viscous Laplacian vanishes') check(Bd*X+velocity.jacobian(X)*velocity-nu*laplace(velocity)+gradient(pressure), 'full affine Navier Stokes momentum residual is zero') check(sum(s.diff(J, xi)*velocity[i] for i, xi in enumerate(X)), 'material derivative of cubic invariant vanishes') check(c*gamma*P.diff(c)+beta*P.diff(eta)-B*P, 'finite deformation solves particle flow equation') potential = velocity.cross(X)/3 check(curl(potential)-velocity, 'vector potential recovers affine velocity') chi = s.Function('chi')(x, y, z) localized = curl(chi*potential) check(divergence(localized), 'arbitrary smooth spatial cutoff preserves divergence') check(localized-curl(potential)*chi-gradient(chi).cross(potential), 'localized velocity product rule') check(phi**2*ep+phi**-2*em-M*M, 'continuous golden flow equals M squared') check(tau**2*(phi**2*ep+phi**-2*em)-A*A, 'normalized golden flow equals A squared') omega, dw = s.symbols('omega dw', real=True) Bsw = s.Matrix([[gamma, -omega, 0], [omega, gamma, 0], [0, 0, -2*gamma]]) Csw = Bsw.diff(gamma)*dg+Bsw.diff(omega)*dw+Bsw*Bsw sym = (Csw+Csw.T)/2 usw = Bsw*X psw = -(X.T*sym*X)[0]/2 expected_force = (dw+2*gamma*omega)*s.Matrix([-y, x, 0]) check(Csw*X+gradient(psw)-expected_force, 'swirling branch force identity') check(curl(usw)-s.Matrix([0, 0, 2*omega]), 'swirling branch vorticity') v1, v2, w1, w2 = s.symbols('v1 v2 w1 w2', real=True) V, W = s.Matrix([v1, v2]), s.Matrix([w1, w2]) qform = lambda q: (q.T*H*q)[0] check((qform(V+W)+qform(V-W))/2-qform(V)-s.trace(H*(W*W.T)), 'golden quadratic mean defect equals stress contraction') check(H*H-s.Rational(5, 4)*s.eye(2), 'golden stress bound spectral constant') vertices = [] for a in (-1, 1): for b in (-1, 1): vertices.extend((s.Matrix([0, a, b*phi]), s.Matrix([a, b*phi, 0]), s.Matrix([b*phi, 0, a]))) radius2 = 1+phi**2 check(sum(vertices, s.zeros(3, 1)), 'icosahedral first moment') second = sum((v*v.T/radius2 for v in vertices), s.zeros(3))/12 check(second-s.eye(3)/3, 'icosahedral second moment') discrete_energy = sum((v.T*B.T*B*v)[0]/radius2 for v in vertices)/12 check(discrete_energy-s.trace(B.T*B)/3, 'exact cubature of affine squared speed') Q, S = 339949771344778, 10**15 require((Q*(Q*26//S))//S == 2 and Q*Q*26//(S*S) == 3, 'iterated quantization must remain distinct from one final floor') names.append('exact counterexample separating iterated quantization and final rounding') print('OMEGA_NS_GEOMETRIC_EXTENSION/1.0') print('SymPy', s.__version__) for name in names: print('PASS:', name) print('TOTAL:', len(names), 'exact checks') print('SCOPE: symbolic identities; smooth localization is proved in the PDF; no Lean build or blowup verification.') if __name__ == '__main__': audit()