Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lecture 8: First-Order Logic

Lecture 8: First-Order Logic

AIMA Chapter 8 — 1 hour

Why First-Order Logic?

  • Propositional logic: Cannot express “all,” “some,” “relations”

  • FOL: Objects, relations, functions, quantifiers

  • More expressive than propositional logic

Learning Objectives

  • Understand syntax and semantics of first-order logic

  • Use quantifiers (∀, ∃) and terms

  • Represent knowledge in FOL

  • Apply knowledge engineering process

FOL: Basic Elements

  • Objects: People, numbers, etc.

  • Relations: Brother(John, Mary)

  • Functions: Mother(John) → person

  • Predicates: True/false of objects

FOL: Syntax

  • Constants: John, 2

  • Variables: x, y

  • Terms: Constants, variables, or f(t₁,...,tₙ)

  • Atomic sentences: Predicate(term₁,...,termₙ)

  • Complex: ¬, ∧, ∨, ⇒, ⇔, ∀, ∃

Quantifiers

  • ∀x P(x): “For all x, P(x)”

  • ∃x P(x): “There exists x such that P(x)”

  • ∀x P(x): Equivalent to ¬∃x ¬P(x)

  • De Morgan: ¬∀x P(x) ≡ ∃x ¬P(x)

FOL: Semantics

  • Model: Domain, interpretation of symbols

  • Interpretation: Maps constants to objects, predicates to relations

  • Satisfaction: m ⊨ φ defined recursively

FOL: Kinship Domain

Family tree
  • Brother(x,y): x is brother of y

  • Parent(x,y): x is parent of y

  • Sibling(x,y): ∃p Parent(p,x) ∧ Parent(p,y)

  • Grandparent: Parent(x,y) ∧ Parent(y,z)

Knowledge Engineering

  1. Identify: Task, questions

  2. Assemble: Relevant knowledge

  3. Vocabulary: Decide on symbols

  4. Encode: General knowledge, specific instance

  5. Pose queries: Query inference procedure

  6. Debug: Fix errors

Electronic Circuits Example

  • Gates: AND, OR, NOT

  • Terminals: Connected, signal

  • OneOf: Each gate is exactly one type

  • Consistency: Connected terminals have same signal

Summary

  • FOL: Objects, relations, functions, quantifiers

  • ∀, ∃: Universal and existential

  • Knowledge engineering: Process for building KBs

  • Next: Inference in FOL

References

  • Russell & Norvig, AIMA 4e, Ch. 8

  • Chapter PDF: chapters/chapter-08.pdf

Questions?

Next lecture: Inference in First-Order Logic (Chapter 9)