1. UNIT 3
Maidhili Mohan K
Assistant Professor
Reference: Elaine Rich, Kevin Knight and Shivshankar B. Nair, Artificial Intelligence, 3rd Edition.
G. F. Luger and W.A Stubblefield, Artificial Intelligence - Structures and Strategies for Complex
Problem Solving, Addison-Wesley, 6th Edition.
Vinod Chandra S. S. and Anand Hareendran S.,Atificial Intelligence and Machine Learning.
CSS2C09 – COMPUTATIONAL INTELLIGENCE
3. Topics covered:
● Knowledge representation issues
● representation and mappings
● Representing simple facts in logic
● representing instances and ISA relationships
● computable functions and predicates
● resolution, natural deduction
● knowledge representation using rules
● Logic programming
● forward versus backward reasoning
● symbolic reasoning under uncertainty
● non-monotonic reasoning
● depth first search
● breadth first search.
Topics
4. Knowledge
What is knowledge?
• facts, information, and skills acquired through experience or
education;
• the theoretical or practical understanding of a subject.
• Knowledge = information + rules
• EXAMPLE: Doctors, managers.
• Knowledge representation is a
relationship between two domains.
• Knowledge representation(KR) is the
field of artificial intelligence (AI)
that representing information about the world in a form of
computer system, that can solve complex tasks, such as
diagnosing a medical condition.
5. Knowledge
Knowledge Representation
● What to Represent?
Let us first consider what kinds of knowledge might need to be represented in AI
systems:
● Objects
-- Facts about objects in our world domain. e.g. Guitars have strings, trumpets are
brass instruments.
● Events
-- Actions that occur in our world. e.g. Steve Vai played the guitar in Frank's Band.
● Performance
-- A behavior like playing the guitar involves knowledge about how to do things.
● Meta-knowledge
-- knowledge about what we know.
6. Knowledge
Knowledge Representation
Thus in solving problems in AI we must represent knowledge and there are two
entities to deal with:
● Facts -- truths about the real world and what we represent. This can be
regarded as the knowledge level
● Representation of the facts which we manipulate. This can be regarded as
the symbol level since we usually define the representation in terms of
symbols that can be manipulated by programs.
We can structure these entities at two levels
● the knowledge level -- at which facts are described
● the symbol level -- at which representations of objects are defined in terms
of symbols that can be manipulated in programs.
There are 5 types of knowledge.
1) Procedural k.
2) Declarative k.
3) Meta k.
4) Heuristic k.
5) Structural k.
7. Knowledge
TYPES OF KNOWLEDGE
1) Procedural Knowledge
● Gives information/ knowledge about how to achieve something.
● Describes how to do things provides set of directions of how to
perform certain tasks.
● Procedural knowledge, also known as imperative knowledge, is the
knowledge exercised in the performance of some task.
● It depends on targets and problems.
● Example: How to drive a car?
2) Declarative knowledge
● Its about statements that describe a particular object and its attributes
including some behavior in relation with it.
● “Can this knowledge be true or false?” It is non-procedural,
independent of targets and problem solving.
● Example: It is sunny today and chemise are red.
8. Knowledge
TYPES OF KNOWLEDGE
3) Meta Knowledge
● It’s a knowledge about knowledge and how to gain them.
● Example: The knowledge that blood pressure is more important for
diagnosing a medical condition then eyes color.
4) Heuristic Knowledge
● Representing knowledge of some expert in a field or subject.
● Rules of thumb.
● Heuristic Knowledge are sometimes called shallow knowledge.
● Heuristic knowledge are empirical as opposed to deterministic.
5) Structural Knowledge
● Describes what relationship exists between concepts/ objects.
● Describe structure and their relationship.
● Example: How to various part of car fit together to make a car, or
knowledge structures in term of concepts, sub concepts and
objects.
9. Knowledge
KNOWLEDGE REPRESENTATION
There are multiple approaches and scheme that comes to mind when we
begin to think about representation.
● Pictures and symbols
● Graphs and network
● Numbers
1) Pictures and symbols
Pictorial representation are not easily translate to useful information is
computer because computer can’t interpret pictures directly without
complex reasoning. Through pictures are useful for human
understanding.
2) Graph and network
Allows relationship between objects to be
incorporated. We can represent procedural
knowledge using graphs.
3) Numbers
Numbers are an integral part of knowledge
representation used by humans. Numbers
translate easily to computer representation.
10. Knowledge
KNOWLEDGE REPRESENTATION TYPES
Basically 4 types of knowledge representation in AI
● Logical representation
● Production rule
● Semantic networks
● Frame representation
1) LOGICAL REPRESENTATION
In order to give information to agent
and get info without errors in
communication.
Logic is based on truth.
There are 2 types of LR
● propositional logic(PL)
● first order predicate logic(FOL)
First-order predicate calculus (FOPL) was developed by logicians to extend
the expressiveness of Propositional Logic. It is generalization of propositional
logic that permits reasoning about world entities (objects) as well as classes
and subclasses of objects. Prolog is also based on FOPL.
Predicate logic uses variables and quantifiers which is not present in
propositional logic.
11. Knowledge
KNOWLEDGE REPRESENTATION TYPES
2) PRODUCTION RULE
Consist of <condition,action>pairs.
Agent check if a conditions holds then give a new situation(state).
Production rule are belong to and same as propositional logic.
3) SEMENTIC NETWORK
These represent knowledge in the form of graphical network.
Example:
★ Tom is a cat
★ Tom is grey in color
★ Tom is mammal
★ Tom is owned by sam
4) FRAME REPRESENTATION
Frames are record like structures that
consist of a collection of slots or
attributes and the corresponding slot value.
Slots have names and values called facets.
12. Knowledge
REPRESENTATION & MAPPING
English or natural language is an obvious
way of representing and handling facts.
Logic enables us to consider the following
fact:
● spot is a dog as dog(spot) We could
then infer that all dogs have tails with:
∀x : dog(x) ->hasatail(x)
We can then deduce: hasatail(Spot)
13. Knowledge
USING KNOWLEDGE
Let us consider a little further to what applications and how knowledge may be
used.
● Learning -- acquiring knowledge. This is more than simply adding new
facts to a knowledge base. New data may have to be classified prior to
storage for easy retrieval, etc. Duplication should be avoided.
● Reasoning -- Infer facts from existing data.
If a system only knows: Davis is a Jazz Musician. All Jazz Musicians can play
their instruments well.
If things like Is Davis a Jazz Musician? or Can Jazz Musicians play their
instruments well? are asked then the answer is readily obtained from the data
structures and procedures.
However a question like Can Davis play his instrument well? requires reasoning.
The following properties should be possessed by a knowledge representation system.
● Representational Adequacy -- the ability to represent the required knowledge;
● Inferential Adequacy - the ability to manipulate the knowledge represented to produce new
knowledge corresponding to that inferred from the original;
● Inferential Efficiency - the ability to direct the inferential mechanisms into the most productive
directions by storing appropriate guides;
● Acquisitional Efficiency - the ability to acquire new knowledge using automatic methods
wherever possible rather than reliance on human intervention.
15. Knowledge
KNOWLEDGE REPRESENTATION SCHEMES
1. Simple Relational Knowledge
The simplest way of storing facts is to use a relational method where each fact
about a set of objects is set out systematically in columns. This representation
gives little opportunity for inference, but it can be used as the knowledge basis
for inference engines. Simple way to store facts.
Each fact about a set of objects is set out systematically in columns.
Little opportunity for inference. Knowledge basis for inference engines.
16. Knowledge
KNOWLEDGE REPRESENTATION SCHEMES
2. Inheritable Knowledge
Relational knowledge is made up of objects
consisting of
● Attributes
● corresponding associated values
We extend the base more by allowing
inference mechanisms:
★ Property inheritance
○ elements inherit values from being
members of a class.
○ data must be organized into a
hierarchy of classes.
Boxed nodes -- objects and values of attributes of
objects.
Values can be objects with attributes and so on.
Arrows -- point from object to its value.
This structure is known as a slot and filler
structure, semantic network or a collection of
frames.
18. Knowledge
KNOWLEDGE REPRESENTATION SCHEMES
3. Inferential Knowledge
Represent knowledge as formal logic:
All dogs have tails
∀(X) : dog(x) -> hasatail(x)
Advantages:
★ A set of strict rules.
★ Can be used to derive more facts.
★ Truths of new statements can be verified.
★ Guaranteed correctness.
★ Popular in AI systems. e.g Automated theorem proving
4. Procedural Knowledge
Knowledge encoded in some procedures. small programs that know how to do
specific things, how to proceed.
Advantages:
★ Heuristic or domain specific knowledge can be represented.
★ Extended logical inferences, such as default reasoning facilitated.
★ Side effects of actions may be modeled. Some rules may become false in
time. Keeping track of this in large systems may be tricky.
80. Reasoning
Forward chaining
● Forward chaining is a data driven method of deriving a particular
goal from a given knowledge base and set of inference rules.
● Inference rules are applied by matching facts to the antecedents
of consequence relations in the knowledge base.
● The application of inference rules results in new knowledge (from
the consequences of the relations matched), which is then added
to the knowledge base.
● In Forward chaining, the system starts from a set of facts, and a
set of rules, and tries to find a way of using those rules and facts
to deduce a conclusion or come up with a suitable course of
action.
● This is known as data-driven reasoning because the reasoning
starts from a set of data and ends up at the goal, which is the
conclusion.
84. Reasoning
Forward chaining
Now the system examines the rules
and finds that Facts 1 and 2 match
the antecedents of Rule 3. Hence,
Rule 3 fires, and its conclusion “Go
to third floor” is added to the
database of facts. Presumably, this
results in the elevator heading
toward the third floor.
Note that Fact 3 was ignored
altogether because it did not match
the antecedents of any of the rules.
Now let us imagine that the elevator
is on its way to the third floor and
has reached the second floor,when
the button is pressed on the first
floor.
The fact “Button pressed on first
floor” Is now added to the database,
which results in Rule 4 firing.
85. Reasoning
Forward chaining
Now let us imagine that later in the day the facts database contains the
following information:
★ Fact 1 At first floor
★ Fact 2 Button pressed on second floor
★ Fact 3 Button pressed on third floor In this case, two rules are
triggered—Rules 2 and 3.
In such cases where there is more than one possible conclusion,
conflict resolution needs to be applied to decide which rule to fire.
● Forward chaining applies a set of rules and facts to deduce
whatever conclusions can be derived, which is useful when a set of
facts are present, but you do not know what conclusions you are
trying to prove.
● In some cases, forward chaining can be inefficient because it may
end up proving a number of conclusions that are not currently
interesting. In such cases, where a single specific conclusion is to
be proved, backward chaining is more appropriate.
94. Reasoning
Forward chaining
CONFLICT RESOLUTION (Ben Coppin)
In a situation where more than one conclusion can be deduced from a set
of facts, there are a number of possible ways to decide which rule to fire
(i.e., which conclusion to use or which course of action to take).
CONFLICT RESOLUTION STRATEGIES
We have different resolution strategies:
1) Fire the first rule in sequence.
2) Assign rule priorities (by importance).
3) More specific rules are preferred over more general rules.(e.g. a rule having
5 IF’s(handle more info) will be preferred over one having 3 IF’s)
4) Prefer rules whose premises are added more recently (time stamping)
5) Parallel strategy (create view points)
95. Reasoning
Forward chaining
IF patient has pain
THEN prescribe
painkiller
IF patient has chest pain
AND patient is over 60
AND patient has history
of heart conditions
THEN take to emergency
room
97. Reasoning
Backward chaining
● Backward chaining is a goal driven method of deriving a particular goal
from a given knowledge base and set of inference rules.
● Inference rules are applied by matching the goal of the search to the
consequences of the relations stored in the knowledge base.
98. Reasoning
Backward chaining
● In backward chaining, we start from a conclusion, which is the hypothesis
we wish to prove, and we aim to show how that conclusion can be
reached from the rules and facts in the database.
● The conclusion we are aiming to prove is called a goal, and so reasoning
in this way is known as goal-driven reasoning.
103. Reasoning
Symbolic reasoning under Uncertainty
Types of Reasoning
The reasoning is the mental process of deriving logical conclusion and
making predictions from available knowledge, facts, and beliefs. Or we
can say, "Reasoning is a way to infer facts from existing data." It is a
general process of thinking rationally, to find valid conclusions.
Reasoning can be divided into the following categories:
1. Deductive reasoning
2. Inductive reasoning
3. Abductive reasoning
4. Common Sense Reasoning
5. Monotonic Reasoning
6. Non-monotonic Reasoning
104. Reasoning
Symbolic reasoning under Uncertainty
1. Deductive reasoning
• Deductive reasoning is deducing new information from logically related
known information. It is the form of valid reasoning, which means the
argument's conclusion must be true when the premises are true.
• Deductive reasoning is a type of propositional logic in AI, and it
requires various rules and facts. In deductive reasoning, the truth of the
premises guarantees the truth of the conclusion.
• Deductive reasoning mostly starts from the general premises to the
specific conclusion, which can be explained as below example.
Ex- Premise-1: All the human eats veggies
Premise-2: Suresh is human.
Conclusion: Suresh eats veggies.
The general process of deductive reasoning is given below:
105. Reasoning
Symbolic reasoning under Uncertainty
2. Inductive Reasoning
• Inductive reasoning is a form of reasoning to arrive at a conclusion
using limited sets of facts by the process of generalization. It starts with
the series of specific facts or data and reaches to a general statement or
conclusion.
• Inductive reasoning is a type of propositional logic, which is also
known as cause-effect reasoning or bottom-up reasoning.
• In inductive reasoning, premises provide probable supports to the
conclusion, so the truth of premises does not guarantee the truth of the
conclusion.
Ex -
• Premise: All of the pigeons we have seen in the zoo are white.
• Conclusion: Therefore, we can expect all the pigeons to be
white.
106. Reasoning
Symbolic reasoning under Uncertainty
3. Abductive reasoning
• Abductive reasoning is a form of logical reasoning which starts with single or multiple
observations then seeks to find the most likely explanation or conclusion for the observation.
• Abductive reasoning is an extension of deductive reasoning, but in abductive reasoning, the
premises do not guarantee the conclusion.
Ex-
• Implication: Cricket ground is wet if it is raining
• Axiom: Cricket ground is wet.
• Conclusion It is raining.
4. Common Sense Reasoning
• Common sense reasoning is an informal form of reasoning, which can be gained through
experiences.
• Common Sense reasoning simulates the human ability to make presumptions about events
which occurs on every day.
Ex-
• One person can be at one place at a time.
• If I put my hand in a fire, then it will burn.
• The above two statements are the examples of common sense reasoning which a human
mind can easily understand and assume.
107. Reasoning
Symbolic reasoning under Uncertainty
5. Monotonic Reasoning
• In monotonic reasoning, once the conclusion is taken, then it will remain
the same even if we add some other information to existing information in
our knowledge base.
In monotonic reasoning, adding knowledge does not decrease the set of
prepositions that can be derived.
• To solve monotonic problems, we can derive the valid conclusion from the
available facts only, and it will not be affected by new facts.
● Monotonic reasoning is not useful for the real-time systems, as in real time,
facts get changed, so we cannot use monotonic reasoning.
● Monotonic reasoning is used in conventional reasoning systems, and a
logic-based system is monotonic. Any theorem proving is an example of
monotonic reasoning.
● Ex-
• Earth revolves around the Sun.
• It is a true fact, and it cannot be changed even if we add another
sentence in knowledge base like, "The moon revolves around the earth"
Or "Earth is not round," etc.
108. Reasoning
Symbolic reasoning under Uncertainty
5. Monotonic Reasoning
● Advantages
○ In monotonic reasoning, each old proof will always remain valid.
○ If we deduce some facts from available facts, then it will remain
valid for always.
● Disadvantages
○ We cannot represent the real world scenarios using Monotonic
reasoning.
○ Hypothesis knowledge cannot be expressed with monotonic
reasoning, which means facts should be true.
○ Since we can only derive conclusions from the old proofs, sonew
knowledge from the real world cannot be added.
109. Reasoning
Symbolic reasoning under Uncertainty
6. Non-monotonic Reasoning
● In Non-monotonic reasoning, some conclusions may be invalidated
if we add some more information to our knowledge base.
● Logic will be said as non-monotonic if some conclusions can be
invalidated by adding more knowledge into our knowledge base.
● Non-monotonic reasoning deals with incomplete and uncertain
models. "Human perceptions for various things in daily life, "is a
general example of non-monotonic reasoning.
● Ex-
• Birds can fly
• Penguins cannot fly
• Pitty is a bird
• So from the above sentences, we can conclude that Pitty can fly.
• However, if we add one another sentence into knowledge base
"Pitty is a penguin", which concludes "Pitty cannot fly", so it
invalidates the above conclusion.
110. Reasoning
Symbolic reasoning under Uncertainty
6. Non-monotonic Reasoning
● Advantages
○ For real-world systems such as Robot navigation, we can use
non-monotonic reasoning.
○ In Non-monotonic reasoning, we can choose probabilistic
facts or can make assumptions.
● Disadvantages
○ In non-monotonic reasoning, the old facts may be invalidated
by adding new sentences.
○ It cannot be used for theorem proving.
Default Logic A : B
--------------
C
“ If A is Provable and it is consistent to assume B then conclude C.”
111. Searching
Search Algorithms in AI
○ Artificial Intelligence is the study of building agents that act
rationally. Most of the time, these agents perform some kind
of search algorithm in the background in order to achieve
their tasks.
○ A search problem consists of:
■ A State Space. Set of all possible states where you can
be.
■ A Start State. The state from where the search begins.
■ A Goal Test. A function that looks at the current state
returns whether or not it is the goal state.
○ The Solution to a search problem is a sequence of actions,
called the plan that transforms the start state to the goal
state.
○ This plan is achieved through search algorithm
113. Search Algorithms in AI
Each of these algorithms will have:
○ A problem graph, containing the start node S and the goal
node G.
○ A strategy, describing the manner in which the graph will be
traversed to get to G .
○ A fringe, which is a data structure used to store all the
possible states (nodes) that you can go from the current
states.
○ A tree, that results while traversing to the goal node.
○ A solution plan, which the sequence of nodes from S to G.
Searching
115. Depth First Search
Searching
● Depth-first search (DFS) is an algorithm for traversing or searching tree
or graph data structures.
● The algorithm starts at the root node (selecting some arbitrary node as
the root node in the case of a graph) and explores as far as possible
along each branch before backtracking.
124. Searching
Revision Questions
2 Weightage Questions:
1. Define monotonic reasoning.
2. What are the rules for knowledge representation in AI?
3. How is knowledge differ from information?
4. List the challenges of knowledge representation.
5. What are the various knowledge representation
methods?
125. Searching
Revision Questions
3 Weightage Questions:
1. What is natural deduction?
2. Describe symbolic reasoning under uncertainty.
3. What are the two different reasoning strategies for state
space search?
4. Detail on the implementation issues in non-monotonic
reasoning.
5. What are the methods used for learning in problem
solving?
126. Searching
Revision Questions
5 Weightage Questions:
1. Write a short note on unification with an example.
2. Distinguish between forward reasoning and backward
reasoning.
3. Explain different types of knowledge and examples of
each.