The criterion for 2-satisfiability, abstractly #
A 2-CNF over a type V of propositional variables is a relation Cl on
literals (DescriptiveComplexity.TwoCnf.Lit, a variable and a sign): Cl p q says
that p ∨ q is one of its clauses. Unit clauses are the case q = p; the empty
clause has no place here and is handled by whoever builds the formula, since it
is unsatisfiable outright.
This file proves the classical criterion (Aspvall, Plass & Tarjan
1979) in this abstract setting: over a finite variable type,
the 2-CNF is satisfiable iff no literal reaches its own negation and back in
the implication graph, where the clause p ∨ q contributes the implications
¬p → q and ¬q → p (DescriptiveComplexity.TwoCnf.Step).
Nothing here mentions first-order logic. That is the point: the criterion is
needed twice over, once for CNF structures over FirstOrder.Language.sat
(DescriptiveComplexity.Problems.TwoSat.Ptime, where it puts 2SAT in PTIME) and once
for the atoms of an arbitrary Krom program (where it turns a Krom definition
into a transitive closure), and the two differ only in what plays the part of a
variable.
The proof of the substantial direction builds a satisfying assignment greedily:
a set of literals that is closed under reachability and consistent (never
containing a literal together with its negation) can always be extended to
decide one more variable, by picking the sign whose literal does not reach its
own negation and adding everything reachable from it. Consistency survives by
contraposition (DescriptiveComplexity.TwoCnf.reach_neg), which turns a clash inside
the new part into the forbidden cycle and a clash with the old part into a
variable that was already decided. Deciding every variable in turn gives the
assignment, and closedness makes every clause true.
Literals #
A literal: a variable together with a sign (true for the variable
itself, false for its negation).
Equations
Instances For
Dependency graph
The negation of a literal.
Instances For
Dependency graph
Dependency graph
Dependency graph
The literal is true under the assignment ν.
Instances For
Dependency graph
Dependency graph
The implication graph #
The assignment satisfies the 2-CNF: every clause has a true literal.
Equations
- DescriptiveComplexity.TwoCnf.Satisfies Cl ν = ∀ (p q : DescriptiveComplexity.TwoCnf.Lit V), Cl p q → DescriptiveComplexity.TwoCnf.LitTrue ν p ∨ DescriptiveComplexity.TwoCnf.LitTrue ν q
Instances For
Dependency graph
One step of the implication graph: the clause ¬p ∨ q, in either order,
is the implication p → q.
Equations
- DescriptiveComplexity.TwoCnf.Step Cl p q = (Cl (DescriptiveComplexity.TwoCnf.neg p) q ∨ Cl q (DescriptiveComplexity.TwoCnf.neg p))
Instances For
Dependency graph
Reachability in the implication graph.
Equations
Instances For
Dependency graph
Contraposition, one step: the implication p → q is also ¬q → ¬p.
Dependency graph
Contraposition: p ⇝ q gives ¬q ⇝ ¬p.
Dependency graph
Soundness #
One implication step preserves truth.
Dependency graph
Implications are sound: reachability preserves truth.
Dependency graph
A satisfiable 2-CNF has no bad cycle: a literal reaching its own negation and back would be both true and false.
Dependency graph
Closed consistent sets of literals #
A set of literals closed under reachability.
Equations
- DescriptiveComplexity.TwoCnf.Closed Cl T = ∀ p ∈ T, ∀ (q : DescriptiveComplexity.TwoCnf.Lit V), DescriptiveComplexity.TwoCnf.Reach Cl p q → q ∈ T
Instances For
Dependency graph
A set of literals containing no literal together with its negation.
Equations
- DescriptiveComplexity.TwoCnf.Consistent T = ∀ p ∈ T, DescriptiveComplexity.TwoCnf.neg p ∉ T
Instances For
Dependency graph
The variable x is decided by T: one of its two literals is in T.
Instances For
Dependency graph
Dependency graph
Dependency graph
The extension step: a closed consistent set that does not decide x
can be extended to one that does, provided x has no bad cycle.
Dependency graph
Deciding a whole finite set of variables, one extension at a time.
Dependency graph
The criterion: a 2-CNF with no literal reaching its own negation and back is satisfiable.
Dependency graph
The criterion, as an equivalence: a 2-CNF over a finite variable type is satisfiable iff no literal reaches its own negation and back.
Dependency graph
A bad cycle as a single walk #
A bad cycle is a conjunction of two reachabilities, p ⇝ ¬p and ¬p ⇝ p,
which no single transitive closure can state. Carrying the literal the walk
started from, and a flag recording that its negation has been passed, turns the
pair into one walk: from (p, p, false) to (p, p, true). This is what lets a
DescriptiveComplexity.TCSpec express unsatisfiability of a 2-CNF, the flag and the
two literals being the finite mode and the two tuples of a node.
A node of the cycle-witnessing graph: the literal the walk started from, the literal it has reached, and whether it has already passed the negation of the start.
Equations
Instances For
Dependency graph
One step of the cycle-witnessing graph: the start is kept, the current
literal moves along an implication, and the flag may turn from false to
true exactly on arrival at the negation of the start.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
A walk of the cycle-witnessing graph projects to a walk of the implication graph.
Dependency graph
The start component is constant along a walk.
Dependency graph
A walk of the implication graph lifts to one of the cycle-witnessing graph at any fixed start and flag.
Dependency graph
What a walk that has raised its flag witnesses: the start's negation was passed on the way.