A composed polynomial-time binary multiplier #
The multiplier scans the little-endian multiplier. Its state contains the
unread multiplier, the current doubled multiplicand, and the accumulated
partial product. Each iteration uses the already verified binary adder. A
quadratic Cobham width bound is proved for every input string, while exact
arithmetic correctness is proved on canonical Nat.bits operands.
Encodes multiplication state as remaining multiplier bits, shifted multiplicand, and accumulator.
Equations
- BeyondBethe.machineBinaryMulPack remaining shift acc = Complexity.pair remaining (Complexity.pair shift acc)
Instances For
Extracts the unprocessed multiplier bits from the multiplication state.
Equations
Instances For
Extracts the shifted multiplicand from the multiplication state.
Equations
Instances For
Extracts the accumulated product from the multiplication state.
Equations
Instances For
Doubles the shifted multiplicand for the next multiplier bit.
Equations
Instances For
Initializes multiplication with the second operand as multiplier and a zero accumulator.
Equations
Instances For
Uses the second operand's bits as the multiplication iteration ruler.
Equations
Instances For
A deliberately generous quadratic state envelope.
Equations
- BeyondBethe.machineBinaryMulWidth word = List.replicate ((List.replicate 16 false ++ word).length * (List.replicate 16 false ++ word).length) false
Instances For
Runs one multiplication step for each bit of the second operand.
Equations
Instances For
Extracts the accumulated product from the final multiplication state.
Equations
Instances For
The concrete multiplier returns the canonical binary expansion of the product of two canonically encoded natural numbers.