0% found this document useful (0 votes)
27 views

Unit 4

Uploaded by

21202040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Unit 4

Uploaded by

21202040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 101

UNIT IV

KNOWLEDGE & REASONING

Knowledge representation issues, representation &


mapping, approaches to knowledge
representation. Using predicate logic, representing
simple fact in logic, representing instant & ISA
relationship, computable functions & predicates,
resolution, natural deduction. Representing
knowledge using rules, Procedural verses
declarative knowledge, logic programming, forward
verses backward reasoning, matching, control
Knowledge.
What is knowledge representation?
• Humans are best at understanding, reasoning,
and interpreting knowledge.
• Human knows things, which is knowledge and
as per their knowledge they perform various
actions in the real world.
• But how machines do all these things comes
under knowledge representation and
reasoning.
we can describe Knowledge representation as following:

• Knowledge representation and reasoning (KR, KRR) is the part of


Artificial intelligence which concerned with AI agents thinking
and how thinking contributes to intelligent behavior of agents.
• It is responsible for representing information about the real
world so that a computer can understand and can utilize this
knowledge to solve the complex real world problems such as
diagnosis a medical condition or communicating with humans in
natural language.
• It is also a way which describes how we can represent
knowledge in artificial intelligence.
• Knowledge representation is not just storing data into some
database, but it also enables an intelligent machine to learn
from that knowledge and experiences so that it can behave
intelligently like a human.
What to Represent
• Following are the kind of knowledge which needs to be
represented in AI systems:
• Object: All the facts about objects in our world domain. E.g.,
Guitars contains strings, trumpets are brass instruments.
• Events: Events are the actions which occur in our world.
• Performance: It describe behavior which involves knowledge
about how to do things.
• Meta-knowledge: It is knowledge about what we know.
• Facts: Facts are the truths about the real world and what we
represent.
• Knowledge-Base: The central component of the knowledge-
based agents is the knowledge base. It is represented as KB. The
Knowledgebase is a group of the Sentences (Here, sentences are
used as a technical term and not identical with the English
language).
Types of knowledge

• Knowledge: Knowledge is awareness or


familiarity gained by experiences of facts,
data, and situations.
Types of knowledge
1. Declarative Knowledge:
• Declarative knowledge is to know about something.
• It includes concepts, facts, and objects.
• It is also called descriptive knowledge and expressed in declarative
sentences.
• It is simpler than procedural language.
2. Procedural Knowledge
• It is also known as imperative knowledge.
• Procedural knowledge is a type of knowledge which is responsible
for knowing how to do something.
• It can be directly applied to any task.
• It includes rules, strategies, procedures, agendas, etc.
• Procedural knowledge depends on the task on which it can be
applied.
Types of knowledge

3. Meta-knowledge:
• Knowledge about the other types of knowledge is called Meta-
knowledge.
4. Heuristic knowledge:
• Heuristic knowledge is representing knowledge of some experts
in a filed or subject.
• Heuristic knowledge is rules of thumb based on previous
experiences, awareness of approaches, and which are good to
work but not guaranteed.
5. Structural knowledge:
• Structural knowledge is to problem-solving.
• It describes relationships between various concepts such as kind
of, part of, and grouping of something.
• It describes the relationship that exists between concepts or
objects.
The relation between knowledge and intelligence:
• Knowledge of real-worlds plays a vital role in intelligence and
same for creating artificial intelligence.
• Knowledge plays an important role in demonstrating
intelligent behavior in AI agents.
• An agent is only able to accurately act on some input when
he has some knowledge or experience about that input.
Cycle of Knowledge Representation in AI

• Artificial Intelligent Systems usually consist of


various components to display their intelligent
behavior.
• Some of these components include:
• Perception
• Learning
• Knowledge Representation & Reasoning
• Planning
• Execution
Cycle of Knowledge Representation in AI
The interaction of an AI system with the real world and
the components involved in showing intelligence

Perception component
• It retrieves data or information from the
environment.
• with the help of this component, you can
retrieve data from the environment, find out
the source of noises and check if the AI was
damaged by anything.
• Also, it defines how to respond when any
sense has been detected.
The interaction of an AI system with the real world and
the components involved in showing intelligence

Learning Component
• It learns from the captured data by the perception
component.
• The goal is to build computers that can be taught
instead of programming them.
• Learning focuses on the process of self-
improvement.
• In order to learn new things, the system requires
knowledge acquisition, inference, acquisition of
heuristics, faster searches, etc.
The interaction of an AI system with the real world and
the components involved in showing intelligence

Knowledge Representation and Reasoning


• The main component in the cycle is Knowledge
Representation and Reasoning which shows the human-like
intelligence in the machines.
• Knowledge representation is all about understanding
intelligence.
• Instead of trying to understand or build brains from the
bottom up, its goal is to understand and build intelligent
behavior from the top-down and focus on what an agent
needs to know in order to behave intelligently.
• Also, it defines how automated reasoning procedures can
make this knowledge available as needed.
The interaction of an AI system with the real world and
the components involved in showing intelligence

Planning and Execution


• This components depend on the analysis of
knowledge representation and reasoning.
• Here, planning includes giving an initial state,
finding their preconditions and effects, and a
sequence of actions to achieve a state in which
a particular goal holds.
• Now once the planning is completed, the final
stage is the execution of the entire process.
Techniques of Knowledge Representation
in AI
Logical Representation

• Logical representation is a language with some definite


rules which deal with propositions and has no ambiguity in
representation.
• It represents a conclusion based on various conditions and
lays down some important communication rules.
• Also, it consists of precisely defined syntax and semantics
which supports the sound inference.
• Each sentence can be translated into logics using syntax and
semantics.
Semantic Network Representation
• Semantic networks work as an alternative of predicate
logic for knowledge representation.
• In Semantic networks, you can represent your
knowledge in the form of graphical networks.
• This network consists of nodes representing objects
and arcs which describe the relationship between
those objects.
• Also, it categorizes the object in different forms and
links those objects.
• This representation consist of two types of relations:
• IS-A relation (Inheritance)
• Kind-of-relation
Semantic Network Representation
Frame Representation
• A frame is a record like structure that consists
of a collection of attributes and values to
describe an entity in the world.
• These are the AI data structure that divides
knowledge into substructures by representing
stereotypes situations.
• Basically, it consists of a collection of slots and
slot values of any type and size.
• Slots have names and values which are called
facets.
Production Rules
• In production rules, agent checks for the condition and if
the condition exists then production rule fires and
corresponding action is carried out.
• The condition part of the rule determines which rule may
be applied to a problem.
• Whereas, the action part carries out the associated
problem-solving steps.
• This complete process is called a recognize-act cycle.
• The production rules system consists of three main parts:
• The set of production rules
• Working Memory
• The recognize-act-cycle
Representations and Mappings
• In order to solve complex problems encountered in artificial
intelligence, one needs both a large amount of knowledge
and some mechanism for manipulating that knowledge to
create solutions.
• Knowledge and Representation are two distinct entities.
• They play central but distinguishable roles in the intelligent
system.
• Knowledge is a description of the world. It determines a
system’s competence by what it knows.
• Moreover, Representation is the way knowledge is encoded.
It defines a system’s performance in doing something.
• Different types of knowledge require different kinds of
representation.
The Knowledge Representation models / mechanisms are
often based on:
• Logic
• Rules
• Frames
• Semantic Net
Approaches to knowledge representation:
• There are mainly four approaches to knowledge representation, which are
given below:
1. Simple relational knowledge:
• It is the simplest way of storing facts which uses the relational
method, and each fact about a set of the object is set out
systematically in columns.
• This approach of knowledge representation is famous in database
systems where the relationship between different entities is
represented.
• This approach has little opportunity for inference.
2. Inheritable Knowledge
• In the inheritable knowledge approach, all data must be
stored into a hierarchy of classes and should be arranged in a
generalized form or a hierarchal manner.
• Also, this approach contains inheritable knowledge which
shows a relation between instance and class, and it is called
instance relation. In this approach, objects and values are
represented in Boxed nodes.
• Example:
3. Inferential Knowledge
• The inferential knowledge approach
represents knowledge in the form of formal logic.
• Thus, it can be used to derive more facts.
• Also, it guarantees correctness.
Example:
• Statement 1: John is a cricketer.
• Statement 2: All cricketers are athletes.
• Then it can be represented as;
• Cricketer(John)
∀x = Cricketer (x) ———-> Athletes (x)
4. Procedural knowledge:
• Procedural knowledge approach uses small
programs and codes which describes how to do
specific things, and how to proceed.
• In this approach, one important rule is used which
is If-Then rule.
• In this knowledge, we can use various coding
languages such as LISP language and Prolog
language.
• We can easily represent heuristic or domain-
specific knowledge using this approach.
• But it is not necessary that we can represent all
cases in this approach.
Requirements for knowledge Representation system:
• A good knowledge representation system must possess the
following properties.
1. Representational Accuracy:
KR system should have the ability to represent all kind of
required knowledge.
2. Inferential Adequacy:
KR system should have ability to manipulate the
representational structures to produce new knowledge
corresponding to existing structure.
3. Inferential Efficiency:
The ability to direct the inferential knowledge mechanism into
the most productive directions by storing appropriate guides.
4. Acquisitional efficiency: The ability to acquire the new
knowledge easily using automatic methods.
What is propositional logic?

• Propositional logic (PL) is declarative, so it


guides us on how to represent information in
a logical form and draw conclusions.
• We can only represent information as
either true or false in propositional logic.
Disadvantages of PL
• If you want to represent complicated sentences or
natural language statements, PL is not sufficient.
• There is very limited expressive power in PL, so we
use FOL instead.
• The sentence shown below cannot be represented
we cannot using PL logic.
Examples
• I love mankind. It’s the people I can’t stand!
• Joe Root likes football.
• I like to eat mangos.
• PL is not enough to represent the sentences above,
so we require powerful logic (such as FOL).
What is first-order logic (FOL)?

• FOL is a mode of representation in Artificial Intelligence.


It is an extension of PL.
• FOL represents natural language statements in a concise
way.
• FOL is also called predicate logic.
• It is a powerful language used to develop information
about an object and express the relationship between
objects.
• 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.
Parts of first-order logic

FOL also has two parts:


• Syntax
• Semantics
Syntax
• The syntax of FOL decides which collection of symbols is a
logical expression.
• The basic syntactic elements of FOL are symbols.
• We use symbols to write statements in shorthand notation.
Atomic and complex sentences in FOL
1. Atomic Sentence
• This is a basic sentence of FOL formed from a
predicate symbol followed by a parenthesis with a
sequence of terms.
• We can represent atomic sentences as a predicate
(value1, value2…., value n).
Example
• John and Michael are colleagues → Colleagues
(John, Michael).
• German Shepherd is a dog → Dog (German
Shepherd).
2. Complex sentence

• Complex sentences are made by combining atomic


sentences using connectives.
• FOL is further divided into two parts:
• Subject: the main part of the statement.
• Predicate: defined as a relation that binds two atoms
together.
Example
1. Colleague (Oliver, Benjamin) ∧ Colleague (Benjamin,
Oliver)
2. “x is an integer”
• It has two parts;
– first, x is the subject.
– second, “is an integer” is called a predicate.
Quantifiers and their use in FOL
• 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.
• There are two types of quantifiers:
– Universal quantifier: for all, everyone, everything.
– Existential quantifier: for some, at least one.
1. Universal quantifiers
• Universal quantifiers 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 →.
• If x is a variable, then ∀x can read as:
– For all x
– For every x
– For each x
Example: Universal quantifiers
2. Existential quantifiers

• 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.
• If x is a variable, the existential quantifier will
be ∃x:
– For some x
– There exists an x
– For at least one x
Example: Existential quantifiers
Some Examples of FOL using quantifier:
1. All birds fly.
In this question the predicate is "fly(bird)."
And since there are all birds who fly so it will be represented as
follows.
∀x bird(x) →fly(x).
2. Every man respects his parent.
In this question, the predicate is "respect(x, y)," where x=man, and
y= parent.
Since there is every man so will use ∀, and it will be represented as
follows:
∀x man(x) → respects (x, parent).
3. Some boys play cricket.
In this question, the predicate is "play(x, y)," where x= boys, and y=
game. Since there are some boys so we will use ∃, and it will be
represented as:
∃x boys(x) → play(x, cricket).
Some Examples of FOL using quantifier:
4. Not all students like both Mathematics and Science.
In this question, the predicate is "like(x, y)," where x=
student, and y= subject.
Since there are not all students, so we will use ∀ with
negation, so following representation for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x,
Science)].

5. Only one student failed in Mathematics.


In this question, the predicate is "failed(x, y)," where x=
student, and y= subject.
Since there is only one student who failed in Mathematics, so
we will use following representation for this:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y)
[¬(x==y) ∧ student(y) → ¬failed (x, Mathematics)].
Representing simple fact in logic
Representing simple fact in logic
Representing simple fact in logic
Representing instant & ISA relationship
• Specific attributes instance and isa play
important role particularly in a useful form of
reasoning called property inheritance.
• The predicates instance and isa explicitly
captured the relationships they are used to
express, namely class membership and class
inclusion.
Representing instant & ISA relationship
Representing instant & ISA relationship
Representing instant & ISA relationship
computable functions & predicates
Resolution
Steps for Resolution:
1. Conversion of facts into first-order logic.
2. Convert FOL statements into CNF
3. Negate the statement which needs to prove
(proof by contradiction)
4. Draw resolution graph (unification).
Example: Resolution

a) John likes all kind of food.


b) Apple and vegetable are food
c) Anything anyone eats and not killed is food.
d) Anil eats peanuts and still alive
e) Harry eats everything that Anil eats.
Prove by resolution that:
f) John likes peanuts.
Step-1: Conversion of Facts into FOL
• In the first step we will convert all the given
statements into its first order logic.
Step-2: Conversion of FOL into CNF
• In First order logic resolution, it is required to
convert the FOL into CNF as CNF form makes
easier for resolution proofs.
• Eliminate existential instantiation quantifier
by elimination.
In this step, we will eliminate existential
quantifier ∃, and this process is known
as Skolemization. But in this example problem
since there is no existential quantifier so all
the statements will remain same in this step.
• Drop Universal quantifiers.
In this step we will drop all universal quantifier
since all the statements are not implicitly
quantified so we don't need it.
• Distribute conjunction ∧ over disjunction ¬.
This step will not make any change in this
problem.
Step-3: Negate the statement to be proved
• In this statement, we will apply negation to
the conclusion statements, which will be
written as ¬likes(John, Peanuts)
Step-4: Draw Resolution graph:
• Now in this step, we will solve the problem by resolution tree
using substitution. For the above problem, it will be given as f
Explanation of Resolution graph:
• In the first step of resolution graph, ¬likes(John, Peanuts) ,
and likes(John, x) get resolved(canceled) by substitution
of {Peanuts/x}, and we are left with ¬ food(Peanuts)
• In the second step of the resolution graph, ¬ food(Peanuts) ,
and food(z) get resolved (canceled) by substitution of {
Peanuts/z}, and we are left with ¬ eats(y, Peanuts) V killed(y) .
• In the third step of the resolution graph, ¬ eats(y,
Peanuts) and eats (Anil, Peanuts) get resolved by
substitution {Anil/y}, and we are left with Killed(Anil) .
• In the fourth step of the resolution graph, Killed(Anil) and ¬
killed(k) get resolve by substitution {Anil/k}, and we are left
with ¬ alive(Anil) .
• In the last step of the resolution graph ¬
alive(Anil) and alive(Anil) get resolved.
Representing knowledge using rules
Procedural and Declarative Knowledge
1.Procedural Knowledge
• The Procedural knowledge is a type of knowledge
where the essential control information that is required
to use the information is integrated in the knowledge
itself.
• It also used with an interpreter to employ the knowledge
which follows the instructions given in the knowledge.
• Ex - It can include a group of logical assertions merged
with a resolution theorem prove to provide an absolute
program for solving problems.
• Here, the implied income tax of an employee salary can
be thought of as a procedural knowledge as it would
require a process to calculate it as given below.
Procedural and Declarative Knowledge

• So, this is how the tax of an employee is


calculated by following a lengthy process
instead of just collecting facts.
Procedural and Declarative Knowledge
2.Declarative Knowledge
• A Declarative knowledge is where only
knowledge is described but not the use to
which the knowledge is employed is not
provided.
• So, in order to use this declarative knowledge,
we need to add it with a program that
indicates what is to be done to the knowledge
and how it is to be done.
Forward Reasoning
• The solution of a problem generally includes the initial data
and facts in order to arrive at the solution.
• These unknown facts and information is used to deduce the
result
• For example, while diagnosing a patient the doctor first
check the symptoms and medical condition of the body such
as temperature, blood pressure, pulse, eye colour, blood, etc
• After that, the patient symptoms are analysed and
compared against the predetermined symptoms.
• Then the doctor is able to provide the medicines according
to the symptoms of the patient.
• So, when a solution employs this manner of reasoning, it is
known as forward reasoning
Steps that are followed in the forward reasoning
1.In the first step, the system is given one or more
than one constraints.
2.Then the rules are searched in the knowledge base
for each constraint. The rules that fulfill the
condition are selected(i.e., IF part).
3.Now each rule is able to produce new conditions
from the conclusion of the invoked one. As a result,
THEN part is again included in the existing one.
4.The added conditions are processed again by
repeating step 2. The process will end if there is no
new conditions exist
Backward Reasoning
• The backward reasoning is inverse of forward
reasoning in which goal is analysed in order to
deduce the rules, initial facts and data.
• We can understand the concept by the similar
example given in the above definition, where the
doctor is trying to diagnose the patient with the help
of the inceptive data such as symptoms.
• However, in this case, the patient is experiencing a
problem in his body, on the basis of which the
doctor is going to prove the symptoms. This kind of
reasoning comes under backward reasoning.
Steps that are followed in the backward reasoning

1.Firstly, the goal state and the rules are selected


where the goal state reside in the THEN part as the
conclusion.
2.From the IF part of the selected rule the sub goals
are made to be satisfied for the goal state to be true.
3.Set initial conditions important to satisfy all the sub
goals.
4.Verify whether the provided initial state matches
with the established states. If it fulfills the condition
then the goal is the solution otherwise other goal
state is selected
Difference between backward chaining
and forward chaining

You might also like