Documentation

CslibFrontier.Computability.Reduction.TruthTable

Truth-table reductions and autoreductions by admissible data #

A truth-table reduction of A to B fixes, for each input a, a number r a of queries q (a, 0), …, q (a, r a - 1) and decides a ∈ A by applying a combiner d to a and the answer word truthTableAnswers (q ⁻¹' B) r a. Positive truth-table reductions restrict the combiner to be monotone in the answer word under List.Forall₂ (· ≤ ·), and disjunctive and conjunctive reductions replace the combiner by "some query is in B" and "every query is in B". Self-query-avoiding autoreductions specialize B = A and adjoin ∀ a i, i < r a → q (a, i) ≠ a to the admissible data, mirroring Cslib.Complexity.ManyOneAutoreducibleBy.

Here the admissible data (r, q, d) or (r, q) are an arbitrary predicate Good. No machine model or encoding is built in. Polynomial-time and logspace truth-table reductions and autoreductions instantiate these kernels directly.

Main definitions #

Main results #

References #

noncomputable def Cslib.Complexity.truthTableAnswers {α : Type u} (A : Set (α × ℕ)) (r : α → ℕ) (a : α) :

The semantic answers to a fixed indexed batch, in increasing index order. This definition does not assert that membership in the indexed language is computable.

@[simp]
theorem Cslib.Complexity.length_truthTableAnswers {α : Type u} (A : Set (α × ℕ)) (r : α → ℕ) (a : α) :

The answer word has one bit per query.

theorem Cslib.Complexity.truthTableAnswers_eq_map_range {α : Type u} (A : Set (α × ℕ)) [DecidablePred fun (x : α × ℕ) => x ∈ A] (r : α → ℕ) (a : α) :
truthTableAnswers A r a = List.map (fun (i : ℕ) => decide ((a, i) ∈ A)) (List.range (r a))

For a decidable indexed family, the answer word is the decided membership of each index below the query count.

theorem Cslib.Complexity.truthTableAnswers_compl {α : Type u} (A : Set (α × ℕ)) (r : α → ℕ) (a : α) :
truthTableAnswers Aᶜ r a = List.map (fun (x : Bool) => !x) (truthTableAnswers A r a)

Answers for the complemented family are the negated answers.

theorem Cslib.Complexity.truthTableAnswers_drop_take {α : Type u} {β : Type v} {γ : Type w} {Q : α × ℕ → γ} {C : Set γ} {N : α → ℕ} {q : α × ℕ → β} {r' : β → ℕ} {q' : β × ℕ → γ} {k : ℕ} {a : α} {i : ℕ} (hN : i * k + r' (q (a, i)) ≤ N a) (hQ : ∀ j < r' (q (a, i)), Q (a, i * k + j) = q' (q (a, i), j)) :
List.take (r' (q (a, i))) (List.drop (i * k) (truthTableAnswers (Q ⁻¹' C) N a)) = truthTableAnswers (q' ⁻¹' C) r' (q (a, i))

Slice i of a block-indexed answer word of total length N a, with block stride k, recovers the inner answer word for q (a, i) whenever i * k + r' (q (a, i)) ≤ N a and block i begins with the inner queries of q (a, i).

Reduction kernels #

def Cslib.Complexity.TruthTableReducibleBy {α : Type u} {β : Type v} (Good : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop) (A : Set α) (B : Set β) :

A truth-table reduces to B by admissible data: some query count r, query map q and combiner d satisfying Good decide a ∈ A from a and the answers to q (a, i), i < r a.

def Cslib.Complexity.PTTReducibleBy {α : Type u} {β : Type v} (Good : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop) (A : Set α) (B : Set β) :

A positively truth-table reduces to B by admissible data: some query count r, query map q and combiner d satisfying Good, with d monotone in the answer word under List.Forall₂ (· ≤ ·), decide a ∈ A from a and the answers to q (a, i), i < r a.

def Cslib.Complexity.DTTReducibleBy {α : Type u} {β : Type v} (Good : (α → ℕ) → (α × ℕ → β) → Prop) (A : Set α) (B : Set β) :

A disjunctively reduces to B by admissible data: a ∈ A exactly when some query q (a, i) with i < r a is in B.

def Cslib.Complexity.CTTReducibleBy {α : Type u} {β : Type v} (Good : (α → ℕ) → (α × ℕ → β) → Prop) (A : Set α) (B : Set β) :

A conjunctively reduces to B by admissible data: a ∈ A exactly when every query q (a, i) with i < r a is in B.

theorem Cslib.Complexity.headD_false_le_of_forall₂ {u v : List Bool} (h : List.Forall₂ (fun (x1 x2 : Bool) => x1 ≤ x2) u v) :

Pointwise order of Boolean answer words is preserved by List.headD false.

theorem Cslib.Complexity.TruthTableReducibleBy.mono {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good Good' : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hle : ∀ (r : α → ℕ) (q : α × ℕ → β) (d : α × List Bool → Bool), Good r q d → Good' r q d) (h : TruthTableReducibleBy Good A B) :

More admissible data give more reductions.

theorem Cslib.Complexity.TruthTableReducibleBy.compl_left {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hneg : ∀ (r : α → ℕ) (q : α × ℕ → β) (d : α × List Bool → Bool), Good r q d → Good r q fun (x : α × List Bool) => !d x) (h : TruthTableReducibleBy Good A B) :

Negating the combiner reduces Aᶜ to B, when negated combiners are admissible.

theorem Cslib.Complexity.TruthTableReducibleBy.compl_right {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hneg : ∀ (r : α → ℕ) (q : α × ℕ → β) (d : α × List Bool → Bool), Good r q d → Good r q fun (x : α × List Bool) => d (x.1, List.map (fun (x : Bool) => !x) x.2)) (h : TruthTableReducibleBy Good A B) :

Negating the answers before the combiner reads them reduces A to Bᶜ, when such combiners are admissible.

theorem Cslib.Complexity.TruthTableReducibleBy.compl {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hneg : ∀ (r : α → ℕ) (q : α × ℕ → β) (d : α × List Bool → Bool), Good r q d → Good r q fun (x : α × List Bool) => !d (x.1, List.map (fun (x : Bool) => !x) x.2)) (h : TruthTableReducibleBy Good A B) :

Negating both the answers and the output of the combiner reduces Aᶜ to Bᶜ, when such combiners are admissible.

theorem Cslib.Complexity.ManyOneReducibleBy.truthTableReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {GoodF : (α → β) → Prop} {Good : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hgood : ∀ (f : α → β), GoodF f → Good (fun (x : α) => 1) (fun (x : α × ℕ) => f x.1) fun (x : α × List Bool) => x.2.headD false) (h : ManyOneReducibleBy GoodF A B) :

A many-one reduction is a truth-table reduction asking the single query f a and returning its answer, when that data is admissible.

theorem Cslib.Complexity.ManyOneReducibleBy.pttReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {GoodF : (α → β) → Prop} {Good : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hgood : ∀ (f : α → β), GoodF f → Good (fun (x : α) => 1) (fun (x : α × ℕ) => f x.1) fun (x : α × List Bool) => x.2.headD false) (h : ManyOneReducibleBy GoodF A B) :

A many-one reduction is a positive truth-table reduction asking the single query f a and returning its answer, when that data is admissible.

theorem Cslib.Complexity.PTTReducibleBy.mono {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good Good' : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hle : ∀ (r : α → ℕ) (q : α × ℕ → β) (d : α × List Bool → Bool), Good r q d → Good' r q d) (h : PTTReducibleBy Good A B) :
PTTReducibleBy Good' A B

More admissible data give more positive truth-table reductions.

theorem Cslib.Complexity.PTTReducibleBy.truthTableReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good Good' : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hgood : ∀ (r : α → ℕ) (q : α × ℕ → β) (d : α × List Bool → Bool), Good r q d → (∀ (a : α) (u v : List Bool), List.Forall₂ (fun (x1 x2 : Bool) => x1 ≤ x2) u v → d (a, u) ≤ d (a, v)) → Good' r q d) (h : PTTReducibleBy Good A B) :

Forgetting positivity gives an ordinary truth-table reduction, transferring admissibility along hgood.

theorem Cslib.Complexity.PTTReducibleBy.toTruthTableReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (h : PTTReducibleBy Good A B) :

Forgetting positivity with unchanged admissible data Good.

theorem Cslib.Complexity.DTTReducibleBy.mono {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good Good' : (α → ℕ) → (α × ℕ → β) → Prop} (hle : ∀ (r : α → ℕ) (q : α × ℕ → β), Good r q → Good' r q) (h : DTTReducibleBy Good A B) :
DTTReducibleBy Good' A B

More admissible data give more reductions.

theorem Cslib.Complexity.DTTReducibleBy.truthTableReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good : (α → ℕ) → (α × ℕ → β) → Prop} {Good' : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hgood : ∀ (r : α → ℕ) (q : α × ℕ → β), Good r q → Good' r q fun (x : α × List Bool) => x.2.any id) (h : DTTReducibleBy Good A B) :

A disjunctive reduction is a truth-table reduction with combiner List.any id, when that combiner is admissible.

theorem Cslib.Complexity.DTTReducibleBy.pttReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good : (α → ℕ) → (α × ℕ → β) → Prop} {Good' : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hgood : ∀ (r : α → ℕ) (q : α × ℕ → β), Good r q → Good' r q fun (x : α × List Bool) => x.2.any id) (h : DTTReducibleBy Good A B) :
PTTReducibleBy Good' A B

A disjunctive reduction is a positive truth-table reduction with combiner List.any id, when that combiner is admissible.

theorem Cslib.Complexity.CTTReducibleBy.mono {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good Good' : (α → ℕ) → (α × ℕ → β) → Prop} (hle : ∀ (r : α → ℕ) (q : α × ℕ → β), Good r q → Good' r q) (h : CTTReducibleBy Good A B) :
CTTReducibleBy Good' A B

More admissible data give more reductions.

theorem Cslib.Complexity.CTTReducibleBy.truthTableReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good : (α → ℕ) → (α × ℕ → β) → Prop} {Good' : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hgood : ∀ (r : α → ℕ) (q : α × ℕ → β), Good r q → Good' r q fun (x : α × List Bool) => x.2.all id) (h : CTTReducibleBy Good A B) :

A conjunctive reduction is a truth-table reduction with combiner List.all id, when that combiner is admissible.

theorem Cslib.Complexity.CTTReducibleBy.pttReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good : (α → ℕ) → (α × ℕ → β) → Prop} {Good' : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} (hgood : ∀ (r : α → ℕ) (q : α × ℕ → β), Good r q → Good' r q fun (x : α × List Bool) => x.2.all id) (h : CTTReducibleBy Good A B) :
PTTReducibleBy Good' A B

A conjunctive reduction is a positive truth-table reduction with combiner List.all id, when that combiner is admissible.

theorem Cslib.Complexity.ManyOneReducibleBy.dttReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {GoodF : (α → β) → Prop} {Good : (α → ℕ) → (α × ℕ → β) → Prop} (hgood : ∀ (f : α → β), GoodF f → Good (fun (x : α) => 1) fun (x : α × ℕ) => f x.1) (h : ManyOneReducibleBy GoodF A B) :

A many-one reduction is a disjunctive reduction asking the single query f a, when that data is admissible.

theorem Cslib.Complexity.ManyOneReducibleBy.cttReducibleBy {α : Type u} {β : Type v} {A : Set α} {B : Set β} {GoodF : (α → β) → Prop} {Good : (α → ℕ) → (α × ℕ → β) → Prop} (hgood : ∀ (f : α → β), GoodF f → Good (fun (x : α) => 1) fun (x : α × ℕ) => f x.1) (h : ManyOneReducibleBy GoodF A B) :

A many-one reduction is a conjunctive reduction asking the single query f a, when that data is admissible.

theorem Cslib.Complexity.dttReducibleBy_iff_cttReducibleBy_compl {α : Type u} {β : Type v} {A : Set α} {B : Set β} {Good : (α → ℕ) → (α × ℕ → β) → Prop} :

De Morgan duality. The disjunctive reductions of A to B are the conjunctive reductions of Aᶜ to Bᶜ, with the same data.

Nonadaptive composition #

def Cslib.Complexity.truthTableCompQuery {α : Type u} {β : Type v} {γ : Type w} (q : α × ℕ → β) (q' : β × ℕ → γ) (M : α → ℕ) (p : α × ℕ) :
γ

Composite query generator with block stride M a: query index t asks inner query t % M a of outer query q (a, t / M a).

theorem Cslib.Complexity.truthTableCompQuery_mul_add {α : Type u} {β : Type v} {γ : Type w} (q : α × ℕ → β) (q' : β × ℕ → γ) (M : α → ℕ) (a : α) (i : ℕ) {j : ℕ} (hj : j < M a) :
truthTableCompQuery q q' M (a, i * M a + j) = q' (q (a, i), j)

Within block i of stride M a, offset j < M a recovers q' (q (a, i), j).

def Cslib.Complexity.truthTableCompCombiner {α : Type u} {β : Type v} (r : α → ℕ) (q : α × ℕ → β) (d : α × List Bool → Bool) (r' : β → ℕ) (d' : β × List Bool → Bool) (M : α → ℕ) (x : α × List Bool) :

The combiner of a composite truth-table reduction: block i of the answer word, of length r' (q (a, i)) and starting at i * M a, is decided by d', and d combines the r a decisions.

theorem Cslib.Complexity.mem_iff_truthTableCompCombiner {α : Type u} {β : Type v} {γ : Type w} {B : Set β} {C : Set γ} {L : Set α} {r : α → ℕ} {q : α × ℕ → β} {d : α × List Bool → Bool} {r' : β → ℕ} {q' : β × ℕ → γ} {d' : β × List Bool → Bool} {M : α → ℕ} {Q : α × ℕ → γ} (hL : ∀ (a : α), a ∈ L ↔ d (a, truthTableAnswers (q ⁻¹' B) r a) = true) (hB : ∀ (b : β), b ∈ B ↔ d' (b, truthTableAnswers (q' ⁻¹' C) r' b) = true) (hM : ∀ (a : α), ∀ i < r a, r' (q (a, i)) ≤ M a) (hQ : ∀ (a : α), ∀ i < r a, ∀ j < r' (q (a, i)), Q (a, i * M a + j) = q' (q (a, i), j)) (a : α) :
a ∈ L ↔ truthTableCompCombiner r q d r' d' M (a, truthTableAnswers (Q ⁻¹' C) (fun (a : α) => r a * M a) a) = true

Correctness of the composite combiner. If block i of the composite queries Q, of length M a, starts with the r' (q (a, i)) second-stage queries of q (a, i), then the composite combiner decides L from the answers to the r a * M a composite queries.

theorem Cslib.Complexity.truthTableCompCombiner_mono {α : Type u} {β : Type v} {r : α → ℕ} {q : α × ℕ → β} {d : α × List Bool → Bool} {r' : β → ℕ} {d' : β × List Bool → Bool} {M : α → ℕ} (hd : ∀ (a : α) (u v : List Bool), List.Forall₂ (fun (x1 x2 : Bool) => x1 ≤ x2) u v → d (a, u) ≤ d (a, v)) (hd' : ∀ (b : β) (u v : List Bool), List.Forall₂ (fun (x1 x2 : Bool) => x1 ≤ x2) u v → d' (b, u) ≤ d' (b, v)) (a : α) (u v : List Bool) (huv : List.Forall₂ (fun (x1 x2 : Bool) => x1 ≤ x2) u v) :
truthTableCompCombiner r q d r' d' M (a, u) ≤ truthTableCompCombiner r q d r' d' M (a, v)

The composite combiner is monotone in the answers when both combiners are.

theorem Cslib.Complexity.TruthTableReducibleBy.trans {α : Type u} {β : Type v} {γ : Type w} {A : Set α} {B : Set β} {C : Set γ} {Good₁ : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} {Good₂ : (β → ℕ) → (β × ℕ → γ) → (β × List Bool → Bool) → Prop} {Good₃ : (α → ℕ) → (α × ℕ → γ) → (α × List Bool → Bool) → Prop} (hcomp : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (d₁ : α × List Bool → Bool) (r₂ : β → ℕ) (q₂ : β × ℕ → γ) (d₂ : β × List Bool → Bool), Good₁ r₁ q₁ d₁ → Good₂ r₂ q₂ d₂ → ∃ (M : α → ℕ), (∀ (a : α), ∀ i < r₁ a, r₂ (q₁ (a, i)) ≤ M a) ∧ Good₃ (fun (a : α) => r₁ a * M a) (truthTableCompQuery q₁ q₂ M) (truthTableCompCombiner r₁ q₁ d₁ r₂ d₂ M)) (hAB : TruthTableReducibleBy Good₁ A B) (hBC : TruthTableReducibleBy Good₂ B C) :

Truth-table reductions compose whenever each admissible pair admits a block stride M making the composite count, quotient/remainder query map and composite combiner admissible.

theorem Cslib.Complexity.TruthTableReducibleBy.trans_bounded {α : Type u} {β : Type v} {γ : Type w} {A : Set α} {B : Set β} {C : Set γ} {k₁ k₂ : ℕ} {Good₁ : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} {Good₂ : (β → ℕ) → (β × ℕ → γ) → (β × List Bool → Bool) → Prop} {Good₃ : (α → ℕ) → (α × ℕ → γ) → (α × List Bool → Bool) → Prop} (hk₁ : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (d₁ : α × List Bool → Bool), Good₁ r₁ q₁ d₁ → ∀ (a : α), r₁ a ≤ k₁) (hk₂ : ∀ (r₂ : β → ℕ) (q₂ : β × ℕ → γ) (d₂ : β × List Bool → Bool), Good₂ r₂ q₂ d₂ → ∀ (b : β), r₂ b ≤ k₂) (hcomp : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (d₁ : α × List Bool → Bool) (r₂ : β → ℕ) (q₂ : β × ℕ → γ) (d₂ : β × List Bool → Bool), Good₁ r₁ q₁ d₁ → Good₂ r₂ q₂ d₂ → (∀ (a : α), r₁ a * k₂ ≤ k₁ * k₂) → Good₃ (fun (a : α) => r₁ a * k₂) (truthTableCompQuery q₁ q₂ fun (x : α) => k₂) (truthTableCompCombiner r₁ q₁ d₁ r₂ d₂ fun (x : α) => k₂)) (hAB : TruthTableReducibleBy Good₁ A B) (hBC : TruthTableReducibleBy Good₂ B C) :

Bounded-query truth-table reductions with query bounds k₁ and k₂ compose with query bound k₁ * k₂, using constant block stride k₂ and (i / k₂, i % k₂) query indexing.

theorem Cslib.Complexity.PTTReducibleBy.trans {α : Type u} {β : Type v} {γ : Type w} {A : Set α} {B : Set β} {C : Set γ} {Good₁ : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} {Good₂ : (β → ℕ) → (β × ℕ → γ) → (β × List Bool → Bool) → Prop} {Good₃ : (α → ℕ) → (α × ℕ → γ) → (α × List Bool → Bool) → Prop} (hcomp : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (d₁ : α × List Bool → Bool) (r₂ : β → ℕ) (q₂ : β × ℕ → γ) (d₂ : β × List Bool → Bool), Good₁ r₁ q₁ d₁ → Good₂ r₂ q₂ d₂ → ∃ (M : α → ℕ), (∀ (a : α), ∀ i < r₁ a, r₂ (q₁ (a, i)) ≤ M a) ∧ Good₃ (fun (a : α) => r₁ a * M a) (truthTableCompQuery q₁ q₂ M) (truthTableCompCombiner r₁ q₁ d₁ r₂ d₂ M)) (hAB : PTTReducibleBy Good₁ A B) (hBC : PTTReducibleBy Good₂ B C) :
PTTReducibleBy Good₃ A C

Positive truth-table reductions compose, preserving monotonicity of the combiner.

theorem Cslib.Complexity.PTTReducibleBy.trans_bounded {α : Type u} {β : Type v} {γ : Type w} {A : Set α} {B : Set β} {C : Set γ} {k₁ k₂ : ℕ} {Good₁ : (α → ℕ) → (α × ℕ → β) → (α × List Bool → Bool) → Prop} {Good₂ : (β → ℕ) → (β × ℕ → γ) → (β × List Bool → Bool) → Prop} {Good₃ : (α → ℕ) → (α × ℕ → γ) → (α × List Bool → Bool) → Prop} (hk₁ : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (d₁ : α × List Bool → Bool), Good₁ r₁ q₁ d₁ → ∀ (a : α), r₁ a ≤ k₁) (hk₂ : ∀ (r₂ : β → ℕ) (q₂ : β × ℕ → γ) (d₂ : β × List Bool → Bool), Good₂ r₂ q₂ d₂ → ∀ (b : β), r₂ b ≤ k₂) (hcomp : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (d₁ : α × List Bool → Bool) (r₂ : β → ℕ) (q₂ : β × ℕ → γ) (d₂ : β × List Bool → Bool), Good₁ r₁ q₁ d₁ → Good₂ r₂ q₂ d₂ → (∀ (a : α), r₁ a * k₂ ≤ k₁ * k₂) → Good₃ (fun (a : α) => r₁ a * k₂) (truthTableCompQuery q₁ q₂ fun (x : α) => k₂) (truthTableCompCombiner r₁ q₁ d₁ r₂ d₂ fun (x : α) => k₂)) (hAB : PTTReducibleBy Good₁ A B) (hBC : PTTReducibleBy Good₂ B C) :
PTTReducibleBy Good₃ A C

Bounded-query positive truth-table reductions with query bounds k₁ and k₂ compose with query bound k₁ * k₂, preserving monotonicity of the combiner.

def Cslib.Complexity.truthTableCompPairs {α : Type u} {β : Type v} (r : α → ℕ) (q : α × ℕ → β) (r' : β → ℕ) (a : α) :

Active (outerIndex, innerIndex) pairs of a two-stage query batch (r, q) followed by r'. Unlike fixed-stride padding, this list contains only active second-stage indices, so disjunctive and conjunctive quantifiers over all indices below its length remain exact even when some inner counts are zero or smaller than the maximum.

def Cslib.Complexity.dttCompQuery {α : Type u} {β : Type v} {γ : Type w} (r : α → ℕ) (q : α × ℕ → β) (r' : β → ℕ) (q' : β × ℕ → γ) (x : α × ℕ) :
γ

Flattened query generator reading the t-th active (outerIndex, innerIndex) pair of truthTableCompPairs.

theorem Cslib.Complexity.length_truthTableCompPairs_le {α : Type u} {β : Type v} {r : α → ℕ} {q : α × ℕ → β} {r' : β → ℕ} {k₁ k₂ : ℕ} {a : α} (hr : r a ≤ k₁) (hr' : ∀ i < r a, r' (q (a, i)) ≤ k₂) :
(truthTableCompPairs r q r' a).length ≤ k₁ * k₂

When r a ≤ k₁ and every active inner count is at most k₂, there are at most k₁ * k₂ active composite query pairs.

theorem Cslib.Complexity.DTTReducibleBy.trans {α : Type u} {β : Type v} {γ : Type w} {A : Set α} {B : Set β} {C : Set γ} {Good₁ : (α → ℕ) → (α × ℕ → β) → Prop} {Good₂ : (β → ℕ) → (β × ℕ → γ) → Prop} {Good₃ : (α → ℕ) → (α × ℕ → γ) → Prop} (hcomp : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (r₂ : β → ℕ) (q₂ : β × ℕ → γ), Good₁ r₁ q₁ → Good₂ r₂ q₂ → Good₃ (fun (a : α) => (truthTableCompPairs r₁ q₁ r₂ a).length) (dttCompQuery r₁ q₁ r₂ q₂)) (hAB : DTTReducibleBy Good₁ A B) (hBC : DTTReducibleBy Good₂ B C) :
DTTReducibleBy Good₃ A C

Disjunctive truth-table reductions compose by flattening the active query pairs.

theorem Cslib.Complexity.DTTReducibleBy.trans_bounded {α : Type u} {β : Type v} {γ : Type w} {A : Set α} {B : Set β} {C : Set γ} {k₁ k₂ : ℕ} {Good₁ : (α → ℕ) → (α × ℕ → β) → Prop} {Good₂ : (β → ℕ) → (β × ℕ → γ) → Prop} {Good₃ : (α → ℕ) → (α × ℕ → γ) → Prop} (hk₁ : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β), Good₁ r₁ q₁ → ∀ (a : α), r₁ a ≤ k₁) (hk₂ : ∀ (r₂ : β → ℕ) (q₂ : β × ℕ → γ), Good₂ r₂ q₂ → ∀ (b : β), r₂ b ≤ k₂) (hcomp : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (r₂ : β → ℕ) (q₂ : β × ℕ → γ), Good₁ r₁ q₁ → Good₂ r₂ q₂ → (∀ (a : α), (truthTableCompPairs r₁ q₁ r₂ a).length ≤ k₁ * k₂) → Good₃ (fun (a : α) => (truthTableCompPairs r₁ q₁ r₂ a).length) (dttCompQuery r₁ q₁ r₂ q₂)) (hAB : DTTReducibleBy Good₁ A B) (hBC : DTTReducibleBy Good₂ B C) :
DTTReducibleBy Good₃ A C

Bounded disjunctive truth-table reductions with query bounds k₁ and k₂ compose with query bound k₁ * k₂.

theorem Cslib.Complexity.CTTReducibleBy.trans {α : Type u} {β : Type v} {γ : Type w} {A : Set α} {B : Set β} {C : Set γ} {Good₁ : (α → ℕ) → (α × ℕ → β) → Prop} {Good₂ : (β → ℕ) → (β × ℕ → γ) → Prop} {Good₃ : (α → ℕ) → (α × ℕ → γ) → Prop} (hcomp : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (r₂ : β → ℕ) (q₂ : β × ℕ → γ), Good₁ r₁ q₁ → Good₂ r₂ q₂ → Good₃ (fun (a : α) => (truthTableCompPairs r₁ q₁ r₂ a).length) (dttCompQuery r₁ q₁ r₂ q₂)) (hAB : CTTReducibleBy Good₁ A B) (hBC : CTTReducibleBy Good₂ B C) :
CTTReducibleBy Good₃ A C

Conjunctive truth-table reductions compose, by De Morgan duality with DTTReducibleBy.trans.

theorem Cslib.Complexity.CTTReducibleBy.trans_bounded {α : Type u} {β : Type v} {γ : Type w} {A : Set α} {B : Set β} {C : Set γ} {k₁ k₂ : ℕ} {Good₁ : (α → ℕ) → (α × ℕ → β) → Prop} {Good₂ : (β → ℕ) → (β × ℕ → γ) → Prop} {Good₃ : (α → ℕ) → (α × ℕ → γ) → Prop} (hk₁ : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β), Good₁ r₁ q₁ → ∀ (a : α), r₁ a ≤ k₁) (hk₂ : ∀ (r₂ : β → ℕ) (q₂ : β × ℕ → γ), Good₂ r₂ q₂ → ∀ (b : β), r₂ b ≤ k₂) (hcomp : ∀ (r₁ : α → ℕ) (q₁ : α × ℕ → β) (r₂ : β → ℕ) (q₂ : β × ℕ → γ), Good₁ r₁ q₁ → Good₂ r₂ q₂ → (∀ (a : α), (truthTableCompPairs r₁ q₁ r₂ a).length ≤ k₁ * k₂) → Good₃ (fun (a : α) => (truthTableCompPairs r₁ q₁ r₂ a).length) (dttCompQuery r₁ q₁ r₂ q₂)) (hAB : CTTReducibleBy Good₁ A B) (hBC : CTTReducibleBy Good₂ B C) :
CTTReducibleBy Good₃ A C

Bounded conjunctive truth-table reductions with query bounds k₁ and k₂ compose with query bound k₁ * k₂.

Self-query-avoiding autoreductions #

def Cslib.Complexity.ManyOneAutoreducibleBy {α : Type u} (Good : (α → α) → Prop) (A : Set α) :

A is many-one autoreducible by an admissible map: some fixed-point-free f satisfying Good reduces A to itself.

theorem Cslib.Complexity.ManyOneAutoreducibleBy.manyOneReducibleBy {α : Type u} {A : Set α} {Good : (α → α) → Prop} (h : ManyOneAutoreducibleBy Good A) :

Forgetting fixed-point-freeness gives an ordinary many-one self-reduction.

theorem Cslib.Complexity.ManyOneAutoreducibleBy.mono {α : Type u} {A : Set α} {Good Good' : (α → α) → Prop} (hle : ∀ (f : α → α), Good f → Good' f) (h : ManyOneAutoreducibleBy Good A) :

Enlarging the admissible maps preserves many-one autoreducibility.

theorem Cslib.Complexity.ManyOneAutoreducibleBy.compl {α : Type u} {A : Set α} {Good : (α → α) → Prop} (h : ManyOneAutoreducibleBy Good A) :

A many-one autoreduction of A is also one of Aᶜ.

theorem Cslib.Complexity.ManyOneAutoreducibleBy.exists_mem_ne {α : Type u} {A : Set α} {Good : (α → α) → Prop} (h : ManyOneAutoreducibleBy Good A) (a : α) :
a ∈ A → ∃ y ∈ A, y ≠ a

Every member of a many-one autoreducible set maps to a distinct member.

theorem Cslib.Complexity.ManyOneAutoreducibleBy.exists_notMem_ne {α : Type u} {A : Set α} {Good : (α → α) → Prop} (h : ManyOneAutoreducibleBy Good A) (a : α) :
a ∉ A → ∃ n ∉ A, n ≠ a

Every non-member of a many-one autoreducible set maps to a distinct non-member.

theorem Cslib.Complexity.not_manyOneAutoreducibleBy_singleton {α : Type u} {Good : (α → α) → Prop} (a₀ : α) :

A singleton set is never fixed-point-free many-one autoreducible.

theorem Cslib.Complexity.not_manyOneAutoreducibleBy_compl_singleton {α : Type u} {Good : (α → α) → Prop} (a₀ : α) :

A co-singleton set is never fixed-point-free many-one autoreducible.

def Cslib.Complexity.TruthTableAutoreducibleBy {α : Type u} (Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop) (A : Set α) :

A is truth-table autoreducible by admissible data: a truth-table reduction of A to itself whose active queries avoid the input (∀ a i, i < r a → q (a, i) ≠ a).

def Cslib.Complexity.PTTAutoreducibleBy {α : Type u} (Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop) (A : Set α) :

A is positively truth-table autoreducible by admissible data: a positive truth-table reduction of A to itself whose active queries avoid the input.

def Cslib.Complexity.DTTAutoreducibleBy {α : Type u} (Good : (α → ℕ) → (α × ℕ → α) → Prop) (A : Set α) :

A is disjunctively truth-table autoreducible by admissible data: a disjunctive reduction of A to itself whose active queries avoid the input.

def Cslib.Complexity.CTTAutoreducibleBy {α : Type u} (Good : (α → ℕ) → (α × ℕ → α) → Prop) (A : Set α) :

A is conjunctively truth-table autoreducible by admissible data: a conjunctive reduction of A to itself whose active queries avoid the input.

theorem Cslib.Complexity.TruthTableAutoreducibleBy.truthTableReducibleBy {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (h : TruthTableAutoreducibleBy Good A) :

Forgetting query avoidance gives an ordinary truth-table self-reduction.

theorem Cslib.Complexity.TruthTableAutoreducibleBy.mono {α : Type u} {A : Set α} {Good Good' : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hle : ∀ (r : α → ℕ) (q : α × ℕ → α) (d : α × List Bool → Bool), Good r q d → Good' r q d) (h : TruthTableAutoreducibleBy Good A) :

Enlarging the admissible data preserves truth-table autoreducibility.

theorem Cslib.Complexity.TruthTableAutoreducibleBy.compl {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hneg : ∀ (r : α → ℕ) (q : α × ℕ → α) (d : α × List Bool → Bool), Good r q d → Good r q fun (x : α × List Bool) => !d (x.1, List.map (fun (x : Bool) => !x) x.2)) (h : TruthTableAutoreducibleBy Good A) :

Negating both the answers and output of the combiner reduces Aᶜ to Aᶜ without changing the queries, so query avoidance is preserved automatically.

theorem Cslib.Complexity.TruthTableAutoreducibleBy.of_decide {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} {g : α → Bool} (hAg : ∀ (a : α), a ∈ A ↔ g a = true) (hg : Good (fun (x : α) => 0) Prod.fst fun (x : α × List Bool) => g x.1) :

A decision predicate g for A gives a zero-query truth-table autoreduction whenever the zero-query data (fun _ => 0, Prod.fst, fun x => g x.1) is admissible.

theorem Cslib.Complexity.PTTAutoreducibleBy.pttReducibleBy {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (h : PTTAutoreducibleBy Good A) :

Forgetting query avoidance gives an ordinary positive truth-table self-reduction.

theorem Cslib.Complexity.PTTAutoreducibleBy.mono {α : Type u} {A : Set α} {Good Good' : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hle : ∀ (r : α → ℕ) (q : α × ℕ → α) (d : α × List Bool → Bool), Good r q d → Good' r q d) (h : PTTAutoreducibleBy Good A) :

Enlarging the admissible data preserves positive truth-table autoreducibility.

theorem Cslib.Complexity.PTTAutoreducibleBy.truthTableAutoreducibleBy {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (h : PTTAutoreducibleBy Good A) :

Forgetting positivity gives a truth-table autoreduction.

theorem Cslib.Complexity.PTTAutoreducibleBy.of_decide {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} {g : α → Bool} (hAg : ∀ (a : α), a ∈ A ↔ g a = true) (hg : Good (fun (x : α) => 0) Prod.fst fun (x : α × List Bool) => g x.1) :

A decision predicate g for A gives a zero-query positive truth-table autoreduction, since fun x => g x.1 ignores the answer word and is therefore monotone in it.

theorem Cslib.Complexity.DTTAutoreducibleBy.dttReducibleBy {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → Prop} (h : DTTAutoreducibleBy Good A) :

Forgetting query avoidance gives an ordinary disjunctive self-reduction.

theorem Cslib.Complexity.DTTAutoreducibleBy.mono {α : Type u} {A : Set α} {Good Good' : (α → ℕ) → (α × ℕ → α) → Prop} (hle : ∀ (r : α → ℕ) (q : α × ℕ → α), Good r q → Good' r q) (h : DTTAutoreducibleBy Good A) :

Enlarging the admissible data preserves disjunctive autoreducibility.

theorem Cslib.Complexity.DTTAutoreducibleBy.pttAutoreducibleBy {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → Prop} {GoodT : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hgood : ∀ (r : α → ℕ) (q : α × ℕ → α), Good r q → GoodT r q fun (x : α × List Bool) => x.2.any id) (h : DTTAutoreducibleBy Good A) :

A disjunctive autoreduction is a positive truth-table autoreduction with combiner List.any id.

theorem Cslib.Complexity.DTTAutoreducibleBy.truthTableAutoreducibleBy {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → Prop} {GoodT : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hgood : ∀ (r : α → ℕ) (q : α × ℕ → α), Good r q → GoodT r q fun (x : α × List Bool) => x.2.any id) (h : DTTAutoreducibleBy Good A) :

A disjunctive autoreduction is a truth-table autoreduction with combiner List.any id.

theorem Cslib.Complexity.CTTAutoreducibleBy.cttReducibleBy {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → Prop} (h : CTTAutoreducibleBy Good A) :

Forgetting query avoidance gives an ordinary conjunctive self-reduction.

theorem Cslib.Complexity.CTTAutoreducibleBy.mono {α : Type u} {A : Set α} {Good Good' : (α → ℕ) → (α × ℕ → α) → Prop} (hle : ∀ (r : α → ℕ) (q : α × ℕ → α), Good r q → Good' r q) (h : CTTAutoreducibleBy Good A) :

Enlarging the admissible data preserves conjunctive autoreducibility.

theorem Cslib.Complexity.CTTAutoreducibleBy.pttAutoreducibleBy {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → Prop} {GoodT : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hgood : ∀ (r : α → ℕ) (q : α × ℕ → α), Good r q → GoodT r q fun (x : α × List Bool) => x.2.all id) (h : CTTAutoreducibleBy Good A) :

A conjunctive autoreduction is a positive truth-table autoreduction with combiner List.all id.

theorem Cslib.Complexity.CTTAutoreducibleBy.truthTableAutoreducibleBy {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → Prop} {GoodT : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hgood : ∀ (r : α → ℕ) (q : α × ℕ → α), Good r q → GoodT r q fun (x : α × List Bool) => x.2.all id) (h : CTTAutoreducibleBy Good A) :

A conjunctive autoreduction is a truth-table autoreduction with combiner List.all id.

theorem Cslib.Complexity.dttAutoreducibleBy_iff_cttAutoreducibleBy_compl {α : Type u} {A : Set α} {Good : (α → ℕ) → (α × ℕ → α) → Prop} :

De Morgan duality for autoreductions. Disjunctive autoreductions of A are the conjunctive autoreductions of Aᶜ, with the same queries.

theorem Cslib.Complexity.ManyOneAutoreducibleBy.truthTableAutoreducibleBy {α : Type u} {A : Set α} {GoodF : (α → α) → Prop} {Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hgood : ∀ (f : α → α), GoodF f → Good (fun (x : α) => 1) (fun (x : α × ℕ) => f x.1) fun (x : α × List Bool) => x.2.headD false) (h : ManyOneAutoreducibleBy GoodF A) :

A fixed-point-free many-one autoreduction is a one-query truth-table autoreduction.

theorem Cslib.Complexity.ManyOneAutoreducibleBy.pttAutoreducibleBy {α : Type u} {A : Set α} {GoodF : (α → α) → Prop} {Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hgood : ∀ (f : α → α), GoodF f → Good (fun (x : α) => 1) (fun (x : α × ℕ) => f x.1) fun (x : α × List Bool) => x.2.headD false) (h : ManyOneAutoreducibleBy GoodF A) :

A fixed-point-free many-one autoreduction is a one-query positive truth-table autoreduction.

theorem Cslib.Complexity.ManyOneAutoreducibleBy.dttAutoreducibleBy {α : Type u} {A : Set α} {GoodF : (α → α) → Prop} {Good : (α → ℕ) → (α × ℕ → α) → Prop} (hgood : ∀ (f : α → α), GoodF f → Good (fun (x : α) => 1) fun (x : α × ℕ) => f x.1) (h : ManyOneAutoreducibleBy GoodF A) :

A fixed-point-free many-one autoreduction is a one-query disjunctive autoreduction.

theorem Cslib.Complexity.ManyOneAutoreducibleBy.cttAutoreducibleBy {α : Type u} {A : Set α} {GoodF : (α → α) → Prop} {Good : (α → ℕ) → (α × ℕ → α) → Prop} (hgood : ∀ (f : α → α), GoodF f → Good (fun (x : α) => 1) fun (x : α × ℕ) => f x.1) (h : ManyOneAutoreducibleBy GoodF A) :

A fixed-point-free many-one autoreduction is a one-query conjunctive autoreduction.

theorem Cslib.Complexity.ManyOneReducibleBy.truthTableAutoreducibleBy_of_compl {α : Type u} {A : Set α} {GoodF : (α → α) → Prop} {Good : (α → ℕ) → (α × ℕ → α) → (α × List Bool → Bool) → Prop} (hgood : ∀ (f : α → α), GoodF f → Good (fun (x : α) => 1) (fun (x : α × ℕ) => f x.1) fun (x : α × List Bool) => !x.2.headD false) (h : ManyOneReducibleBy GoodF Aᶜ A) :

A many-one reduction of Aᶜ to A cannot fix any input (a ∉ A ↔ a ∈ A is impossible); asking its single query f a and negating the answer gives a one-query truth-table autoreduction of A.