Documentation

Complexitylib.RationalHitting.Internal.Procedures

Rational hitting lists: procedures #

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

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

A concrete syntax for nonnegative polynomial bounds. This is only used to bound actual stack transitions, never as an additional machine instruction.

Instances For
    Equations
    Instances For

      Evaluate a nonnegative polynomial time-bound expression at an input size.

      Equations
      Instances For
        @[simp]
        @[simp]

        Substitution is again a polynomial with nonnegative coefficients.

        Equations
        Instances For
          @[simp]
          theorem Complexity.RationalHitting.TimeBound.growth (p : TimeBound) :
          ∃ (C : ℕ) (k : ℕ), 0 < C ∧ 0 < k ∧ ∀ (n : ℕ), 1 ≤ n → p.eval n ≤ C * n ^ k

          These certificates imply an ordinary fixed positive-coefficient, positive- degree power bound. This prevents any hidden superpolynomial time allowance.

          A store with one specified register and all other registers empty.

          Equations
          Instances For
            @[simp]
            theorem Complexity.RationalHitting.StackLanguage.single_other {K : Type} [DecidableEq K] {k j : K} (w : List Bool) (h : j ≠ k) :
            single k w j = []
            @[simp]
            theorem Complexity.RationalHitting.StackLanguage.extend_single {K L : Type} [DecidableEq K] [DecidableEq L] (f : K → L) (hf : Function.Injective f) (k : K) (w : List Bool) :
            (Function.extend f (single k w) fun (x : L) => []) = single (f k) w
            theorem Complexity.RationalHitting.StackLanguage.Eval.rename_single {K L : Type} [DecidableEq K] [DecidableEq L] {p : Program K} {i o : K} {x y : List Bool} {t : ℕ} (h : Eval p (single i x) (single o y) t) (f : K → L) (hf : Function.Injective f) :
            Eval (Program.rename f p) (single (f i) x) (single (f o) y) t
            structure Complexity.RationalHitting.StackLanguage.Procedure {A B : Type} (ca : A → List Bool) (cb : B → List Bool) (f : A → B) :

            A quantitative implementation, with completely clean stack input and output. Both execution and result size are polynomially bounded.

            Instances For
              def Complexity.RationalHitting.StackLanguage.Feasible {A B : Type} (ca : A → List Bool) (cb : B → List Bool) (f : A → B) :

              A compositional polynomial-time feasibility predicate.

              Equations
              Instances For

                Order-preserving transfer, implemented using two stack reversals.

                Equations
                Instances For
                  theorem Complexity.RationalHitting.StackLanguage.eval_move {K : Type} [DecidableEq K] {a b tmp : K} (hab : a ≠ b) (hat : a ≠ tmp) (hbt : b ≠ tmp) (s : Store K) (hb : s b = []) (ht : s tmp = []) :
                  Eval (move a b tmp) s (Function.update (Function.update s a []) b (s a)) (4 * (s a).length + 3)
                  theorem Complexity.RationalHitting.StackLanguage.Eval.move_single {K : Type} [DecidableEq K] {a b tmp : K} (hab : a ≠ b) (hat : a ≠ tmp) (hbt : b ≠ tmp) (w : List Bool) :
                  Eval (move a b tmp) (single a w) (single b w) (4 * w.length + 3)
                  theorem Complexity.RationalHitting.StackLanguage.Eval.runAt {K L : Type} [DecidableEq K] [DecidableEq L] {p : Program K} {i o : K} {x y : List Bool} {t : ℕ} (h : Eval p (single i x) (single o y) t) (f : K → L) (hf : Function.Injective f) (s : Store L) (hs : ∀ (k : K), s (f k) = single i x k) :
                  Eval (Program.rename f p) s (Function.update (Function.update s (f i) []) (f o) y) t

                  Run in an embedded register bank, preserving every register outside it.

                  Identity has no operation of unbounded cost.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    def Complexity.RationalHitting.StackLanguage.Procedure.comp {A B C : Type} {ca : A → List Bool} {cb : B → List Bool} {cc : C → List Bool} {f : A → B} {g : B → C} (q : Procedure cb cc g) (p : Procedure ca cb f) :
                    Procedure ca cc (g ∘ f)

                    Composition uses disjoint scratch banks and an actual order-preserving stack transfer.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Complexity.RationalHitting.StackLanguage.Procedure.recode {A B : Type} {ca : A → List Bool} {cb : B → List Bool} {f : A → B} {A' B' : Type} (p : Procedure ca cb f) (ca' : A' → List Bool) (cb' : B' → List Bool) (f' : A' → B') (e : A' → A) (hi : ∀ (a : A'), ca (e a) = ca' a) (ho : ∀ (a : A'), cb (f (e a)) = cb' (f' a)) :
                      Procedure ca' cb' f'

                      Reinterpret equal input/output words, with no additional computation.

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