Lecture 9: Inference in First-Order Logic
Learning Objectives¶
Reduce FOL inference to propositional inference
Apply unification for variable substitution
Implement forward and backward chaining in FOL
Use resolution for FOL theorem proving
Propositional vs. FOL Inference¶
Propositionalization: Ground (instantiate) all variables
Problem: Infinite Herbrand universe
Solution: Lifted inference — keep variables, use unification
Unification¶
Substitution: θ = {x/A, y/B}
Unify(Knows(John,x), Knows(John,Jane)): θ = {x/Jane}
Unify(Knows(John,x), Knows(y,Mother(y))): θ = {x/Mother(John), y/John}
MGU: Most general unifier
Unification Algorithm¶
Occurs check: x must not occur in term we substitute for x
Recursive: Unify arguments, combine substitutions
Failure: Incompatible (e.g., P(A) vs P(B))
Forward Chaining (FOL)¶
Definite clauses: L₁ ∧ L₂ ∧ ... ⇒ L
Ground: Substitute to get ground facts
Efficient: Indexing, incremental
First-Order Definite Clauses¶
Storage: Index by predicate
Matching: Unify rule premises with facts
Incremental: Only check rules affected by new fact
Backward Chaining (FOL)¶
Goal: Prove query
Find: Rules whose head unifies with goal
Recurse: Prove body (subgoals)
Prolog: Depth-first, left-to-right
Logic Programming (Prolog)¶
Horn clauses: Definite clauses
Resolution: Backward chaining
Database semantics: Closed-world assumption
Negation as failure: ¬P if P not provable
Redundant Inference¶
Redundant: Derive same fact multiple ways
Memoization: Cache proved goals
Infinite loops: p(X) :- p(X) — need occurs check
Resolution for FOL¶
Convert to CNF: Eliminate quantifiers, Skolemize
Skolemization: ∃x P(x) → P(SkolemConstant)
Resolution: Unify literals, resolve
Resolution Rule (FOL)¶
Binary resolution: (L₁ ∨ ... ∨ Lₙ) and (¬M₁ ∨ ... ∨ Mₘ)
Unify: Lᵢ and Mⱼ
Resolvent: Combine clauses, remove Lᵢ and Mⱼ
Completeness of Resolution¶
Resolution: Refutation-complete for FOL
Lifting: FOL resolution lifts propositional resolution
Herbrand: If unsatisfiable, finite ground subset
Resolution Strategies¶
Unit preference: Prefer unit clauses
Subsumption: Remove subsumed clauses
Set of support: One clause from goal
Summary¶
Unification: Variable substitution, MGU
Forward chaining: Data-driven, definite clauses
Backward chaining: Goal-driven, Prolog
Resolution: Skolemize, resolve, complete
References¶
Russell & Norvig, AIMA 4e, Ch. 9
Chapter PDF:
chapters/chapter-09.pdf