0% found this document useful (0 votes)
25 views18 pages

AI 3rd Unit Notes

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)
25 views18 pages

AI 3rd Unit Notes

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/ 18

Artificial Intelligence and Application

Unit -3
KNOWLEGDE REPRESENTATION

Knowledge Representation :
▪ Knowledge-Based Agents.
▪ The Wumpus World, Logic,
▪ Propositional Logic, Propositional Theorem Proving,
▪ Effective Propositional Model Checking.
▪ Agents Based on Propositional Logic,
▪ First-Order Logic-Syntax and Semantics of First-Order Logic,
▪ Using First-Order Logic,
▪ Unification and Lifting Forward Chaining,
▪ Backward Chaining
Artificial Intelligence and Application

✓ What is Knowledge Representation?

▪ Knowledge Representation in AI describes the representation of knowledge.


▪ Basically, it is a study of how the beliefs, intentions, and judgments of an intelligent agent can be expressed suitably for automated reasoning.
▪ One of the primary purposes of Knowledge Representation includes modeling intelligent behavior for an agent.
▪ Knowledge Representation and Reasoning (KR, KRR) represents information from the real world for a computer to understand and then utilize this
knowledge to solve complex real-life problems like communicating with human beings in natural language.
▪ Knowledge representation in AI is not just about storing data in a database, it allows a machine to learn from that knowledge and behave
intelligently like a human being.

The different kinds of knowledge that need to be represented in AI include:

▪ Objects
▪ Events
▪ Performance
▪ Facts
▪ Meta-Knowledge
▪ Knowledge-base
Artificial Intelligence and Application

Different Types of Knowledge

There are 5 types of Knowledge such as:

▪ Declarative Knowledge – It includes concepts, facts, and objects and expressed in a declarative sentence.

▪ Structural Knowledge – It is a basic problem-solving knowledge that describes the relationship between
concepts and objects.

▪ Procedural Knowledge – This is responsible for knowing how to do something and includes rules, strategies,
procedures, etc.

▪ Meta Knowledge – Meta Knowledge defines knowledge about other types of Knowledge.

▪ Heuristic Knowledge – This represents some expert knowledge in the field or subject.

These are the important types of Knowledge Representation in AI. Now, let’s have a look at the cycle of knowledge
representation and how it works.
Artificial Intelligence and Application

✓ Knowledge-Based Agents.

▪ An intelligent agent needs knowledge about the real world for taking decisions and reasoning to act efficiently.
▪ Knowledge-based agents are those agents who have the capability of maintaining an internal state of knowledge, reason over that knowledge, update
their knowledge after observations and take actions. These agents can represent the world with some formal representation and act intelligently.
▪ Knowledge-based agents are composed of two main parts:
▪ Knowledge-base and
▪ Inference system.

A knowledge-based agent must 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.
Artificial Intelligence and Application

The architecture of knowledge-based agent :

▪ The above diagram is representing a generalized architecture for a knowledge-based agent.


▪ The knowledge-based agent (KBA) take input from the environment by perceiving the environment.
▪ The input is taken by the inference engine of the agent and which also communicate with KB to decide as per the knowledge store in KB.
▪ The learning element of KBA regularly updates the KB by learning new knowledge.
▪ Knowledge base: Knowledge-base is a central component of a knowledge-based agent, it is also known as KB.
▪ It is a collection of sentences (here 'sentence' is a technical term and it is not identical to sentence in English).
▪ These sentences are expressed in a language which is called a knowledge representation language.
▪ The Knowledge-base of KBA stores fact about the world.
Artificial Intelligence and Application

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 deduce 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:
1. Forward chaining
2. Backward chaining

Operations Performed by KBA

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

▪ TELL: This operation tells the knowledge base what it perceives from the environment.
▪ ASK: This operation asks the knowledge base what action it should perform.
▪ Perform: It performs the selected action.
Artificial Intelligence and Application

Various levels of knowledge-based agent:

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

1. 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.
▪ 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.

2. Logical level:
▪ At this level, we understand that how the knowledge representation of knowledge is stored. At this level, sentences are encoded 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.

3. Implementation level:
▪ This is the physical representation of logic and knowledge.
▪ At the implementation level agent perform actions as per logical and knowledge level.
▪ At this level, an automated taxi agent actually implement his knowledge and logic so that he can reach to the destination.
Artificial Intelligence and Application

✓ Wumpus World

▪ The Wumpus world is a simple world example to illustrate the worth of a knowledge-based agent and to represent knowledge representation.
▪ It was inspired by a video game Hunt the Wumpus by Gregory Yob in 1973.
▪ The Wumpus world is a cave which has 4/4 rooms connected with passageways.
▪ So there are total 16 rooms which are connected with each other.
▪ We have a knowledge-based agent who will go forward in this world.
▪ The cave has a room with a beast which is called Wumpus, who eats anyone who enters the room.
▪ The Wumpus can be shot by the agent, but the agent has a single arrow.
▪ In the Wumpus world, there are some Pits rooms which are bottomless, and if agent falls in Pits, then he will be stuck there forever.
▪ The exciting thing with this cave is that in one room there is a possibility of finding a heap of gold.
▪ So the agent goal is to find the gold and climb out the cave without fallen into Pits or eaten by Wumpus.
▪ The agent will get a reward if he comes out with gold, and he will get a penalty if eaten by Wumpus or falls in the pit.

Following is a sample diagram for representing the Wumpus world. It is showing some rooms with Pits, one room with Wumpus and one
agent at (1, 1) square location of the world.
Artificial Intelligence and Application

There are also some components which can help the agent to navigate the cave. These components are given as follows:

1) The rooms adjacent to the Wumpus room are smelly, so that it would have some
stench.

2) The room adjacent to PITs has a breeze, so if the agent reaches near to PIT, then he
will perceive the breeze.

3) There will be glitter in the room if and only if the room has gold.

4) The Wumpus can be killed by the agent if the agent is facing to it, and Wumpus will
emit a horrible scream which can be heard anywhere in the cave.
Artificial Intelligence and Application

PEAS description of Wumpus world:

To explain the Wumpus world we have given PEAS description as below:

Performance measure:
▪ +1000 reward points if the agent comes out of the cave with the gold.
▪ -1000 points penalty for being eaten by the Wumpus or falling into the pit.
▪ -1 for each action, and -10 for using an arrow.
▪ The game ends if either agent dies or came out of the cave.

Environment:

▪ A 4*4 grid of rooms.


▪ The agent initially in room square [1, 1], facing toward the right.
▪ Location of Wumpus and gold are chosen randomly except the first square [1,1].
▪ Each square of the cave can be a pit with probability 0.2 except the first square.

Actuators:

▪ Left turn,
▪ Right turn
▪ Move forward
▪ Grab
▪ Release
▪ Shoot.
Artificial Intelligence and Application

Sensors:

▪ The agent will perceive the stench if he is in the room adjacent to the Wumpus. (Not diagonally).
▪ The agent will perceive breeze if he is in the room directly adjacent to the Pit.
▪ The agent will perceive the glitter in the room where the gold is present.
▪ The agent will perceive the bump if he walks into a wall.
▪ When the Wumpus is shot, it emits a horrible scream which can be perceived anywhere in the cave.
▪ These percepts can be represented as five element list, in which we will have different indicators for each sensor.
▪ Example if agent perceives stench, breeze, but no glitter, no bump, and no scream then it can be represented as:
[Stench, Breeze, None, None, None].

The 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.
▪ 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.
Artificial Intelligence and Application

Exploring the Wumpus world:


Now we will explore the Wumpus world and will determine how the agent will find its goal by applying logical reasoning.

Agent's First step:

▪ Initially, the agent is in the first room or on the square [1,1], and we already know that this room is safe for the agent, so to represent on the
below diagram (a) that room is safe we will add symbol OK.
▪ Symbol A is used to represent agent, symbol B for the breeze, G for Glitter or gold, V for the visited room, P for pits, W for Wumpus.
▪ At Room [1,1] agent does not feel any breeze or any Stench which means the adjacent squares are also OK.
Artificial Intelligence and Application
Agent's second Step:
▪ Now agent needs to move forward, so it will either move to [1, 2], or [2,1].
▪ Let's suppose agent moves to the room [2, 1], at this room agent perceives some breeze which means Pit is around this room.
▪ The pit can be in [3, 1], or [2,2], so we will add symbol P? to say that, is this Pit room?
▪ Now agent will stop and think and will not make any harmful move.
▪ The agent will go back to the [1, 1] room. The room [1,1], and [2,1] are visited by the agent, so we will use symbol V to represent the visited squares.
Agent's third step:
▪ At the third step, now agent will move to the room [1,2] which is OK.
▪ In the room [1,2] agent perceives a stench which means there must be a Wumpus nearby.
▪ But Wumpus cannot be in the room [1,1] as by rules of the game, and also not in [2,2] (Agent had not detected any stench when he was at [2,1]).
▪ Therefore agent infers that Wumpus is in the room [1,3], and in current state, there is no breeze which means in [2,2] there is no Pit and no Wumpus.
▪ So it is safe, and we will mark it OK, and the agent moves further in [2,2].

Agent's fourth step:


At room [2,2], here no stench and no breezes present so let's suppose agent decides to move to [2,3]. At room [2,3] agent perceives glitter, so it should
grab the gold and climb out of the cave.
Artificial Intelligence and Application
✓ Propositional logic
▪ Propositional logic, also known as propositional calculus, is a branch of formal logic that deals with propositions or statements, and the logical
relationships between them.
▪ In the context of artificial intelligence (AI), propositional logic serves as a foundational framework for representing and manipulating knowledge.
▪ Its purpose in AI is to provide a structured and formal way to express and reason about facts, information, and their relationships.
▪ In AI, propositional logic is essential for tasks such as knowledge representation, reasoning, and decision-making.
▪ It enables AI systems to model the world, infer new information from existing knowledge, and make intelligent choices based on logical
deductions.
▪ By using propositions and logical operators, AI systems can process information in a way that resembles human thought processes, making it a
vital tool for various AI applications.

Explain the Key Components of Propositional Logic:

1. Propositions (Statements):

▪ In propositional logic, propositions are the basic building blocks.


▪ A proposition represents a declarative statement that can be either true or false but not both.
▪ These statements can be about anything, from simple facts to more complex statements.
▪ For example, "The sky is blue" is a proposition because it can be evaluated as either true or false.
Artificial Intelligence and Application

2. Logical Operators:

▪ AND (Conjunction): The AND operator, often represented by ∧, is used to combine two or more propositions. It yields a true result only when all the
propositions it connects are true. For example, if P represents "It's raining" and Q represents "I have an umbrella," then P ∧ Q is true only if both "It's
raining" and "I have an umbrella" are true.

▪ OR (Disjunction): The OR operator, represented by ∨, combines propositions and results in true if at least one of the connected propositions is true.
For instance, if P represents "It's sunny" and Q represents "It's warm," then P ∨ Q is true if either "It's sunny" or "It's warm" or both are true.

▪ NOT (Negation): The NOT operator, represented by ¬, is used to negate or reverse the truth value of a single proposition. If P is "The store is open,"
then ¬P is true if the store is not open.

3. Truth Values (True and False):

▪ Every proposition in propositional logic has one of two possible truth values—true or false.
▪ These truth values indicate whether the statement is valid or not in a given context.
Artificial Intelligence and Application

Truth Tables for Different Logical Operators (AND, OR, NOT):

Here are truth tables for the basic logical operators in propositional logic:

1. Conjunction (AND, ∧) Truth Table: 3. Negation (NOT, ¬) Truth Table:

2. Disjunction (OR, ∨) Truth Table:


Artificial Intelligence and Application
✓ First-Order logic:
▪ First-order logic is another way of knowledge representation in artificial intelligence. It is an extension to propositional logic.
▪ FOL is sufficiently expressive to represent the natural language statements in a concise way.
▪ First-order logic is also known as Predicate logic or First-order predicate logic. First-order logic is a powerful language that develops information
about the objects in a more easy way and can also express the relationship between those objects.
▪ First-order logic (like natural language) does not only assume that the world contains facts like propositional logic but also assumes the following
things in the world:
▪ Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus, ......
▪ Relations: It can be unary relation such as: red, round, is adjacent, or n-any relation such as: the sister of, brother of, has color, comes
between
▪ Function: Father of, best friend, third inning of, end of, ......
▪ As a natural language, first-order logic also has two main parts:
▪ Syntax
▪ Semantics
✓ Semantics of First-Order Logic

Semantics in first-order logic deals with the interpretation of sentences and formulas within the framework of a mathematical model. It provides a way to assign
meanings to the symbols and structures used in first-order logic.

Key Elements of Semantics in First-Order Logic

▪ Variables: These represent placeholders for objects or elements within a domain.


▪ Constants: These represent specific elements within the domain.
▪ Predicates: These are expressions that can be true or false depending on the objects they’re applied to.
▪ Functions: These map elements from the domain to other elements in the domain.
▪ Quantifiers: Such as “for all” (∀) and “exists” (∃), used to express universal and existential quantification, respectively.
Artificial Intelligence and Application

✓ Difference between Forwarding Chaining and Backward Chaining:

Forward Backward

When based on available data a decision is taken then the process is Backward chaining starts from the goal and works backward to determine
1.
called as Forward chaining. what facts must be asserted so that the goal can be achieved.

Forward chaining is known as data-driven technique because we reaches Backward chaining is known as goal-driven technique because we start from
2.
to the goal using the available data. the goal and reaches the initial state in order to extract the facts.

3. It is a bottom-up approach. It is a top-down approach.

4. It applies the Breadth-First Strategy. It applies the Depth-First Strategy.

5. Its goal is to get the conclusion. Its goal is to get the possible facts or the required data.

6. Slow as it has to use all the rules. Fast as it has to use only a few rules.

It operates in forward direction i.e it works from initial state to final


7. It operates in backward direction i.e it works from goal to reach initial state.
decision.

Forward chaining is used for the planning, monitoring, control, and It is used in automated inference engines, theorem proofs, proof assistants
8.
interpretation application. and other artificial intelligence applications.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy