Documentation

CslibFrontier.Foundations.Computability.RecursiveInStream

Type-2 computability on Baire space #

A partial map F : (ℕ → ℕ) →. (ℕ → ℕ) on Baire space is computable relative to the oracle p when one oracle code c computes every output entry from the join of p with the input: (F x) n = Φ_c^{p ⊕ x}(n) for every x in the domain of F and every n (Nat.RecursiveIn.Code.ComputesStream). Nothing is required outside the domain. A map is computable when it is computable relative to the oracle that is constantly 0, that is, relative to no information (Nat.RecursiveIn.StreamComputable); equivalently, relative to some computable oracle.

Main definitions #

Main results #

Implementation notes #

Oracles are partial functions ℕ →. ℕ, as in Nat.RecursiveIn.Code.eval, so that the oracles of a composite are joined by Partrec.join. The continuity results take a total oracle, since the use principle Nat.RecursiveIn.Code.exists_use is stated for total oracles. A total map F : (ℕ → ℕ) → ℕ → ℕ enters through the coercion to (ℕ → ℕ) →. (ℕ → ℕ), and Nat.RecursiveIn.Code.computesStream_coe_iff turns ComputesStream into the entrywise equations of RecursiveInContinuous.

The definition is the relative form of the type-2 machines of Weihrauch: a code reads its input through the oracle and produces its output entry by entry, instead of writing an infinite output tape. The associate is Kleene's neighbourhood function in a form that only asks for consistency on prefixes of each input, not monotonicity in the prefix.

References #

The code c computes the partial map F on Baire space relative to the oracle p: for every input x in the domain of F, the code run relative to the join p ⊕ x computes the output F x entry by entry. Outside the domain of F nothing is required.

The partial map on Baire space that the code c computes relative to the oracle p: it is defined at x when the code converges relative to p ⊕ x at every entry.

@[simp]
theorem Nat.RecursiveIn.Code.dom_evalStream {p : ℕ →. ℕ} {c : Code} {x : ℕ → ℕ} :
(evalStream p c x).Dom ↔ ∀ (n : ℕ), (eval (Partrec.join p ↑x) c n).Dom
theorem Nat.RecursiveIn.Code.mem_evalStream {p : ℕ →. ℕ} {c : Code} {x y : ℕ → ℕ} :
y ∈ evalStream p c x ↔ eval (Partrec.join p ↑x) c = ↑y

A code computes the partial map it evaluates to.

theorem Nat.RecursiveIn.Code.ComputesStream.mem_evalStream {p : ℕ →. ℕ} {c : Code} {F : (ℕ → ℕ) →. ℕ → ℕ} (h : ComputesStream p c F) {x y : ℕ → ℕ} (hy : y ∈ F x) :
y ∈ evalStream p c x

A code computing F converges at every entry on the domain of F, so F is a restriction of evalStream p c.

theorem Nat.RecursiveIn.Code.computesStream_coe_iff {p : ℕ →. ℕ} {c : Code} {F : (ℕ → ℕ) → ℕ → ℕ} :
ComputesStream p c ↑F ↔ ∀ (x : ℕ → ℕ) (n : ℕ), eval (Partrec.join p ↑x) c n = Part.some (F x n)

For a total map, ComputesStream is the entrywise equation of RecursiveInContinuous.

Composition #

noncomputable def Nat.RecursiveIn.Code.streamComp (d c : Code) :

The code of the composite of two maps computed relative to the same oracle p: it runs d relative to p ⊕ y, where y is the output of c relative to p ⊕ x.

The code of the composite is a primitive recursive function of the two codes.

theorem Nat.RecursiveIn.Code.ComputesStream.comp {p : ℕ →. ℕ} {c d : Code} {F G : (ℕ → ℕ) →. ℕ → ℕ} (hd : ComputesStream p d G) (hc : ComputesStream p c F) :

Closure under composition. If c computes F and d computes G relative to p, then streamComp d c computes G ∘ F relative to p.

theorem Nat.RecursiveIn.Code.ComputesStream.subst {p q : ℕ →. ℕ} {a c : Code} {F : (ℕ → ℕ) →. ℕ → ℕ} (ha : eval q a = p) (hc : ComputesStream p c F) :

A code computing F relative to p gives one computing F relative to q, given a code a that computes p relative to q.

Continuity on the domain #

theorem Nat.RecursiveIn.Code.ComputesStream.exists_cylinder {p : ℕ → ℕ} {c : Code} {F : (ℕ → ℕ) →. ℕ → ℕ} (h : ComputesStream (↑p) c F) {x y : ℕ → ℕ} (hy : y ∈ F x) (n : ℕ) :
∃ (N : ℕ), ∀ x' ∈ PiNat.cylinder x N, ∀ y' ∈ F x', y' n = y n

Computable maps are continuous on their domain, entrywise: each output entry is constant on the inputs of the domain in some cylinder around x.

The domain of a computation is a Gδ set: the inputs on which a code converges at every entry, relative to a total oracle, form a countable intersection of open sets.

theorem Nat.RecursiveIn.Code.continuous_get_iff_forall_exists_cylinder {F : (ℕ → ℕ) →. ℕ → ℕ} :
(Continuous fun (x : ↑F.Dom) => (F ↑x).get ⋯) ↔ ∀ (x y : ℕ → ℕ), y ∈ F x → ∀ (n : ℕ), ∃ (k : ℕ), ∀ x' ∈ PiNat.cylinder x k, ∀ y' ∈ F x', y' n = y n

A partial map on Baire space is continuous on its domain if and only if each output entry is constant on the inputs of the domain in some cylinder around each point of the domain.

theorem Nat.RecursiveIn.Code.exists_code_continuous_get :
∃ (e : Code), ∀ (F : (ℕ → ℕ) →. ℕ → ℕ), (Continuous fun (x : ↑F.Dom) => (F ↑x).get ⋯) → ∃ (p : ℕ → ℕ), ComputesStream (↑p) e F

Continuous partial maps are computable through one fixed code. A single oracle code e computes every partial map F on Baire space that is continuous on its domain, relative to the join of an oracle p encoding F with the input.

Computability relative to an oracle #

The partial map F on Baire space is computable relative to the oracle p when some code computes it relative to p.

The partial map F on Baire space is computable when some code computes it relative to the oracle that is constantly 0, that is, without oracle information (streamComputable_iff_exists_computable).

Computability relative to p passes to every oracle q that computes p.

Closure under composition. Maps computable relative to p and to q compose to a map computable relative to p ⊕ q.

Closure under composition of computable maps.

A map is computable exactly when it is computable relative to some computable oracle.

theorem Nat.RecursiveIn.StreamComputableIn.continuous_get {p : ℕ → ℕ} {F : (ℕ → ℕ) →. ℕ → ℕ} (hF : StreamComputableIn (↑p) F) :
Continuous fun (x : ↑F.Dom) => (F ↑x).get ⋯

Computable maps are continuous on their domain. A map computable relative to a total oracle, restricted to its domain, is continuous.

theorem Nat.RecursiveIn.continuous_get_iff_streamComputableIn {F : (ℕ → ℕ) →. ℕ → ℕ} :
(Continuous fun (x : ↑F.Dom) => (F ↑x).get ⋯) ↔ ∃ (p : ℕ → ℕ), StreamComputableIn (↑p) F

The continuity theorem for partial maps. A partial map on Baire space is continuous on its domain if and only if it is computable relative to some total oracle.

theorem Nat.RecursiveIn.exists_gδ_extension_of_continuous_get {F : (ℕ → ℕ) →. ℕ → ℕ} (hF : Continuous fun (x : ↑F.Dom) => (F ↑x).get ⋯) :
∃ (p : ℕ → ℕ) (F' : (ℕ → ℕ) →. ℕ → ℕ), IsGδ F'.Dom ∧ (∀ (x y : ℕ → ℕ), y ∈ F x → y ∈ F' x) ∧ StreamComputableIn (↑p) F' ∧ Continuous fun (x : ↑F'.Dom) => (F' ↑x).get ⋯

Gδ extension of continuous partial maps. Every partial map on Baire space that is continuous on its domain extends to a partial map with a Gδ domain that is computable relative to a total oracle and continuous on its extended domain.

The continuity theorem. A total map on Baire space is continuous if and only if it is computable relative to some oracle.

The effective form #

The effective continuity theorem. A total map on Baire space is computable exactly when it has a computable associate.