Documentation

CslibFrontier.Foundations.Computability.TuringJoin

The Turing join and the join semilattice of Turing degrees #

The join f ⊕ g of two partial functions f g : ℕ →. ℕ codes their disjoint union by parity: on 2 * n it returns f n doubled, and on 2 * n + 1 it returns g n doubled plus one. Each of f and g is Turing reducible to f ⊕ g, and f ⊕ g is reducible to every h to which both f and g are reducible. So the join is a least upper bound for ≤ᵀ, and it makes TuringDegree a join semilattice [KP54], [Soa87].

Main definitions #

Main results #

Implementation notes #

This file is a copy of the additions that the open Mathlib PR 37062 by Tanner Duve, https://github.com/leanprover-community/mathlib4/pull/37062 ("Turing join and semilattice structure on Turing degrees", at head 1bac7307b0), makes to Mathlib/Computability/Partrec.lean, Mathlib/Computability/RecursiveIn.lean and Mathlib/Computability/TuringDegree.lean. It keeps that PR's declaration names and statements, so that clients switch to Mathlib by changing their imports. Delete this file when Mathlib PR 37062, or a successor providing the join, lands in the pinned Mathlib, and point its importers at Mathlib.

The copy differs from the PR in three places, each marked -- vendored: below. The PR proves that Nat.RecursiveIn is closed under conditionals through an equality test and unbounded search (Partrec.kronecker, Nat.RecursiveIn.cond'); here the join is instead the sum of two guarded branches, each guarded by the PR's Nat.RecursiveIn.cond_const, so the equality test is not copied. The PR's Nat.RecursiveIn.of_primrec and Nat.RecursiveIn.of_partrec restate the pinned Nat.Primrec.recursiveIn and Nat.Partrec.recursiveIn, which are used instead. On the pinned Mathlib, f ≤ᵀ g unfolds to the encoded RecursiveIn {g} f rather than Nat.RecursiveIn {g} f, and RecursiveIn.iff_nat converts between them.

References #

The join of partial functions f and g, coding a disjoint union by parity.

The join of partial functions f and g, coding a disjoint union by parity.

@[simp]
theorem Partrec.Join.even (f g : ℕ →. ℕ) (n : ℕ) :
join f g (2 * n) = Part.map (fun (y : ℕ) => 2 * y) (f n)
@[simp]
theorem Partrec.Join.odd (f g : ℕ →. ℕ) (n : ℕ) :
join f g (2 * n + 1) = Part.map (fun (y : ℕ) => 2 * y + 1) (g n)

Every function is recursive in the singleton oracle set containing it.

The first function in a two-element oracle set is recursive in that set.

The second function in a two-element oracle set is recursive in that set.

theorem Nat.RecursiveIn.div2 {O : Set (ℕ →. ℕ)} :
Nat.RecursiveIn O ↑fun (n : ℕ) => n.div2
theorem Nat.RecursiveIn.double {O : Set (ℕ →. ℕ)} :
Nat.RecursiveIn O ↑fun (n : ℕ) => 2 * n
theorem Nat.RecursiveIn.double_add_one {O : Set (ℕ →. ℕ)} :
Nat.RecursiveIn O ↑fun (n : ℕ) => 2 * n + 1
theorem Nat.RecursiveIn.comp_at_even {O : Set (ℕ →. ℕ)} {h : ℕ →. ℕ} (hh : Nat.RecursiveIn O h) :
Nat.RecursiveIn O fun (n : ℕ) => h (2 * n)
theorem Nat.RecursiveIn.comp_at_odd {O : Set (ℕ →. ℕ)} {h : ℕ →. ℕ} (hh : Nat.RecursiveIn O h) :
Nat.RecursiveIn O fun (n : ℕ) => h (2 * n + 1)
theorem Nat.RecursiveIn.encode_even {O : Set (ℕ →. ℕ)} {h : ℕ →. ℕ} (hh : Nat.RecursiveIn O h) :
Nat.RecursiveIn O fun (n : ℕ) => do let y ← ↑(some n.div2) >>= h ↑(some (2 * y))
theorem Nat.RecursiveIn.encode_odd {O : Set (ℕ →. ℕ)} {h : ℕ →. ℕ} (hh : Nat.RecursiveIn O h) :
Nat.RecursiveIn O fun (n : ℕ) => do let y ← ↑(some n.div2) >>= h ↑(some (2 * y + 1))
theorem Nat.RecursiveIn.cond_const {O : Set (ℕ →. ℕ)} {c : ℕ → Bool} {f : ℕ →. ℕ} (hc : Computable c) (hf : Nat.RecursiveIn O f) (k : ℕ) :
Nat.RecursiveIn O fun (n : ℕ) => bif c n then f n else Part.some k

Conditional with a computable guard and constant fallback.

f is Turing reducible to the join f ⊕ g.

g is Turing reducible to the join f ⊕ g.

The join is recursive in the pair of oracles {f, g}.

theorem join_le (f g h : ℕ →. ℕ) (hf : TuringReducible f h) (hg : TuringReducible g h) :

If f and g are both reducible to h, then their join is reducible to h.

If f ≤ᵀ f', then f is reducible to any join with f' on the left.

If g ≤ᵀ g', then g is reducible to any join with g' on the right.

theorem TuringDegree.join_mono {f f' g g' : ℕ →. ℕ} (hf : TuringReducible f f') (hg : TuringReducible g g') :

The Turing join respects Turing reducibility: if f ≤ᵀ f' and g ≤ᵀ g', then f ⊕ g ≤ᵀ f' ⊕ g'.

The Turing join respects Turing equivalence.

The supremum operation on Turing degrees, induced by the Turing join.

@[simp]

The sup on Turing degrees agrees with the Turing join on representatives.