Documentation

CslibFrontier.Computability.BlumComplexity.Naming

The naming theorem #

For every Blum complexity measure Φ there is a measured family of functions that contains a name for every complexity class of a computable bound. That is the naming theorem [Odifreddi1999, Theorem VII.3.6], attributed there to Meyer and McCreight McCreight and Meyer, Classes of computable functions defined by bounds on computation. A family φ_{h 0}, φ_{h 1}, … is measured [Odifreddi1999, Definition VII.2.9] when the predicate φ_{h i} x = y is decidable, uniformly in i, x and y. A bound t' is a name for C_t when C_{t'} = C_t.

naming_theorem gives a computable h : Code → Code such that

  1. the predicate φ_{h i} x = y is decidable, uniformly in i, x and y;
  2. if φ_i is total, so is φ_{h i};
  3. if φ_i is total, then C_{φ_{h i}} = C_{φ_i}.

These are items 1–3 of the source. The function φ_{h i} is Φ.name i, defined directly from i by a priority construction; naming_theorem packages Φ.name as a computable map on programs.

Construction #

Fix the program i. The stages are s = ⟪x, z⟫. Input x receives its value at the first stage ⟪x, z⟫ at which some index acts, or at which i halts on x within cost z. Index e is flagged at stage s when some input y ≤ s, on which i halts within cost s, has φ_i y < Φ_e y (program e does not halt on y within cost φ_i y), and y had not flagged e already when e last acted. A candidate is a flagged index e ≤ s that does not halt on x within z, such that every unflagged index of higher priority does. The candidate of highest priority acts, and x receives the value z. If no index acts and i halts on x within exactly z, then x receives max z (φ_i x).

Priority is dynamic. An index that has never acted has key 2 e; an index that last acted at stage a has key 2 a + 1. Smaller keys have higher priority, so an index that acts moves behind every other index considered so far. The key replaces the source's explicit priority list, and the flag condition replaces its marks; both are computed from the history of earlier stages.

The value at an action is z. The source takes Φ_{e_x}(x) - 1 instead, where e_x is the acting index. Both are below Φ_{e_x}(x) when the latter is defined, and both are at least z, which is what item 1 uses. The value z is defined even when Φ_{e_x}(x) is not.

Verification #

Let i compute a total t, with name t'.

Together these give eventually_cost_le_name_iff for every program, total or not, and hence C_{t'} = C_t. The source verifies its requirements H_e (C_t ⊆ C_{t'}) and L_e (C_{t'} ⊆ C_t) separately, by cases on whether e eventually keeps a mark. Here both directions split on whether e acts at finitely many stages, so the L_e direction is proved by a different argument (quiet-set stabilization).

Main definitions #

Main results #

References #

Bounded halting #

The construction #

Fix the code i of the bound. The construction runs through the stages s = ⟪x, z⟫. At each stage at most one index e acts, which defines the name at x with the value z. The history of the stages < s is a list of Option ℕ.

Computability #

The history #

The name Φ.name i of the bound computed by program i, from the proof of the naming theorem [Odifreddi1999, Theorem VII.3.6]: the value at x is assigned at the first stage ⟪x, z⟫ at which input x receives a value in the priority construction.

The names are uniformly partial recursive.

@[reducible, inline]

Input argument q.2.1 in a graph-membership triple (code, x, y).

@[reducible, inline]

Output candidate q.2.2 in a graph-membership triple (code, x, y).

The graph of each name is decidable, uniformly in the program: the set of names is measured.

A name is defined wherever the program it names halts.

Comparison with the bound #

Fix a program i computing a total t, and the name t' of i.

theorem Cslib.BlumComplexity.BlumMeasure.exists_name_total (Φ : BlumMeasure) {i : Nat.Partrec.Code} {t : ℕ → ℕ} (ht : ∀ (n : ℕ), t n ∈ i.eval n) :
∃ (t' : ℕ → ℕ), ∀ (n : ℕ), t' n ∈ Φ.name i n

The name of a program that halts everywhere halts everywhere.

theorem Cslib.BlumComplexity.BlumMeasure.eventually_cost_le_name_iff {Φ : BlumMeasure} {i : Nat.Partrec.Code} {t t' : ℕ → ℕ} (ht : ∀ (n : ℕ), t n ∈ i.eval n) (ht' : ∀ (n : ℕ), t' n ∈ Φ.name i n) (c : Nat.Partrec.Code) :
(∀ᶠ (n : ℕ) in Filter.atTop, ∃ m ∈ Φ.cost c n, m ≤ t n) ↔ ∀ᶠ (n : ℕ) in Filter.atTop, ∃ m ∈ Φ.cost c n, m ≤ t' n

The naming property, pointwise. Let program i compute the total function t, with name t'. Every program c, total or not, halts within t almost everywhere if and only if it halts within t' almost everywhere.

theorem Cslib.BlumComplexity.BlumMeasure.complexityClass_name {Φ : BlumMeasure} {i : Nat.Partrec.Code} {t t' : ℕ → ℕ} (ht : ∀ (n : ℕ), t n ∈ i.eval n) (ht' : ∀ (n : ℕ), t' n ∈ Φ.name i n) :

The name of a total program defines the same complexity class: C_{t'} = C_t.

theorem Cslib.BlumComplexity.BlumMeasure.naming_theorem (Φ : BlumMeasure) :
∃ (h : Nat.Partrec.Code → Nat.Partrec.Code), Computable h ∧ (ComputablePred fun (q : Nat.Partrec.Code × ℕ × ℕ) => nameValue q ∈ (h q.1).eval (nameInput q)) ∧ ∀ (i : Nat.Partrec.Code) (t : ℕ → ℕ), (∀ (n : ℕ), t n ∈ i.eval n) → ∃ (t' : ℕ → ℕ), (∀ (n : ℕ), t' n ∈ (h i).eval n) ∧ Φ.complexityClass t' = Φ.complexityClass t

The naming theorem [Odifreddi1999, Theorem VII.3.6]. There is a computable map h on programs such that

  1. the predicate φ_{h i} x = y is decidable, uniformly in i, x and y;
  2. if φ_i is total, so is φ_{h i};
  3. if φ_i is total, then C_{φ_{h i}} = C_{φ_i}.

So the measured set {φ_{h i}} contains a name for every complexity class C_t of a computable t.