Topic 5: First-Order Logic (FOL)

Extending Expressiveness with Objects and Relations

Back to Lecture 7 Overview

Why First-Order Logic?

First-Order Logic (FOL) extends propositional logic by adding objects, relations, and quantifiers, making it much more expressive for representing real-world knowledge.

Key Advantages over Propositional Logic:
  • Objects: Can represent specific entities (John, Mary, book1)
  • Relations: Can represent relationships (loves, taller_than, owns)
  • Quantifiers: Can represent "all" and "some" statements
  • Functions: Can represent computed values (father, age)

FOL Components

First-Order Logic builds on propositional logic by adding several new components:

Basic Components:
Constants:
  • Specific objects: John, Mary, book1
  • Numbers: 0, 1, 2, ...
  • Symbols: a, b, c, ...
Variables:
  • Placeholders: x, y, z, ...
  • Can be quantified
  • Range over objects
Predicates:
  • Relations: loves(x,y), taller_than(x,y)
  • Properties: red(x), student(x)
  • Arity: number of arguments
Functions:
  • Mappings: father(x), age(x)
  • Return objects
  • Can be nested
Quantifiers:
(Universal: "for all")
(Existential: "there exists")

∀x P(x): "For all x, P(x) is true"
∃x P(x): "There exists an x such that P(x) is true"

FOL Syntax

The syntax of FOL defines how to construct valid expressions:

Well-Formed Formulas (WFFs):
  1. Every atomic formula is a WFF
  2. If P is a WFF, then ¬P is a WFF
  3. If P and Q are WFFs, then (P ∧ Q), (P ∨ Q), (P → Q), (P ↔ Q) are WFFs
  4. If P is a WFF and x is a variable, then ∀x P and ∃x P are WFFs
  5. Nothing else is a WFF
Examples of FOL WFFs:
  • student(john) (atomic formula)
  • loves(john, mary) (atomic formula with two arguments)
  • ∀x (student(x) → person(x)) (universal quantification)
  • ∃x (student(x) ∧ loves(x, mary)) (existential quantification)
  • ∀x ∃y loves(x, y) (nested quantifiers)

FOL Semantics

The semantics of FOL defines what formulas mean in terms of objects, relations, and truth:

Interpretation (Model):
  • Domain: Set of objects (e.g., {john, mary, book1})
  • Constants: Mapped to specific objects
  • Predicates: Mapped to relations on objects
  • Functions: Mapped to functions on objects
Example Interpretation:
  • Domain: {john, mary, book1}
  • Constants: john → john, mary → mary
  • Predicates: student = {john}, loves = {(john, mary), (mary, book1)}
  • Functions: father(john) = mary

Translating English to FOL

One of the most important skills in FOL is translating natural language statements:

English FOL Notes
John is a student student(john) Simple property
John loves Mary loves(john, mary) Binary relation
All students are people ∀x (student(x) → person(x)) Universal quantification
Some students love books ∃x (student(x) ∧ loves(x, books)) Existential quantification
Every student loves some book ∀x (student(x) → ∃y (book(y) ∧ loves(x, y))) Nested quantifiers
John is taller than Mary taller_than(john, mary) Comparative relation
John's father is a teacher teacher(father(john)) Function application

Inference in FOL

FOL inference extends propositional inference with new rules for handling quantifiers:

Universal Instantiation
∀x P(x) ⊢ P(a)
If P holds for all x, then P holds for specific a
Existential Generalization
P(a) ⊢ ∃x P(x)
If P holds for specific a, then P holds for some x
Existential Instantiation
∃x P(x) ⊢ P(c)
If P holds for some x, then P holds for new constant c
Universal Generalization
P(c) ⊢ ∀x P(x)
If P holds for arbitrary c, then P holds for all x

Unification

Unification is the process of finding substitutions that make two expressions identical. It's crucial for FOL inference.

Unification Process:
  1. Find the most general unifier (MGU)
  2. Substitute variables with terms
  3. Make expressions identical
  4. Handle function symbols and constants
Unification Examples:
  • P(x, a) and P(b, y): {x/b, y/a}
  • P(x, f(y)) and P(g(z), f(a)): {x/g(z), y/a}
  • P(x, x) and P(y, z): {x/y, z/y}
  • P(x, f(x)) and P(y, y): No unifier (occurs check fails)

Generalized Modus Ponens

This is the key inference rule for FOL, extending Modus Ponens to handle variables and unification:

P₁' ∧ P₂' ∧ ... ∧ Pₙ' ∧ (P₁ ∧ P₂ ∧ ... ∧ Pₙ → Q) ⊢ Q'
Where:
  • Pᵢ' are instances of Pᵢ (after unification)
  • Q' is the corresponding instance of Q
  • Unification finds the substitution that makes Pᵢ' match Pᵢ
Example:
  • Rule: ∀x (student(x) ∧ loves(x, books) → reads(x, books))
  • Facts: student(john), loves(john, books)
  • Unification: {x/john}
  • Conclusion: reads(john, books)

FOL Limitations

While FOL is much more expressive than propositional logic, it still has limitations:

Expressiveness Limitations:
  • No Higher-Order Quantification: Can't quantify over predicates
  • No Probabilistic Statements: Can't represent uncertainty
  • No Temporal Logic: Can't represent time directly
  • No Default Reasoning: Can't handle exceptions easily
Computational Limitations:
  • Undecidability: No algorithm can decide all FOL entailment
  • Complexity: Even decidable fragments can be very slow
  • Incompleteness: Some true statements can't be proved

Key Takeaways

FOL Components:
  • Objects: Constants and variables
  • Relations: Predicates and functions
  • Quantifiers: ∀ (all) and ∃ (some)
Inference:
  • Unification: Find matching substitutions
  • Generalized Modus Ponens: Key inference rule
  • Quantifier Rules: Instantiation and generalization
Translation Skills:
  • English to FOL: Identify objects, relations, quantifiers
  • Nested Quantifiers: Handle complex statements
  • Functions: Represent computed values
Next Steps:

Now that we understand FOL, we'll explore the specific reasoning techniques that use these logical foundations in Topic 6: Logical Reasoning & Proof Techniques.

Previous: Propositional Logic Next: Reasoning Techniques