Math¶
Mathematical foundations: category theory, topological observables, and differential geometry on coupling graphs.
Category Theory¶
sc_neurocore.math.category_theory
¶
CategoryTheoryBridge
¶
Functor mapping between distinct computational domains. Stochastic <-> Quantum <-> Bio
Source code in src/sc_neurocore/math/category_theory.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
stochastic_to_quantum(bitstream)
staticmethod
¶
Map bitstream probability p to quantum amplitude sqrt(p).
Source code in src/sc_neurocore/math/category_theory.py
37 38 39 40 41 42 43 44 45 46 | |
quantum_to_bio(state_vector)
staticmethod
¶
Map quantum probability |beta|^2 to concentration [0, 10] uM.
Source code in src/sc_neurocore/math/category_theory.py
48 49 50 51 52 53 54 55 | |
bio_to_stochastic(concentration, length=100)
staticmethod
¶
Map concentration to bitstream.
Source code in src/sc_neurocore/math/category_theory.py
57 58 59 60 61 62 63 64 | |
Topological Observables¶
Geometric invariants computed on SCPN coupling graphs: winding number from phase dynamics, Ollivier-Ricci curvature on edges, sheaf consistency defect, and connection curvature from parallel transport.
sc_neurocore.math.topology.winding_number(phases)
¶
Compute the winding number of a phase trajectory around S^1.
The winding number counts how many times the phase wraps around the circle [0, 2*pi). It is a topological invariant — continuous deformations of the trajectory cannot change it.
Parameters¶
phases : np.ndarray, shape (T,) Time series of phase values (radians).
Returns¶
int Number of complete windings (positive = counterclockwise).
Source code in src/sc_neurocore/math/topology.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
sc_neurocore.math.topology.ollivier_ricci_curvature(knm, i, j)
¶
Compute Ollivier-Ricci curvature between nodes i and j on the coupling graph.
Ollivier (2009), "Ricci curvature of Markov chains on metric spaces." The curvature kappa(i,j) measures how much the neighborhoods of i and j overlap. Positive curvature = neighborhoods converge (community structure). Negative curvature = neighborhoods diverge (bottleneck).
Approximation: kappa(i,j) = 1 - W1(mu_i, mu_j) / d(i,j) where mu_i is the lazy random walk distribution from node i, and W1 is the Wasserstein-1 distance on the graph.
Simplified version: uses the coupling strength ratio as a proxy.
Parameters¶
knm : np.ndarray, shape (N, N) Coupling matrix (non-negative, not necessarily symmetric). i, j : int Node indices.
Returns¶
float Estimated Ollivier-Ricci curvature in [-1, 1].
Source code in src/sc_neurocore/math/topology.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
sc_neurocore.math.topology.sheaf_consistency_defect(phases, knm)
¶
Compute the sheaf consistency defect for the SCPN phase state.
In sheaf theory, a global section exists iff the gluing conditions are satisfied on all overlaps. For the SCPN, the coupling matrix defines the overlaps, and the phase differences weighted by coupling measure the failure to glue.
defect = (1/N^2) * sum_{i,j} |K_ij| * |1 - cos(theta_i - theta_j)|
When phases are synchronized (all equal), defect = 0. When phases are maximally incoherent, defect approaches max(|K|).
This is equivalent to (1 - Kuramoto_R) weighted by coupling.
Parameters¶
phases : np.ndarray, shape (N,) Phase values (radians) for each layer/oscillator. knm : np.ndarray, shape (N, N) Coupling matrix.
Returns¶
float Sheaf consistency defect >= 0. Zero means globally coherent.
Source code in src/sc_neurocore/math/topology.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
sc_neurocore.math.topology.connection_curvature(phases, knm)
¶
Compute the connection curvature from PGBO phase dynamics.
The PGBO covariant derivative u_mu = dphi_mu - alpha * A_mu defines a U(1) connection. The curvature F_{ij} = K_{ij} * cos(theta_i - theta_j) measures the obstruction to parallel transport between layers i and j.
Parameters¶
phases : np.ndarray, shape (N,) Phase values. knm : np.ndarray, shape (N, N) Coupling matrix.
Returns¶
np.ndarray, shape (N, N) Connection curvature matrix. Diagonal is zero.
Source code in src/sc_neurocore/math/topology.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |