Documentation

CslibFrontier.Logics.Propositional.Resolution.TreeLike

Tree-like resolution #

A tree-like resolution derivation (Cslib.Logic.PL.CNF.Derivation) is a derivation by resolution in which every derived clause is used once: a tree whose leaves are clauses of the formula and whose inner nodes resolve the clauses of their two children. Its size is its number of nodes (Cslib.Logic.PL.CNF.Derivation.size). A tree-like derivation unfolds a resolution proof in which a line may be used many times, and conversely gives a proof with at most as many lines (Cslib.Logic.PL.CNF.Derivation.exists_isProof).

Tree-like resolution and DPLL search trees. A decision tree whose leaves are clauses finds a falsified clause of φ (Cslib.DecisionTree.FindsFalsifiedClause) if, on every assignment, the leaf it reaches is a clause of φ that the assignment falsifies. This models the search-tree certificates of Davis, Logemann and Loveland, allowing repeated queries. The correspondence concerns certificates; no solver implementation or runtime bound is given. A tree-like refutation is such a tree, with one leaf for each leaf of the refutation, querying the variable resolved at each node (Cslib.Logic.PL.CNF.Derivation.findsFalsifiedClause_toDecisionTree). Conversely, a decision tree finding falsified clauses gives a tree-like refutation with fewer nodes than twice its number of leaves, whose decision tree has at most its Ehrenfeucht–Haussler rank (Cslib.DecisionTree.FindsFalsifiedClause.exists_derivation_rank_le): along a path, the clauses reached below each node resolve on the variable queried there to a clause falsified by the answers above it.

Short tree-like refutations are narrow [Ben-Sasson and Wigderson, Theorem 3.3] [BSW01]: a formula with clauses of width at most k and a tree-like refutation of at most 2 ^ b nodes is refutable in width at most k + b (Cslib.Logic.PL.CNF.RefutableInWidth.of_derivation). The two subtrees of the root refute the two restrictions of the formula by the variable resolved there; the smaller has at most half the nodes, so by induction its restriction is refutable in width k + b - 1, and the other in width k + b, which Cslib.Logic.PL.CNF.RefutableInWidth.of_restrict combines.

Main definitions #

Main results #

References #

inductive Cslib.Logic.PL.CNF.Derivation {V : Type u_1} [DecidableEq V] (φ : CNF V) :
Clause V → Type u_1

A tree-like resolution derivation of c from φ: a clause of φ, or the resolvent of the conclusions of two tree-like derivations on a variable occurring positively in the first and negatively in the second.

def Cslib.Logic.PL.CNF.Derivation.size {V : Type u_1} [DecidableEq V] {φ : CNF V} {c : Clause V} :
φ.Derivation c → ℕ

The number of nodes of a tree-like derivation.

@[simp]
theorem Cslib.Logic.PL.CNF.Derivation.size_mem {V : Type u_1} [DecidableEq V] {φ : CNF V} {c : Clause V} (hc : c ∈ φ) :
(mem hc).size = 1

A leaf derivation of a clause of φ has size 1.

@[simp]
theorem Cslib.Logic.PL.CNF.Derivation.size_resolvent {V : Type u_1} [DecidableEq V] {φ : CNF V} {c₁ c₂ : Clause V} (v : V) (d₁ : φ.Derivation c₁) (d₂ : φ.Derivation c₂) (hv₁ : (v, true) ∈ c₁) (hv₂ : (v, false) ∈ c₂) :
(resolvent v d₁ d₂ hv₁ hv₂).size = d₁.size + d₂.size + 1

The size of a resolution step is the sum of the sizes of its two subderivations plus 1.

theorem Cslib.Logic.PL.CNF.Derivation.size_pos {V : Type u_1} [DecidableEq V] {φ : CNF V} {c : Clause V} (d : φ.Derivation c) :
0 < d.size

A tree-like derivation has a node.

theorem Cslib.Logic.PL.CNF.Derivation.derives {V : Type u_1} [DecidableEq V] {φ : CNF V} {c : Clause V} :
∀ (a : φ.Derivation c), φ.Derives c

The conclusion of a tree-like derivation is derivable.

theorem Cslib.Logic.PL.CNF.Derivation.exists_isProof {V : Type u_1} [DecidableEq V] {φ : CNF V} {c : Clause V} (d : φ.Derivation c) :
∃ (ls : List (Clause V)), φ.IsProof ls ∧ c ∈ ls ∧ ls.length ≤ d.size

A tree-like derivation gives a proof with at most as many lines as it has nodes.

A tree-like refutation of s nodes gives a refutation of at most s lines.

theorem Cslib.Logic.PL.CNF.Derivation.fst_ne_of_restrict {V : Type u_1} [DecidableEq V] {φ : CNF V} {c : Clause V} {v : V} {b : Bool} (d : (φ.restrict v b).Derivation c) {l : Literal V} (hl : l ∈ c) :
l.1 ≠ v

A clause derived from φ with v fixed does not mention v.

theorem Cslib.Logic.PL.CNF.Derivation.restrict {V : Type u_1} [DecidableEq V] {φ : CNF V} {c : Clause V} (v : V) (b : Bool) (d : φ.Derivation c) (hvc : (v, b) ∉ c) :
∃ (c' : Clause V) (d' : (φ.restrict v b).Derivation c'), (∀ l ∈ c', l ∈ c) ∧ d'.size ≤ d.size

Restricting a tree-like derivation. A tree-like derivation from φ of a clause without the literal (v, b) becomes a tree-like derivation from φ with v fixed to b, with at most as many nodes, of a clause with a subset of its literals.

theorem Cslib.Logic.PL.CNF.Derivation.exists_of_relabel {V : Type u_1} [DecidableEq V] {φ : CNF V} {W : Type u_2} [DecidableEq W] {f : V → W} (hf : Function.Injective f) {c : Clause W} (d : (relabel f φ).Derivation c) :
∃ (c' : Clause V) (d' : φ.Derivation c'), Clause.relabel f c' = c ∧ d'.size = d.size

Relabelling back a tree-like derivation. Along an injective map f, a tree-like derivation from φ.relabel f is a relabelled tree-like derivation from φ with the same number of nodes: every variable it mentions is f of a variable of φ, and resolving on f u is resolving on u.

theorem Cslib.Logic.PL.CNF.Derivation.exists_size_eq_of_relabel {V : Type u_1} [DecidableEq V] {φ : CNF V} {W : Type u_2} [DecidableEq W] {f : V → W} (hf : Function.Injective f) (d : (relabel f φ).Derivation []) :
∃ (d' : φ.Derivation []), d'.size = d.size

A tree-like refutation of φ.relabel f, for injective f, gives a tree-like refutation of φ with the same number of nodes.

Decision trees #

The decision tree of a tree-like derivation: a leaf for each clause of the formula used, and a query of the resolved variable at each resolution step, answering false towards the premise with the variable positive.

The decision tree of a tree-like derivation has one leaf for each leaf of the derivation.

A tree-like derivation has at most as many leaves as nodes.

theorem Cslib.Logic.PL.CNF.Derivation.eval_toDecisionTree {V : Type u_1} [DecidableEq V] {φ : CNF V} {c : Clause V} (d : φ.Derivation c) {σ : V → Bool} :

On an assignment falsifying the conclusion of a tree-like derivation, its decision tree reaches a clause of the formula falsified by the assignment.

theorem Cslib.Logic.PL.CNF.Derives.nonempty_derivation {V : Type u_1} [DecidableEq V] {φ : CNF V} {c : Clause V} (h : φ.Derives c) :

A derivable clause has a tree-like derivation, unfolding each shared premise into its own subtree.

A clause is derivable from φ if and only if it has a tree-like derivation from φ.

@[instance_reducible]

Tree-like resolution derivations from φ as a Cslib.Logic.InferenceSystem indexed by the clauses of φ ({d // d ∈ φ}⇓c).

@[instance_reducible]

Tree-like resolution derivations from φ as a Cslib.Logic.InferenceSystem indexed by the clause set {d | d ∈ φ} ({d | d ∈ φ}⇓c).

@[instance_reducible]

Tree-like resolution derivations as a canonical Cslib.Logic.HasInferenceSystem on formula–clause pairs (⇓(φ, c)).

Derivability by resolution is Cslib.Logic.InferenceSystem.DerivableIn for the clauses of φ.

Derivability by resolution is Cslib.Logic.InferenceSystem.Derivable for the pair (φ, c).

A decision tree with clauses at its leaves finds a falsified clause of φ if, on every assignment, the clause at the leaf it reaches is a clause of φ that the assignment falsifies. These are the search trees of the DPLL procedure on φ.

A tree-like refutation is a DPLL tree: its decision tree finds a falsified clause.

theorem Cslib.Logic.PL.Literal.negate_mem_of_mem_cons {V : Type u_1} {π : List (Literal V)} {u : V} {s : Bool} {l : Literal V} (h : Std.Sat.Literal.negate l ∈ (u, s) :: π) (hne : l ≠ (u, !s)) :

If the negation of l is among (u, s) :: π and l is not (u, !s), it is among π.

A DPLL tree is a tree-like refutation, preserving rank: a decision tree finding a falsified clause of φ gives a tree-like refutation of φ with fewer nodes than twice its number of leaves, whose decision tree has rank at most that of the given tree.

A DPLL tree is a tree-like refutation: a decision tree finding a falsified clause of φ gives a tree-like refutation of φ with fewer nodes than twice its number of leaves.

A DPLL tree has as many leaves as a tree-like refutation: a decision tree finding a falsified clause of φ gives a tree-like refutation of φ with at most as many leaves.

Short tree-like refutations are narrow #

theorem Cslib.Logic.PL.CNF.RefutableInWidth.of_derivation {V : Type u_1} [DecidableEq V] {φ : CNF V} {k b : ℕ} (hk : ∀ c ∈ φ, c.width ≤ k) {c : Clause V} (d : φ.Derivation c) (hc : c = []) (hd : d.size ≤ 2 ^ b) :

Short tree-like refutations are narrow [Ben-Sasson and Wigderson, Theorem 3.3] [BSW01]. A formula whose clauses have width at most k, with a tree-like refutation of at most 2 ^ b nodes, is refutable in width at most k + b.