Skip to main content

solve_prime_power

Function solve_prime_power 

Source
pub fn solve_prime_power(
    equations: &[ModpEquation],
    num_vars: usize,
    p: u64,
    k: u32,
) -> Option<ModmOutcome>
Expand description

Decide a linear system over the residue ring ℤ/pᵏ. For k = 1 this is the prime field, handed to the proven crate::modp::solve. For k ≥ 2 the ring has zero divisors, so we diagonalize over the integers — U·A·V = D with U, V unimodular (Smith-style: gcd row/column reduction) — after which each dₜ·yₜ ≡ (U·b)ₜ (mod pᵏ) is an independent 1-D congruence, solvable iff gcd(dₜ, pᵏ) ∣ (U·b)ₜ. U yields both the satisfying assignment (x = V·y) and, on failure, the re-checkable refutation (a row of U, scaled to annihilate the coefficients mod pᵏ). Returns None only if the integer entries would exceed [GROWTH_CAP].