Documentation

Complexitylib.RationalHitting.Internal.SignedArithmetic

Rational hitting lists: signed arithmetic #

Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a. Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/RationalHitting/SignedArithmetic.lean

Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.

Compute the magnitude of the signed difference of two binary natural inputs.

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

    Compute the sign of the difference of two binary natural inputs.

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

      The nonnegative part of an integer, represented as a natural number.

      Equations
      Instances For

        The magnitude of the negative part of an integer.

        Equations
        Instances For
          @[simp]

          A clean procedure computing unary predecessor.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem Complexity.RationalHitting.StackLanguage.Poly.unaryPred_iterate (a : Unary) (n : ℕ) :
            (fun (a : Unary) => { val := a.val - 1 })^[n] a = { val := a.val - n }
            theorem Complexity.RationalHitting.StackLanguage.powerStep_iterate (a : ℤ × ℤ) (n : ℕ) :
            (fun (a : ℤ × ℤ) => (a.1, a.2 * a.1))^[n] a = (a.1, a.2 * a.1 ^ n)

            Consume the head of an integer list and add it to the accumulator.

            Equations
            Instances For