Documentation

LeanPool.Computability.Oracle

Oracle Computability #

This file defines a model of oracle computability using partial recursive functions. It extends the notion of Nat.Partrec by allowing access to a set of oracle functions.

Main Definitions #

Implementation Notes #

The encoding/decoding mechanism relies on Primcodable. The definition of RecursiveIn mimics the inductive structure of Nat.Partrec.

References #

Tags #

Computability, Oracle, Recursion, Primitive Recursion

The type of partial functions recursive in a set of oracles O is the smallest type containing the constant zero, the successor, left and right projections, each oracle g ∈ O, and is closed under pairing, composition, primitive recursion, and μ-recursion.

Instances For
    inductive Computability.PrimrecIn (O : Set ()) :
    ()Prop

    The primitive recursive functions ℕ → ℕ relative to a set of oracles O.

    Instances For
      def Computability.liftPrim {α : Type u_1} {σ : Type u_2} [Primcodable α] [Primcodable σ] (f : α →. σ) :

      Encodes a partial function α →. σ as a partial function ℕ →. ℕ using Primcodable.

      Equations
      Instances For
        def Computability.liftPrimrec {α : Type u_1} {σ : Type u_2} [Primcodable α] [Primcodable σ] (f : ασ) :

        Encodes a total function α → σ as a function ℕ → ℕ using Primcodable.

        Equations
        Instances For
          def Computability.RecursiveIn' {α : Type u_1} {σ : Type u_2} [Primcodable α] [Primcodable σ] (O : Set ( →. )) (f : α →. σ) :

          A partial function between Primcodable types is recursive in O if its lift is.

          Equations
          Instances For
            def Computability.PrimrecIn' {α : Type u_1} {σ : Type u_2} [Primcodable α] [Primcodable σ] (O : Set ()) (f : ασ) :

            Relative primitive recursion between primcodable types

            Equations
            Instances For
              def Computability.RecursiveIn₂ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [Primcodable α] [Primcodable β] [Primcodable σ] (O : Set ( →. )) (f : αβ →. σ) :

              A binary partial function is recursive in O if the curried form is.

              Equations
              Instances For
                def Computability.ComputableIn {α : Type u_1} {σ : Type u_2} [Primcodable α] [Primcodable σ] (O : Set ( →. )) (f : ασ) :

                A total function is computable in O if its constant lift is recursive in O.

                Equations
                Instances For
                  def Computability.ComputableIn₂ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [Primcodable α] [Primcodable β] [Primcodable σ] (O : Set ( →. )) (f : αβσ) :

                  A binary total function is computable in O.

                  Equations
                  Instances For
                    theorem Computability.RecursiveIn.of_eq {O : Set ( →. )} {f g : →. } (hf : RecursiveIn O f) (H : ∀ (n : ), f n = g n) :
                    theorem Computability.RecursiveIn.of_eq_tot {O : Set ( →. )} {f : →. } {g : } (hf : RecursiveIn O f) (H : ∀ (n : ), g n f n) :

                    If a function is partial recursive, then it is recursive in every partial function.

                    theorem Computability.computableIn_of_computable {α : Type u_1} {β : Type u_2} {O : Set ( →. )} {f : αβ} [Primcodable α] [Primcodable β] (hf : Computable f) :

                    If a function is computable, then it is computable in every oracle.

                    theorem Computability.RecursiveIn.of_primrec {O : Set ( →. )} {f : } (hf : Nat.Primrec f) :
                    RecursiveIn O fun (n : ) => (some (f n))
                    theorem Computability.computableIn_of_primrec {α : Type u_1} {σ : Type u_2} [Primcodable α] [Primcodable σ] {f : ασ} (hf : Primrec f) (O : Set ( →. )) :
                    theorem Computability.computableIn₂_of_primrec₂ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [Primcodable α] [Primcodable β] [Primcodable σ] {f : αβσ} (hf : Primrec₂ f) (O : Set ( →. )) :
                    theorem Computability.ComputableIn.recursiveIn' {α : Type u_1} {σ : Type u_2} [Primcodable α] [Primcodable σ] {f : ασ} {O : Set ( →. )} (hf : ComputableIn O f) :
                    RecursiveIn' O fun (a : α) => Part.some (f a)
                    theorem Computability.ComputableIn₂.recursiveIn₂ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [Primcodable α] [Primcodable β] [Primcodable σ] {f : αβσ} {O : Set ( →. )} (hf : ComputableIn₂ O f) :
                    RecursiveIn₂ O fun (a : α) => (f a)
                    theorem Computability.const_in {α : Type u_1} {σ : Type u_4} [Primcodable α] [Primcodable σ] (O : Set ( →. )) (s : σ) :
                    ComputableIn O fun (x : α) => s
                    theorem Computability.fst_in {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] (O : Set ( →. )) :
                    theorem Computability.snd_in {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] (O : Set ( →. )) :
                    theorem Computability.sumInl_in {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] (O : Set ( →. )) :
                    theorem Computability.sumInr_in {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] (O : Set ( →. )) :

                    If a function is recursive in the constant zero function, then it is partial recursive.

                    If a function is partial recursive in the constant none function, then it is partial recursive.

                    A partial function f is partial recursive if and only if it is recursive in every partial function g.

                    theorem Computability.recursiveIn_mono {O₁ O₂ : Set ( →. )} (hsub : O₁ O₂) {g : →. } :
                    RecursiveIn O₁ gRecursiveIn O₂ g
                    theorem Computability.RecursiveIn_subst {O O' : Set ( →. )} {f : →. } (hf : RecursiveIn O f) (hO : gO, RecursiveIn O' g) :