Documentation

Complexity.Computability.WordRAM.Power

Native natural powers #

Main definitions #

Main results #

@[reducible, inline]

Result accumulator, initially one.

Instances For
    @[reducible, inline]

    Number of completed multiplications.

    Instances For
      @[reducible, inline]

      Input base.

      Instances For
        @[reducible, inline]

        Input exponent.

        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)) :
                ∃ (y : Data 5), ExecWithin w program x y (4 * n + 5) ∧ y.regs value = b ^ n ∧ y.regs counter = n ∧ y.regs one = 1 ∧ y.mem = x.mem ∧ y.regs base = b ∧ y.regs exponent = n

                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.