Horn-SAT forward-chaining algorithm Created 2026-09-28 Updated 2026-11-05
The Horn-SAT forward-chaining algorithm maintains the set of Boolean variables already forced true. Write each Horn clause as an implication , where the conclusion is either a Boolean variable or false. Start with . Whenever every antecedent belongs to , add the conclusion ; if the conclusion is false, report failure.
Every satisfying assignment must make all members of true: this holds initially and is preserved by each enabled implication. Thus an enabled false conclusion proves that no satisfying assignment exists. If no further Boolean variable can be added and no such failure occurs, interpreting exactly as true satisfies every Horn clause. It is the least satisfying assignment under inclusion of true Boolean variables.
For example, the clauses , and force . Adding makes the instance unsatisfiable. Each Boolean variable enters at most once. Indexing antecedent occurrences and maintaining a counter per clause permits one update per occurrence, avoiding repeated full scans.
Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 124 3 iii Solution 2026-09-28
Write each Horn clause as an implicationwhen it has one positive literal , or as a forbidden conjunctionwhen it has none. Start with every variable false. Repeatedly, whenever all antecedents of an implication are true, set its conclusion true. If a forbidden conjunction ever has all antecedents true, report unsatisfiable; otherwise stop when no change is possible and return the resulting assignment.
Each step changes a previously false variable to true, so at most the number of variables steps occur; scanning all clauses after each step is polynomial time. For correctness, every satisfying assignment must set every variable derived by this Horn-SAT forward-chaining algorithm to true, by induction over the derivation. Therefore, if the algorithm violates a negative clause, every assignment violates it. If no violation occurs, all implications and all negative clauses are satisfied by the final assignment. This proves polynomial-time decidability.