Documentation

Complexitylib.Models.TuringMachine.Subroutines.BinaryRippleSub.Defs

Linear-time canonical binary subtraction -- definitions #

This module defines a full-borrow scan over two preserved little-endian binary work tapes. The scan writes a fixed-width difference to a fresh result tape. A single backward pass then erases the complete result on underflow or removes only its redundant high zeros, while returning the result head to cell one.

The low output bit of one binary-subtraction column.

Equations
Instances For

    The outgoing borrow of one binary-subtraction column.

    Equations
    Instances For

      Raw fixed-width output of a borrow scan.

      • bits : List Bool

        Little-endian difference bits produced so far.

      • borrow : Bool

        Borrow propagated beyond the most-significant scanned column.

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

          Scan two little-endian bit strings with an incoming borrow. A missing side is padded by zero; the final borrow is retained separately from the raw bits.

          Equations
          Instances For

            Remove redundant most-significant zeros from a little-endian bit string.

            Equations
            Instances For

              Canonical truncated subtraction semantics on arbitrary little-endian bit strings. Underflow is represented by canonical zero.

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

                Forward-borrow states, backward cleanup states, and the unique halt state.

                Instances For
                  Equations
                  Instances For
                    @[implicit_reducible]

                    BinaryRippleSubPhase is finite, as required by the concrete TM model.

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

                    Pairwise distinct work tapes owned by the ripple-borrow subtractor.

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

                      Scan two canonical operands, write their fixed-width raw difference, and canonicalize the result while moving backward. A final borrow erases the whole result; otherwise high zeros are erased until the first high one is seen.

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

                        Forward scan time, including the simultaneous-blank turn.

                        Equations
                        Instances For

                          Backward cleanup time, including the final marker bounce.

                          Equations
                          Instances For

                            Exact time of the forward scan followed by backward canonicalization.

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

                              Canonical subtraction followed by rewinds of the two preserved operands.

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

                                Width-linear time bound for the core, two rewinds, and two seams.

                                Equations
                                Instances For