★ Must-know
A knowledge-based agent is composed of a knowledge base and an inference system.
A generic knowledge-based agent receives a percept, tells the KB what it perceives, asks the KB what action to take, tells the KB which action was chosen, and returns that action.
Further detail
A knowledge-based agent must be able to: represent states and actions, incorporate new percepts, update its internal representation of the world, deduce its internal representation of the world, deduce appropriate actions
The generic agent begins with background knowledge and a time counter initialized to zero; MAKE-PERCEPT-SENTENCE, MAKE-ACTION-QUERY, and MAKE-ACTION-SENTENCE encode the percept, action query, and executed action, respectively.
Perceive, update the KB, infer, then act.
★ Must-know
Further detail
The KB stores sentences; the inference system derives new ones.
★ Must-know
📌 At the knowledge level, the agent is specified by what it knows and its goals; at the logical level, its knowledge is encoded in logical sentences; at the implementation level, the logic and knowledge are physically represented and used to perform actions.
📌 The declarative approach initializes an agent with a knowledge base and adds starting sentences, whereas the procedural approach directly encodes desired behavior as program code.
Further detail
For an automated taxi travelling from station A to station B, knowing the route is knowledge-level information, expecting arrival at B illustrates the logical level, and carrying out the route illustrates the implementation level.
A successful real-world agent can combine declarative and procedural approaches, and declarative knowledge can be compiled into more efficient procedural code.
★ Must-know
The Wumpus world is a cave of 16 rooms arranged in a 4-by-4 grid and connected by passageways.
The cave contains: a Wumpus that eats anyone entering its room, bottomless pits that trap an agent falling into them, a possible heap of gold in one room
The agent's goal is to find the gold and climb out without falling into a pit or being eaten by the Wumpus.
Further detail
The Wumpus world was inspired by Gregory Yob's 1973 video game Hunt the Wumpus.
The agent has a single arrow that can kill the Wumpus when the agent is facing it.
Picture a cave grid where nearby hazards leave sensory clues.
★ Must-know
In the Wumpus world, the performance measure gives +1000 points for exiting with gold, −1000 for being eaten or falling into a pit, −1 per action, and −10 for using an arrow; the game ends when the agent dies or exits.
The Wumpus environment is a 4-by-4 grid with the agent initially at [1,1] facing right; the Wumpus and gold are randomly placed outside [1,1], and each other square has pit probability 0.2.
The Wumpus agent senses: stench in a room directly adjacent to the Wumpus, breeze in a room directly adjacent to a pit, glitter in the room containing gold, a bump when it walks into a wall, a scream anywhere in the cave after the Wumpus is shot
The Wumpus world is:
Further detail
The Wumpus agent's actuators are:
A Wumpus percept is represented as a five-element list for stench, breeze, glitter, bump, and scream; [Stench, Breeze, None, None, None] represents stench and breeze without the other three percepts.
No stench or breeze at [1,1] makes adjacent rooms safe.
★ Must-know
📌 Deductive logic draws a conclusion from complete evidence, whereas inductive logic reasons from particular observations using a bottom-up approach.
📌 A logic is specified by its syntax, semantics, and syntactic inference method: syntax defines allowable expressions, semantics assigns meanings and truth values, and inference rules derive theorems mechanically.
Further detail
📌 A fact is a claim about the world that may be true or false, whereas a representation is a sentence in a language that encodes objects and relations for a computer program.
Syntax shapes sentences; semantics assigns their meaning and truth.
★ Must-know
📌 An atomic proposition is a single proposition symbol, whereas a compound proposition combines simpler propositions using connectives and parentheses.
📌 A tautology is always true, a contradiction is always false, and a contingent proposition formula can be either true or false depending on its valuation.
Further detail
Propositional logic represents knowledge using propositions and logical connectives, and is also called Boolean logic because it works with 0 and 1.
Questions, commands, and opinions are not propositions because they are not declarative statements with truth values.
Parentheses, negation, conjunction, disjunction, implication, biconditional.
★ Must-know
📐 Formula - De Morgan's laws are and .
Further detail
📐 Formula - Conjunction and disjunction are commutative: and .
📐 Formula - Conjunction and disjunction are associative: and .
📐 Formula - Double-negation elimination is .
★ Must-know
📌 For an implication P → Q, its converse is Q → P, its contrapositive is ¬Q → ¬P, and its inverse is ¬P → ¬Q; the implication and contrapositive are equivalent, as are the converse and inverse.
📌 Modus Ponens infers Q from P and P → Q.
Further detail
Hypothetical Syllogism infers P → R from P → Q and Q → R.
Disjunctive Syllogism infers Q from P ∨ Q and ¬P.
Universal means every instance; existential means at least one.
★ Must-know
📌 An atomic first-order sentence consists of a predicate applied to a sequence of terms, whereas a complex sentence combines atomic sentences with connectives.
📌 The universal quantifier ∀ expresses that a predicate holds for every object in its domain, whereas the existential quantifier ∃ expresses that it holds for at least one object.
Further detail
First-order logic distinguishes subjects and predicates, and its domain may include objects, relations such as red or sister-of, and functions such as father-of.
The basic first-order logic symbols include:
Universal quantifiers commute with one another and existential quantifiers commute with one another, but ∃x∀y is not equivalent to ∀y∃x.
★ Must-know
📌 Unification requires matching predicate symbols and equal argument counts, and fails if a variable occurs within the expression it would replace.
📌 Universal instantiation infers P(c) from ∀x P(x) by substituting a ground term c for x.
📌 Forward chaining begins with known facts and applies rules to generate conclusions, whereas backward chaining begins with a goal and works backward to supporting facts.
Further detail
The most general unifier for King(x) and King(John) is the substitution {John/x}.
Universal generalization infers ∀x P(x) when P(c) holds for an arbitrary element c of the domain, with x not free in the relevant assumptions.
📌 Existential instantiation infers P(c) from ∃x P(x) using a new constant c that has not appeared in the knowledge base.
Existential introduction infers ∃x P(x) from P(c) for an element c in the domain.
Forward chaining is bottom-up, generally uses breadth-first search, tests available rules, and suits planning, monitoring, control, and interpretation; backward chaining is top-down, generally uses depth-first search, tests relevant rules, and suits diagnosis, prescription, and debugging.
Forward chaining is data-driven; backward chaining is goal-driven.
Forward and Backward Chaining
| Dimension | Forward chaining | Backward chaining |
|---|---|---|
| Starting point | Known facts | Goal |
| Direction | Bottom-up | Top-down |
| Reasoning driver | Data-driven | Goal-driven |
| Search strategy | Breadth-first | Depth-first |
| Typical applications | Planning, monitoring, control, interpretation | Diagnosis, prescription, debugging |
Take a 11-question practice quiz on Logic Agents and Knowledge Representation, with every answer explained.
1. What distinguishes a knowledge-based agent from an agent that reacts without maintaining an internal world model?
2. In a generic knowledge-based agent cycle, what happens after the agent receives a percept and tells the knowledge base what it perceives?
Memorize the key concepts of Logic Agents and Knowledge Representation with 10 flashcards.
What does a knowledge-based agent maintain, and how does it use that knowledge?
It maintains an internal world representation, reasons over it, updates it from observations, and selects actions.
What are the two components of a knowledge-based agent?
A knowledge base and an inference system.
What does a knowledge base store, and how are its sentences expressed?
It stores facts about the world in a knowledge representation language.
Upload your class notes and Revizly writes a study guide, a quiz and flashcards in about a minute.
Study guide maker