Documentation

Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Internal.Pure

Linear-time canonical binary addition -- pure proofs #

This file proves that the finite full-adder recurrence computes addition on canonical little-endian Nat.bits. The generalized theorem includes an incoming carry so that its induction follows the recurrence exactly.

theorem Complexity.BinaryRippleAdd.ripple_natBits_carry_internal (carry : Bool) (lhs rhs : ) :
ripple carry lhs.bits rhs.bits = (lhs + rhs + if carry = true then 1 else 0).bits

Ripple addition with an incoming carry computes the corresponding natural sum. This is the induction-strengthened form of ripple_natBits_internal.

Ripple addition without an incoming carry computes canonical addition.

The pure result has exactly the canonical width of the sum.

Rewrite the list-level scan bound as a bound in natural-number widths.