1. Gyanastra
  2. Artificial Intelligence
  3. Knowledge Representation
  4. Logic Resolution and Unification
Free lesson, no account needed 10 min read 10 practice questions after it
Asked in past papers4 times
  • UGC NET2020201720152013

Artificial Intelligence · Knowledge Representation

Logic Resolution and Unification

Overview

Resolution is a single, sound and refutation‑complete inference rule for propositional and first‑order logic.
Unification is the matching procedure that makes resolution work in first‑order logic by finding substitutions that make two literals identical.
These two ideas underpin automated theorem proving, logic programming (Prolog uses SLD resolution and unification), and knowledge‑based systems that reason with Horn clauses.
The topic sits in the Knowledge Representation chapter of AI, after propositional logic, first‑order logic, and clause form.
Before studying it, you should know the syntax of first‑order logic (predicates, functions, variables, quantifiers), the meaning of entailment, and the basic equivalences (implication elimination, De Morgan’s laws).

Key concepts

  • Literal: an atomic proposition or its negation. A clause is a disjunction of literals.
  • Empty clause (□): a clause with no literals; it represents contradiction (false).
  • Resolution rule (propositional): from clauses (A∨B)(A \lor B) and (¬A∨C)(\neg A \lor C) infer (B∨C)(B \lor C). The literal AA and its negation cancel.
  • Resolution rule (first‑order): from clauses C1C_1 and C2C_2 that contain complementary literals LL and ¬L\neg L, if a substitution σ\sigma is the most general unifier (MGU) of LL and ¬L\neg L, infer the resolvent (C1∖{L})σ∪(C2∖{¬L})σ(C_1 \setminus \{L\})\sigma \cup (C_2 \setminus \{\neg L\})\sigma.
  • Substitution: a finite set {x1/t1,…,xn/tn}\{x_1/t_1,\dots,x_n/t_n\} where each xix_i is a variable and tit_i is a term. Applying it replaces variables by terms simultaneously.
  • Unification: finding a substitution that makes two expressions (terms, atoms, or literals) syntactically identical.
    A unifier is such a substitution; the most general unifier (MGU) is the unifier that imposes the fewest constraints (all other unifiers are instances of it).
  • Occurs check: during unification, when trying to bind variable xx to term tt, if xx occurs inside tt, the unification fails. Without it, infinite terms arise.
  • Horn clause: a clause with at most one positive literal. Definite clause: exactly one positive literal, written as A1∧⋯∧An→BA_1 \land \cdots \land A_n \rightarrow B or ¬A1∨⋯∨¬An∨B\neg A_1 \lor \cdots \lor \neg A_n \lor B. Goal clause: no positive literals, e.g., ¬A1∨⋯∨¬An\neg A_1 \lor \cdots \lor \neg A_n.
  • Skolemization: eliminating existential quantifiers by introducing Skolem constants (if no universal quantifier precedes) or Skolem functions (if universal quantifiers precede).
    It preserves satisfiability, not logical equivalence.
  • Resolution refutation: to prove KB⊨αKB \models \alpha, show that KB∪{¬α}KB \cup \{\neg \alpha\} is unsatisfiable by deriving the empty clause.
  • Modus Ponens (MP): from AA and A→BA \rightarrow B, infer BB. Modus Tollens (MT): from ¬B\neg B and A→BA \rightarrow B, infer ¬A\neg A.
  • Forward chaining and backward chaining are natural inference algorithms for Horn clauses; they are sound and complete for definite clauses.
  • Prolog uses SLD resolution (a form of linear resolution) with unification; its semantic foundation is first‑order predicate calculus.

How it works

Resolution refutation procedure (first‑order)

  1. Convert all sentences of the knowledge base to clause form (see below).
  2. Negate the goal α\alpha and add the resulting clauses to the knowledge base.
  3. Repeat until the empty clause is found or no new clauses can be added:
    • Select two clauses that contain complementary literals.
    • Unify the complementary literals to obtain the MGU σ\sigma.
    • Form the resolvent by applying σ\sigma to both clauses and removing the complementary literals.
    • Add the resolvent to the clause set.
  4. If the empty clause is derived, the original knowledge base entails α\alpha.

Conversion to clause form (standard steps)

  1. Eliminate implications: A→B≡¬A∨BA \rightarrow B \equiv \neg A \lor B.
  2. Move negations inward using De Morgan’s laws and double negation.
  3. Standardize variables apart (rename so each quantifier uses a distinct variable).
  4. Move quantifiers to the front (prenex normal form).
  5. Skolemize: eliminate existential quantifiers.
    • If ∃y\exists y is not inside the scope of any universal quantifier, replace yy by a new Skolem constant.
    • If ∃y\exists y is inside the scope of universal quantifiers x1,…,xnx_1,\dots,x_n, replace yy by a new Skolem function f(x1,…,xn)f(x_1,\dots,x_n).
  6. Drop universal quantifiers (all remaining variables are universally quantified).
  7. Distribute ∨\lor over ∧\land to obtain a conjunction of disjunctions.
  8. Split into separate clauses.
  9. Rename variables if necessary so that no two clauses share a variable.

Unification algorithm (informal)

Given two atoms (or terms) AA and BB:

  • If both are identical constants or variables, they already match.
  • If one is a variable xx and the other is a term tt:
    • If xx occurs in tt (occurs check), fail.
    • Otherwise add x/tx/t to the substitution.
  • If both are compound terms with the same function/predicate symbol and same arity, recursively unify their arguments.
  • If symbols differ or arities differ, fail.
  • The result is the MGU if the algorithm succeeds.

Resolution with Horn clauses

  • A definite clause ¬A1∨⋯∨¬An∨B\neg A_1 \lor \cdots \lor \neg A_n \lor B is written B←A1,…,AnB \leftarrow A_1,\dots,A_n.
  • Forward chaining starts from known facts and applies rules to derive new facts.
  • Backward chaining starts from the goal and works backward through rules to find supporting facts.
  • Both are efficient and complete for definite Horn clauses.
Figure. Notice the loop: after forming a resolvent, if no empty clause appears, the procedure selects two clauses with complementary literals; an empty clause ends it as goal proved.

Formulas

  • Resolution (propositional): A∨B¬A∨CB∨C\frac{A \lor B \quad \neg A \lor C}{B \lor C}
  • Resolution (first‑order): C1C2(C1∖{L})σ∪(C2∖{¬L})σ\frac{C_1 \quad C_2}{(C_1 \setminus \{L\})\sigma \cup (C_2 \setminus \{\neg L\})\sigma} where σ=MGU(L,¬L)\sigma = \text{MGU}(L, \neg L).
  • Substitution composition: if θ={x/t}\theta = \{x/t\} and σ={y/s}\sigma = \{y/s\}, then θσ\theta\sigma applies θ\theta then σ\sigma.
  • MGU condition: for any unifier θ\theta of expressions E1E_1 and E2E_2, there exists a substitution σ\sigma such that θ=MGU(E1,E2)σ\theta = \text{MGU}(E_1,E_2)\sigma.
  • Horn clause: at most one positive literal. Definite clause: exactly one positive literal.
  • Skolemization: ∃x P(x)\exists x \, P(x) becomes P(c)P(c) (new constant cc). ∀y ∃x P(x,y)\forall y \, \exists x \, P(x,y) becomes ∀y P(f(y),y)\forall y \, P(f(y),y) (new function ff).
  • Entailment: KB⊨αKB \models \alpha iff KB∪{¬α}KB \cup \{\neg \alpha\} is unsatisfiable.
  • Modus Ponens: AA→BB\frac{A \quad A \rightarrow B}{B}. Modus Tollens: ¬BA→B¬A\frac{\neg B \quad A \rightarrow B}{\neg A}.

Worked examples

Example 1 (Unification, easy). Find the MGU of P(x,f(y),y)P(x, f(y), y) and P(a,f(b),b)P(a, f(b), b).

  • Match arguments: xx with aa → {x/a}\{x/a\}.
  • f(y)f(y) with f(b)f(b) → unify yy with bb → add {y/b}\{y/b\}.
  • yy with bb → already {y/b}\{y/b\}.
  • No occurs check violation. MGU is {x/a,y/b}\{x/a, y/b\}.

Example 2 (Resolution, medium). Resolve (¬P∨Q)(\neg P \lor Q) and (¬Q∨R)(\neg Q \lor R) on QQ.

  • Complementary literals: QQ and ¬Q\neg Q.
  • MGU is empty (propositional case).
  • Resolvent: (¬P∨R)(\neg P \lor R).

Example 3 (Resolution refutation, hard). Prove Mortal(Socrates)\text{Mortal(Socrates)} from:

  1. Human(Socrates)\text{Human(Socrates)}
  2. ∀x (Human(x)→Mortal(x))\forall x \, (\text{Human}(x) \rightarrow \text{Mortal}(x))
  • Clause form of (2): ¬Human(x)∨Mortal(x)\neg \text{Human}(x) \lor \text{Mortal}(x).
  • Negate goal: ¬Mortal(Socrates)\neg \text{Mortal(Socrates)}.
  • Resolve (1) and (2) with {x/Socrates}\{x/\text{Socrates}\}: Mortal(Socrates)\text{Mortal(Socrates)}.
  • Resolve with negated goal: empty clause. Therefore entailment holds.

Example 4 (Skolemization, hard). Convert ∃u∀v∀x∃y (P(f(u),v,x,y)→Q(u,v,y))\exists u \forall v \forall x \exists y \, (P(f(u),v,x,y) \rightarrow Q(u,v,y)) to clause form.

  • Eliminate implication: ¬P(f(u),v,x,y)∨Q(u,v,y)\neg P(f(u),v,x,y) \lor Q(u,v,y).
  • Move quantifiers: ∃u∀v∀x∃y (¬P(f(u),v,x,y)∨Q(u,v,y))\exists u \forall v \forall x \exists y \, (\neg P(f(u),v,x,y) \lor Q(u,v,y)).
  • Skolemize ∃u\exists u: no preceding universals → new constant aa.
  • Skolemize ∃y\exists y: preceded by ∀v∀x\forall v \forall x → new function g(v,x)g(v,x).
  • Result: ∀v∀x (¬P(f(a),v,x,g(v,x))∨Q(a,v,g(v,x)))\forall v \forall x \, (\neg P(f(a),v,x,g(v,x)) \lor Q(a,v,g(v,x))).
  • Drop universals and write as clause: ¬P(f(a),v,x,g(v,x))∨Q(a,v,g(v,x))\neg P(f(a),v,x,g(v,x)) \lor Q(a,v,g(v,x)).

Example 5 (Match logical forms to clauses, medium).

Logical formClause form
P→QP \rightarrow Q¬P∨Q\neg P \lor Q
P∧Q→RP \land Q \rightarrow R¬P∨¬Q∨R\neg P \lor \neg Q \lor R
P→(Q∨R)P \rightarrow (Q \lor R)¬P∨Q∨R\neg P \lor Q \lor R
¬P→Q\neg P \rightarrow QP∨QP \lor Q

Comparison

ConceptDefinitionKey property
UnificationFinding a substitution that makes two expressions identicalProduces MGU; occurs check prevents infinite terms
SubstitutionMapping of variables to termsApplied to expressions to instantiate them
ResolutionInference rule that cancels complementary literalsRefutation‑complete; requires clause form
SkolemizationReplacing existentially quantified variables with constants/functionsPreserves satisfiability, not equivalence
Modus PonensFrom AA and A→BA\rightarrow B infer BBForward reasoning
Modus TollensFrom ¬B\neg B and A→BA\rightarrow B infer ¬A\neg ABackward reasoning
Horn clause typePositive literalsFormUse
Definite clauseExactly oneB←A1,…,AnB \leftarrow A_1,\dots,A_nForward/backward chaining
Goal clauseZero←A1,…,An\leftarrow A_1,\dots,A_nQuery in Prolog
Horn clause (general)At most onee.g., ¬A∨¬B∨C\neg A \lor \neg B \lor CResolution
Propositional resolutionFirst‑order resolution
No variables, no unificationUses unification and MGU
Literals are propositionsLiterals are predicates with terms
DecidableSemi‑decidable (refutation‑complete)

Revision summary

  • Horn clause: at most one positive literal. Definite clause: exactly one positive literal.
  • Resolution proves entailment by refutation: add negated goal, derive empty clause.
  • MGU is the most general unifier; apply occurs check to avoid infinite terms.
  • Skolem constant for existential not under universal; Skolem function when under universals.
  • Modus Ponens = A,A→B⊢BA, A\rightarrow B \vdash B; Modus Tollens = ¬B,A→B⊢¬A\neg B, A\rightarrow B \vdash \neg A.
    Do not swap names.
  • Prolog uses SLD resolution and unification; its foundation is first‑order predicate calculus.
  • Forward chaining is data‑driven; backward chaining is goal‑driven.
  • Resolution is sound and refutation‑complete; it is not a decision procedure for all FOL.
  • Propositional logic does not scale to unbounded environments; first‑order logic handles objects and relations.
  • For resolution, clauses must be in clause form (conjunction of disjunctions).
  • Empty clause represents contradiction; deriving it means the negated goal is inconsistent with KB.

Previous-year exam insights

  • Questions often test direct definitions: Horn clause (at most one positive literal), definite clause, MGU, Skolemization.
  • Resolution problems ask for the resolvent of two clauses; check complementary literals and apply MGU correctly.
  • Unification problems give two atoms and ask for MGU; always perform occurs check and match symbols/arity.
  • Statement‑type questions compare Modus Ponens vs Modus Tollens and their names; the names are frequently swapped in wrong options.
  • Skolemization questions show a formula and its transformed version; identify the process as Skolemization, not simplification or unification.
  • Horn clause properties: the resolvent of two Horn clauses is a Horn clause (key property).
  • Resolution refutation order: negate goal, add to KB, convert to clauses, resolve until empty clause.
  • Trap: thinking resolution is complete for all first‑order logic; it is refutation‑complete.
    Also, without occurs check, unification can produce infinite terms.

Practice at PARIKSHA

You are ready for the PARIKSHA tests of this sub-topic when you can:

  • Write the resolution rule for propositional and first‑order logic and explain the role of the MGU.
  • Given two atoms, compute their MGU step by step and state whether the occurs check fails.
  • Convert a first‑order sentence to clause form, including correct Skolemization.
  • Prove a simple entailment using resolution refutation and show every resolvent.
  • Identify whether a clause is a Horn clause, definite clause, or goal clause.
  • Distinguish Modus Ponens from Modus Tollens by their premises and conclusions.
  • Explain forward chaining and backward chaining for Horn clauses.
  • Describe the steps of the unification algorithm and why the occurs check is necessary.
  • Match logical forms to their equivalent clause representations.
  • Explain why Prolog’s inference is based on resolution and unification.

Attempt the sub-topic test first, then the subject test.

Pages 1–2 of 2