Unit 2 - PPT
Unit 2 - PPT
Class - T.Y.
PLD(SEM-IV)
Unit - II
Knowledge Representation, Planning & Reasoning
AY 2024-2025
1
MIT School of Computing
Department of Computer Science & Engineering
Unit-II Syllabus
2
MIT School of Computing
Department of Computer Science & Engineering
Knowledge is the
information about a
domain that can be used
to solve problems in that
domain.
Importance of intelligence
4
MIT School of Computing
Department of Computer Science & Engineering
We have to induce right knowledge in the machine so that it can process it to take
right decision; like if we write right program we will get right output.
A machine sounds like an empty box unless it is encoded with some features or
information. Therefore, to make it a valuable machine, it is required to put the
necessary knowledge in it. So that it could understand it and is able to take the right
decisions.
There are three factors which are put into the machine, which makes it valuable:
1. Knowledge: The information related to the environment is stored in the
machine.
2. Reasoning: The ability of the machine to understand the stored knowledge.
3. Intelligence: The ability of the machine to make decisions on the basis of the
stored information.
All these things comes under knowledge representation and reasoning also known as
KR or KRR. It is the representation of the information that is extracted from the real
world and utilized for solving complex problems.
5
MIT School of Computing
Department of Computer Science & Engineering
6
MIT School of Computing
Department of Computer Science & Engineering
7
MIT School of Computing
Department of Computer Science & Engineering
Cont.
Structural knowledge:
Declarative knowledge:
• It is the basic knowledge to problem solving
• Describes what is known about problem
• describes relationships between various
• Tells us facts- what things are
concepts/objects
• Includes: concepts, facts and objects
• Also known as descriptive knowledge Meta knowledge:
• Describes knowledge about another
Procedural knowledge: knowledge
• Describes how to solve problem • Used to pick other knowledge that is best
• Also known as Imperative knowledge suited for solving a problem
• Provides direction on how to do
something Heuristic knowledge:
• Can be directly applied to a task. • It is representing knowledge of some experts
• Include: rules, strategies and in a field or subject
procedures • knowledge created by previous experiences,
approaches
8
MIT School of Computing
Department of Computer Science & Engineering
9
MIT School of Computing
Department of Computer Science & Engineering
10
MIT School of Computing
Department of Computer Science & Engineering
Inferential It is the ability of the system to directly add new knowledge in the
Efficiency system with efficiency.
11
MIT School of Computing
Department of Computer Science & Engineering
12
MIT School of Computing
Department of Computer Science & Engineering
Cont.
Logical Representation
It is the basic method used to represent the knowledge of a machine. The term logic
means to apply intelligence over the stored knowledge.
13
MIT School of Computing
Department of Computer Science & Engineering
Cont.
Rule-based System
In the rule-based system, we impose rules over the propositional logic and first-
order logic techniques. If-then clause is used for this technique. For example, if
there are two variables A and B. Value of both A and B is True. Consequently, the
result of both should also be True and vice-versa.
Semantic Networks
The technique is based on storing the knowledge into the system in the form of a
graph. Nodes of a graph represent the objects which exist in the real world, and the
arrow represents the relationship between these objects. Such techniques show the
connectivity of one object with another object.
14
MIT School of Computing
Department of Computer Science & Engineering
Cont.
Frames
In this technique, the knowledge is stored via slots and fillers. As we have seen in
DBMS, we store the information of an employee in the database, where, the Slots
are the entities and Fillers are its attributes. They are together stored in a frame.
So, whenever there is a requirement, the machine infers the necessary information
to take the decision.
Script is an advanced technique over the Frames. Here, the information is stored in
the form of a script. The script is stored in the system containing all the required
information. The system infers the information from that script and solves the
problem
15
MIT School of Computing
Department of Computer Science & Engineering
3. Finding the right structure: The information is stored in a large amount. The
question is how to access the relevant information out of whole?
16
MIT School of Computing
Department of Computer Science & Engineering
LOGICAL REPRESENTATION
Language with some concrete rules which deals with propositions and has no
ambiguity in representation.
It consists of precisely defined syntax and semantics which supports the sound
inference. Each sentence can be translated into logics using syntax and semantics.
Semantics
• Rules by which we can interpret the sentence in the logic.
• Defined the truth or meaning of sentence a world.
17
MIT School of Computing
Department of Computer Science & Engineering
18
MIT School of Computing
Department of Computer Science & Engineering
• Because it operates with 0 and 1, propositional logic is also known as Boolean logic.
• Symbolic variables are used to express the logic, and any symbol can be used to represent a
proposition, such as A, B, C, P, Q, R, and so on.
• Propositions can be true or false, but not both at the same time.
• An object, relations or functions, and logical connectives make up propositional logic.
• Logical operators are another name for these connectives.
• The essential parts of propositional logic are propositions and connectives.
• Connectives are logical operators that link two sentences together.
• Statements that are inquiries, demands, or opinions are not propositions, such as "Where is
Rohini", "How are you", and "What is your name" are not propositions.
19
MIT School of Computing
Department of Computer Science & Engineering
20
MIT School of Computing
Department of Computer Science & Engineering
21
MIT School of Computing
Department of Computer Science & Engineering
PROPOSITIONAL LOGIC
(LOGICAL CONNECTIVES)
Once the machine reads the message, it applies the Boolean logic-based formulas to create the
TRUE and FALSE chart to interpret the final output of a complex proposition.
Commutativity: Associativity:
P ∧ Q= Q ∧ P, or (P ∧ Q) ∧ R = P ∧ (Q ∧ R),
P ∨ Q = Q ∨ P. (P ∨ Q) ∨ R= P ∨ (Q ∨ R).
DE Morgan's Law:
Double-negation elimination:
¬(P ∧ Q) = (¬P) ∨ (¬Q),
¬(¬P) = P.
¬(P ∨ Q) = (¬ P) ∧ (¬Q).
23
MIT School of Computing
Department of Computer Science & Engineering
• This is not possible to represent relations like ALL, some, or none with propositional
logic.
Example:
All the girls are intelligent.
Some apples are sweet.
24
MIT School of Computing
Department of Computer Science & Engineering
FIRST-ORDER LOGIC
Propositional Logic is failed to represent complicated phrases or natural language statements.
"Some humans are intelligent"
PL logic is insufficient to represent. we required some more powerful logic, such as first-order
logic.
FOL is also called predicate logic.
FOL not only assumes that does the world contains facts (like PL does), but it also assumes the
following:
• Objects: A, B, people, numbers, colors, wars, theories, squares, pit, etc.
• Relations: It is unary relation such as red, round, sister of, brother of, etc.
• Function: best friend, third inning of, end of, etc.
25
MIT School of Computing
Department of Computer Science & Engineering
FIRST-ORDER LOGIC
First-order logic also has two main parts as a natural language:
(i) Syntax (ii) Semantics
26
MIT School of Computing
Department of Computer Science & Engineering
• Atomic sentences are the most fundamental first-order logic sentences. These
sentences are made up of a predicate symbol, a parenthesis, and a series of terms.
• Predicate can be used to represent atomic sentences (term1, term2, ......, term n).
• Predicate logic or First-order predicate logic are other names for first-order logic.
Example:
• Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
• Chinky is a cat: => cat (Chinky).
27
MIT School of Computing
Department of Computer Science & Engineering
28
MIT School of Computing
Department of Computer Science & Engineering
Quantifiers generate quantification and specify the number of specimen in the universe.
Quantifiers allow us to determine or identify the range and scope of the variable in a
logical expression.
29
MIT School of Computing
Department of Computer Science & Engineering
Quantifiers generate quantification and specify the number of specimen in the universe.
Specify that the statement within the range is true for everything or every instance of a particular
thing.
Universal quantifiers are denoted by a symbol (∀ ) that looks like an inverted A. In a universal
quantifier, we use → .
• For all x
• For every x
• For each x
30
MIT School of Computing
Department of Computer Science & Engineering
Explanation:
31
MIT School of Computing
Department of Computer Science & Engineering
Existential quantifiers are used to express that the statement within their scope is true for at least
one instance of something.
∃ , which looks like an inverted E, is used to represent them. We always use AND or conjunction
symbols.
• For some x
• There exists an x
• For at least one x
32
MIT School of Computing
Department of Computer Science &
Engineering
Explanation:
33
MIT School of Computing
Department of Computer Science & Engineering
EXAMPLES
All birds fly.
The predicate in this question is "fly(bird)."
Because all birds are able to fly, it will be portrayed as follows.
∀ x bird(x) →fly(x).
34
MIT School of Computing
Department of Computer Science & Engineering
EXAMPLES
Not all students like both Mathematics and Science.
The predicate in this question is "like(x, y)," where x= student, and y= subject.
Because there are not all students, so we will use ∀ with negation, so following portray
for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].
35
MIT School of Computing
Department of Computer Science & Engineering
Free Variable:
Bound Variable:
36
MIT School of Computing
Department of Computer Science & Engineering
37
MIT School of Computing
Department of Computer Science & Engineering
Cont.
Graphical notation for representing knowledge in interconnected nodes pattern.
rectangle
circle (physical) ellipse (concept)
(situation)
39
MIT School of Computing
Department of Computer Science & Engineering
Example
Mamm
Mat al Tom is a cat.
Tom caught a bird.
Tom is owned by John.
Tom is black in color.
Crea likes
Cat Animal Cats like cream.
m The cat sat on the mat.
A cat is a mammal.
A bird is an animal.
Tom Bird All mammals are animals
caught
Black John
40
MIT School of Computing
Department of Computer Science & Engineering
41
MIT School of Computing
Department of Computer Science & Engineering
42
MIT School of Computing
Department of Computer Science & Engineering
Knowledge Graph proposed by Google in 2012 uses semantic networks in the search
engines.
43
MIT School of Computing
Department of Computer Science & Engineering
Frame Representation
• Devised by Marvin Minsky, 1974
• A variant of semantic networks.
• Frames - semantic net with properties
• A frame is a record like structure which consists of a collection of attributes
and its values to describe an entity in the world.
• Frames are the AI data structure which divides knowledge into
substructures by representing stereotypes/fixed situations.
• It consists of a collection of slots and slot values.
• These slots may be of any type and size. Slots have names and values
which are called facets.
44
MIT School of Computing
Department of Computer Science & Engineering
Frame (Example)
45
MIT School of Computing
Department of Computer Science & Engineering
Frame types
Class Frame
Individual or Instance
Frame
46
MIT School of Computing
Department of Computer Science & Engineering
Frame Representation
Frames are more structured form of packaging knowledge, - used for representing
objects, concepts etc.
Lower level frames can inherit information from upper level frames in network.
47
MIT School of Computing
Department of Computer Science & Engineering
Frame Representation
A frame may have any number of slots needed for describing object. e.g.,
• faculty frame may have name, age, address, qualification etc. as slot names.
Each frame includes two basic element : slots and facets (aspects of a slot).
• Each slot may contain one or more facets (called fillers) which may take many
forms such as :
• value (value of the slot),
• default (default value of the slot),
• range (indicates the range of integer or enumerated values, a slot can
have),
• demons (procedural attachments such as if_needed, if_deleted, if_added
etc.) and
• other (may contain rules, other frames, semantic net or any type of other
information).
48
MIT School of Computing
Department of Computer Science & Engineering
49
MIT School of Computing
Department of Computer Science & Engineering
50
MIT School of Computing
Department of Computer Science & Engineering
Frames
• Each frame represent either a class or an instance.
• Class frame represents a general concept whereas instance frame represents a
Description
• Search will start from frame13 in upward direction till we get our answer or
have reached root frame.
• The frame can be easily represented in prolog by choosing predicate name as
frame with two arguments.
• First argument is the name of the frame and second argument is a list of slot -
facet pair
51
MIT School of Computing
Department of Computer Science & Engineering
52
MIT School of Computing
Department of Computer Science & Engineering
53
MIT School of Computing
Department of Computer Science & Engineering
Production Rules
Production rules system consist of (condition, action) pairs which mean, "If condition then
action".
This cycle of selecting the rule based on some conditions and consequently acting to solve the
problem is known as a recognition and act cycle.
The working memory contains the description of the current state of problems-solving and rule can
write knowledge to the working memory.
54
MIT School of Computing
Department of Computer Science & Engineering
Production Rules
If there is a new situation (state) generates, then multiple production rules will be fired
together, this is called conflict set. In this situation, the agent needs to select a rule
from working memory, and it is called a conflict resolution.
Example:
1. IF (at bus stop AND bus arrives) THEN action (get into the bus).
2. IF (on the bus AND paid AND empty seat) THEN action (sit down).
3. IF (on bus AND unpaid) THEN action (pay charges).
4. IF (bus arrives at destination) THEN action (get down from the bus).
55
MIT School of Computing
Department of Computer Science & Engineering
Disadvantages
• Does not exhibit any learning capabilities, as it does not store the result of the
problem for the future uses.
• During the execution of the program, many rules may be active hence rule-
based production systems are inefficient.
56
MIT School of Computing
Department of Computer Science & Engineering
57
MIT School of Computing
Department of Computer Science & Engineering
58
MIT School of Computing
Department of Computer Science & Engineering
59
MIT School of Computing
Department of Computer Science & Engineering
60
MIT School of Computing
Department of Computer Science & Engineering
61
MIT School of Computing
Department of Computer Science & Engineering
62
MIT School of Computing
Department of Computer Science & Engineering
63
MIT School of Computing
Department of Computer Science & Engineering
64
MIT School of Computing
Department of Computer Science & Engineering
65
MIT School of Computing
Department of Computer Science & Engineering
66
MIT School of Computing
Department of Computer Science & Engineering
67
MIT School of Computing
Department of Computer Science & Engineering
68
MIT School of Computing
Department of Computer Science & Engineering
69
MIT School of Computing
Department of Computer Science & Engineering
70
MIT School of Computing
Department of Computer Science & Engineering
71
MIT School of Computing
Department of Computer Science & Engineering
73
MIT School of Computing
Department of Computer Science & Engineering
74
MIT School of Computing
Department of Computer Science & Engineering
75
MIT School of Computing
Department of Computer Science & Engineering
76
MIT School of Computing
Department of Computer Science & Engineering
77
MIT School of Computing
Department of Computer Science & Engineering
78
MIT School of Computing
Department of Computer Science & Engineering
79
MIT School of Computing
Department of Computer Science & Engineering
80
MIT School of Computing
Department of Computer Science & Engineering
81
MIT School of Computing
Department of Computer Science & Engineering
Reasoning-Introduction
Reasoning in AI refers to the process of using logical and deductive techniques to
draw conclusions, make inferences, and solve problems.
82
MIT School of Computing
Department of Computer Science & Engineering
Types of Reasoning
Deductive Reasoning: It involves using general rules to draw specific conclusions.
For example, if "All cats have tails" and "Whiskers is a cat," then we can deduce that
"Whiskers has a tail."
Abductive Reasoning: It involves generating the best explanation for given evidence.
For example, if a patient has a high fever and a sore throat, the doctor might
conclude that "The patient has strep throat."
83
MIT School of Computing
Department of Computer Science & Engineering
Deductive Reasoning
Deductive reasoning follows logical rules to draw specific conclusions.
Example: If we know that "All birds can fly" and "Robins are birds," then we can
logically deduce that "Robins can fly."
Inductive Reasoning
Inductive reasoning involves making generalizations from specific observations.
Example: If we observe multiple apples and they are all red, we may infer that "All
apples are red."
84
MIT School of Computing
Department of Computer Science & Engineering
Abductive Reasoning
Abductive reasoning generates the best explanation based on available evidence.
Example: If someone finds a wet umbrella and sees dark clouds, they may conclude
that "It is likely to rain."
Rule-based Reasoning
Rule-based reasoning uses predefined rules to make deductions.
Example: If we have a rule that "If it's raining, take an umbrella," and we observe
that "It's raining," then we deduce that "We should take an umbrella."
85
MIT School of Computing
Department of Computer Science & Engineering
Case-based Reasoning
Case-based reasoning solves problems based on similar past cases.
Logical Reasoning
Logical reasoning involves using formal logic to draw conclusions.
Example: If "A implies B" and "B implies C," we can logically conclude that "A implies
C."
86
MIT School of Computing
Department of Computer Science & Engineering
Probabilistic Reasoning
Probabilistic reasoning deals with uncertainty using probability theory.
Example: Based on sensor data, a self-driving car can estimate the probability of an
object being a pedestrian and make decisions accordingly.
Summary
• Reasoning is crucial for AI systems to make decisions and solve problems.
• Deductive, inductive, and abductive reasoning are common approaches.
• Rule-based reasoning, case-based reasoning, logical reasoning, and
probabilistic reasoning are widely used techniques.
87
MIT School of Computing
Department of Computer Science & Engineering
Reasoning-Introduction
Probabilistic reasoning is a fundamental technique in AI for handling uncertainty.
Bayes' theorem provides a mathematical framework for updating probabilities
based on new evidence. This presentation explores the concept of probabilistic
reasoning and explains the application of Bayes' theorem in AI.
Posterior Probability (P(A|B)): The updated probability of event A after taking the
evidence B into account.
89
MIT School of Computing
Department of Computer Science & Engineering
Example Scenario
90
Example Scenario
Subsets Of AI-Introduction
Artificial Intelligence (AI) is a vast field with several subsets or branches that focus
on different aspects of intelligence and problem-solving. This presentation explores
some of the major subsets of AI and provides an overview of each.
Machine Learning
Definition: Machine Learning is a subset of AI that focuses on developing algorithms
and models that enable computers to learn from data and improve performance
without explicit programming.
92
MIT School of Computing
Department of Computer Science & Engineering
Computer Vision
Definition: Computer Vision is a subset of AI focused on enabling computers to
understand and interpret visual information from images or videos. It involves tasks
like object recognition, image classification, and image segmentation.
Robotics
Definition: Robotics is a subset of AI that deals with the design, construction, and
operation of robots. It involves the integration of AI techniques to enable robots to
perceive their environment, make decisions, and perform physical tasks.
Expert Systems
Definition: Expert Systems are AI systems that mimic human expertise and
knowledge in a specific domain. They use rule-based reasoning and knowledge
representation to solve complex problems.
Reinforcement Learning
Definition: Reinforcement Learning is a subset of machine learning that involves
training agents to make sequential decisions in an environment to maximize
rewards. It utilizes a trial-and-error approach to learn optimal strategies.
Data Mining
Definition: Data Mining is a subset of AI that focuses on discovering patterns and
extracting useful information from large datasets. It involves techniques such as
clustering, classification, and association rule mining.
Importance: Data Mining helps uncover hidden insights, make predictions, and
support decision-making processes in various fields, including finance, marketing,
healthcare, and fraud detection.
95
MIT School of Computing
Department of Computer Science & Engineering
Genetic Algorithms
Definition: Genetic Algorithms are search and optimization techniques inspired by
the process of natural selection. They use evolutionary principles to solve complex
problems by iteratively evolving a population of potential solutions.
Deep Learning
Definition: Deep Learning is a subset of machine learning that focuses on training
artificial neural networks with multiple layers to learn and extract hierarchical
representations from complex data.
96
MIT School of Computing
Department of Computer Science & Engineering
97