Logical Agents
Logical Agents
1
LOGICAL AGENTS
2
“ In which we design agents that can form
representationsof the world, use a
process ofinferenceto derive new
representations about the world, and
use these new representations to
deducewhat to do.
3
4
▰ A knowledge
-based agent must be able to do the following:
▰ An agent should be able to represent states, actions, etc.
▰ An agent Should be able to incorporate new percepts
▰ An agent can update the internal representation of the world
▰ An agent can deduce the internal representation of the world
▰ An agent can deduce appropriate actions.
5
6
A knowledge
-based agent
7
▰ Inference system - To add/update some new
information or sentences in the knowledge-
based system.
▰ Helps in making conclusions by applying
logical rules.
8
9
FUNCTIONS
11
Various levels of
knowledge-based agent:
12
▰ Implementation level - agent perform actions
as per logical and knowledge level.
13
The Wumpus World environment
15
▰ Pits: Dangerous holes in the ground that will
cause the agent to fall and lose the game if it
steps into them. These are randomly placed
in the grid.
▰ Gold:The item the agent is trying to find.
Once found, the agent must return to the
starting position to win the game.
16
PEAS description of Wumpus world
▰ Performance measure:
▰ (+1000)
▰ (-1000)
▰ (-1)
▰ (-10)
17
▰ Environment
▰ 4X4 grid of rooms
▰ The player always starts in the square labeled
[1,1] and facing towards the right.
18
▰ Actuators
▰ Left turn,
▰ Right turn
▰ Move forward
▰ Grab
▰ Shoot
▰ Climb
19
▰ Sensors:
▰ Stench
▰ Breeze
▰ Glitter
▰ Bump
▰ Scream (shot Wumpus)
20
Wumpus world Properties
• Partially observable: The Wumpus world is
partially observable because the agent can
only perceive the close environment such as
an adjacent room.
• Deterministic: It is deterministic, as the result
and outcome of the world are already known.
• Sequential: The order is important, so it is
sequential
21
• Static: It is static as Wumpus and Pits are not
moving.
• Discrete: The environment is discrete.
• One agent: The environment is a single agent
as we have one agent only and Wumpus is not
considered as an agent.
22
Exploring the Wumpus world
23
Exploring the Wumpus world
24
Logic
28
Characteristics of a Proposition:
•P→Q
•¬P∨Q
38
Entailment
A set of sentences (called premises) logically entails a
sentence (called a conclusion) if and only if every truth
assignment that satisfies the premises also satisfies the
conclusion.
▰ Entailment means that one thing follows logically from
another:
α |=β and β |= α
Where α is true and β is also true.
P⊨(P∨Q)
39
▻ E.g.,the sentence (A) The president was
assassinated. entails (B) The president is
dead.”
▻ E.g., x+y = 4 entails 4 = x+y
▻ Entailment is a relationship between
sentences (i.e., syntax) that is based on
semantics
40
▰ Validity-the sentence P∨ ¬P is valid. Valid
sentences are also known as tautologies
41
Inference
▰ Inference rules are the templates for
generating valid arguments.
▰ Inference rules are applied to derive proofs in
artificial intelligence.
▰ proof is a sequence of the conclusion that
leads to the desired goal. Inference
–
Process through which conclusions are
made.
42
▰ Implication:It is one of the logical
connectives which can be represented as P
→ Q. It is a Boolean expression.
▰ Converse:The converse of implication, which
means the right-hand side proposition goes
to the left-hand side and vice-versa. It can be
written as Q → P.
43
▰ Contrapositive:The negation of converse is
termed as contrapositive, and it can be
represented as ¬ → Q ¬ P.
▰ Inverse:The negation of implication is called
inverse. It can be represented as ¬ P → ¬ Q.
44
45
Types of Inference rules:
47
▰ Eg: if (WumpusAhead ∧WumpusAlive) ⇒
Shoot
▰ and (WumpusAhead ∧ WumpusAlive) are
given, then Shoot can be inferred.
48
Proof by resolution
49
▰ This process continues until one of the two
things happen:
▰· There are no new clauses that can be
added
▰· An application of the resolution rule
derives the empty clause
50
▰ Clause: Disjunction of literals (an atomic sentence) is
called aclause. It is also known as a unit clause.
▰ Conjunctive Normal Form : A sentence represented as
a conjunction of clauses is said toconjunctive
be
normal formor CNF.
▰ The purpose of the proof of resolutionis to
demonstrate the validity of logical statements and to
derive conclusions from a set of premises using a
systematic method.
51
▰ Conversion of facts into first
-order logic.
▰ Convert FOL statements into CNF
▰ Negate the statement which needs to prove
(proof by contradiction)
▰ Draw resolution graph (unification).
52
Steps for Resolution:
53
▰ Apply the Resolution Rule
▰ Identify Pairs of Clauses to Resolve:
▻ Look for two clauses where one contains a literal and the other
contains its negation.
▰ Perform Resolution:
▻ Resolve by combining the clauses and eliminating the
complementary literals.
▰ Derive a Contradiction
▰ Check for Empty Clause
54
55
Example:
56
▰ Assignment: write a short note on forward
chaining and backward chaining algorithm
57