Modular evaluation of ternary prefixes #
A ternary prefix depends only on a residue modulo a power of three. The
binary-digit modular exponentiation function below lets the finite certificate
evaluate those residues without first constructing the enormous value 4 ^ m.
Taking depth ternary digits preserves exactly the nonzero digits of the
residue modulo 3 ^ depth.
The two-2 prefix predicate can be checked on a modular residue.
Modular exponentiation by repeated squaring over binary exponent digits.
Equations
- GKPCarry.powMod base exponent modulus = GKPCarry.powModDigits base modulus (Nat.digits 2 exponent)
Instances For
theorem
GKPCarry.powModDigits_eq_pow_mod
(base modulus : ℕ)
(digits : List ℕ)
(hdigits : ∀ digit ∈ digits, digit < 2)
: