Documentation

Complexitylib.Classes.PCP.Internal.UnaryDivMod

Division with remainder, in unary #

Every index decomposition in an algorithmic constraint graph is a division: which edge of the original graph, which step of the walk, which copy of the gadget. This module divides one unary number by another in polynomial time, by counting up and rolling the remainder over.

Main definitions #

Main results #

One tick: extend the remainder, and roll it over into the quotient when it reaches the divisor. The state is pair (pair quotient remainder) divisor.

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

    The count divides. After a ticks the state holds a / b and a % b.

    Halving #

    theorem Complexity.dmStep_one (q r b : List Bool) :
    ∃ (q' : List Bool) (r' : List Bool), dmStep (pair (pair q r) b) = pair (pair q' r') b q'.length q.length + 1 r'.length r.length + 1
    theorem Complexity.dmStep_shape (k : ) (q r b : List Bool) :
    ∃ (q' : List Bool) (r' : List Bool), dmStep^[k] (pair (pair q r) b) = pair (pair q' r') b q'.length q.length + k r'.length r.length + k
    noncomputable def Complexity.dmRun (b s : List Bool) :

    The counting run: divide a length by a fixed divisor.

    Equations
    Instances For
      noncomputable def Complexity.divFn (b s : List Bool) :

      The quotient of a length by a fixed divisor, in unary.

      Equations
      Instances For
        noncomputable def Complexity.modFn (b s : List Bool) :

        The remainder of a length by a fixed divisor, in unary.

        Equations
        Instances For

          Dividing by a length read from the input #

          noncomputable def Complexity.dmRun2 (z : List Bool) :

          The counting run with the divisor read from the argument: pair b s.

          Equations
          Instances For
            noncomputable def Complexity.divFn2 (z : List Bool) :

            The quotient of one length by another, in unary.

            Equations
            Instances For
              noncomputable def Complexity.modFn2 (z : List Bool) :

              The remainder of one length by another, in unary.

              Equations
              Instances For
                noncomputable def Complexity.halfFn (s : List Bool) :

                Halving a length, in unary.

                Equations
                Instances For