Documentation

LeanPool.GKPCarry.FiniteRange

Kernel-checked bounded C3 certificate #

The Boolean certificates cover 27 ≤ m ≤ 6560 over the five ranges on which the ternary length is constant. Within each range, modular residues are advanced by multiplication by four, so only the first power is computed from scratch. Residue tests stop scanning ternary digits as soon as two twos have been found. Their soundness is transported through proved modular exponentiation and ternary prefix lemmas, yielding the headline carry theorem at the end of this file.

@[irreducible]

Test whether the ternary expansion contains at least required twos, stopping as soon as enough have been found.

Equations
Instances For

    The digit scanner is equivalent to counting twos in the canonical ternary expansion.

    theorem GKPCarry.four_pow_has_two_ternary_twos_in_finite_range {m : ℕ} (hlower : 27 ≤ m) (hupper : m ≤ 6560) :

    For every m in the closed interval from 27 through 6560, the first 6 * ternaryLength m little-endian ternary digits of 4 ^ m contain at least two digits equal to 2.

    Equivalent length-indexed form of the bounded ternary-prefix theorem.

    Bounded C3 carry result: throughout 27 ≤ m ≤ 6560, doubling the selected prefix of the ternary expansion of 4 ^ m produces at least two outgoing carries.