FOL Inference
Inference in First Order Logic
Course Information:
Course Title: CSC-4240/5240: ARTIFICIAL INTELLIGENCE
Instructor: Amr Hilal
Date: 10/7/2025
Recap of First-Order Logic (FOL)
Propositional Logic: Assumptions
Assumes the world contains facts.
First-Order Logic (FOL): Assumptions
Assumes the world contains:
Objects:
Examples: people, houses, numbers, colors, baseball games, wars, etc.
Relations/Properties:
Examples: red, round, prime, brother, bigger than, part of, comes between, etc.
Properties: Unary relations such as red, round, etc.
Functions: Examples include father of, best friend, one more than, plus, etc.
Construction of Facts: Facts in FOL are created by combining objects, properties, and functions.
More Examples of FOL
All purple mushrooms are poisonous
Representation:
A mushroom is poisonous if and only if it is purple
Representation:
No purple mushroom is poisonous
Representation:
No human enjoys sushi
Representation:
FOL Inference
Recall, in Propositional Logic (PL):
Model checking and inference rules are applied.
Common rules: Modus Ponens, AND-elimination, AND/OR-Introduction, Resolution, etc.
In FOL:
Focus on inference rules through two approaches:
Reduction to Propositional Logic (Propositionalization):
Utilizes the existing knowledge of inference from propositional logic.
Lifted Inference:
Seeks more general inference rules that are compatible with FOL.
Propositionalization
Step 1: Eliminate the Quantifiers
Universal Instantiation (UI):
Proposes that every instantiation of a universally quantified sentence is entailed by it.
Representation:
A variable can be substituted with any ground term making true.
Ground Term: A term absent of variables applicable to all objects in the Knowledge Base (KB).
Example:
From:
Yields:
Holds for:
Provides:
From KB:
Existential Instantiation (EI):
Replace an existentially quantified variable with a unique new constant symbol.
Representation:
Example:
yields:
Constant is unique in the KB and permits substitution.
Notice: EI can only be applied once while UI can be repeatedly applied to replace the original quantifier.
Step 2: Reduce to Propositional Logic Syntax
Convert predicates and functions into PL symbols:
Example Conversions:
Example: Reduction to Propositional Inference
FOL KB Given:
To ascertain if can be inferred:
Instantiating the universal statement indicates:
From:
Provides:
New KB includes propositional symbols:
Utilizes search algorithms to conclude which is equivalent to .
Lifted Inference
Generalized Modus Ponens (GMP)
Overview:
Propositionalization can create excessive instantiations of universally quantified sentences.
Rewrite PL inference rules to apply to FOL.
Generalization of Modus Ponens:
Lifts the Modus Ponens from propositional logic to first-order logic.
Inference rules transforming with a lifted approach.
Generalized Modus Ponens (GMP) Definition
Notation:
Let be atomic sentences (Predicate(Term) or Term=Term).
include variables .
includes ground terms (which may include other variables).
Substitution Definition:
heta = ext{{v1/g1, v2/g2, v3/g3, …}} suggests replacing variables in with corresponding ground terms in to conclude .
Example for Generalized Modus Ponens
Example KB:
To deduce if can still be inferred without propositionalization:
Set
Set
Set
Set
Set
Define as .
Apply substitution to arrive at .
Unification
Definition:
Lifted inference methods necessitate discovering substitutions which render different logical expressions identical.
Immediate inference is possible when a substitution is found such that and match with and .
Unify Algorithm:
Purpose: Takes two sentences and returns a unifier , or failure if one does not exist.
Unification Example
Query: - identifies whom John knows.
Output: Retrieval of answers by unifying with sentences in the KB that match :
Variables and sentences:
Unification results:
making both sentences equivalent.
Examples of Further Unification
Next Queries:
Other variables:
Resulting substitutions yield varying outputs, e.g.:
Substitutions: {y/John, x/Biden}, etc.
Unify Algorithm Details
Function UNIFY:
This function executes substitution to achieve identical expressions or recognize failure.
Function Logic:
If both expressions are equivalent, return.
If one expression is a variable, it triggers another function UNIFY-VAR that performs specific checks.
If both are compound with arguments, or in a list format, it recursively unfolds their structured components until it finds a conclusion or a failure.
Most General Unification (MGU)
Concept:
Unify expressions such as and .
Potential substitutions: or .
Uniqueness of MGU:
There exists a unique most general unifier that remains valid through renaming of variables.
Example MGU is: , which is more general than the other substitution.
Further Notes:
Check if a variable occurs within the term during matching to prevent unsound inference.
Adopted techniques may bypass this to simplify algorithm complexity.
Summary of Substitutions
Example Unifications:
For various term pairs, list substitutions achieved or recognized failures in cases where terms match incorrectly, ensuring clear identification of successful and unsuccessful unifications.