Documentation

CslibFrontier.Computability.Complexity.Classes.TFNP.Subclasses.Principles

Combinatorial principles for total search subclasses #

The classical subclasses of TFNP introduced by Johnson, Papadimitriou and Yannakakis [JPY88] and by Papadimitriou [Pap94b] classify total search problems by the finite combinatorial principle that guarantees a solution on the hypercube {0, 1} ^ n (represented as bit strings u : List Bool of length n, with distinguished origin zeroVertex n = List.replicate n false):

Main definitions #

Main results #

References #

Fixed-length bit strings #

The distinguished origin vertex 0 ^ n of {0, 1} ^ n.

def Cslib.Complexity.PreservesWidth {α : Type} (n : α → ℕ) (F : α × List Bool → List Bool) :

F preserves the bit-width n: on every instance a, it maps strings of length n a to strings of length n a, so F (a, ·) restricts to a map of the cube {0, 1} ^ (n a).

Local optimality (PLS) #

def Cslib.Complexity.localOptRel {α : Type} (n : α → ℕ) (N : α × List Bool → List Bool) (C : α × List Bool → ℕ) (a : α) (u : List Bool) :

The search relation of a local-search family (PLS): given bit-length n a, neighbor function N and cost function C, a vertex u of length n a is a solution if its neighbor N (a, u) does not have strictly smaller cost.

theorem Cslib.Complexity.exists_localOpt {α : Type} {n : α → ℕ} {N : α × List Bool → List Bool} {C : α × List Bool → ℕ} {a : α} (hN : ∀ (u : List Bool), u.length = n a → (N (a, u)).length = n a) :
∃ (u : List Bool), localOptRel n N C a u

Finite local-optimum principle: if N (a, ·) preserves length n a, some vertex of length n a is a local minimum of C (a, ·).

theorem Cslib.Complexity.isTotalSearch_localOptRel {α : Type} {n : α → ℕ} {N : α × List Bool → List Bool} {C : α × List Bool → ℕ} (hN : PreservesWidth n N) :

localOptRel is total whenever the neighbor map preserves the vertex bit-length.

Pigeonhole principle (PPP) #

def Cslib.Complexity.pigeonRel {α : Type} (n : α → ℕ) (F : α × List Bool → List Bool) (a : α) (w : List Bool) :

The search relation of a pigeonhole family (PPP): a candidate w of length 2 * n a encodes the pair of n a-bit strings u = w.take (n a) and v = w.drop (n a), and is a solution if F (a, u) = 0 ^ (n a) or u ≠ v with F (a, u) = F (a, v).

theorem Cslib.Complexity.exists_pigeon {α : Type} {n : α → ℕ} {F : α × List Bool → List Bool} {a : α} (hF : ∀ (u : List Bool), u.length = n a → (F (a, u)).length = n a) :
∃ (w : List Bool), pigeonRel n F a w

Finite pigeonhole principle: any length-preserving map F (a, ·) on {0, 1} ^ (n a) either hits 0 ^ (n a) or collides on two distinct strings of length n a.

theorem Cslib.Complexity.isTotalSearch_pigeonRel {α : Type} {n : α → ℕ} {F : α × List Bool → List Bool} (hF : PreservesWidth n F) :

pigeonRel is total whenever F preserves the vertex bit-length.

Directed end-of-line principle (PPAD) #

def Cslib.Complexity.hasOut {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (a : α) (u : List Bool) :

Vertex u has an active outgoing edge to S (a, u) in the directed graph presented by predecessor P and successor S: P points back from S (a, u) to u, and S (a, u) is neither a self-loop nor the canonical source 0 ^ (n a).

def Cslib.Complexity.hasIn {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (a : α) (u : List Bool) :

Vertex u has an active incoming edge from P (a, u) in the directed graph presented by P and S: S points forward from P (a, u) to u, P (a, u) ≠ u, and u is not the canonical source 0 ^ (n a).

theorem Cslib.Complexity.hasIn_of_hasOut {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} {u : List Bool} (h : hasOut n P S a u = true) :
hasIn n P S a (S (a, u)) = true

If u has an active outgoing edge to v = S (a, u), then v has an active incoming edge from u = P (a, v).

theorem Cslib.Complexity.hasOut_of_hasIn {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} {u : List Bool} (h : hasIn n P S a u = true) :
hasOut n P S a (P (a, u)) = true

If u has an active incoming edge from v = P (a, u), then v has an active outgoing edge to u = S (a, v).

@[simp]
theorem Cslib.Complexity.hasIn_zeroVertex {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (a : α) :
hasIn n P S a (zeroVertex (n a)) = false

The canonical source 0 ^ (n a) never has an active incoming edge.

def Cslib.Complexity.endOfLineRel {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (a : α) (u : List Bool) :

The search relation of a directed end-of-line family (PPAD): a vertex u of length n a is a solution if its incoming/outgoing parity is unbalanced relative to 0 ^ (n a): either u = 0 ^ (n a) and u has no active outgoing edge (!hasOut), or u ≠ 0 ^ (n a) and u is a sink (hasIn ∧ !hasOut) or proper source (!hasIn ∧ hasOut).

theorem Cslib.Complexity.endOfLineRel_zeroVertex_of_hasOut_eq_false {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} (h : hasOut n P S a (zeroVertex (n a)) = false) :
endOfLineRel n P S a (zeroVertex (n a))

The canonical source 0 ^ (n a) solves endOfLineRel whenever it lacks an active outgoing edge.

theorem Cslib.Complexity.endOfLineRel_of_hasIn_of_hasOut_eq_false {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} {u : List Bool} (hlen : u.length = n a) (hin : hasIn n P S a u = true) (hout : hasOut n P S a u = false) :
endOfLineRel n P S a u

Any vertex u of length n a with an active incoming edge and no active outgoing edge solves endOfLineRel.

def Cslib.Complexity.ppadToPppMap {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (p : α × List Bool) :

The pigeonhole map used to reduce endOfLineRel to pigeonRel: follow active outgoing edges, and fix every vertex that lacks an active outgoing edge.

theorem Cslib.Complexity.length_ppadToPppMap {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} {u : List Bool} (hS : ∀ (u : List Bool), u.length = n a → (S (a, u)).length = n a) (hu : u.length = n a) :
(ppadToPppMap n P S (a, u)).length = n a
theorem Cslib.Complexity.endOfLineRel_of_pigeonRel {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} {w : List Bool} (h : pigeonRel n (ppadToPppMap n P S) a w) :
endOfLineRel n P S a (if (!hasOut n P S a (List.take (n a) w)) = true then List.take (n a) w else List.drop (n a) w)

Any solution of pigeonRel for ppadToPppMap n P S yields a solution of endOfLineRel n P S by selecting whichever of the two n a-bit halves lacks an active outgoing edge.

theorem Cslib.Complexity.exists_endOfLine {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} (hS : ∀ (u : List Bool), u.length = n a → (S (a, u)).length = n a) :
∃ (u : List Bool), endOfLineRel n P S a u

Directed end-of-line principle: if S (a, ·) preserves length n a, some vertex of length n a satisfies endOfLineRel.

theorem Cslib.Complexity.isTotalSearch_endOfLineRel {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} (hS : PreservesWidth n S) :

endOfLineRel is total whenever the successor map preserves the vertex bit-length.

Undirected parity / handshake principle (PPA) #

def Cslib.Complexity.undirectedEdge {α : Type} (N₁ N₂ : α × List Bool → List Bool) (a : α) (u v : List Bool) :

Undirected edge between u and v in the graph of maximum degree 2 presented by two neighbor functions N₁, N₂: u ≠ v, v is listed by u, and u is listed by v.

theorem Cslib.Complexity.undirectedEdge_comm {α : Type} (N₁ N₂ : α × List Bool → List Bool) (a : α) (u v : List Bool) :
undirectedEdge N₁ N₂ a u v = undirectedEdge N₁ N₂ a v u
@[simp]
theorem Cslib.Complexity.undirectedEdge_self {α : Type} (N₁ N₂ : α × List Bool → List Bool) (a : α) (u : List Bool) :
undirectedEdge N₁ N₂ a u u = false
theorem Cslib.Complexity.eq_or_eq_of_undirectedEdge {α : Type} {N₁ N₂ : α × List Bool → List Bool} {a : α} {u v : List Bool} (h : undirectedEdge N₁ N₂ a u v = true) :
v = N₁ (a, u) ∨ v = N₂ (a, u)
def Cslib.Complexity.hasOddDegree {α : Type} (N₁ N₂ : α × List Bool → List Bool) (a : α) (u : List Bool) :

Vertex u has odd degree (degree 1) in the undirected graph presented by N₁, N₂.

def Cslib.Complexity.leafRel {α : Type} (n : α → ℕ) (N₁ N₂ : α × List Bool → List Bool) (a : α) (u : List Bool) :

The search relation of an undirected parity family (PPA): a vertex u of length n a is a solution if either u = 0 ^ (n a) has even degree or u ≠ 0 ^ (n a) has odd degree.

theorem Cslib.Complexity.exists_leaf {α : Type} {n : α → ℕ} {N₁ N₂ : α × List Bool → List Bool} {a : α} (hN₁ : ∀ (u : List Bool), u.length = n a → (N₁ (a, u)).length = n a) (hN₂ : ∀ (u : List Bool), u.length = n a → (N₂ (a, u)).length = n a) :
∃ (u : List Bool), leafRel n N₁ N₂ a u

Finite parity / handshake principle: if N₁ (a, ·) and N₂ (a, ·) preserve length n a, some vertex of length n a satisfies leafRel.

theorem Cslib.Complexity.isTotalSearch_leafRel {α : Type} {n : α → ℕ} {N₁ N₂ : α × List Bool → List Bool} (hN₁ : PreservesWidth n N₁) (hN₂ : PreservesWidth n N₂) :
IsTotalSearch (leafRel n N₁ N₂)

leafRel is total whenever both neighbor maps preserve the vertex bit-length.

Reducing directed end-of-line (PPAD) to undirected parity (PPA) #

def Cslib.Complexity.ppadToPpaN₁ {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (p : α × List Bool) :

First neighbor map on {0, 1} ^ (n a + 1) for reducing endOfLineRel to leafRel: false :: u is the outgoing port of u, matched with true :: S (a, u) when hasOut n P S a u holds; true :: u is the incoming port of u, matched with false :: P (a, u) when hasIn n P S a u holds.

def Cslib.Complexity.isActiveNonZero {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (a : α) (u : List Bool) :

Whether a vertex u is a non-source vertex (u ≠ 0 ^ (n a)) participating in at least one active directed edge (hasOut or hasIn).

def Cslib.Complexity.ppadToPpaN₂ {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (p : α × List Bool) :

Second neighbor map on {0, 1} ^ (n a + 1) for reducing endOfLineRel to leafRel: internally pairs false :: u and true :: u for every vertex u ≠ 0 ^ (n a) that participates in at least one active directed edge (hasOut or hasIn), leaving the ports of 0 ^ (n a) and isolated vertices unpaired.

@[simp]
theorem Cslib.Complexity.ppadToPpaN₁_false_cons {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (a : α) (u : List Bool) :
ppadToPpaN₁ n P S (a, false :: u) = if hasOut n P S a u = true then true :: S (a, u) else false :: u
@[simp]
theorem Cslib.Complexity.ppadToPpaN₁_true_cons {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (a : α) (u : List Bool) :
ppadToPpaN₁ n P S (a, true :: u) = if hasIn n P S a u = true then false :: P (a, u) else true :: u
@[simp]
theorem Cslib.Complexity.ppadToPpaN₂_cons {α : Type} (n : α → ℕ) (P S : α × List Bool → List Bool) (a : α) (b : Bool) (u : List Bool) :
ppadToPpaN₂ n P S (a, b :: u) = if isActiveNonZero n P S a u = true then (!b) :: u else b :: u
theorem Cslib.Complexity.length_ppadToPpaN₁ {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} {w : List Bool} (hP : ∀ (u : List Bool), u.length = n a → (P (a, u)).length = n a) (hS : ∀ (u : List Bool), u.length = n a → (S (a, u)).length = n a) (hw : w.length = n a + 1) :
(ppadToPpaN₁ n P S (a, w)).length = n a + 1
theorem Cslib.Complexity.length_ppadToPpaN₂ {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} {w : List Bool} (hw : w.length = n a + 1) :
(ppadToPpaN₂ n P S (a, w)).length = n a + 1
theorem Cslib.Complexity.endOfLineRel_tail_of_leafRel {α : Type} {n : α → ℕ} {P S : α × List Bool → List Bool} {a : α} {w : List Bool} (h : leafRel (fun (a : α) => n a + 1) (ppadToPpaN₁ n P S) (ppadToPpaN₂ n P S) a w) :
endOfLineRel n P S a w.tail

Any solution w of leafRel for (ppadToPpaN₁ n P S, ppadToPpaN₂ n P S) has w.tail as a solution of endOfLineRel n P S.