A knowledge base stores sentences; an inference algorithm answers a query using them. The central task is to decide whether every model of the knowledge base satisfies the query. This note follows FIT3080’s progression through model checking, Horn clauses, chaining, and resolution refutation, then adds a small SAT-solving bridge [1][1] Monash, “FIT3080 Artificial Intelligence: Logic, Inference Algorithms, and First Order Logic, Parts I and II,” 2025. Course lecture materials, Semester 2. Part II reading list: AIMA 4th ed., Sections 7.1--7.5, 8.1--8.3, 9.1, 9.2, 9.5., [2][2] S. Russell and P. Norvig, Artificial Intelligence: A Modern Approach, 4th ed. Pearson, 2020.. Read Formal Logic and Natural Deduction first for the distinction between semantic consequence and syntactic derivation.
Throughout this note, the knowledge base is finite and propositional. When writing , we mean the conjunction of all its sentences with the negated query. The finite propositional restriction is what makes the exhaustive procedures below terminate; it must not be silently transferred to unrestricted first-order logic.
Entailment as a search for a counterexample
The key reduction is
A satisfying assignment for the right-hand formula is exactly a model of that falsifies . It refutes the entailment, not necessarily the query in every model. Conversely, proving the formula unsatisfiable rules out every countermodel.
For propositional variables, truth-table entailment enumerates assignments. For each, evaluate all premises; if they hold, check the query. Return “not entailed” with a countermodel as soon as one is found. If all assignments have been checked without a countermodel, return “entailed.” Evaluation is mechanical, but the number of assignments grows exponentially.
Let and query . The assignment is a countermodel, so does not entail . But also satisfies , so does not entail either. The available information leaves the answer undetermined.
A contradictory entails every query in classical logic. Before interpreting a positive answer as meaningful domain knowledge, distinguish “the query follows from consistent premises” from “the premises have no model.” Checking satisfiability of separately makes that distinction explicit.
Clauses, CNF, and the goal of a transformation
A literal is an atom or its negation. A clause is a disjunction of literals; CNF is a conjunction of clauses. A clause set represents that conjunction. The empty clause is false, whereas the empty clause set is true: an empty disjunction has no successful alternative, and an empty conjunction imposes no constraint.
To obtain an equivalent CNF, remove implications and biconditionals, push negations inward, then distribute disjunction over conjunction. For example,
The order matters conceptually: CNF is a representation suitable for inference, not a claim that the expression is minimal. Direct distribution can make a formula exponentially larger. SAT encodings often introduce fresh variables with defining clauses to preserve satisfiability efficiently. Such an encoding is equisatisfiable with the original formula, but need not be equivalent as a formula over the enlarged variable set.
Introduce to represent . The definition is encoded by
To assert that this represented formula is true, also require . The definition alone only connects to the inputs; it does not force the represented expression to hold.
Definite clauses and Horn clauses
A Horn clause contains at most one positive literal. A definite clause contains exactly one, and can be written as a rule with a conjunction of positive atoms as its body and one positive atom as its head:
A fact is a definite clause with an empty body. A Horn clause with no positive literal expresses a constraint, such as . The simple chaining algorithms below first concern finite propositional definite-clause knowledge bases and positive atomic queries. General Horn satisfiability additionally checks whether any constraint body becomes true.
Use the following original running example:
The query is . All rules are implications, not equivalences: knowing does not justify inferring or by reversing the first rule.
Forward chaining: facts trigger rules
Forward chaining starts from facts and repeatedly adds the head of a rule whose body has been established. In the example, enable , which enables , and then enable . A fixed point is reached when no new atom can be added.
Algorithm 1 Forward chaining for a finite definite-clause KB
1:procedure ForwardChain(Facts, Rules, q)
2:
3:while true do
4:if then
5:return true
6:end if
7:
8:for all do
9:if then
10:
11:end if
12:end for
13:
14:if then
15:return false
16:end if
17:
18:end while
19:end procedure
This deliberately simple version may scan the rules repeatedly. The usual agenda implementation stores, for each rule, the number of unmet body atoms and indexes which rules mention each atom. Processing each newly derived atom once then gives linear-time propagation in the total number of literal occurrences, plus initialization. That bound describes the indexed implementation, not every implementation of the pseudocode.
Each addition is sound by modus ponens. At termination, the derived set is the least model of the definite-clause theory: every model must contain the initial facts and every consequence added from them; the closed set itself satisfies every rule. Therefore a positive atom absent from that set is not entailed. Absence still does not mean its negation is entailed.
Backward chaining: a query generates subgoals
Backward chaining starts with . Its rule requires and ; proving requires ; proving requires and , which are facts. A rule body is an AND requirement, while multiple rules with the same head provide OR alternatives. All body goals of one successful alternative must be solved.
A naive depth-first implementation can loop, for example with rules and . Repeated goals need cycle handling, and shared subgoals benefit from tabling. A goal blocked on the current recursion stack must not be permanently cached as globally false: another rule or later fact may establish it. Finite propositional tabling with fixed-point propagation, or a suitable complete search, can recover all definite-clause consequences. Completeness of the rule system does not make every search order complete.
Forward chaining is useful when many consequences or repeated queries matter; backward chaining can avoid deriving facts irrelevant to a particular query. Neither direction is universally faster. FIT3080 introduces both before moving to general clauses [1][1] Monash, “FIT3080 Artificial Intelligence: Logic, Inference Algorithms, and First Order Logic, Parts I and II,” 2025. Course lecture materials, Semester 2. Part II reading list: AIMA 4th ed., Sections 7.1--7.5, 8.1--8.3, 9.1, 9.2, 9.5..
Resolution refutation
Resolution combines clauses containing complementary literals:
If is false, the first parent requires ; if is true, the second requires . Either way, holds. This proves the rule’s soundness. Remove one selected complementary pair, retain the other literals, and discard duplicates. Do not delete several unrelated complementary pairs at once.
Let and query . Convert the premises to clauses and add the negated query.
| Clause | Formula | Source |
|---|---|---|
| 1 | First premise | |
| 2 | Second premise | |
| 3 | Fact | |
| 4 | Negated query | |
| 5 | Resolve 1 and 3 on | |
| 6 | Resolve 2 and 5 on | |
| 7 | Resolve 4 and 6 on |
Every step has parent clauses and a selected literal. The empty clause shows that is unsatisfiable, so .
To turn the rule into a decision procedure, repeatedly generate new resolvents while retaining derived clauses and avoiding duplicates. For finitely many propositional variables there are finitely many distinct non-tautological clauses. A complete saturation procedure either derives or reaches a fixed point without it; in the latter case the clause set is satisfiable. A timeout before saturation establishes neither outcome.
Resolution is refutation-complete: an unsatisfiable propositional clause set has a resolution refutation. This does not say that unrestricted forward resolution literally generates every logically implied formula. The algorithm answers an entailment query by negating it first.
Induct on the number of atoms. With no atoms, a clause set is unsatisfiable exactly when it contains the empty clause. For the induction step choose . Keep every clause not mentioning , and add every resolvent of a pair , . Discard tautologies. Call this smaller-variable set .
Any model of the original restricts to a model of by resolution soundness. Conversely take a model of . A clause forces true only when is false; a clause forces it false only when is false. Both demands cannot occur, since the corresponding retained resolvent would then be false (and could not be a tautology). Choose to satisfy the demands, or arbitrarily if there are none. This extends the model to the original set. Thus elimination preserves satisfiability.
If the original is unsatisfiable, so is . Induction refutes , whose clauses are originals or one-step resolvents, so prefixing those steps gives a refutation of the original. For atoms there are at most non-tautological clauses, since each atom is absent, positive, or negative. Saturation without the empty clause is therefore both finite and, by completeness, satisfiable.
SAT search: DPLL as a small decision procedure
A SAT solver asks whether a propositional formula has a satisfying assignment. DPLL works on CNF by simplifying clauses under a partial assignment, applying unit propagation, and branching when necessary. A unit clause forces its remaining literal to be true. An empty clause signals a conflict; no remaining clauses means all original clauses have been satisfied by the partial assignment.
Algorithm 2 DPLL on a finite propositional clause set
1:procedure DPLL(S)
2: UnitPropagate()
3:if then
4:return false
5:end if
6:if then
7:return true
8:end if
9:Choose an unassigned atom occurring in
10:if DPLL() then
11:return true
12:end if
13:return DPLL()
14:end procedure
Here restriction removes satisfied clauses and removes falsified literals from the others. Unit propagation repeatedly applies this restriction for a unit literal until no unit remains or a conflict occurs. Each branch assigns a new atom, so the finite search terminates. The pseudocode returns a Boolean; an implementation that reports a model must also retain and return the accumulated assignments.
For , unit propagation first forces false, then false, then true. Every clause is satisfied. Adding instead forces a conflict, establishing unsatisfiability. Modern SAT solvers add conflict-driven clause learning and other search machinery; this basic procedure supplies the logical foundation rather than an account of modern solver performance.
A unit literal must be true in every model, so restricting by it preserves satisfiability. For any remaining atom , every model sets it either true or false; hence the current set is satisfiable exactly when one of the two restricted branches is satisfiable. An empty clause has no model, while an empty clause set accepts every extension of the current assignment. These are the base cases. Induction on the number of unassigned atoms proves that the recursive Boolean answer is correct. Each propagation or branch removes an unassigned atom, so the same finite measure proves termination.
What a small theorem prover must record
A minimal propositional entailment tool needs an input language, a semantics-preserving or appropriately equisatisfiable encoding, an inference or search engine, and an interpretable result. A countermodel should be checked against the original premises and query. A resolution certificate should record parent clauses and pivots, ending at . A separate checker can verify each step without repeating the original search.
The distinction is between finding a proof and checking one. A valid local inference rule does not guarantee a useful search strategy; a fast search does not justify an unchecked conclusion. SAT, UNSAT, and unfinished search must remain different results. For entailment, SAT of provides a countermodel, while UNSAT establishes the consequence.
Exercises
Classify , , , and as definite, Horn but not definite, or non-Horn.
Show solution
The first two are definite, each having exactly one positive literal. The third is Horn but not definite and expresses a constraint. The fourth is non-Horn, with two positive literals.
Run forward chaining on for query . What follows, and what does failure to derive mean?
Show solution
The least model contains . Nothing supplies , so is not derived and is not entailed. This does not entail : setting all four atoms true also satisfies the knowledge base. Inferring from the rule with head would reverse an implication without justification.
Prove from , , and using resolution refutation.
Show solution
The clauses are , , , and the negated query . Resolve the second and fourth to obtain , and the third and fourth to obtain . Resolve with to get , then with to get .
A resolution search stops after one hundred steps without deriving the empty clause. May it report that the query is not entailed?
Show solution
No. A step limit is not saturation, and the missing refutation may require further steps. Report an unfinished or unknown result. A verified satisfying assignment of the negated-query problem would justify “not entailed”; a complete finite saturation procedure can also decide it.
Next: variables, witnesses, and unification
The propositional procedures treat each atom as indivisible. To reason with objects, relations, and quantified rules, we need First-Order Resolution and Theorem Proving. The inference-versus-search distinction remains, but termination is no longer automatic.
References
- [1] Monash, “FIT3080 Artificial Intelligence: Logic, Inference Algorithms, and First Order Logic, Parts I and II,” 2025. Course lecture materials, Semester 2. Part II reading list: AIMA 4th ed., Sections 7.1--7.5, 8.1--8.3, 9.1, 9.2, 9.5. a b
- [2] S. Russell and P. Norvig, Artificial Intelligence: A Modern Approach, 4th ed. Pearson, 2020. ↩
Comments