The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V32. Logic, model theory and computability

Mathlib.Computability.RecursiveIn

55 declarations. Mathlib docs · Source

Oracle computability

This file defines oracle computability using partial recursive functions.

Main definitions

  • Nat.RecursiveIn O f: A partial function f : ℕ →. ℕ is partial recursive given access to oracles in the set O.
  • RecursiveIn O f: Lifts Nat.RecursiveIn to partial functions between Primcodable types.
  • ComputableIn O f: A total function f : α → σ is computable given access to oracles in O.

Main results

  • Nat.Partrec.recursiveIn: Every partial recursive function is recursive in any oracle set.
  • partrec_iff_forall_recursiveIn_singleton: A function is partial recursive iff it is recursive in every singleton oracle set.
  • recursiveIn_empty_iff: Being recursive in the empty set is equivalent to being partial recursive.
  • RecursiveIn.mono: Monotonicity of RecursiveIn with respect to oracle sets.

Implementation notes

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.

References

  • [Piergiorgio Odifreddi, Classical Recursion Theory: The Theory of Functions and Sets of Natural Numbers][odifreddi1989]

Tags

Computability, Oracle, Turing Degrees, Reducibility, Equivalence Relation

ctor Nat.RecursiveIn.below.zero E0 #

∀ {O : Set (ℕ →. ℕ)} {motive : (a : ℕ →. ℕ) → Nat.RecursiveIn O a → Prop}, Nat.RecursiveIn.below ⋯

ctor Nat.RecursiveIn.below.prec E0 #

∀ {O : Set (ℕ →. ℕ)} {motive : (a : ℕ →. ℕ) → Nat.RecursiveIn O a → Prop} {f h : ℕ →. ℕ} (hf : Nat.RecursiveIn O f)
  (hh : Nat.RecursiveIn O h),
  Nat.RecursiveIn.below hf → motive f hf → Nat.RecursiveIn.below hh → motive h hh → Nat.RecursiveIn.below ⋯

ctor Nat.RecursiveIn.below.left E0 #

∀ {O : Set (ℕ →. ℕ)} {motive : (a : ℕ →. ℕ) → Nat.RecursiveIn O a → Prop}, Nat.RecursiveIn.below ⋯

ctor Nat.RecursiveIn.below.rfind E0 #

∀ {O : Set (ℕ →. ℕ)} {motive : (a : ℕ →. ℕ) → Nat.RecursiveIn O a → Prop} {f : ℕ →. ℕ} (hf : Nat.RecursiveIn O f),
  Nat.RecursiveIn.below hf → motive f hf → Nat.RecursiveIn.below ⋯

ctor Nat.RecursiveIn.below.oracle E0 #

∀ {O : Set (ℕ →. ℕ)} {motive : (a : ℕ →. ℕ) → Nat.RecursiveIn O a → Prop} (g : ℕ →. ℕ) (a : g ∈ O),
  Nat.RecursiveIn.below ⋯

ctor Nat.RecursiveIn.below.pair E0 #

∀ {O : Set (ℕ →. ℕ)} {motive : (a : ℕ →. ℕ) → Nat.RecursiveIn O a → Prop} {f h : ℕ →. ℕ} (hf : Nat.RecursiveIn O f)
  (hh : Nat.RecursiveIn O h),
  Nat.RecursiveIn.below hf → motive f hf → Nat.RecursiveIn.below hh → motive h hh → Nat.RecursiveIn.below ⋯

ctor Nat.RecursiveIn.below.right E0 #

∀ {O : Set (ℕ →. ℕ)} {motive : (a : ℕ →. ℕ) → Nat.RecursiveIn O a → Prop}, Nat.RecursiveIn.below ⋯

ctor Nat.RecursiveIn.below.succ E0 #

∀ {O : Set (ℕ →. ℕ)} {motive : (a : ℕ →. ℕ) → Nat.RecursiveIn O a → Prop}, Nat.RecursiveIn.below ⋯

ctor Nat.RecursiveIn.below.comp E0 #

∀ {O : Set (ℕ →. ℕ)} {motive : (a : ℕ →. ℕ) → Nat.RecursiveIn O a → Prop} {f h : ℕ →. ℕ} (hf : Nat.RecursiveIn O f)
  (hh : Nat.RecursiveIn O h),
  Nat.RecursiveIn.below hf → motive f hf → Nat.RecursiveIn.below hh → motive h hh → Nat.RecursiveIn.below ⋯

inductive Nat.RecursiveIn E3 #

Set (ℕ →. ℕ) → (ℕ →. ℕ) → Prop

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.

ctor Nat.RecursiveIn.zero E0 #

∀ {O : Set (ℕ →. ℕ)}, Nat.RecursiveIn O fun x ↦ 0

ctor Nat.RecursiveIn.succ E0 #

∀ {O : Set (ℕ →. ℕ)}, Nat.RecursiveIn O ↑Nat.succ

ctor Nat.RecursiveIn.left E0 #

∀ {O : Set (ℕ →. ℕ)}, Nat.RecursiveIn O fun n ↦ ↑(some (Nat.unpair n).1)

ctor Nat.RecursiveIn.right E0 #

∀ {O : Set (ℕ →. ℕ)}, Nat.RecursiveIn O fun n ↦ ↑(some (Nat.unpair n).2)

ctor Nat.RecursiveIn.oracle E0 #

∀ {O : Set (ℕ →. ℕ)}, ∀ g ∈ O, Nat.RecursiveIn O g

ctor Nat.RecursiveIn.pair E0 #

∀ {O : Set (ℕ →. ℕ)} {f h : ℕ →. ℕ},
  Nat.RecursiveIn O f → Nat.RecursiveIn O h → Nat.RecursiveIn O fun n ↦ Nat.pair <$> f n <*> h n

ctor Nat.RecursiveIn.comp E0 #

∀ {O : Set (ℕ →. ℕ)} {f h : ℕ →. ℕ}, Nat.RecursiveIn O f → Nat.RecursiveIn O h → Nat.RecursiveIn O fun n ↦ h n >>= f

ctor Nat.RecursiveIn.prec E0 #

∀ {O : Set (ℕ →. ℕ)} {f h : ℕ →. ℕ},
  Nat.RecursiveIn O f →
    Nat.RecursiveIn O h →
      Nat.RecursiveIn O fun p ↦
        match Nat.unpair p with
        | (a, n) =>
          Nat.rec (f a)
            (fun y IH ↦ do
              let i ← IH
              h (Nat.pair a (Nat.pair y i)))
            n

ctor Nat.RecursiveIn.rfind E0 #

∀ {O : Set (ℕ →. ℕ)} {f : ℕ →. ℕ},
  Nat.RecursiveIn O f → Nat.RecursiveIn O fun a ↦ Nat.rfind fun n ↦ (fun m ↦ decide (m = 0)) <$> f (Nat.pair a n)

def RecursiveIn E3 #

{α : Type u_4} → {σ : Type u_5} → [Primcodable α] → [Primcodable σ] → Set (ℕ →. ℕ) → (α →. σ) → Prop

A partial function f : α →. σ between Primcodable types is recursive in a set of oracles O if its encoding as a function ℕ →. ℕ is Nat.RecursiveIn O.

theorem RecursiveIn.iff_nat E1 #

∀ {f : ℕ →. ℕ} {O : Set (ℕ →. ℕ)}, RecursiveIn O f ↔ Nat.RecursiveIn O f

def RecursiveIn₂ E1 #

{α : Type u_4} →
  {β : Type u_5} →
    {σ : Type u_6} → [Primcodable α] → [Primcodable β] → [Primcodable σ] → Set (ℕ →. ℕ) → (α → β →. σ) → Prop

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

def ComputableIn E1 #

{α : Type u_4} → {σ : Type u_5} → [Primcodable α] → [Primcodable σ] → Set (ℕ →. ℕ) → (α → σ) → Prop

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

def ComputableIn₂ E1 #

{α : Type u_4} →
  {β : Type u_5} →
    {σ : Type u_6} → [Primcodable α] → [Primcodable β] → [Primcodable σ] → Set (ℕ →. ℕ) → (α → β → σ) → Prop

A binary total function is computable in O.

theorem Nat.RecursiveIn.of_eq E0 #

∀ {f g : ℕ →. ℕ} {O : Set (ℕ →. ℕ)}, Nat.RecursiveIn O f → (∀ (n : ℕ), f n = g n) → Nat.RecursiveIn O g

theorem Nat.RecursiveIn.of_eq_tot E1 #

∀ {f : ℕ →. ℕ} {g : ℕ → ℕ} {O : Set (ℕ →. ℕ)}, Nat.RecursiveIn O f → (∀ (n : ℕ), g n ∈ f n) → Nat.RecursiveIn O ↑g

theorem Nat.RecursiveIn.subst E1 #

∀ {O O' : Set (ℕ →. ℕ)} {f : ℕ →. ℕ}, Nat.RecursiveIn O f → (∀ g ∈ O, Nat.RecursiveIn O' g) → Nat.RecursiveIn O' f

If every element of O is Nat.RecursiveIn O', then any function which is Nat.RecursiveIn O is also Nat.RecursiveIn O'.

theorem Nat.RecursiveIn.partrec_of_oracle E1 #

∀ {f : ℕ →. ℕ} {O : Set (ℕ →. ℕ)}, (∀ g ∈ O, Nat.Partrec g) → Nat.RecursiveIn O f → Nat.Partrec f

If every function in O is partial recursive, then a function which is Nat.RecursiveIn O is also partial recursive.

theorem Nat.Partrec.recursiveIn E3 #

∀ {f : ℕ →. ℕ} {O : Set (ℕ →. ℕ)}, Nat.Partrec f → Nat.RecursiveIn O f

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

theorem Partrec.recursiveIn E1 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ} {O : Set (ℕ →. ℕ)},
  Partrec f → RecursiveIn O f

If a partial function is partial recursive, then it is RecursiveIn any oracle set.

theorem Nat.Primrec.recursiveIn E1 #

∀ {O : Set (ℕ →. ℕ)} {f : ℕ → ℕ}, Nat.Primrec f → Nat.RecursiveIn O fun n ↦ ↑(some (f n))

theorem Computable.computableIn E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β] {f : α → β} {O : Set (ℕ →. ℕ)},
  Computable f → ComputableIn O f

theorem Primrec.computableIn E1 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → σ} {O : Set (ℕ →. ℕ)},
  Primrec f → ComputableIn O f

theorem Primrec₂.computableIn₂ E1 #

∀ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
  {f : α → β → σ} {O : Set (ℕ →. ℕ)}, Primrec₂ f → ComputableIn₂ O f

theorem ComputableIn.recursiveIn E1 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α → σ} {O : Set (ℕ →. ℕ)},
  ComputableIn O f → RecursiveIn O fun a ↦ Part.some (f a)

theorem ComputableIn₂.recursiveIn₂ E1 #

∀ {α : Type u_1} {β : Type u_2} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable β] [inst_2 : Primcodable σ]
  {f : α → β → σ} {O : Set (ℕ →. ℕ)}, ComputableIn₂ O f → RecursiveIn₂ O fun a ↦ ↑(f a)

theorem RecursiveIn.of_eq E0 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {O : Set (ℕ →. ℕ)} {f g : α →. σ},
  RecursiveIn O f → (∀ (x : α), f x = g x) → RecursiveIn O g

theorem RecursiveIn.of_eq_tot E1 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {O : Set (ℕ →. ℕ)} {f : α →. σ}
  {g : α → σ}, RecursiveIn O f → (∀ (n : α), g n ∈ f n) → RecursiveIn O ↑g

theorem RecursiveIn.oracle E1 #

∀ {O : Set (ℕ →. ℕ)}, ∀ g ∈ O, RecursiveIn O g

theorem RecursiveIn.some E1 #

∀ {α : Type u_1} [inst : Primcodable α] {O : Set (ℕ →. ℕ)}, RecursiveIn O Part.some

theorem RecursiveIn.none E1 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {O : Set (ℕ →. ℕ)},
  RecursiveIn O fun x ↦ Part.none

theorem RecursiveIn.subst E1 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {O O' : Set (ℕ →. ℕ)} {f : α →. σ},
  RecursiveIn O f → (∀ g ∈ O, RecursiveIn O' g) → RecursiveIn O' f

If every element of O is RecursiveIn O', then any function which is RecursiveIn O is also RecursiveIn O'.

theorem RecursiveIn.mono E3 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ} {O₁ O₂ : Set (ℕ →. ℕ)},
  O₁ ⊆ O₂ → RecursiveIn O₁ f → RecursiveIn O₂ f

Monotonicity of RecursiveIn with respect to oracle sets.

theorem RecursiveIn.partrec_of_oracle E1 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ} {O : Set (ℕ →. ℕ)},
  (∀ g ∈ O, Partrec g) → RecursiveIn O f → Partrec f

If every function in O is partial recursive, then a function which is RecursiveIn O is also partial recursive.

theorem RecursiveIn.partrec_of_const E1 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ} {s : Part ℕ},
  RecursiveIn {fun x ↦ s} f → Partrec f

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

theorem recursiveIn_empty_iff E3 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ},
  RecursiveIn ∅ f ↔ Partrec f

theorem partrec_iff_forall_recursiveIn_singleton E3 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {f : α →. σ},
  Partrec f ↔ ∀ (g : ℕ →. ℕ), RecursiveIn {g} f

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

theorem ComputableIn.const E1 #

∀ {α : Type u_1} {σ : Type u_3} [inst : Primcodable α] [inst_1 : Primcodable σ] {O : Set (ℕ →. ℕ)} (s : σ),
  ComputableIn O fun x ↦ s

theorem ComputableIn.id E1 #

∀ {α : Type u_1} [inst : Primcodable α] {O : Set (ℕ →. ℕ)}, ComputableIn O id

theorem ComputableIn.fst E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β] {O : Set (ℕ →. ℕ)},
  ComputableIn O Prod.fst

theorem ComputableIn.snd E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β] {O : Set (ℕ →. ℕ)},
  ComputableIn O Prod.snd

theorem ComputableIn.unpair E1 #

∀ {O : Set (ℕ →. ℕ)}, ComputableIn O Nat.unpair

theorem ComputableIn.succ E1 #

∀ {O : Set (ℕ →. ℕ)}, ComputableIn O Nat.succ

theorem ComputableIn.sumInl E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β] {O : Set (ℕ →. ℕ)},
  ComputableIn O Sum.inl

theorem ComputableIn.sumInr E1 #

∀ {α : Type u_1} {β : Type u_2} [inst : Primcodable α] [inst_1 : Primcodable β] {O : Set (ℕ →. ℕ)},
  ComputableIn O Sum.inr