You are on page 1of 28

KNOWLEDGE AND REASONING

Knowledge is the information


possessed by a system, while
reasoning is the process of
deriving conclusions or making
decisions based on this
information, fundamental for
intelligent systems in AI.
AGENTS

Agents are entities that can


perceive their environment
through sensors and act upon
that environment through
actuators. Environments are the
external surroundings in which
agents operate, providing inputs
and receiving outputs
EXAMPLES OF INTELLIGENT AGENTS

1)Human Agent:
• Sensors: Eyes, Skin, Ears, Nose, Tongue
• Actuators: Hands, Legs

2)Robot Agent:
• Sensors: Camera, Informed range finders, etc
• Actuators: Various types of motors,
Printing devices, etc.
KNOWLEDGE BASED AGENTS
• Knowledge based agents are the agents with
specific knowledge.
• Knowledge based agents update their knowledge
based on the environment they are present in.
• Knowledge based agents can take actions based on
the knowledge it has.
• Normal agents cannot do all these things.
• There are two most important components of
Knowledge based agents: Knowledge base and
inference engine.
1. KNOWLEDGE BASE

• Central and most important component of


knowledge based agents.
• Knowledge base has sentences.
• Sentences in a knowledge base are simple
statements of facts about the world,
organized in a structured format and used by
a system to reason and make decisions.
INFERENCE ENGINE

• Inference means deriving new sentences from


old sentences.
• Because of inference engine, we can add new
sentences to the knowledge base.
• Inference engine is capable of generating new
facts and characteristics for things. This helps
update knowledge base even more.
LEVELS OF KNOWLEDGE BASED AGENTS
There are three different levels of knowledge based LEVELS OF
KNOWLEDGE
agents: BASED AGENTS

1. Knowledge level: Specifies what agent knows and


what its goal is.
Knowledge Level
2. Logical level: Different logics are used to build
sentences.
Logical Level
3. Implementation level: Considers all things
mentioned in knowledge level and logical level Implementation Level
and implements them and achieves targets.
WUMPUS WORLD PROBLEM

• The Wumpus World problem is a classic


challenge in the field of artificial
intelligence.
• Inspired by the game "Hunt the Wumpus,"
it presents a scenario where an agent must
navigate a hazardous cave to find treasure
while avoiding dangerous creatures.
WUMPUS WORLD PROBLEM
• Problem statement:
The Wumpus World problem challenges
an agent to navigate a hazardous cave with
16 rooms(4*4), avoiding pits and a deadly
Wumpus while searching for gold, using
limited sensory information and strategic
decision-making.
Everything in this problem happens
either horizontally or vertically.
RULES OF THE ENVIRONMENT
• Movement: The agent can move one square at a
time in any of the four cardinal directions (up,
down, left, right).
• Perception: The agent senses nearby hazards
(pits or the Wumpus) through smell and senses
gold through glitter in adjacent squares.
• Consequences:
• Falling into a pit or encountering the Wumpus
results in failure, ending the game.
• Collecting gold and returning to the starting position
leads to success.
• Shooting the Wumpus successfully eliminates the
threat, but the arrow has a limited range.
P.E.A.S PROPERTIES
• Performance measures:
We can measure the performance of the
agent because of agents performance measure.
1. If agent successfully reaches its start state
after collecting gold, he will get +100 points.
2. -1 point for every action performed by agent.
3. -10 points, if agent uses arrow.
4. -200 points, if agent dies.
ENVIRONMENT, SENSORS AND EFFECTORS
1. Environment: Empty rooms, room with
Wumpus, breezy room, stenchy rooms, pit
rooms, room with gold, arrow.
2. Sensors: Camera, Odor sensors(sense
stench), audio sensors(hear Wumpus scream
after hit by an arrow).
3. Effectors: Motor to move, robotic arm to
grab gold, robotic machine to shot arrow.
ACTUAL WORKING
KNOWLEDGE REPRESENTATION
• Knowledge representation involves organizing
information in a structured format that KNOWLEDGE
computers can understand and manipulate. REPRESENTATION

• It allows AI systems to store, process and utilize


knowledge to solve problems and make
Propositional Logic
decisions effectively.
• Two types of Knowledge Representation: First Order Logic(FOL)

1. Propositional Logic
2. First Order Logic(FOL)
1. PROPOSITIONAL LOGIC
• Propositional logic simplifies complex statements into symbols and logical operators,
facilitating analysis of truth values and relationships without considering internal
structures.
• Symbols of propositional logic:
Symbols are used in propositional logic to represent English written sentences in a
form that is machine understandable.
EXAMPLES OF PROPOSITIONAL LOGIC
• X: It is cold.
Y: It is sunny.
Z: It is breezy.
1. It is not cold.
ans: ~x
2. It is cold and breezy.
ans: x^z
3. If it is breezy, then it is not sunny.
ans: z ~y
EXAMPLES OF PROPOSITIONAL LOGIC

1. Manan did not kill Kajal.

Ans: kill(Manan, Kajal)

Action word Action is performed on

Action performed by
FIRST ORDER LOGIC
• First order logic are more expressive than propositional logic, because they
use quantifiers along with symbols used in propositional logic.
• FOL is widely used as compared to propositional logic.
¬ (Negation), ∧ (Conjunction), ∨ (Disjunction), → (Implication), ↔
Connectives
(Biconditional)

Quantifiers ∀ (Universal Quantifier), ∃ (Existential Quantifier)

Variables x, y, z, ... (Variable symbols)

Constants a, b, c, ... (Constant symbols)

Predicates P, Q, R, ... (Predicate symbols)


QUANTIFIERS IN FOL
1.Universal Quantifiers: "∀" (for all) denotes that a statement holds true for all
instances of a variable. Universal Quantifier (∀): Pronounced as "for all" or "for
every".
2. Existential Quantifiers: "∃" (there exists) indicates that at least one instance of a
variable satisfies a statement. Existential Quantifier (∃): Pronounced as "there
exists" or "there is".
Example:
1) All boys like cricket.
ans: ∀x (Boy(x) → LikesCricket(x))
2) Some boys like football.
ans: ∃x (Boy(x) ∧ LikesFootball(x))
INFERENCE IN FOL
• In first-order logic (FOL), inference refers to the process of deriving new
information or conclusions from existing knowledge or premises using
logical rules.
• It's like solving puzzles or connecting dots based on given clues.
• In simpler terms, inference in FOL involves using logical reasoning to figure
out what must be true based on what we already know.
FORWARD CHAINING
• In forward chaining, the data is already given at the initial stage and you have
to find goal state which means reach the conclusion.
• It is also called as data driven approach because whatever data is given, you
drive towards the conclusion using that data.
BACKWARD CHAINING
• Backward chaining is opposite to forward chaining.
• In backward chaining, the goal state is given, you have to find the initial
state.
• This approach is also called as Goal driven because you are aware about the
goal.
EXAMPLE OF FORWARD AND BACKWARD
CHAINING
• Data: x=1, y=2 F
O
B
A
R C
• Rules: If(x==1 & y==2) W
A
K
W
R A
Then z=3; D
C
R
D
H C
If(z==3) A
I
H
A
N I

Then a=4 I
N
N
I
G N

• Conclusion: a=4 G
KNOWLEDGE ENGINEERING IN FOL
• Involves process of representing knowledge in a structured and logical
manner so that it can be effectively utilized by computer system on other
knowledge based systems.
• In knowledge engineering, unification and resolution are fundamental
concepts used in inference and reasoning, particularly in logic based systems
like FOL.
UNIFICATION RESOLUTION
UNIFICATION
• The process of finding a substitution that makes two logical expressions identical is called
Unification.
• It simply means making expressions look identical.
• Unification is done using the process of simplification.
• Example:
p(x, f(y))_________1
p(a, f(g(2))_________2
1 and 2 are identical if x is replaced with a and y is replaced with g(2).
p(a, f(g(2))

Unification is written as:[a/x, g(2)/y] This is called substitution set

X is replaced by a y is replaced by g
(2)
RESOLUTION
• Resolution is an inference rule used in logic for proving the validity of a
statement by contradiction.
• Resolution is based on the principle of refutation: To prove a statement,
assume the negation of the statement to derive a contradiction.
• Example:
1.Alice is a musician or Alice is a painter.
2.Alice is not a painter.
• By applying resolution, we can infer:
• Alice is a musician.
• This inference is made by resolving the two statements to derive the conclusion that Alice must be
a musician, as she cannot be both a painter and not a painter simultaneously.
PROBLEMS: SOLVE USING PL

1. Manan eats mango biscuits.


2. Anurag watches Elite or GOT.
3. x: It is cold.
y: It is sunny.
z: It is Breezy.
• If it is breezy and cold, then it is not sunny.
EDUCATE

EMPOWER

ILLUMINATE

You might also like