Documentation

CslibFrontier.Computability.PCP.Encoded.Deloop

Removing loops from binary constraint graphs #

A loop of a binary constraint graph is an edge occurrence whose two ends are the same vertex u, with a relation R on the label of u taken twice. Cslib.PCP.Encoded.Graph.deloop doubles the vertex numbers: vertex v becomes 2 v, every edge between distinct vertices keeps its relation, and a loop at u becomes an edge from 2 u to the fresh vertex 2 u + 1. Its relation checks R on the label of 2 u alone and ignores the label of 2 u + 1. The result is loopless, and every labelling τ of it violates exactly as many edges as the labelling v ↦ τ (2 v) of the original graph. So the two graphs have the same value (unsatVal_deloop).

Dinur's preprocessing deliberately adds loops, so the hard binary CSP instances of Cslib.Complexity.GapTwoCSP_npHard are not loopless; loop removal prepares them for the incidence construction of Label Cover, whose output then has no parallel edges. The construction is a library adaptation to the executable graph API.

Main definitions #

Main results #

def Cslib.PCP.Encoded.Graph.deloopEdge {α : Type} (d : Edge (α → α → Bool)) :
Edge (α → α → Bool)

The image of an edge under loop removal: a loop at u becomes an edge from 2 u to 2 u + 1 whose relation reads the label of 2 u twice; any other edge is renumbered by doubling.

def Cslib.PCP.Encoded.Graph.deloop {α : Type} (g : Graph (α → α → Bool)) :
Graph (α → α → Bool)

Loop removal: double the vertex numbers and redirect every loop to a fresh vertex.

@[simp]

Loop removal keeps the number of edge occurrences.

theorem Cslib.PCP.Encoded.Graph.WellFormed.deloop {α : Type} {g : Graph (α → α → Bool)} (hg : g.WellFormed) :

Loop removal keeps the declared vertices: endpoints below n go below 2 n.

The result of loop removal is loopless.

theorem Cslib.PCP.Encoded.Graph.countP_deloop {α : Type} (g : Graph (α → α → Bool)) (τ : ℕ → α) :
List.countP (fun (d : Edge (α → α → Bool)) => !d.constraint (τ d.src) (τ d.dst)) g.deloop.edges = List.countP (fun (d : Edge (α → α → Bool)) => !d.constraint (τ (2 * d.src)) (τ (2 * d.dst))) g.edges

A labelling of the result violates exactly as many edges as its restriction v ↦ τ (2 v) to the doubled original vertices violates in the original graph.

Loop removal keeps the value. A labelling of the original graph lifts to the result by reading the label of v at 2 v and 2 v + 1, and a labelling of the result restricts to the even vertices; both keep the number of violated edges.

Loop removal keeps satisfiability.

Loop removal is polynomial-time for every fixed finite alphabet: it rewrites each edge record, reading its unary endpoints and its complete relation table.