Documentation

CslibFrontier.Algorithms.ExactTriangle.CountPrime

Modular triangle counts from the actual seven-product coefficient recursion #

The coefficient arrays contain zero padding and one monomial for each real edge residue. CountPrime.count applies the executable finite Strassen recursion and selects one product coefficient for each original AB pair. It equals the existing countZeroMod, including modular false positives. This is a mathematical specification and correctness bridge for the native counter, not a native execution or running-time theorem.

The construction selectively adapts Spec/Sec3/Theorem17/Strassen.lean, the matPList, matQList, countBy and countOf_eq sections, at revision 16a5ce41304fcdaea4e0be7c132e1c361dc26da5. Existing matP, matQ, cyclic coefficients and modular triangle counts are reused; no parallel triangle problem or polynomial ring is added.

Native P coefficient specification, including true zero padding outside the original side.

Native Q coefficient specification; the original BC coordinates are transposed.

Every actual monomial coefficient, including padding, has magnitude at most one.

The transposed monomial matrix has the same unit coefficient bound.

theorem Cslib.Algorithms.ExactTriangle.CountPrime.multiply_entry_eq_coeff {n p k : ℕ} (hp : p ≠ 0) (hn : n ≤ 2 ^ k) (wBC wAC : Fin n → Fin n → ℤ) (a b : Fin n) (r : ℕ) (hr : r < p) :

Every original pair and residue in the executable finite Strassen coefficient array has exactly the existing cyclic matrix-product meaning, including power-of-two padding.

theorem Cslib.Algorithms.ExactTriangle.CountPrime.multiply_entry_bounds {n p k : ℕ} (hp : p ≠ 0) (hn : n ≤ 2 ^ k) (wBC wAC : Fin n → Fin n → ℤ) (a b : Fin n) (r : ℕ) (hr : r < p) :

The selected real product coefficient is a nonnegative count of at most n middle vertices. Native signed-to-unsigned extraction uses this bound before every sum.

def Cslib.Algorithms.ExactTriangle.CountPrime.count {n : ℕ} (p k : ℕ) (wAB wBC wAC : Fin n → Fin n → ℤ) :

Select the (-AB)-residue coefficient for each original pair after the real seven-product finite recursion. The depth controls zero padding; it is not a supplied multiplication.

theorem Cslib.Algorithms.ExactTriangle.CountPrime.count_eq {n p k : ℕ} (hp : p ≠ 0) (hn : n ≤ 2 ^ k) (wAB wBC wAC : Fin n → Fin n → ℤ) :
count p k wAB wBC wAC = ↑(countZeroMod wAB wBC wAC p)

The finite coefficient algorithm counts exactly the existing modular-zero predicate, for every nonzero modulus and every power-of-two padding covering the input.