0% found this document useful (0 votes)
15 views9 pages

AIML Unit - II

The document discusses knowledge-based agents and propositional logic. Knowledge-based agents maintain an internal knowledge base and use inference to reason about the world and take actions. They are composed of a knowledge base and inference system. Propositional logic represents statements as propositions that can be true or false and uses logical connectives. The Wumpus world is given as an example of a knowledge-based agent problem.

Uploaded by

ANJI PRASAD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views9 pages

AIML Unit - II

The document discusses knowledge-based agents and propositional logic. Knowledge-based agents maintain an internal knowledge base and use inference to reason about the world and take actions. They are composed of a knowledge base and inference system. Propositional logic represents statements as propositions that can be true or false and uses logical connectives. The Wumpus world is given as an example of a knowledge-based agent problem.

Uploaded by

ANJI PRASAD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

1

UNIT– II:
Knowledge–Representation and Reasoning:
Logical Agents: Knowledge based agents,
The Wumpus world, logic.
Patterns in Propositional Logic,
Inference in First-Order Logic-Propositional
vs first order inference,
unification and lifting

Knowledge-Based Agent, Logic


An intelligent agent needs knowledge about the real world for taking decisions
and reasoning to act efficiently.
1. Knowledge-based agents are those agents who have the capability of maintaining an
internal knowledge, reason over that knowledge, update their knowledge after observations
and take actions.

2. These agents can represent the world with some formal representation and act intelligently.

3. Knowledge-based agents are composed of two main parts:

1. Knowledge-base and

2. Reasoning (Inference) system.


A knowledge-based agent must able to do the following:

• Agent should be able to identify states, actions, etc.


• An agent Should be able to Update knowledge with new percepts
• An agent can update the internal representation of the world
• An agent can trace the internal representation of the world
• An agent can perform appropriate actions.

The architecture of knowledge-based agent:


2

• The above diagram is representing a generalized architecture for a knowledge-based


agent.
• The knowledge-based agent (KBA) take input from the environment
• The input is taken by the sensor of the agent and
• Agent which also communicate with KB to decide as per the knowledge store in KB.
• Knowledge Base Agent regularly updates the KB by learning new knowledge.
Knowledge base: Knowledge-base is a central component of a knowledge-based agent.

Why use a knowledge base?


• Knowledge-base is required for updating knowledge for an agent to learn with experiences
and take action as per the knowledge.

Inference system

• Inference means deriving new sentences from old.


• Inference system allows us to add a new sentence to the knowledge base.
• A sentence is a proposition about the world.
• Inference system applies logical rules to the KB to add new information.
• Inference system generates new facts so that an agent can update the KB. An inference
system works mainly in two rules which are given as:
3

• Forward chaining
• Backward chaining
• Operations Performed by KBA
• Following are three operations which are performed by KBA in order to show the
intelligent behavior:

Inference system
Inference means deriving new sentences from old.

Inference system allows us to add a new sentence to the knowledge base.

Inference system add logical rules to the KB.

Inference system generates new facts so that an agent can update the KB.

An inference system works mainly in two rules which are given as:

o Forward chaining

o Backward chaining

Operations Performed by KBA


Following are three operations which are performed by KBA in order to show the
intelligent behavior:

1. TELL: This operation tells the knowledge base what it perceives from the environment.

2. ASK: This operation asks the knowledge base what action it should perform.

3. Perform: It performs the selected action.

Various levels of knowledge-based agent:


A knowledge-based agent can be viewed at different levels which are given below:

Knowledge level
• Knowledge level is the first level of knowledge-based agent,

• And in this level, we need to specify what the agent knows,

• And what the agent goals are.


4

• With these specifications, we can fix its behavior.

• For example, suppose an automated taxi agent needs to go from a station A to station
B,

• And he knows the way from A to B, so this comes at the knowledge level.

Logical level:
• At this level, we understand that how the knowledge representation of knowledge is stored.

• At this level, sentences are converts into different logics.

• At the logical level, an encoding of knowledge into logical sentences occurs.

• At the logical level we can expect to the automated taxi agent to reach to the destination B.

Implementation level:
• Implementation level agent automatically implement knowledge based on some logics.
• Example Automatic Cars , Users just mentioned the destinations.
• At this level, an automated car agents actually implement knowledge based on logic
• So that car can reach to the destination.

The Wumpus world

1. Wumpus World’s agent is an example of a knowledge-based agent that represents Knowledge


representation, reasoning and planning.
2. Knowledge-Based agent links general knowledge with current percepts to infer hidden
characters of current state before selecting actions.
3. Its necessity is vital in partially observable environments.

Problem Statement:
The Wumpus world is a cave with 16 rooms (4×4).
4. Each room is connected to others through walkways (no rooms are connected diagonally).
5. The knowledge-based agent starts from Room[1, 1].
6. The cave has – some pits, a treasure and a beast named Wumpus.
7. The Wumpus can not move but eats the one who enters its room.
8. If the agent enters the pit, it gets stuck there.
9. The goal of the agent is to take the treasure and come out of the cave.
10. The agent is rewarded, when the goal conditions are met.
5

11. The agent is penalized, when it falls into a pit or being eaten by the Wumpus.
Some elements support the agent to explore the cave, like -The wumpus’s adjacent rooms are
stenchy. –
12. The agent is given one arrow which it can use to kill the wumpus when facing it (Wumpus
screams when it is killed). –
13. The adjacent rooms of the room with pits are filled with breeze. –
14. The treasure room is always glittery.

PEAS represents Performance Measures, Environment, Actuators, and Sensors. The PEAS description
helps in grouping the agents.

PEAS Description for the Wumpus World problem:


1. Performance measures:
• Agent gets the gold and return back safe = +1000 points
• Agent dies = -1000 points
• Each move of the agent = -1 point
• Agent uses the arrow = -10 points
2. Environment:
• A cave with 16(4×4) rooms
• Rooms adjacent (not diagonally) to the Wumpus are stinking
• Rooms adjacent (not diagonally) to the pit are breezy
• The room with the gold glitters
• Agent’s initial position – Room[1, 1] and facing right side
• Location of Wumpus, gold and 3 pits can be anywhere, except in Room[1, 1].
3. Actuators:
Devices that allow the agent to perform the following actions in the environment.
6

• Move forward
• Turn right
• Turn left
• Shoot
• Grab
• Release
4. Sensors:
Devices which helps the agent in sensing the following from the environment.
• Breeze
• Stench
• Glitter
• Scream (When the Wumpus is killed)
• Bump (when the agent hits a wall)
Wumpus World Characterization:
• Partially Observable: knows only the local perceptions
• Deterministic: outcome is precisely specified
• Sequential: subsequent level of actions performed
• Static: Wumpus, pits are immobile
• Discrete: discrete environment
• Single-agent: The knowledge-based agent is the only agent whereas the wumpus is considered as
the environment’s feature.

Propositional logic
• Propositional logic (PL) is the simplest form of logic
• Where all the statements are made by propositions.
• A proposition is a declarative statement which is either true or false.
• It is a technique of knowledge representation in logical and mathematical form.

Example:
a) It is Sunday.
b) The Sun rises from West (False proposition)
c) 3+3= 7(False proposition)
d) 5 is a prime number.

Following are some basic facts about propositional logic:


7

• Propositional logic is also called Boolean logic as it works on 0 and 1.


• In propositional logic, we use symbolic variables to represent the logic, and we can use any symbol for a
representing a proposition, such A, B, C, P, Q, R, etc.
• Propositions can be either true or false, but it cannot be both.
• Propositional logic consists of an object, relations or function, and logical connectives.
• These connectives are also called logical operators.
• The propositions and connectives are the basic elements of the propositional logic.
• Connectives can be said as a logical operator which connects two sentences.
• A proposition formula which is always true is called tautology, and it is also called a valid sentence.
• A proposition formula which is always false is called Contradiction.
• A proposition formula which has both true and false values is called
• Statements which are questions, commands, or opinions are not propositions such as "Where is Rohini",
"How are you", "What is your name", are not propositions.
Syntax of propositional logic:
The syntax of propositional logic defines the allowable sentences for the knowledge representation. There are
two types of Propositions:

Atomic Propositions
Compound propositions
Atomic Proposition: Atomic propositions are the simple propositions. It consists of a single proposition
symbol. These are the sentences which must be either true or false.
Example:

a) 2+2 is 4, it is an atomic proposition as it is a true fact.


b) "The Sun is cold" is also a proposition as it is a false fact.
Compound proposition: Compound propositions are constructed by combining simpler or atomic propositions,
using parenthesis and logical connectives.
Example:

a) "It is raining today, and street is wet."


b) "Ankit is a doctor, and his clinic is in Mumbai."
Logical Connectives:
Logical connectives are used to connect two simpler propositions or representing a sentence logically.
We can create compound propositions with the help of logical connectives.
8

There are mainly five connectives, which are given as follows:

Negation: A sentence such as ¬ P is called negation of P. A literal can be either Positive literal or negative
literal.
Conjunction: A sentence which has ∧ connective such as, P ∧ Q is called a conjunction.
Example: Rohan is intelligent and hardworking. It can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.
Disjunction: A sentence which has ∨ connective, such as P ∨ Q. is called disjunction, where P and Q are the
propositions.
Example: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is Doctor, so we can write it as P ∨ Q.
Implication: A sentence such as P → Q, is called an implication. Implications are also known as if-then rules. It
can be represented as
If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is represented as P → Q
Biconditional: A sentence such as P⇔ Q is a Biconditional sentence, example If I am breathing, then I am alive
P= I am breathing, Q= I am alive, it can be represented as P ⇔ Q.
Following is the summarized table for Propositional Logic Connectives:

Inference in First-Order Logic-Propositional


9

Inference in First-Order Logic is used to deduce new facts or sentences from existing sentences. Before
understanding the FOL inference rule, let's understand some basic terminologies used in FOL.

Substitution:

Substitution is a fundamental operation performed on terms and formulas. It occurs in all inference systems in
first-order logic. The substitution is complex in the presence of quantifiers in FOL. If we write F[a/x], so it refers
to substitute a constant "a" in place of variable "x".

You might also like