Documentation

CslibFrontier.Computability.Complexity.Reduction.Nontrivial

Reductions from P to nontrivial problems #

Every problem in P polynomial-time reduces to every problem with a member and a nonmember: decide membership, then output the member or the nonmember. So P lies below every nontrivial problem in the polynomial-time many-one order, and under P = NP every nontrivial problem is NP-hard.

Main results #

theorem Cslib.Complexity.polyTimeReducible_of_mem_P {α β : Type} {encA : α ↪ List Bool} {encB : β ↪ List Bool} {A : Set α} {B : Set β} (hA : A ∈ P encA) {b₁ b₀ : β} (h₁ : b₁ ∈ B) (h₀ : b₀ ∉ B) :
PolyTimeReducible encA encB A B

Every problem in P reduces to every problem with a member b₁ and a nonmember b₀: decide membership and output b₁ or b₀.