Documentation

Complexitylib.RationalHitting.Internal.ListProcedures

Rational hitting lists: list procedures #

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

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

def Complexity.RationalHitting.StackLanguage.Procedure.padEmpty (w : List Bool) :
Procedure (fun (x : List Bool) => x) (fun (x : List Bool) => x) fun (a : List Bool) => if a = [] then w else a

Append an empty list component to a coded value.

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

    Test whether a raw input word is empty.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Complexity.RationalHitting.StackLanguage.Feasible.listHeadD {A : Type} (ca : A → List Bool) (z : A) :
      Feasible (listCode ca) ca fun (a : List A) => a.headD z
      theorem Complexity.RationalHitting.StackLanguage.Poly.iterate {A : Type} [Coding A] {f : A → A} (hf : Poly f) (Q : TimeBound) (hQ : ∀ (n : ℕ) (a : A), ∀ i ≤ n, (code (f^[i] a)).length ≤ Q.eval ((pairCode unaryCode code (n, a)).length + 1)) :
      Poly fun (a : Unary × A) => f^[a.1.val] a.2

      Consume one encoded record and increment a unary length counter.

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

        A polynomially bounded procedure computing encoded list length in unary.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem Complexity.RationalHitting.StackLanguage.Poly.listMap {A B C : Type} [Coding A] [Coding B] [Coding C] [Inhabited B] {f : A × B → C} (hf : Poly f) :
          Poly fun (a : A × List B) => List.map (fun (b : B) => f (a.1, b)) a.2