Documentation

CslibFrontier.Foundations.NumberTheory.DyadicCircle

Dyadic approximation modulo one #

Rounding each summand down at precision B and reducing the sum modulo one gives a rational point on the circle. The error is at most the number of summands times 2⁻ᴮ. The estimate uses integer translates, so it applies to negative and zero targets as well.

This is the rounding step in Section 2, equation crt-circle-error, of [OAI26f]. No complexity bound or prime-window estimate is claimed.

Main definitions #

Main results #

References #

def Cslib.CircleClose (ε u v : ℚ) :

Two rational numbers differ by less than ε, up to an integer translate.

def Cslib.dyadicSumNumerator {ι : Type u_1} [Fintype ι] (B : ℕ) (f : ι → ℚ) :

Sum the numerators obtained by rounding each fraction down at dyadic precision B.

def Cslib.dyadicCircleApprox {ι : Type u_1} [Fintype ι] (B : ℕ) (f : ι → ℚ) :

The rounded dyadic sum modulo one. Only the supplied fractions are inputs.

theorem Cslib.dyadicCircleApprox_eq_fract {ι : Type u_1} [Fintype ι] (B : ℕ) (f : ι → ℚ) :

The dyadic circle approximation is the fractional part of the unwrapped rounded sum.

theorem Cslib.dyadicCircleApprox_mem {ι : Type u_1} [Fintype ι] (B : ℕ) (f : ι → ℚ) :

The approximation is represented in the half-open unit interval.

theorem Cslib.dyadicSumNumerator_error {ι : Type u_1} [Fintype ι] (B : ℕ) (f : ι → ℚ) :
0 ≤ ∑ i : ι, f i - ↑(dyadicSumNumerator B f) / 2 ^ B ∧ ∑ i : ι, f i - ↑(dyadicSumNumerator B f) / 2 ^ B ≤ ↑(Fintype.card ι) / 2 ^ B

The unwrapped rounded sum underestimates the sum, by at most one unit per summand.

theorem Cslib.dyadicCircleApprox_close {ι : Type u_1} [Fintype ι] (B : ℕ) (f : ι → ℚ) {x ε : ℚ} (h : ∃ (z : ℤ), ∑ i : ι, f i - x = ↑z) (hε : ↑(Fintype.card ι) / 2 ^ B < ε) :

Rounding a sum congruent to any rational target gives a circular approximation. The target may be negative or zero; no choice of its representative is required.

@[simp]
theorem Cslib.dyadicCircleApprox_zero {ι : Type u_1} [Fintype ι] (B : ℕ) :
(dyadicCircleApprox B fun (x : ι) => 0) = 0

Zero summands have zero approximation, at every precision.