Documentation

Complexitylib.Models.TuringMachine.Subroutines.BinaryPred.Defs

Little-endian binary predecessor — definitions #

This module defines the finite controller for in-place predecessor on a positive canonical binary natural. Borrow turns initial low-order zero bits into ones. The first one becomes zero; when it was the unique high bit, a one-cell lookahead detects the terminating blank and erases that now-redundant zero before rewinding.

The controller is total on zero, where it simply rewinds the unchanged empty representation. Public correctness theorems intentionally start from value + 1, so no underflow behavior is claimed.

Ripple one borrow through a little-endian bit string, dropping a vacated unique high bit. The empty case defines underflow as unchanged zero.

Equations
Instances For

    Exact transition count used by binaryPredTM on a canonical bit string.

    Equations
    Instances For

      Finite phases of ripple-borrow predecessor.

      Instances For
        @[implicit_reducible]

        BinaryPredPhase has exactly five states.

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

        Exact running time for decrementing canonical value + 1 to value.

        Equations
        Instances For
          def Complexity.TM.binaryPredSpace (initialSpace value : ) :

          Explicit width-based all-prefix space budget for predecessor.

          Equations
          Instances For
            def Complexity.TM.binaryPredTM {n : } (idx : Fin n) :
            TM n

            Decrement a positive canonical little-endian natural on work tape idx.

            The borrow phase flips initial zeros to ones and replaces the first one by zero. A lookahead distinguishes an internal bit from the terminating blank; the latter case erases the vacated high zero. The machine finally rewinds to cell one. On canonical zero it takes the blank branch and leaves zero intact.

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