Documentation

CslibFrontier.Foundations.NumberTheory.DyadicResidues

Natural arithmetic for dyadic residue approximations #

Canonical nonnegative residues permit dyadic CRT approximation using only natural multiplication, division, summation and remainder. The bridge identifies that numerator formula with the rational approximation used by the correctness theorem. No represented integer or product of moduli is an input to the operation.

def Cslib.dyadicResidueNumerator (s : Finset ℕ) (B : ℕ) (c : ℕ → ℕ) :

The numerator of a dyadic residue sum, reduced to its precision.

theorem Cslib.dyadicResidueNumerator_eq (s : Finset ℕ) (B : ℕ) (c : ℕ → ℕ) :
↑(dyadicResidueNumerator s B c) / 2 ^ B = crtCircleApprox (fun (p : ↥s) => ↑↑p) B fun (p : ↥s) => ↑(c ↑p)

Natural quotient arithmetic agrees exactly with the mathematical dyadic CRT formula.