Documentation

TauCeti.Computability.TuringDegree

Set oracles and the Turing join #

Mathlib's TuringReducible compares partial functions ℕ →. ℕ. A set of naturals is used as an oracle through its characteristic function: A.oracle is the total partial function with values A.indicator 1, answering 1 on A and 0 off it. Turing reducibility of sets is Turing reducibility of these oracles.

The Turing join f.turingJoin g of two partial functions answers f on even inputs and g on odd inputs, and records the side in the parity of its output. It is the least upper bound of f and g for Turing reducibility, which makes Mathlib's TuringDegree a join-semilattice. For sets, the parity join A.turingJoin B = {2 * x | x ∈ A} ∪ {2 * x + 1 | x ∈ B} has an oracle Turing equivalent to the Turing join of the two oracles, so it is the least upper bound of A and B among sets, and its degree is the supremum of their degrees.

Main definitions #

Main results #

References #

@[simp]

The order on degrees represented by partial functions is Turing reducibility.

noncomputable def Set.oracle (A : Set ℕ) :

The oracle of a set of naturals: its characteristic function A.indicator 1, as a total partial function.

Instances For
    @[simp]
    theorem Set.oracle_apply (A : Set ℕ) (n : ℕ) :

    The oracle of A answers A.indicator 1 n at n.

    A set's characteristic function is computable in its own oracle.

    Reducing a set oracle is equivalent to computing its characteristic function.

    @[simp]
    theorem Set.oracle_empty :
    ∅.oracle = fun (x : ℕ) => Part.some 0

    The empty set answers zero on every input.

    @[simp]

    A set oracle is partial computable exactly when membership in the set is computable.

    The empty set oracle is Turing reducible to every partial function.

    A set is Turing reducible to the empty oracle exactly when its membership is computable.

    If A and B are Turing reducible to an oracle g, so is A ∪ B: take the maximum of the two answers.

    theorem ManyOneReducible.turingReducible_oracle {A B : Set ℕ} (h : (fun (x : ℕ) => x ∈ A) ≤₀ fun (x : ℕ) => x ∈ B) :

    A many-one reduction of sets of naturals gives a Turing reduction of their oracles: query the oracle of B at the image of the input.

    The Turing join of partial functions #

    The Turing join of two partial functions ℕ →. ℕ. It sends 2 * n to 2 * y for each value y of f n, and 2 * n + 1 to 2 * y + 1 for each value y of g n: the parity of the input selects the side, and the parity of the output records it.

    Instances For
      @[simp]
      theorem PFun.turingJoin_two_mul (f g : ℕ →. ℕ) (n : ℕ) :
      f.turingJoin g (2 * n) = Part.map (fun (x : ℕ) => 2 * x) (f n)

      The Turing join answers f on even inputs, doubling its values.

      @[simp]
      theorem PFun.turingJoin_two_mul_add_one (f g : ℕ →. ℕ) (n : ℕ) :
      f.turingJoin g (2 * n + 1) = Part.map (fun (x : ℕ) => 2 * x + 1) (g n)

      The Turing join answers g on odd inputs, sending each value y to 2 * y + 1.

      A partial function is Turing reducible to its Turing join with any other: query the join at 2 * n and halve the answer.

      A partial function is Turing reducible to the Turing join of any other with it: query the join at 2 * n + 1 and halve the answer.

      The Turing join of two partial functions reducible to h is reducible to h: on input n, run the reduction of f or of g at n.div2 according to the parity of n.

      The Turing join is the least upper bound for Turing reducibility: it is reducible to h exactly when both of its sides are.

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

      The Turing join is monotone for Turing reducibility in both arguments.

      The Turing join respects Turing equivalence in both arguments.

      Turing degrees form a join-semilattice #

      @[instance_reducible]

      Turing degrees form a join-semilattice: the supremum of the degrees of f and g is the degree of their Turing join.

      The parity join of sets #

      The parity join {2 * x | x ∈ A} ∪ {2 * x + 1 | x ∈ B} of two sets of naturals.

      Instances For
        @[simp]
        theorem Set.two_mul_mem_turingJoin {A B : Set ℕ} {n : ℕ} :
        2 * n ∈ A.turingJoin B ↔ n ∈ A

        An even number 2 * n lies in the parity join of A and B exactly when n ∈ A.

        @[simp]
        theorem Set.two_mul_add_one_mem_turingJoin {A B : Set ℕ} {n : ℕ} :
        2 * n + 1 ∈ A.turingJoin B ↔ n ∈ B

        An odd number 2 * n + 1 lies in the parity join of A and B exactly when n ∈ B.

        theorem Set.mem_turingJoin {A B : Set ℕ} {n : ℕ} :
        n ∈ A.turingJoin B ↔ n.div2 ∈ bif n.bodd then B else A

        A number n lies in the parity join of A and B exactly when n.div2 lies in B if n is odd, and in A if n is even.

        The oracle of the parity join of two sets is Turing equivalent to the Turing join of their oracles.

        The oracle of A is Turing reducible to the oracle of the parity join of A and B.

        The oracle of B is Turing reducible to the oracle of the parity join of A and B.

        The parity join is the least upper bound of two sets for Turing reducibility: its oracle is reducible to h exactly when the oracles of both sets are.