Datasets:
Formats:
json
Languages:
English
Size:
< 1K
Tags:
mathematical-physics
arrow-of-time
temporal-irreversibility
time-reversal-symmetry
quantum-information
quantum-foundations
Download verification/verify_geometry.py from PureOne/Neixarua-Operational-Temporal-Orientation: direct link, hf CLI and curl.
- Browser
- Download file 4.11 kB
-
https://huggingface.co/datasets/PureOne/Neixarua-Operational-Temporal-Orientation/resolve/main/verification/verify_geometry.py
- Command line
-
hf download hf://datasets/PureOne/Neixarua-Operational-Temporal-Orientation/verification/verify_geometry.py
-
curl -L -o verify_geometry.py https://huggingface.co/datasets/PureOne/Neixarua-Operational-Temporal-Orientation/resolve/main/verification/verify_geometry.py
4.11 kB
| #!/usr/bin/env python3 | |
| """Symbolic identities and counterexample checks; not a proof-assistant certificate.""" | |
| from pathlib import Path | |
| import json | |
| import sympy as s | |
| ROOT = Path(__file__).resolve().parents[1] | |
| OUT = ROOT / "verification" / "results" | |
| OUT.mkdir(parents=True, exist_ok=True) | |
| results = [] | |
| def checked(name, expressions, detail): | |
| residuals = [s.simplify(s.trigsimp(e)) for e in expressions] | |
| # Hyperbolic identities with symbolic shifts sometimes need the exponential | |
| # representation before SymPy recognizes the identically zero residual. | |
| residuals = [s.simplify(s.together(e.rewrite(s.exp))) if e != 0 else e | |
| for e in residuals] | |
| assert all(e == 0 for e in residuals), (name, residuals) | |
| results.append({"name": name, "passed": True, | |
| "symbolic_residuals": [str(e) for e in residuals], | |
| "detail": detail}) | |
| q, p, z = s.symbols("q p z", real=True) | |
| H = s.Function("H")(q, p, z) | |
| coords = (q, p, z) | |
| X = (-s.diff(H,p), s.diff(H,q)+p*s.diff(H,z), H-p*s.diff(H,p)) | |
| act = lambda v, h, c=coords: sum(vv*s.diff(h,xx) for vv,xx in zip(v,c)) | |
| div = lambda v, c=coords: sum(s.diff(vv,xx) for vv,xx in zip(v,c)) | |
| checked("generic_contact_convention", | |
| [X[2]-p*X[0]-H, act(X,H)-H*s.diff(H,z), div(X)-2*s.diff(H,z)], | |
| "lambda=dz-p dq; checks lambda(X_H)=H, X_H H=H H_z, div X_H=2 H_z.") | |
| checked("generic_contact_invariant_density", | |
| [div(tuple(v/H**2 for v in X))], | |
| "On H!=0, H^(-2) dq dp dz is stationary; no finiteness is inferred.") | |
| D = 1+p*p+q*q+z*z | |
| h = (q+z*p)/D | |
| v = (-s.diff(h,p), s.diff(h,q)+p*s.diff(h,z), h-p*s.diff(h,p)) | |
| checked("noncompact_zero_energy_crossing", | |
| [v[1].subs({p:0,q:0})-1/(1+z*z), h.subs(q,-z*p)], | |
| "At p=q=0 the complete rational contact model has positive dp/dt.") | |
| Dz=(1+p*p)*(1+z*z) | |
| vp=s.simplify(v[1].subs(q,-z*p)) | |
| vz=s.simplify(v[2].subs(q,-z*p)) | |
| checked("gelfand_leray_divergence", | |
| [vp-1/(1+z*z), vz+p*z/Dz, | |
| (s.diff(Dz*vp,p)+s.diff(Dz*vz,z))/Dz-p/Dz], | |
| "On q=-zp, density Dz dp dz has divergence p/Dz, as n=1 requires.") | |
| u, w = s.symbols("u w", positive=True) | |
| c=1+u*u+w*w | |
| g=s.exp(u+w) | |
| rho=s.exp(-u*u-w*w) | |
| W=(u+w, u*w-1) | |
| divrho=div(tuple(rho*t for t in W),(u,w))/rho | |
| left=div(tuple(g*rho*c*t for t in W),(u,w))/(g*rho) | |
| right=c*(divrho+act(W,s.log(c*g),(u,w))) | |
| checked("clock_density_cocycle",[left-right], | |
| "Representative nonconstant speed, reference density and density gauge.") | |
| tau, radius, shift = s.symbols("tau radius shift", real=True) | |
| uu=radius/s.cosh(2*radius*tau+shift) | |
| vv=radius*s.tanh(2*radius*tau+shift) | |
| checked("completed_semicircle_solution", | |
| [s.diff(uu,tau)+2*uu*vv, s.diff(vv,tau)-2*uu*uu, | |
| uu*uu+vv*vv-radius*radius], | |
| "For radius>0, uX has u=R sech and v=R tanh on all real clock times.") | |
| dens=s.exp(-u*u-w*w) | |
| old=(-2*w,2*u) | |
| new=(-2*u*w,2*u*u) | |
| checked("semicircle_ensemble_cost", | |
| [div(tuple(dens*t for t in old),(u,w)), | |
| div(tuple(dens*t/u for t in new),(u,w)), | |
| div(tuple(dens*t for t in new),(u,w))/dens+2*w, | |
| act(new,s.atan(w),(u,w))-2*u*u/(1+w*w)], | |
| "Original density locally stationary; completion preserves density/u, not density.") | |
| t=s.symbols("t", real=True) | |
| b=t**4*(1-t)**4 | |
| f=s.diff(b,t,2) | |
| mom0=s.integrate(f,(t,0,1)) | |
| mom1=s.integrate(t*f,(t,0,1)) | |
| mom2=s.integrate(t*t*f,(t,0,1)) | |
| checked("branch_localization_moments", | |
| [mom0,mom1,mom2-2*s.integrate(b,(t,0,1))], | |
| "Polynomial compact C^3 test of the integration-by-parts identity. " | |
| "The theorem itself uses a smooth compact bump, not this finite-regularity test.") | |
| assert mom2 > 0 | |
| results[-1]["positive_second_moment"] = str(mom2) | |
| payload={"suite":"geometry","sympy_version":s.__version__, | |
| "demonstration_count":len(results),"all_passed":all(x["passed"] for x in results), | |
| "checks":results,"limitations":"Finite symbolic identities do not verify every analytic hypothesis."} | |
| (OUT/"geometry_results.json").write_text(json.dumps(payload,indent=2)+"\n") | |
| print(json.dumps({"suite":"geometry","demonstrations":len(results),"all_passed":True})) | |