Stanford CS221 | Autumn 2025 | Lecture 16: Logic II
By Stanford Online
Key Concepts
- First-Order Logic (FOL): A formal system that extends propositional logic by introducing objects, predicates, functions, and quantifiers.
- Terms: Expressions that denote objects (constants, variables, or functions).
- Predicates: Symbols that take terms as arguments and return a truth value (Boolean).
- Quantifiers: Operators ($\forall$ for "for all," $\exists$ for "there exists") that allow reasoning over sets of objects.
- Interpretation Function: A mapping from syntax (symbols) to semantics (objects in a domain).
- Substitution & Unification: Mechanisms to replace variables with terms and find mappings that make two expressions identical.
- Modus Ponens: An inference rule used to derive new facts from definite clauses.
- Definite Clauses: A specific subset of FOL formulas (implications with no disjunctions) that allow for efficient inference.
1. Syntax and Semantics of First-Order Logic
FOL is designed to represent complex statements about the world more compactly than propositional logic.
- Syntax: Unlike propositional logic, which only uses truth-valued symbols, FOL distinguishes between terms (objects) and formulas (truth values).
- Constants: Specific objects (e.g.,
Alice,arithmetic). - Variables: Placeholders (e.g.,
x,y). - Functions: Mappings from objects to objects (e.g.,
father(Alice)). - Predicates: Mappings from objects to Booleans (e.g.,
student(Alice)).
- Constants: Specific objects (e.g.,
- Semantics: A model in FOL consists of a domain (a set of objects) and an interpretation function that maps constants, functions, and predicates to elements within that domain. This provides a "bridge" between symbolic logic and the real world.
2. Inference and Logical Reasoning
Inference involves determining if a new formula is entailed by a knowledge base (KB).
- Propositionalization: If one assumes Unique Names (each constant maps to a unique object) and Domain Closure (every object has a constant name), FOL can be reduced to propositional logic. This allows the use of standard model-checking techniques.
- Modus Ponens for FOL: To perform inference without full propositionalization, we use Modus Ponens on definite clauses.
- Substitution: The process of replacing variables with terms (e.g., replacing
xwithAlice). - Unification: The process of finding a substitution that makes two different expressions identical (e.g., unifying
takes(x, y)withtakes(Alice, 221)).
- Substitution: The process of replacing variables with terms (e.g., replacing
- Soundness vs. Completeness: Modus Ponens is sound (if it derives a formula, that formula is true), but it is not complete (it cannot derive all entailed formulas, especially those involving disjunctions).
3. Translating Natural Language to FOL
The lecture emphasizes specific patterns for translating natural language into logical expressions:
- Universal Quantifiers ($\forall$): Typically paired with implication ($\implies$).
- Example: "All students know arithmetic" $\rightarrow \forall x, \text{student}(x) \implies \text{knows}(x, \text{arithmetic})$.
- Existential Quantifiers ($\exists$): Typically paired with conjunction ($\land$).
- Example: "Some student knows arithmetic" $\rightarrow \exists x, \text{student}(x) \land \text{knows}(x, \text{arithmetic})$.
- Common Pitfalls: Using conjunction with $\forall$ (which asserts everything is a student) or implication with $\exists$ (which is logically weak) are common errors.
4. Limitations and Extensions
- Expressivity: FOL is more powerful than propositional logic but still limited. It cannot express statements like "70% of students know machine learning," which would require higher-order logic (quantifying over sets or functions of functions).
- Computational Complexity: While FOL is powerful, the use of functions can lead to an infinite number of atomic formulas, making inference potentially undecidable or computationally expensive.
Synthesis
First-order logic provides a robust framework for knowledge representation by breaking down monolithic propositional symbols into objects, predicates, and functions. By utilizing quantifiers, FOL enables the expression of general rules that apply to entire domains, effectively acting as the "for loops" of logic. While inference in FOL is more complex than in propositional logic, the use of unification and substitution allows for systematic reasoning. Despite its power, FOL remains a restricted language, serving as a foundational step toward more advanced logical systems capable of handling statistical or higher-order concepts.
Chat with this Video
AI-PoweredHi! I can answer questions about this video "Stanford CS221 | Autumn 2025 | Lecture 16: Logic II". What would you like to know?