Documentation

CslibFrontier.Logics.Propositional.CNF.ThreeCNF

Splitting clauses into clauses of width three #

A clause l₁ ∨ l₂ ∨ ⋯ ∨ lₘ with m > 3 is equisatisfiable with the chain of width-three clauses

(l₁ ∨ l₂ ∨ y₀) ∧ (¬y₀ ∨ l₃ ∨ y₁) ∧ ⋯ ∧ (¬yₘ₋₄ ∨ lₘ₋₁ ∨ lₘ)

in fresh variables y₀, …, yₘ₋₄: in a satisfying assignment yⱼ can be taken to say that one of the literals after lⱼ₊₂ is true Arora and Barak, Section 2.3.1. Splitting every clause of a formula, with the fresh variables of a clause indexed by its position, gives a formula with clauses of width at most three that is satisfiable exactly when the original one is.

Main definitions #

Main results #

References #

One clause #

def Cslib.Logic.PL.Clause.splitAux {W : Type u_2} (fresh : ℕ → W) :
ℕ → Literal W → Clause W → CNF W

The chain of width-three clauses for the clause carry :: rest, with auxiliary variables fresh j, fresh (j + 1), ….

Instances For
    def Cslib.Logic.PL.Clause.split3 {W : Type u_2} (fresh : ℕ → W) (j : ℕ) :
    Clause W → CNF W

    The chain of width-three clauses for a clause, with auxiliary variables fresh j, fresh (j + 1), …. A clause with at most three literals is kept as it is.

    Instances For

      Formulas #

      def Cslib.Logic.PL.CNF.to3CNF {V : Type u_1} (φ : CNF V) :

      Split every clause of a formula, renaming its variables into the left summand and naming the auxiliary variables of clause i by (i, j).

      Instances For
        theorem Cslib.Logic.PL.Clause.length_le_three_of_mem_split3 {W : Type u_2} (fresh : ℕ → W) (j : ℕ) (c d : Clause W) :
        d ∈ split3 fresh j c → List.length d ≤ 3

        Every clause in Clause.split3 fresh j c has at most three literals.

        theorem Cslib.Logic.PL.CNF.length_le_three_of_mem_to3CNF {V : Type u_1} {φ : CNF V} {c : Clause (V ⊕ ℕ × ℕ)} (hc : c ∈ φ.to3CNF) :

        Every clause of CNF.to3CNF φ has at most three literals.

        theorem Cslib.Logic.PL.Clause.eval_of_eval_split3 {W : Type u_2} (fresh : ℕ → W) (σ : W → Bool) (j : ℕ) (c : Clause W) (h : CNF.eval σ (split3 fresh j c) = true) :
        eval σ c = true

        Any assignment satisfying Clause.split3 fresh j c satisfies c.

        theorem Cslib.Logic.PL.CNF.eval_comp_inl_of_eval_to3CNF {V : Type u_1} {φ : CNF V} {τ : V ⊕ ℕ × ℕ → Bool} (hτ : eval τ φ.to3CNF = true) :

        Splitting, backward witnesses. An assignment satisfying the split formula satisfies the original formula on the original variables.

        def Cslib.Logic.PL.CNF.to3CNFAssignment {V : Type u_1} (φ : CNF V) (σ : V → Bool) :
        V ⊕ ℕ × ℕ → Bool

        The explicit extension of an assignment σ of φ to the variables of φ.to3CNF: the auxiliary variable (i, k) of clause i says that one of the literals of clause i after position k + 1 holds under σ Arora and Barak, Section 2.3.1.

        Instances For
          @[simp]
          theorem Cslib.Logic.PL.CNF.to3CNFAssignment_inl {V : Type u_1} (φ : CNF V) (σ : V → Bool) (v : V) :
          φ.to3CNFAssignment σ (Sum.inl v) = σ v
          @[simp]
          theorem Cslib.Logic.PL.CNF.to3CNFAssignment_inr {V : Type u_1} (φ : CNF V) (σ : V → Bool) (i k : ℕ) :
          theorem Cslib.Logic.PL.CNF.eval_to3CNF_to3CNFAssignment {V : Type u_1} {φ : CNF V} {σ : V → Bool} (hσ : eval σ φ = true) :

          Splitting, forward witnesses. The explicit extension of an assignment satisfying φ satisfies the split formula.

          Splitting the clauses of a formula preserves satisfiability.

          theorem Cslib.Logic.PL.Clause.length_split3 {W : Type u_2} (fresh : ℕ → W) (j : ℕ) (c : Clause W) :
          List.length (split3 fresh j c) = max 1 (List.length c - 2)

          Splitting a clause of width w gives w - 2 clauses, and at least one.

          theorem Cslib.Logic.PL.CNF.length_to3CNF {V : Type u_1} (φ : CNF V) :
          List.length φ.to3CNF = (List.map (fun (c : Clause V) => max 1 (List.length c - 2)) φ).sum

          The number of clauses after splitting.

          Splitting keeps falsified clauses falsified: an assignment of the split formula falsifies at least as many clauses as its restriction to the original variables falsifies in the original formula.