Documentation

CslibFrontier.Logics.Propositional.ClauseSet.Sparsification.CountingSearch

Counting sparsification -- branching rules #

A counting branching rule (CountingBranchingRule) is the counting-sparsification analogue of BranchingRule (CslibFrontier/Logics/Propositional/ClauseSet/Sparsification/Tree.lean): a deterministic step next : σ → Bool → σ on states σ representing clause sets via toClauseSet, which at every state that is not sparse takes the heart (false) or petal-plus-negated-heart-units (true) child (ClauseSet.Sparsification.countingChild) for some valid choice Choice θ. Its tree (CountingBranchingRule.tree) is the binary branching whose leaves are the sparse states; words, leaf words and the depth-first search are those of Cslib.BinaryBranching.

When all thresholds for j ≥ 1 are at least 2 (in particular for countingThreshold M with M ≥ 2), every non-sparse step strictly decreases the clause-set potential potential ψ = ∑ C ∈ ψ, 2 ^ C.card (potential_countingChild_lt from CountingTree.lean), so the tree terminates (CountingBranchingRule.tree_terminating): removing a flower of |F| ≥ 2 clauses of width c decreases the potential by |F| · 2 ^ c, while adding the |F| petals of width c - |H| ≤ c - 1 and |H| ≤ c - 1 unit clauses adds at most |F| · 2 ^ (c - 1) + 2 (c - 1) < |F| · 2 ^ c. Furthermore, because reduce eliminates every clause of the flower F on both branches, each step increases the total clause count by at most K (card_countingChild_le, CountingBranchingRule.card_walk_le).

At the list level, Cslib.Logic.PL.CNF.Sparsification.countingRule instantiates CountingBranchingRule on {ψ : CNF V // CountingNormalized k ψ} using countingNext θ k. The model count is additive at its inner states, so it is the sum of the model counts of the leaves (Cslib.Logic.PL.CNF.Sparsification.sum_leafWords_countingRule_modelCountOn).

Main definitions #

Main results #

References #

Clause-set properties of countingChild #

theorem Cslib.Logic.PL.ClauseSet.Sparsification.card_countingChild_le {V : Type u_1} [DecidableEq V] {θ : ℕ → ℕ} (hθ : ∀ (j : ℕ), 1 ≤ θ j) {ψ : ClauseSet V} {c k : ℕ} {H : Finset (Literal V)} (h : Heavy θ ψ c H) (hk : ∀ C ∈ ψ, C.card ≤ k) (b : Bool) :

Each counting child increases the number of clauses by at most k: the flower F is removed from ψ while at most |F| + |H| ≤ |F| + k clauses are added.

Counting branching rules #

structure Cslib.Logic.PL.ClauseSet.Sparsification.CountingBranchingRule (θ : ℕ → ℕ) (V : Type u_2) [DecidableEq V] (σ : Type u_3) :
Type (max u_2 u_3)

A counting branching rule for the thresholds θ: a deterministic step next on states σ, each representing the clause set toClauseSet s, which at every state that is not sparse takes the heart (false) or petal + negated-heart-units (true) child countingChild for one valid choice.

The branching tree of a counting rule: its leaves are the sparse states.

@[simp]
theorem Cslib.Logic.PL.ClauseSet.Sparsification.CountingBranchingRule.tree_next {V : Type u_1} [DecidableEq V] {θ : ℕ → ℕ} {σ : Type u_2} (R : CountingBranchingRule θ V σ) (a✝ : σ) (a✝¹ : Bool) :
R.tree.next a✝ a✝¹ = R.next a✝ a✝¹
theorem Cslib.Logic.PL.ClauseSet.Sparsification.CountingBranchingRule.tree_terminating {V : Type u_1} [DecidableEq V] {θ : ℕ → ℕ} {σ : Type u_2} {R : CountingBranchingRule θ V σ} (hθ : ∀ (j : ℕ), 1 ≤ j → 2 ≤ θ j) :

Termination. When ∀ j, 1 ≤ j → 2 ≤ θ j, each counting branching step strictly decreases the potential.

theorem Cslib.Logic.PL.ClauseSet.Sparsification.CountingBranchingRule.card_le_of_mem_walk {V : Type u_1} [DecidableEq V] {θ : ℕ → ℕ} {σ : Type u_2} {R : CountingBranchingRule θ V σ} (hθ : ∀ (j : ℕ), 1 ≤ θ j) {k : ℕ} {s : σ} (hk : ∀ C ∈ R.toClauseSet s, C.card ≤ k) {w : List Bool} (hw : R.tree.IsNodeWord s w) (C : Finset (Literal V)) :
C ∈ R.toClauseSet (R.tree.walk s w) → C.card ≤ k

Node words preserve clause width ≤ k.

theorem Cslib.Logic.PL.ClauseSet.Sparsification.CountingBranchingRule.card_walk_le {V : Type u_1} [DecidableEq V] {θ : ℕ → ℕ} {σ : Type u_2} {R : CountingBranchingRule θ V σ} (hθ : ∀ (j : ℕ), 1 ≤ θ j) {k : ℕ} {s : σ} (hk : ∀ C ∈ R.toClauseSet s, C.card ≤ k) {w : List Bool} (hw : R.tree.IsNodeWord s w) :

Along a node word w from a state of width ≤ k, the number of clauses increases by at most k * w.length.

For 2 ≤ M and 1 ≤ j, 2 ≤ countingThreshold M j.

def Cslib.Logic.PL.CNF.Sparsification.countingRule {V : Type u_1} [DecidableEq V] {θ : ℕ → ℕ} (hθ : ∀ (j : ℕ), 1 ≤ θ j) {k : ℕ} (hk : 1 ≤ k) :

The list-level counting branching rule, on formulas in nontautological normal form (CountingNormalized k): uses countingNext θ k.

theorem Cslib.Logic.PL.CNF.Sparsification.support_walk_countingRule {V : Type u_1} [DecidableEq V] {θ : ℕ → ℕ} (hθ : ∀ (j : ℕ), 1 ≤ θ j) {k : ℕ} (hk : 1 ≤ k) {s : { ψ : CNF V // CountingNormalized k ψ }} {declared : Finset V} (hs : ∀ C ∈ ↑s, ∀ l ∈ C, l.1 ∈ declared) (w : List Bool) (C : Clause V) :
C ∈ ↑((countingRule hθ hk).tree.walk s w) → ∀ l ∈ C, l.1 ∈ declared

Walking along countingRule preserves variable support containment for any word w.

theorem Cslib.Logic.PL.CNF.Sparsification.sum_leafWords_countingRule_modelCountOn {V : Type u_1} [DecidableEq V] {θ : ℕ → ℕ} (hθ1 : ∀ (j : ℕ), 1 ≤ θ j) (hθ2 : ∀ (j : ℕ), 1 ≤ j → 2 ≤ θ j) {k : ℕ} (hk : 1 ≤ k) (declared : Finset V) {f : { ψ : CNF V // CountingNormalized k ψ } → ℕ} (s : { ψ : CNF V // CountingNormalized k ψ }) (hf : ∀ (w : List Bool), (countingRule hθ1 hk).tree.IsLeafWord s w → f ((countingRule hθ1 hk).tree.walk s w) = (↑((countingRule hθ1 hk).tree.walk s w)).modelCountOn declared) {W : Finset (List Bool)} (hW : ∀ (w : List Bool), w ∈ W ↔ (countingRule hθ1 hk).tree.IsLeafWord s w) :
∑ w ∈ W, f ((countingRule hθ1 hk).tree.walk s w) = (↑s).modelCountOn declared

List-level leaf model-count partition. If f computes CNF.modelCountOn · declared on every leaf of s under countingRule, then the sum of f over the leaf words of s equals s.1.modelCountOn declared.