Documentation

CslibFrontier.Computability.Complexity.FineGrained.PPSZ.AssignSL

The random process AssignSL #

Hertli's analysis of PPSZ on general satisfiable formulas weights the satisfying assignments of a formula by the output distribution of a random process, AssignSL Hertli, Definition 12 (p. 6): starting from a partial assignment τ, repeatedly pick a uniformly random satisfying literal x = b, one whose addition still leaves a satisfying extension, and add it, until every variable is assigned. This file defines the satisfying literals and the output distribution, and proves the properties used by the cost-function induction of Hertli, §3. Nothing here depends on PPSZ itself.

The process starts from the partial assignment τ. Its output probability assignProb φ τ α of a total assignment α is defined by recursion on the number of unassigned variables (assignProb_of_free_eq_empty, assignProb_eq_sum). It is a probability distribution on the satisfying extensions of τ (assignProb_nonneg, sum_assignProb, assignProb_pos_iff). The recursion can be rewritten as a sum over the unassigned variables Hertli, Observation 13 (p. 7) (card_satLits_mul_assignProb), and adding a literal of α never lowers the probability of α, the first statement of Hertli, Lemma 16 (p. 7) (assignProb_le_assignProb_update).

The unassigned variables of τ are its free coordinates Cslib.BitString.PartialAssignment.free, and the extension condition is Cslib.BitString.PartialAssignment.Agrees.

Main definitions #

Main results #

Implementation notes #

Hertli restricts the formula by each chosen literal, so that the process runs on a shrinking set of variables, and lets p(F, α) ignore the values of α outside the variables of F. Here the formula stays fixed and the process extends a partial assignment τ : Fin n → Option Bool, as PPSZ does (Cslib.Complexity.PPZ.runWith). Accordingly assignProb φ τ α is the probability that the process outputs exactly the total assignment α, which is 0 unless α extends τ; the literals of α in Hertli are the updates of τ by α on its unassigned variables.

References #

Satisfying extensions and satisfying literals #

def Cslib.Complexity.PPSZ.IsSatExtension {n : ℕ} (φ : Logic.PL.CNF (Fin n)) (τ : Fin n → Option Bool) (σ : Fin n → Bool) :

σ is a satisfying extension of the partial assignment τ: it agrees with τ wherever τ is defined (Cslib.BitString.PartialAssignment.Agrees) and satisfies φ.

Instances For
    def Cslib.Complexity.PPSZ.SatLit {n : ℕ} (φ : Logic.PL.CNF (Fin n)) (τ : Fin n → Option Bool) (y : Fin n) (b : Bool) :

    The literal y = b is a satisfying literal under τ Hertli, Definition 8 (p. 5): y is unassigned and some satisfying extension of τ sets y to b. Equivalently, τ updated by y = b has a satisfying extension (satLit_iff_update).

    Instances For
      @[instance_reducible]
      instance Cslib.Complexity.PPSZ.instDecidableSatLit {n : ℕ} (φ : Logic.PL.CNF (Fin n)) (τ : Fin n → Option Bool) (y : Fin n) (b : Bool) :
      Decidable (SatLit φ τ y b)

      The satisfying literals under τ Hertli, Definition 8 (p. 5), as pairs of a variable and a value.

      @[simp]
      theorem Cslib.Complexity.PPSZ.mem_satLits {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} {l : Fin n × Bool} :
      l ∈ satLits φ τ ↔ SatLit φ τ l.1 l.2

      Assigning an unassigned variable lowers the number of unassigned variables by one.

      theorem Cslib.Complexity.PPSZ.isSatExtension_update_iff {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} {y : Fin n} (hy : τ y = none) {b : Bool} {σ : Fin n → Bool} :
      IsSatExtension φ (Function.update τ y (some b)) σ ↔ IsSatExtension φ τ σ ∧ σ y = b

      Satisfying extensions of τ updated by an unassigned y = b are the satisfying extensions of τ that set y to b.

      theorem Cslib.Complexity.PPSZ.satLit_iff_update {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} {y : Fin n} {b : Bool} :
      SatLit φ τ y b ↔ τ y = none ∧ ∃ (σ : Fin n → Bool), IsSatExtension φ (Function.update τ y (some b)) σ

      y = b is a satisfying literal exactly when y is unassigned and τ updated by y = b has a satisfying extension, the form of Hertli, Definition 8 (p. 5).

      theorem Cslib.Complexity.PPSZ.SatLit.update_isSatExtension {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} {y : Fin n} {b : Bool} (h : SatLit φ τ y b) :
      ∃ (σ : Fin n → Bool), IsSatExtension φ (Function.update τ y (some b)) σ

      After setting a satisfying literal, a satisfying extension remains.

      There are at most two satisfying literals per unassigned variable.

      At least one satisfying literal per unassigned variable, after Hertli, p. 5: if τ has a satisfying extension σ, every unassigned y = σ y is a satisfying literal.

      theorem Cslib.Complexity.PPSZ.card_satLits_pos {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} (h : ∃ (σ : Fin n → Bool), IsSatExtension φ τ σ) (hne : (BitString.PartialAssignment.free τ).Nonempty) :
      0 < (satLits φ τ).card

      With a satisfying extension and an unassigned variable, there is a satisfying literal.

      theorem Cslib.Complexity.PPSZ.satLits_update_subset {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} {y : Fin n} (hy : τ y = none) (b : Bool) :
      satLits φ (Function.update τ y (some b)) ⊆ (satLits φ τ).erase (y, b)

      Assigning an unassigned variable only removes satisfying literals, among them the literals on that variable.

      theorem Cslib.Complexity.PPSZ.card_satLits_update_lt {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} {y : Fin n} {b : Bool} (h : SatLit φ τ y b) :
      (satLits φ (Function.update τ y (some b))).card < (satLits φ τ).card

      Setting a satisfying literal removes at least that literal from the satisfying literals.

      theorem Cslib.Complexity.PPSZ.free_induction {n : ℕ} {P : (Fin n → Option Bool) → Prop} (base : ∀ (τ : BitString.PartialAssignment (Fin n)), τ.free = ∅ → P τ) (step : ∀ (τ : BitString.PartialAssignment (Fin n)), τ.free.Nonempty → (∀ (y : Fin n) (b : Bool), τ y = none → P (Function.update τ y (some b))) → P τ) (τ : Fin n → Option Bool) :
      P τ

      Induction on the unassigned variables: a property holds for every partial assignment if it holds when no variable is unassigned, and holds for τ whenever it holds for every update of τ on an unassigned variable.

      The output distribution of AssignSL #

      noncomputable def Cslib.Complexity.PPSZ.assignProbAux {n : ℕ} (φ : Logic.PL.CNF (Fin n)) :
      ℕ → (Fin n → Option Bool) → (Fin n → Bool) → ℝ

      assignProb with an explicit bound k on the recursion depth; assignProb takes k to be the number of unassigned variables.

      noncomputable def Cslib.Complexity.PPSZ.assignProb {n : ℕ} (φ : Logic.PL.CNF (Fin n)) (τ : Fin n → Option Bool) (α : Fin n → Bool) :

      The output distribution of AssignSL Hertli, Definition 12 (p. 6): the probability that the process started at τ, which repeatedly sets a uniformly random satisfying literal until no variable is unassigned, outputs the total assignment α. When no variable is unassigned, it is 1 if α is a satisfying extension of τ and 0 otherwise; when some variable is unassigned and τ has no satisfying extension, there are no satisfying literals and it is 0.

      When no variable is unassigned, AssignSL outputs α exactly when α is a satisfying extension.

      theorem Cslib.Complexity.PPSZ.assignProb_eq_sum {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} (h : (BitString.PartialAssignment.free τ).Nonempty) (α : Fin n → Bool) :
      assignProb φ τ α = (↑(satLits φ τ).card)⁻¹ * ∑ l ∈ satLits φ τ, assignProb φ (Function.update τ l.1 (some l.2)) α

      One step of AssignSL Hertli, Definition 12 (p. 6): while some variable is unassigned, the process sets a uniformly random satisfying literal.

      theorem Cslib.Complexity.PPSZ.assignProb_nonneg {n : ℕ} (φ : Logic.PL.CNF (Fin n)) (τ : Fin n → Option Bool) (α : Fin n → Bool) :
      0 ≤ assignProb φ τ α

      Output probabilities are nonnegative.

      theorem Cslib.Complexity.PPSZ.isSatExtension_of_assignProb_ne_zero {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} {α : Fin n → Bool} (h : assignProb φ τ α ≠ 0) :

      AssignSL outputs satisfying extensions Hertli, Observation 13 (p. 7).

      theorem Cslib.Complexity.PPSZ.assignProb_eq_zero {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} {α : Fin n → Bool} (h : ¬IsSatExtension φ τ α) :
      assignProb φ τ α = 0

      AssignSL never outputs an assignment that is not a satisfying extension.

      theorem Cslib.Complexity.PPSZ.assignProb_pos_iff {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} {α : Fin n → Bool} :
      0 < assignProb φ τ α ↔ IsSatExtension φ τ α

      The support of AssignSL Hertli, Observation 13 (p. 7): the process started at τ outputs α with positive probability exactly when α is a satisfying extension of τ.

      theorem Cslib.Complexity.PPSZ.sum_assignProb {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {τ : Fin n → Option Bool} (h : ∃ (σ : Fin n → Bool), IsSatExtension φ τ σ) :
      ∑ α : Fin n → Bool, assignProb φ τ α = 1

      AssignSL is a probability distribution Hertli, Observation 13 (p. 7): if τ has a satisfying extension, the output probabilities sum to 1.

      theorem Cslib.Complexity.PPSZ.card_satLits_mul_assignProb {n : ℕ} (φ : Logic.PL.CNF (Fin n)) (τ : Fin n → Option Bool) (α : Fin n → Bool) :
      ↑(satLits φ τ).card * assignProb φ τ α = ∑ y ∈ BitString.PartialAssignment.free τ, assignProb φ (Function.update τ y (some (α y))) α

      Observation 13 of Hertli, p. 7, multiplied out: s · R(τ)(α) is the sum of R(τ[y ↦ α y])(α) over the unassigned variables y, where R is the output distribution of AssignSL and s the number of satisfying literals.

      Observation 13 of Hertli, p. 7: while some variable is unassigned, R(τ)(α) = (1/s) ∑_y R(τ[y ↦ α y])(α) over the unassigned variables y, where R is the output distribution of AssignSL and s the number of satisfying literals.

      theorem Cslib.Complexity.PPSZ.assignProb_le_assignProb_update {n : ℕ} (φ : Logic.PL.CNF (Fin n)) (τ : Fin n → Option Bool) (α : Fin n → Bool) (y : Fin n) :
      assignProb φ τ α ≤ assignProb φ (Function.update τ y (some (α y))) α

      Lemma 16 of Hertli, p. 7, its first statement: setting a variable to its value in α does not lower the probability that AssignSL outputs α. Its second statement, the equality of the probabilities and the cost inequality for a literal on a frozen variable, is not formalized; the cost-function induction (Cslib.Complexity.PPSZ.factorial_mul_le_succSum) uses only the first.

      The proof is an induction on the number of unassigned variables (original). By Observation 13 (card_satLits_mul_assignProb), s · R(τ)(α) is R(τ[y ↦ α y])(α) plus the sum of R(τ[z ↦ α z])(α) over the other unassigned z; by induction each of these is at most R(τ[y ↦ α y][z ↦ α z])(α), and these sum to s' · R(τ[y ↦ α y])(α) by Observation 13 again, where s' < s (card_satLits_update_lt). Hertli argues instead through the sampling process.