Lecture 09.1: Knowledge-Based Agents and Logic
Exploring how AI agents use explicit knowledge representation, Propositional Logic, and First-Order Logic to reason about the world.
Early AI research (like neural networks) relied heavily on implicit knowledge buried inside mathematical weights. In the 1970s and 1980s, driven by researchers like Marvin Minsky, AI shifted focus toward symbolic reasoning and explicit knowledge representation.
A Knowledge-Based Agent is an intelligent AI system that uses an explicit representation of knowledge to reason and make decisions. It has two main components:
- Knowledge Base (KB): The facts, rules, and relationships are written out directly (e.g., ). The knowledge is visible and checkable.
- Inference Engine: Performs logical reasoning to derive new facts or actions from the stored knowledge.
To store and process this knowledge, we need formal logical languages.
Propositional Logic
Propositional logic is a simple language consisting of basic atoms (propositions) that are either true or false. We combine these simple sentences using connectives to form compound sentences:
- Negation (NOT): (e.g., "It is not raining" )
- Conjunction (AND): (e.g., "It is raining and it is cold" )
- Disjunction (OR): (e.g., "It is raining or it is snowing" )
- Implication (IF-THEN): (e.g., "If it is raining, the ground is wet" )
- Biconditional (IFF): (e.g., "It is raining if and only if there are clouds" )
Logical Equivalences
To manipulate logical statements in a Knowledge Base, we rely on standard logical equivalences:
| Rule Name | Equivalence |
|---|---|
| Double Negation | |
| Commutative Laws | |
| Associative Laws | |
| Distributive Laws | |
| De Morgan's Laws | |
| Implication Elimination | |
| Biconditional Elimination |
Limitations of Propositional Logic
Propositional logic lacks expressiveness. It can only express relationships between fixed, specific facts. It cannot generalize.
[!NOTE] Propositional vs. First-Order Logic Size Comparison: To represent the rules of chess in Propositional Logic, it would require 100,000 pages of logic sentences. In First-Order Logic, it takes only 1 page.
First-Order Logic (FOL)
First-Order Logic (FOL), or Predicate Logic, is a generalization of propositional logic that allows us to represent objects, properties of objects, and relationships.
- Constants: Specific objects in the domain (e.g., , ).
- Predicates: Properties and relations that evaluate to true or false (e.g., ).
- Functions: Mapping from objects to another object (e.g., ).
- Variables: Placeholders for objects (e.g., , ).
Quantifiers
FOL introduces quantifiers to make sweeping statements about groups of objects:
1. Universal Quantifier ()
Means "For all..." or "Every..."
- Example: "All dogs like bones."
Explanation: "For any object , if is a dog, then likes bones."
- Example: "Anything with a beak and feathers is a bird."
2. Existential Quantifier ()
Means "There exists at least one..." or "There is some..."
- Example: "There is someone who likes liver."
- Example: "Mary owns a coat."
Critical Quantifier Rules
Quantifier Order Matters
The order of quantifiers is extremely important. Swapping them changes the entire meaning:
- Meaning: "For every person , there exists a person that loves." (Everyone loves someone).
- Meaning: "There exists a person who loves every person ." (There is one super-loving person).
Translating Complex Sentences
Consider the sentence: "Every rose has a thorn."
- For all , if is a rose, then there exists some such that is a thorn and has .
- FOL representation:
Lecture 08.2: Fuzzy Expert Systems
Handling vagueness and ambiguity using Fuzzy Logic, membership functions, and the four steps of Fuzzy Inference.
Lecture 09.2: CNF Conversion and Resolution
How to convert First-Order Logic into Conjunctive Normal Form (CNF) and use Resolution graphs to prove theorems.