Documentation

CslibFrontier.Logics.Propositional.CliqueColoring

Clique and colouring formulas #

Krajíček's formulas Clique_{n,k}(p, q) and Color_{n,r}(p, r) [Krajíček, Definition 7.1] [Kra97] share the variables p of the possible edges of a graph on n vertices, numbered as the inputs of the clique function (Cslib.BitString.Graph.edgeEquiv). The clique formula (Cslib.Logic.PL.CNF.clique) has a variable q (u, i) for each u : Fin k and vertex i, read as "the u-th member of the clique is i", and says that

The colouring formula (Cslib.Logic.PL.CNF.coloring) has a variable z (i, a) for each vertex i and colour a : Fin r, read as "i has colour a", and says that

Krajíček states (1c) for the unordered pair {i, j}; the clause is taken here for both orders of i and j, as the reading of Clique_{n,k} as an injection onto a clique requires: were (1c) taken only for i < j, the members assigned to vertices in decreasing order would satisfy every clause (1c), whatever the graph. Clause (2c) is symmetric in i and j and is taken once for each pair i < j.

An assignment of the edges extends to a model of the clique formula exactly when its graph has a k-clique (Cslib.Logic.PL.CNF.exists_eval_clique_iff), and to a model of the colouring formula exactly when its graph is r-colourable (Cslib.Logic.PL.CNF.exists_eval_coloring_iff). The edge variables occur only positively in the clique formula and only negatively in the colouring formula, which is what monotone feasible interpolation needs.

Main definitions #

Main results #

References #

The clique formula #

Clause (1a) of the clique formula: the u-th member of the clique is one of the vertices.

Clause (1b) of the clique formula: the members u and v are not both the vertex i.

noncomputable def Cslib.Logic.PL.CNF.cliqueEdgeClause {n k : ℕ} (u v : Fin k) {i j : Fin n} (h : i ≠ j) :

Clause (1c) of the clique formula: if the members u and v are the vertices i ≠ j, then i and j are adjacent.

The clique formula Clique_{n,k}(p, q) Krajíček, Definition 7.1, over the edges p of a graph on n vertices and the variables q (u, i), read as "the u-th member of the clique is the vertex i": (1a) every member u : Fin k is some vertex, (1b) two members u < v are not the same vertex, and (1c) if members u < v are vertices i ≠ j, then i and j are adjacent.

theorem Cslib.Logic.PL.CNF.mem_clique {n k : ℕ} {c : Clause (Fin (BitString.Graph.edgeCount n) ⊕ Fin k × Fin n)} :
c ∈ clique n k ↔ (∃ (u : Fin k), c = cliqueMemberClause n u) ∨ (∃ (u : Fin k) (v : Fin k), u < v ∧ ∃ (i : Fin n), c = cliqueDistinctClause u v i) ∨ ∃ (u : Fin k) (v : Fin k), u < v ∧ ∃ (i : Fin n) (j : Fin n) (h : i ≠ j), c = cliqueEdgeClause u v h

The clauses of the clique formula.

@[simp]

Clause (1a) holds when the member u is some vertex.

@[simp]

Clause (1b) holds when the members u and v are not both the vertex i.

@[simp]

Clause (1c) holds when the members u and v are not the vertices i and j, or i and j are adjacent.

theorem Cslib.Logic.PL.CNF.eval_clique_eq_true_iff {n k : ℕ} (σ : Fin (BitString.Graph.edgeCount n) ⊕ Fin k × Fin n → Bool) :
eval σ (clique n k) = true ↔ (∀ (u : Fin k), ∃ (i : Fin n), σ (Sum.inr (u, i)) = true) ∧ (∀ (u v : Fin k), u < v → ∀ (i : Fin n), σ (Sum.inr (u, i)) = true → σ (Sum.inr (v, i)) = false) ∧ ∀ (u v : Fin k), u < v → ∀ (i j : Fin n) (h : i ≠ j), σ (Sum.inr (u, i)) = true → σ (Sum.inr (v, j)) = true → σ (Sum.inl ((BitString.Graph.edgeEquiv n) (BitString.Graph.edge h))) = true

The semantics of the clique formula: every member is some vertex, two members u < v are not the same vertex, and members u < v that are vertices i ≠ j make i and j adjacent.

Extendibility for the clique formula. An assignment x of the edges extends to a model of the clique formula exactly when the graph of x has a k-clique.

The edge variables occur only positively in the clique formula.

The colouring formula #

Clause (2a) of the colouring formula: the vertex i has one of the colours.

Clause (2b) of the colouring formula: the vertex i does not have both colours a and b.

noncomputable def Cslib.Logic.PL.CNF.colorEdgeClause {n r : ℕ} (a : Fin r) {i j : Fin n} (h : i ≠ j) :

Clause (2c) of the colouring formula: if the vertices i ≠ j both have the colour a, then they are not adjacent.

The colouring formula Color_{n,r}(p, z) Krajíček, Definition 7.1, over the edges p of a graph on n vertices and the variables z (i, a), read as "the vertex i has the colour a": (2a) every vertex has some colour a : Fin r, (2b) no vertex has two colours a < b, and (2c) two vertices i < j of the same colour are not adjacent.

theorem Cslib.Logic.PL.CNF.mem_coloring {n r : ℕ} {c : Clause (Fin (BitString.Graph.edgeCount n) ⊕ Fin n × Fin r)} :
c ∈ coloring n r ↔ (∃ (i : Fin n), c = colorVertexClause r i) ∨ (∃ (i : Fin n) (a : Fin r) (b : Fin r), a < b ∧ c = colorUniqueClause i a b) ∨ ∃ (a : Fin r) (i : Fin n) (j : Fin n) (h : i < j), c = colorEdgeClause a ⋯

The clauses of the colouring formula.

@[simp]

Clause (2a) holds when the vertex i has some colour.

@[simp]
theorem Cslib.Logic.PL.CNF.eval_colorUniqueClause {n r : ℕ} (σ : Fin (BitString.Graph.edgeCount n) ⊕ Fin n × Fin r → Bool) (i : Fin n) (a b : Fin r) :
Clause.eval σ (colorUniqueClause i a b) = (!σ (Sum.inr (i, a)) || !σ (Sum.inr (i, b)))

Clause (2b) holds when the vertex i does not have both colours a and b.

@[simp]

Clause (2c) holds when the vertices i and j do not both have the colour a, or are not adjacent.

theorem Cslib.Logic.PL.CNF.eval_coloring_eq_true_iff {n r : ℕ} (σ : Fin (BitString.Graph.edgeCount n) ⊕ Fin n × Fin r → Bool) :
eval σ (coloring n r) = true ↔ (∀ (i : Fin n), ∃ (a : Fin r), σ (Sum.inr (i, a)) = true) ∧ (∀ (i : Fin n) (a b : Fin r), a < b → σ (Sum.inr (i, a)) = true → σ (Sum.inr (i, b)) = false) ∧ ∀ (a : Fin r) (i j : Fin n) (h : i < j), σ (Sum.inr (i, a)) = true → σ (Sum.inr (j, a)) = true → σ (Sum.inl ((BitString.Graph.edgeEquiv n) (BitString.Graph.edge ⋯))) = false

The semantics of the colouring formula: every vertex has some colour, no vertex has two colours a < b, and vertices i < j with the same colour are not adjacent.

Extendibility for the colouring formula. An assignment x of the edges extends to a model of the colouring formula exactly when the graph of x is r-colourable.

The edge variables occur only negatively in the colouring formula.