HORN-SAT is SO-Horn definable #
HORNSAT ∈ PTIME (DescriptiveComplexity.hornSat_mem_PTIME): Horn satisfiability is
itself definable in the Horn fragment, which with the discharge of
DescriptiveComplexity.Problems.HornSat.Hardness makes HORN-SAT PTIME-complete
(DescriptiveComplexity.HORNSAT_PTIME_complete).
The obstacle, and what the order is for: a clause of the input has an
unbounded number of negative literals, so the rule “if all negative literals
of c are forced then its positive literal is forced” is not a Horn clause –
its body would have unboundedly many atoms. The standard fix walks the
literals of a clause along the order. The program guesses
T x, the set of variables forced true by unit propagation, andB c z, meaning “every negative literal ofcup tozis inT”,
and derives B by four rules following the order (base case at the minimum,
step case along the successor relation, each split on whether the current
element is a negative literal of c), so that B c max is the unbounded
conjunction, assembled one element at a time. One further rule derives T
from a clause whose body is complete, and two goal clauses reject the two ways
of failing: a clause with no positive literal whose body is complete, and a
clause with two distinct positive literals (the Horn condition itself, which
DescriptiveComplexity.HORNSAT folds into its yes-instances).
All the order-dependent predicates – being minimal or maximal, being the
immediate successor – are first-order over Language.sat.sum Language.order
(the shared guards of DescriptiveComplexity.OrderWalk),
and appear only in guards, where arbitrary first-order formulas are allowed.
The second-order atoms are T and B only, one or two per clause body: the
program is Horn.
The Horn program #
The block of the SO-Horn definition of HORN-SAT: a unary relation variable
T (the variables forced true) and a binary one B (B c z: every negative
literal of the clause c up to z is forced).
Equations
- DescriptiveComplexity.hsBlock = { ι := Bool, ιFinite := Bool.instFinite, arity := fun (i : Bool) => bif i then 1 else 2 }
Instances For
Dependency graph
The atom T xᵢ.
Instances For
Dependency graph
The atom B (xᵢ, xⱼ).
Instances For
Dependency graph
The “is a clause” symbol over the ordered expansion.
Instances For
Dependency graph
The positive-occurrence symbol over the ordered expansion.
Instances For
Dependency graph
The negative-occurrence symbol over the ordered expansion.
Instances For
Dependency graph
The guard isClause xᵢ.
Equations
Instances For
Dependency graph
The guard posIn (xᵢ, xⱼ).
Equations
Instances For
Dependency graph
The guard negIn (xᵢ, xⱼ).
Equations
Instances For
Dependency graph
The guard “the clause xᵢ has no positive literal”.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The guard xᵢ ≠ xⱼ.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Base rule: at the minimum, a non-literal position starts a complete body.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Base rule: at the minimum, a negative literal must be forced.
Equations
- DescriptiveComplexity.hsC2 = { guard := DescriptiveComplexity.minF 1 ⊓ DescriptiveComplexity.negG 0 1, body := [DescriptiveComplexity.tAt 1], head := some (DescriptiveComplexity.bAt 0 1) }
Instances For
Dependency graph
Step rule at a non-literal position.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Step rule at a negative literal, which must be forced.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Propagation: a clause whose body is complete forces its positive literal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Goal clause: a clause with a complete body and no positive literal is falsified.
Equations
- DescriptiveComplexity.hsG1 = { guard := DescriptiveComplexity.isClG 0 ⊓ DescriptiveComplexity.maxF 3 ⊓ DescriptiveComplexity.noPosG 0, body := [DescriptiveComplexity.bAt 0 3], head := none }
Instances For
Dependency graph
Goal clause: two distinct positive literals in a clause violate the Horn
condition, which DescriptiveComplexity.HORNSAT folds into its yes-instances.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The Horn program defining HORN-SAT.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
Correctness #
The intended interpretation of the variable B: every negative literal of
the clause c up to z is forced.
Equations
Instances For
Dependency graph
The canonical assignment: the propagation closure and its partial bodies.
Equations
- DescriptiveComplexity.hsAssign A true = fun (w : Fin 1 → A) => DescriptiveComplexity.Forced (w 0)
- DescriptiveComplexity.hsAssign A false = fun (w : Fin 2 → A) => DescriptiveComplexity.BodyUpTo (w 0) (w 1)
Instances For
Dependency graph
A complete body at a maximum means that all negative literals are forced.
Dependency graph
HORN-SAT is SO-Horn definable. The guessed relations are the propagation closure and its partial bodies; the order assembles the unbounded body of a clause one element at a time.