Documentation

CslibFrontier.Logics.Propositional.CNF.UnsatVal

Unsatisfiability value of CNF formulas and the 7 / 8 random-assignment bound #

The unsatisfiability value CNF.unsatVal φ of a formula in conjunctive normal form is the least proportion of its clauses, counted with multiplicity, that an assignment falsifies (CNF.countUnsat). The value vanishes on the empty formula and on satisfiable formulas (CNF.unsatVal_eq_zero_iff), and 1 - CNF.unsatVal φ is the value of φ as an instance of MAX-SAT.

When the three variables of every clause are distinct (CNF.IsExactThreeDistinct), a uniform random assignment falsifies each clause with probability 1 / 8 (Clause.IsExactThreeDistinct.expect_eval_eq_false), so some assignment falsifies at most 1 / 8 of the clauses (CNF.IsExactThreeDistinct.unsatVal_le_one_eighth). Håstad showed that this 7 / 8 threshold is optimal [Has01].

Main definitions #

Main results #

References #

Counting falsified clauses #

theorem Cslib.Logic.PL.CNF.countUnsat_eq_card {V : Type u_1} (σ : V → Bool) (φ : CNF V) :
countUnsat σ φ = {j : Fin (List.length φ) | Clause.eval σ φ[j] = false}.card

The number of falsified clauses, counted by their positions in the formula.

theorem Cslib.Logic.PL.CNF.countUnsat_relabel {V : Type u_1} {W : Type u_2} (φ : CNF V) (f : V → W) (τ : W → Bool) :
countUnsat τ (relabel f φ) = countUnsat (τ ∘ f) φ

Relabelling counts the falsified clauses of the composite assignment.

theorem Cslib.Logic.PL.CNF.countUnsat_congr {V : Type u_1} {σ τ : V → Bool} {φ : CNF V} (h : ∀ v ∈ φ.vars, σ v = τ v) :
countUnsat σ φ = countUnsat τ φ

The number of falsified clauses depends only on the values of the variables of the formula.

The value of a formula #

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

The unsatisfiability value of a formula: the least proportion of its clauses, counted with multiplicity, that an assignment falsifies. The formula without clauses has value zero.

theorem Cslib.Logic.PL.CNF.unsatVal_le {V : Type u_1} (φ : CNF V) (σ : V → Bool) :
φ.unsatVal ≤ ↑(countUnsat σ φ) / ↑(List.length φ)

The value is at most the proportion of the clauses that any assignment falsifies.

theorem Cslib.Logic.PL.CNF.unsatVal_nonneg {V : Type u_1} (φ : CNF V) :

The value is nonnegative.

theorem Cslib.Logic.PL.CNF.le_unsatVal_iff {V : Type u_1} (φ : CNF V) {c : ℝ} :
c ≤ φ.unsatVal ↔ ∀ (σ : V → Bool), c ≤ ↑(countUnsat σ φ) / ↑(List.length φ)

A lower bound on the value bounds the proportion falsified by every assignment.

theorem Cslib.Logic.PL.CNF.exists_countUnsat_div_eq_unsatVal {V : Type u_1} (φ : CNF V) :
∃ (σ : V → Bool), ↑(countUnsat σ φ) / ↑(List.length φ) = φ.unsatVal

The minimum is attained: the proportions take finitely many values.

The value vanishes exactly on satisfiable formulas.

theorem Cslib.Logic.PL.CNF.length_pos_of_unsatVal_pos {V : Type u_1} {φ : CNF V} (h : 0 < φ.unsatVal) :

A formula in which every assignment falsifies a positive proportion of the clauses has a clause.

theorem Cslib.Logic.PL.CNF.one_sub_inv_two_pow_mul_le_of_two_pow_mul_countUnsat_le {V : Type u_1} {k : ℕ} {φ : CNF V} {σ : V → Bool} (hσ : 2 ^ k * countUnsat σ φ ≤ List.length φ) :
(1 - 2⁻¹ ^ k) * (1 - φ.unsatVal) ≤ 1 - ↑(countUnsat σ φ) / ↑(List.length φ)

From a clause-count guarantee to an approximation ratio: an assignment that falsifies at most 2 ^ -k of the clauses satisfies at least 1 - 2 ^ -k times the largest proportion of the clauses that an assignment satisfies, 1 - φ.unsatVal.

Exact 3-clauses with distinct variables and the 7 / 8 random assignment bound #

A uniform random assignment falsifies any 3-clause on three distinct variables with probability 1 / 8.

theorem Cslib.Logic.PL.Clause.IsExactThreeDistinct.expect_eval_eq_true {ι : Type u_3} [Fintype ι] [DecidableEq ι] {c : Clause ι} (hc : c.IsExactThreeDistinct) :
(Finset.univ.expect fun (σ : ι → Bool) => if eval σ c = true then 1 else 0) = 7 / 8

A uniform random assignment satisfies any 3-clause on three distinct variables with probability 7 / 8.

Over the 3-bit cube Fin 3 → Bool, any 3-clause on three distinct variables is satisfied by exactly 7 of the 8 truth assignments.

theorem Cslib.Logic.PL.CNF.IsExactThreeDistinct.expect_countUnsat {ι : Type u_3} [Fintype ι] [DecidableEq ι] {φ : CNF ι} (hφ : φ.IsExactThreeDistinct) :
(Finset.univ.expect fun (σ : ι → Bool) => ↑(countUnsat σ φ)) = ↑(List.length φ) / 8

The expected number of falsified clauses in an exact 3-CNF formula with distinct variables per clause under a uniform random assignment is φ.length / 8.

A clause with three distinct variables has three distinct literals.

theorem Cslib.Logic.PL.Clause.IsExactThreeDistinct.relabel_of_injOn {V : Type u_1} {ι : Type u_3} {f : V → ι} {c : Clause V} (hf : ∀ x ∈ List.map Prod.fst c, ∀ y ∈ List.map Prod.fst c, f x = f y → x = y) (hc : c.IsExactThreeDistinct) :

Relabelling a clause along a map that is injective on its variables preserves Clause.IsExactThreeDistinct.

The 7 / 8 random-assignment bound: in every exact 3-CNF formula φ with three distinct variables per clause, some assignment falsifies at most 1 / 8 of the clauses (φ.unsatVal ≤ 1 / 8), hence satisfies at least 7 / 8 of the clauses.

theorem Cslib.Logic.PL.CNF.IsExactThreeDistinct.exists_countUnsat_le_div_eight {V : Type u_1} {φ : CNF V} (hφ : φ.IsExactThreeDistinct) :
∃ (σ : V → Bool), ↑(countUnsat σ φ) ≤ ↑(List.length φ) / 8

In every exact 3-CNF formula φ with three distinct variables per clause, there exists an assignment falsifying at most φ.length / 8 clauses (equivalently satisfying at least 7 / 8 * φ.length clauses).