Total modular arithmetic within function levels #
The existing square-and-multiply certificate charges binary exponents and intermediate residues. Combining its three arguments through fixed tagged oracles preserves a function level. Modulus zero has the existing fixed default, rather than an exponentially long unreduced power.
theorem Cslib.Complexity.CountingFunction.nat_mul {α : Type} {enc : α ↪ List Bool} {a : ℕ} {f g : α → ℕ} (hf : f ∈ CountingFunction a enc Turing.MultiTapeTM.encNat) (hg : g ∈ CountingFunction a enc Turing.MultiTapeTM.encNat) :
Binary natural multiplication preserves the common function level.
theorem Cslib.Complexity.CountingFunction.nat_mod {α : Type} {enc : α ↪ List Bool} {a : ℕ} {f g : α → ℕ} (hf : f ∈ CountingFunction a enc Turing.MultiTapeTM.encNat) (hg : g ∈ CountingFunction a enc Turing.MultiTapeTM.encNat) :
Binary natural remainder preserves the common function level, including the total value
n % 0 = n.
theorem Cslib.Complexity.CountingFunction.nat_lt {α : Type} {enc : α ↪ List Bool} {a : ℕ} {f g : α → ℕ} (hf : f ∈ CountingFunction a enc Turing.MultiTapeTM.encNat) (hg : g ∈ CountingFunction a enc Turing.MultiTapeTM.encNat) :
Comparing binary naturals preserves their common function level.
theorem Cslib.Complexity.CountingFunction.powMod {α : Type} {enc : α ↪ List Bool} {a : ℕ} {m x e : α → ℕ} (hm : m ∈ CountingFunction a enc Turing.MultiTapeTM.encNat) (hx : x ∈ CountingFunction a enc Turing.MultiTapeTM.encNat) (he : e ∈ CountingFunction a enc Turing.MultiTapeTM.encNat) :
(fun (w : α) => Turing.MultiTapeTM.powMod (m w) (x w) (e w)) ∈ CountingFunction a enc Turing.MultiTapeTM.encNat
Binary modular exponentiation preserves the level of its three uniformly accessible inputs.
For modulus zero, powMod returns one.