Native natural powers #
Main definitions #
Power.program: repeated native multiplication, with base and exponent in registers.
Main results #
Power.exec:b^nwithin4n+5instructions, with input-derived intermediate fits.
@[reducible, inline]
Result accumulator, initially one.
Instances For
@[reducible, inline]
Number of completed multiplications.
Instances For
@[reducible, inline]
Constant one, initialized by the routine.
Instances For
One multiplication and one counter increment.
Instances For
A fixed program for natural exponentiation by repeated multiplication.
Instances For
theorem Cslib.WordRAM.Power.exec {w : ℕ} (b n : ℕ) (hb : 1 ≤ b) (x : Data 5) (hx : x.regs base = b) (hn : x.regs exponent = n) (hfit : Fits w (b ^ n + n + 2)) :
The routine is uniform in its arguments and preserves memory and both input registers. Every multiplication fit follows from the final power and exponent bound.