Documentation

Complexitylib.RationalHitting.Internal.UnaryArithmetic

Rational hitting lists: unary arithmetic #

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

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

theorem Complexity.RationalHitting.StackLanguage.unaryMulStep_iterate (a : Unary × Unary) (n : ℕ) :
(fun (a : Unary × Unary) => (a.1, { val := a.2.val + a.1.val }))^[n] a = (a.1, { val := a.2.val + n * a.1.val })
@[reducible, inline]

Unary division state containing divisor, quotient, and remainder.

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

    One unary division step, carrying into the quotient when possible.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Complexity.RationalHitting.StackLanguage.divStep_expected (d n : ℕ) :
      divStep ({ val := d }, { val := n / d }, { val := n % d }) = ({ val := d }, { val := (n + 1) / d }, { val := (n + 1) % d })
      theorem Complexity.RationalHitting.StackLanguage.divStep_iterate (d : Unary) (n : ℕ) :
      divStep^[n] (d, { val := 0 }, { val := 0 }) = (d, { val := n / d.val }, { val := n % d.val })

      Compute raw word length as a unary output.

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

        Double a value while it is at most the given threshold.

        Equations
        Instances For

          Advance threshold-bounded doubling while preserving the threshold.

          Equations
          Instances For