Documentation

Complexitylib.Models.TuringMachine.Subroutines.BinaryShiftMul.Defs

Width-driven binary shift-and-add multiplication -- definitions #

This module defines a six-work-tape multiplication ABI and a concrete least-significant-bit-first shift-and-add machine. The multiplicands are preserved, the accumulator receives their product, and three scratch tapes are returned to canonical zero.

def Complexity.BinaryShiftMul.step (bit : Bool) (acc shift : ) :

One pure shift-and-add iteration. The first component is the partial accumulator and the second is the current shifted multiplicand.

Equations
Instances For

    Fold little-endian multiplier bits through generalized initial accumulator and shift values.

    Equations
    Instances For

      Accumulator value after the first i little-endian multiplier bits.

      Equations
      Instances For

        Shifted multiplicand after i iterations.

        Equations
        Instances For

          Compact injective assignment of the six multiplication roles to work tapes. Injectivity makes every pair of roles structurally distinct.

          • tape : Fin 6 Fin n

            Injective map from semantic roles to physical work tapes.

          Instances For

            Preserved multiplicand tape.

            Equations
            Instances For

              Preserved multiplier and loop-driver tape.

              Equations
              Instances For

                Initially-zero output accumulator tape.

                Equations
                Instances For

                  Current shifted multiplicand tape.

                  Equations
                  Instances For

                    First alternating zero scratch tape.

                    Equations
                    Instances For

                      Second alternating zero scratch tape.

                      Equations
                      Instances For
                        theorem Complexity.TM.BinaryShiftMulABI.tape_ne {n : } (abi : BinaryShiftMulABI n) {first second : Fin 6} (hne : first second) :
                        abi.tape first abi.tape second

                        Distinct ABI slots map to distinct work tapes.

                        Initialize the shifted multiplicand from lhs, using the zero accumulator as the copy routine's preserved zero scratch.

                        Equations
                        Instances For

                          Add the current shift into the accumulator. The sum is formed on tmp, copied back through zero scratch dbl, and tmp is reset.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Double shift. A copy on tmp is added back into dbl; after alternating copy-back and resets, shift contains twice its old value and both scratch tapes are zero.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Execute the conditional add and then the unconditional doubling step.

                              Equations
                              Instances For

                                Branch on the current multiplier bit. A one performs update-and-double; every other dispatched Boolean symbol performs only the doubling step.

                                Equations
                                Instances For

                                  Iterate once per canonical bit on the preserved multiplier tape.

                                  Equations
                                  Instances For

                                    Restore the multiplier head and reset every non-output scratch tape.

                                    Equations
                                    Instances For

                                      Initialize, scan the multiplier, and clean up the six-tape shift-and-add implementation.

                                      Equations
                                      Instances For

                                        Combined input width used by the conservative multiplication budget.

                                        Equations
                                        Instances For

                                          Audited conservative quadratic budget for initialization, all multiplier iterations, cleanup, and composition seams.

                                          Equations
                                          Instances For