Professional Documents
Culture Documents
Chapter 7 Logical Agents
Chapter 7 Logical Agents
Logical Agents
Prepared by :
Noor Saad Thura Jamal Zainab Malik
OUTLINES
• Knowledge-based agents are best understood as agents that know about their
world and reason about their courses of action.
Basic concepts :
• The knowledge-base (KB): a set of representations of facts about the
world.
• The knowledge representation language: a language whose sentences
represent facts about the world.
• TELL and ASK interface: operations for adding new sentences to the KB and
querying what is known. This is similar to updating and querying in databases.
We can describe a knowledge-based agent at three levels:
1. The knowledge level: In this level the agent is specified by saying what it knows about
the world and what its goals are .
2. The logical level: This is the level at which the knowledge is encoded into sentences of
some logical language .
3. The implementation level: This is the level where sentences are implemented. This level
runs on the agent architecture.
* A successful agent must combine both Declarative & procedural elements in its
design.
7.2 THE WUMPUS WORLD
Environment : 4x4 grid of rooms with agent, wumpus, gold and pits.
o Squares adjacent to wumpus are smelly
o Squares adjacent to pit are breezy
o Glitter if gold is in the same square
o Shooting kills wumpus if you are facing it
o Shooting uses up the only arrow
o Grabbing picks up gold if in same square
o Releasing drops the gold in same square
Actuators : Forward, Turn Left (90°),, Turn Right (90°),, Grab, Release, Shoot .
• Truth : A sentence will be called true under a particular interpretation if the state of
affairs it represents is the case.
Example :
X+Y = 4 entails the sentence 4 = X+Y
Logical inference : the process of using entailment to derive conclusions .
Model checking : enumerates all possible models to check that a sentence α is true
in all models in which KB is true .
-Model checking works if the space of models is finite .
* There are 23 =8 possible models
• No pit in [1,1]
• R1: ¬P1,1
• Pits cause breezes in adjacent squares
• R2: B1,1 (P1,2 ˅ P2,1)
• R3: B2,1 (P1,1 ˅ P2,2 ˅ P3,1)
• For first two squares
• R4: ¬B1,1
• R5: B2,1
Wumpus World Symbols and Sentences Ri
Equivalence, validity, and satisfiability
Some logical additional concepts related to entailment:
• Logical equivalence – two sentences α and β are
logically equivalent if they are true in the same set of
models.
• Validity – a sentence is valid if it is true in all
models.
• Valid sentences are also called tautologies –
sentences that are necessarily true.
Equivalence, validity, and satisfiability
• Satisfiability a sentence is satisfiable if it is true in
some model.
• Determining satisfiability in propositional logic is
was proved to be Np-complete.
Standard logical equivalences
You need to
know these !
Reasoning Patterns in Propositional Logic
• Inference rules used to derive chains of conclusions that lead
to the desired goal
• Common Patterns:
• "If you have a current password, then you can log on to the network"
• "You have a current password“
Therefore
Therefore
P1,3
7.5.2 proof by resolution
True!
False in
all worlds
A resolution algorithm
7.5.3 Horn clauses and definite clauses
• Some real-world knowledge bases satisfy certain
restrictions on the form of sentences they contain.
which enables them to use a more restricted and
efficient inference algorithm.
Such restricted forms are :
• Definite clause – disjunction of literals, of which exactly
one is positive e.g. ¬P1 ˅ ¬P2 ˅ ¬P3 ˅ P4
• Horn clause – a disjunction of literals at most one of
which is positive e.g. ¬P1 ˅ ¬P2, or ¬P3 ˅ P4
- Can be used with forward chaining or backward chaining
- Deciding entailment is linear in the size of KB
• Goal clause – a clause with no positive literals, ¬P1˅¬P2
7.5.3 Horn clauses and definite clauses
Forward chaining
• It begins from known facts (positive literals) in the KB. If
all the premises of an implication are known, then its
conclusion is added to the set of known facts. For example,
if L1,1 and Breeze are known and (L1,1 ∧ Breeze) ⇒ B1,1 is in
the KB, then B1,1 can be added.
• a sound and complete inference algorithm that is essentially
Modus Ponens
7.5.4 Forward and backward chaining
37
KB
AND-OR graph
Agenda
A
B
L
M
P
A B L, A B Q
Every step is Modus Ponens, e.g.
L
38
KB
39