A composed polynomial-time binary adder #
The adder uses little-endian words, matching Nat.bits. Its state is
pair x (pair y (pair carry accRev)). One verified FP step consumes at
most one bit from each operand and prepends one result bit to accRev.
Complexitylib's proved bounded-iteration machine runs this step for the
length of a linear ruler; the final reversal restores little-endian order.
Encodes binary-addition state as two remaining operands, carry, and reversed accumulated bits.
Equations
- BeyondBethe.machineBinaryAddPack x y carry accRev = Complexity.pair x (Complexity.pair y (Complexity.pair carry accRev))
Instances For
Extracts the unprocessed bits of the first addition operand.
Equations
Instances For
Extracts the unprocessed bits of the second addition operand.
Equations
Instances For
Extracts the carry word from the binary-addition state.
Equations
Instances For
Extracts the accumulated sum bits in reverse order.
Equations
Instances For
Total addition transition. A completed state is a fixed point.
Equations
- BeyondBethe.machineBinaryAddStep state = BeyondBethe.machineIfHead (BeyondBethe.machineBinaryAddActive state) (BeyondBethe.machineBinaryAddAdvanced state) state
Instances For
Initial state from a paired pair of operand words.
Equations
Instances For
A linear-length iteration ruler.
Equations
Instances For
A quadratic-width zero word. This is intentionally generous and makes the bounded-iteration proof independent of fine constant accounting.
Equations
- BeyondBethe.machineBinaryAddWidth word = List.replicate ((List.replicate 8 false ++ word).length * (List.replicate 8 false ++ word).length) false
Instances For
States reachable from the canonical pack retain a one-bit carry.
Equations
Instances For
Final bounded-iteration state.
Equations
Instances For
Machine-level binary addition. The final accumulator is reversed from the transition-friendly most-recent-bit-first representation.