Download tests/test_dbits.py from dontelightfoot/symbolic-recursion-coherence: direct link, hf CLI and curl.
- Browser
- Download file 2.47 kB
-
https://huggingface.co/dontelightfoot/symbolic-recursion-coherence/resolve/main/tests/test_dbits.py
- Command line
-
hf download hf://dontelightfoot/symbolic-recursion-coherence/tests/test_dbits.py
-
curl -L -o test_dbits.py https://huggingface.co/dontelightfoot/symbolic-recursion-coherence/resolve/main/tests/test_dbits.py
2.47 kB
| """DBITS paper engine — full certificate suite for LinkedIn release.""" | |
| from __future__ import annotations | |
| import asyncio | |
| from symbolic_recursion.dbits import ( | |
| D0, | |
| MU, | |
| DbitParams, | |
| apply_gate, | |
| continuous_offset_series, | |
| list_gates, | |
| multi_dbit_trajectory, | |
| run_all_proofs, | |
| spine_summary, | |
| trajectory, | |
| ) | |
| from symbolic_recursion.equations.catalog import catalog_stats, get_equation | |
| from symbolic_recursion.tools.kernel_tools import KernelToolRunner | |
| def test_constants() -> None: | |
| assert abs(MU - 0.16905) < 1e-12 | |
| assert abs(D0 - 149.9992314) < 1e-6 | |
| def test_stability_box_and_rho() -> None: | |
| p = DbitParams(0.3, 0.3, 0.05) | |
| assert p.in_stability_box() | |
| assert p.rho() < 1.0 | |
| p_bad = DbitParams(0.3, 0.3, 0.8) | |
| assert p_bad.rho() >= 1.0 | |
| def test_trajectory_contracts() -> None: | |
| p = DbitParams() | |
| x, m = trajectory(p, 100, 0.5, 0.3) | |
| assert abs(x[-1]) < abs(x[0]) or abs(x[-1]) < 0.05 | |
| def test_all_gates_apply() -> None: | |
| assert len(list_gates()) == 10 | |
| for g in list_gates(): | |
| out = apply_gate(g["key"], 0.4, 0.2) | |
| assert "output" in out | |
| def test_multi_dbit_energy_decays() -> None: | |
| out = multi_dbit_trajectory(n_agents=16, steps=100) | |
| assert out["status"] == "PASS" | |
| assert out["E_final"] < out["E0"] | |
| def test_offset_to_D0() -> None: | |
| out = continuous_offset_series(t_end=4.0, n_points=30, x0=160.0) | |
| assert out["status"] in ("STABILIZED", "CONVERGING") | |
| assert abs(out["state_series"][-1] - D0) < 2.0 | |
| def test_full_proof_suite_pass() -> None: | |
| report = run_all_proofs() | |
| assert report["overall"] == "PASS" | |
| assert report["n_pass"] == 6 | |
| assert report["n_total"] == 6 | |
| def test_catalog_includes_dbits() -> None: | |
| stats = catalog_stats() | |
| assert stats["by_family"].get("dbits", 0) >= 20 | |
| eq = get_equation("D05") | |
| assert "0.2" in eq.latex or "stability" in eq.name.lower() or "box" in eq.name.lower() | |
| def test_tool_dbits_proofs() -> None: | |
| data = asyncio.run(KernelToolRunner().run("dbits_proofs")) | |
| assert data["overall"] == "PASS" | |
| assert data["n_pass"] == 6 | |
| def test_tool_dbits_simulate_and_spine() -> None: | |
| sim = asyncio.run(KernelToolRunner().run("dbits_simulate", steps=80, n_agents=16)) | |
| assert sim["in_stability_box"] is True | |
| spine = asyncio.run(KernelToolRunner().run("dbits_spine")) | |
| assert spine["summary"]["nodes"] >= 20 | |
| assert spine_summary()["spine_id"] == "piqb-dbits-spine-v2" | |