Documentation

Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleAdd.Defs

Linear-time canonical binary addition -- definitions #

This module defines a finite-state ripple-carry scan over two preserved little-endian binary work tapes. Each scan step appends one sum bit to a fresh result tape. A composed wrapper then rewinds all three owned tapes.

The output bit of a one-column binary addition with incoming carry.

Equations
Instances For

    The outgoing carry of a one-column binary addition.

    Equations
    Instances For
      @[irreducible]

      Ripple-carry addition on little-endian bit strings, padding a missing side with zero and emitting a final high bit exactly when the carry remains set.

      Equations
      Instances For

        Carry-bearing scan states followed by the unique halt state.

        Instances For
          @[implicit_reducible]

          BinaryRippleAddPhase is finite, as required by the concrete machine model.

          Equations
          • One or more equations did not get rendered due to their size.
          structure Complexity.TM.BinaryRippleAddDistinct {n : } (lhsIdx rhsIdx resultIdx : Fin n) :

          Pairwise distinct work tapes used by the ripple-carry adder.

          • lhs_rhs : lhsIdx rhsIdx
          • lhs_result : lhsIdx resultIdx
          • rhs_result : rhsIdx resultIdx
          Instances For
            def Complexity.TM.binaryRippleAddScanTM {n : } (lhsIdx rhsIdx resultIdx : Fin n) :
            TM n

            Scan two canonical little-endian operands and append their sum to a fresh result tape. Operand cells are written back unchanged. An exhausted operand stays on its first blank while the longer operand continues to advance.

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

              Exact number of scan transitions, including the final simultaneous-blank transition.

              Equations
              Instances For
                def Complexity.TM.binaryRippleAddTM {n : } (lhsIdx rhsIdx resultIdx : Fin n) :
                TM n

                Scan the operands into a fresh result and then rewind both operands and the result to cell one.

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

                  Linear width bound for the scan, three rewinds, and three composition seams.

                  Equations
                  Instances For