AIML Unit - II
AIML Unit - II
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
2. These agents can represent the world with some formal representation and act intelligently.
1. Knowledge-base and
Inference system
• 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 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
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.
Knowledge level
• Knowledge level is the first level of knowledge-based agent,
• 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 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.
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.
• 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.
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:
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 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".