EP-0184: Comparative Verification — Topology, Information Theory & Formal Languages (¶
SciPy.stats & Reference TDA Oracles)
| Field | Value |
|---|---|
| EP | 0184 |
| Title | Comparative Verification — Topology, Information Theory & Formal Languages (SciPy.stats & Reference TDA Oracles) |
| Author | Eran Rivlis & Antigravity (Council Agent) |
| Sponsor | The Council |
| Delegate | 🔬 Karl Popper (Falsifiability), ⚖️ Emmy Noether (Symmetry), 💡 Richard Feynman (Clarity) & 🧭 The Explorer |
| Status | Final |
| Type | Standards Track |
| Created | 2026-10-24 |
| Updated | 2026-10-25 |
| Replaces | None |
| Superseded-By | None |
Abstract¶
This proposal specifies Wave 1D of the Phase 5 Mathematical Verification Track
(EP-0180): a Comparative Verification Suite covering
algebrax.homology, algebrax.probability, algebrax.automata, and algebrax.metrics. It pits information-theoretic
measures (entropy, kl_divergence, js_divergence, mutual_information, bayes_update) against scipy.stats
and scipy.special, validates simplicial homology Betti numbers and Hodge Laplacians against exact rank-nullity
oracles (numpy.linalg.matrix_rank / sympy.Matrix.rank) and canonical triangulated manifolds (\(S^1, S^2, T^2\)),
verifies discrete Stokes' theorem \(\langle d\omega, c \rangle = \langle \omega, \partial c \rangle\), and validates
DFA/NFA formal language acceptance (algebrax.automata) against reference state-subset constructions.
Motivation¶
- Topological Invariant Ground Truth (
algebrax.homology): Simplicial complexes, Betti numbers (\(\beta_0, \beta_1, \beta_2\)), Hodge Laplacians (\(\Delta_k = \partial_{k+1}\partial_{k+1}^T + \partial_k^T \partial_k\)), and discrete exterior calculus operators must agree with exact linear algebraic rank calculations (\(\beta_k = \dim C_k - \operatorname{rank} (\partial_k) - \operatorname{rank} (\partial_{k+1})\)) and must satisfy the Euler–Poincaré Theorem (\(\chi = \sum (-1)^k |K_k| = \sum (-1)^k \beta_k\)) as well as Discrete Stokes' Theorem (\(\langle d\omega, c \rangle = \langle \omega, \partial c \rangle\)). - Information Theory Parity (
algebrax.probability): Probability distributions, Shannon entropy, Kullback–Leibler divergence, Jensen–Shannon divergence, and Bayesian updates are foundational to statistical machine learning. Comparingalgebrax.probabilitydirectly againstscipy.stats.entropyandscipy.spatial.distance.jensenshannonguarantees numerical accuracy across skewed, uniform, and sparse support distributions. - Formal Language Equivalence (
algebrax.automata):simulate_dfaandsimulate_nfaimplement weighted and unweighted state-machine transitions via semiring matrix-vector products. Comparing NFA execution against deterministic Rabin–Scott powerset construction and Python'sreengine on regular languages proves formal language correctness. - Sparsity & Fractal Dimension Metrics (
algebrax.metrics):box_counting_dimensionand sparsity estimators must converge to analytical Hausdorff dimensions on self-similar fractals (\(\ln 2 / \ln 3\) for the Cantor set, \(\ln 3 / \ln 2\) for the Sierpiński gasket).
Rationale¶
- 🔬 Falsifiability (Popper): Tests randomized probability simplex vectors via Hypothesis
(
st.lists(st.floats(0, 1))normalized to sum to 1) againstscipy.stats.entropy, probing near-zero probabilities \(p_i \to 0^+\) where \(0 \log 0 = 0\) conventions are critical. - ⚖️ Symmetry (Noether): Validates the fundamental duality between homology chains (\(\partial_k\)) and cohomology cochains (\(d_{k-1} = \partial_k^T\)) via Discrete Stokes' Theorem \(\langle d\omega, c \rangle = \langle \omega, \partial c \rangle\), and verifies Hodge Theorem isomorphism \(\dim (\ker \Delta_k) = \beta_k\).
- 💡 Clarity (Feynman): Uses classical geometric surfaces—the Circle \(S^1\), Hollow Tetrahedron \(\cong S^2\), Minimal Triangulated Torus \(T^2\) (\(\beta = (1, 2, 1)\)), and Disconnected Clusters—as transparent, self-explanatory topological test beds.
Specification¶
1. Target Modules & Comparative Verification Matrix¶
Tests reside in tests/verifications/test_differential_topology_prob.py:
| AlgebraX Module & Function | External Oracle / Analytical Law | Mathematical Truth Verified | Tolerance |
|---|---|---|---|
homology.SimplicialComplex.betti_numbers |
np.linalg.matrix_rank on dense \(\partial_k\) & canonical manifolds |
$\beta_k = | K_k |
homology Euler–Poincaré Characteristic |
$\chi(K) = \sum_k (-1)^k | K_k | $ vs \(\sum_k (-1)^k \beta_k\) |
homology Discrete Stokes' Theorem |
exterior_derivative (\(d\omega\)) vs boundary_matrices (\(\partial c\)) |
\(\langle d\omega, c \rangle = \langle \omega, \partial c \rangle\) for all \((k-1)\)-cochains \(\omega\) and \(k\)-chains \(c\) | \(10^{-11}\) |
homology.hodge_laplacian(k) |
scipy.linalg.eigvalsh(Delta_k) nullity |
Number of zero eigenvalues of \(\Delta_k\) equals Betti number \(\beta_k\) (Discrete Hodge Theorem) | Exact (==) |
probability.entropy(P) |
scipy.stats.entropy(P) |
Shannon entropy \(H(P) = -\sum p_i \ln p_i\) parity, $0 \le H(P) \le \ln | S |
probability.kl_divergence(P, Q) |
scipy.stats.entropy(P, Q) / scipy.special.rel_entr |
\(D_{KL}(P \| Q)\) parity, Gibbs' inequality \(D_{KL}(P \| Q) \ge 0\), \(D_{KL}(P \| P) = 0\) | \(10^{-11}\) |
probability.js_divergence(P, Q) |
scipy.spatial.distance.jensenshannon(P, Q) ** 2 |
Symmetry \(JSD(P \| Q) = JSD(Q \| P)\), boundedness \(0 \le JSD \le \ln 2\) | \(10^{-11}\) |
probability.bayes_update(prior, likelihood) |
Analytical Bayes' Rule & iterated sequential conditioning | Commutativity of independent evidence updates \(B(B(P, E_1), E_2) = B(B(P, E_2), E_1)\) | \(10^{-12}\) |
automata.simulate_dfa / simulate_nfa |
Rabin–Scott powerset DFA & regex oracle | NFA acceptance equals determinized DFA acceptance across \(\Sigma^*\) words | Exact (==) |
metrics.density / sparsity |
Dense np.count_nonzero(A) / A.size |
Exact density + sparsity \(= 1.0\) conservation | \(10^{-12}\) |
Backwards Compatibility¶
Purely additive verification test suite under tests/verifications/test_differential_topology_prob.py. Zero impact on
src/algebrax.
How to Teach This / Documentation Plan¶
- Add Discrete Stokes' Theorem and Discrete Hodge Theorem (\(\dim \ker \Delta_k = \beta_k\)) verification examples to
docs/guide/geometry/. - Add Information Theory vs
scipy.statsverification table todocs/guide/probability/information.md.
Reference Implementation¶
tests/verifications/test_differential_topology_prob.py
Rejected Ideas¶
- Requiring
gudhiorripserC++ Bindings as Mandatory CI Dependencies: Rejected becausegudhibinary wheels often lag behind bleeding-edge Python releases (e.g., Python 3.14 on Windows). Usingnumpy.linalg.matrix_rank,scipy.linalg.eigvalsh, and exact rational Smith/Gaussian rank alongside optionalpytest.importorskip("gudhi")guards guarantees 100% execution on Python 3.14 while supportinggudhiwhen installed.
Open Questions¶
None.
Change Log¶
- 2026-10-24: Initial draft created as Wave 1D of the Phase 5 Comparative Verification series.
- 2026-10-25: Implemented
tests/verifications/test_differential_topology_prob.py(10 comparative test suites covering canonical manifold homology, Discrete Hodge Theorem, Discrete Stokes' Theorem, Helmholtz–Hodge decomposition,scipy.statsinformation theory & moments, Bayes/Markov chains, DFA/NFA Rabin–Scott & regex equivalence, and Sierpiński fractal dimension) and documented indocs/verification.md. Status updated toFinal.