AI Unit 3
AI Unit 3
Unit 3
Knowledge Representation
Components of Knowledge
The knowledge that needs to be presented in artificial intelligence systems can include:
Object: Objects surround humans constantly. Hence, the information regarding those
objects is essential and must be considered a knowledge type. For example, pianos have
white and black keys, cars have wheels, buses need drivers, planes need pilots, etc.
Events: Numerous events are constantly taking place in the real world. And human
perception is based on events. AI needs to have events knowledge to take action. Some
events are famines, the advancement of societies, wars, disasters, achievements, and
more.
Performance: This knowledge deals with humans’ certain actions in various situations. It
represents the behavior side of knowledge which is quite essential for AI to understand.
Meta knowledge: For instance, if we look around the world and sum up all the knowledge
out there, we see it is mostly divided into three categories:
Meta knowledge deals with the first one, i.e, what we know and lets AI perceive the same.
Facts: This knowledge is based on the factual description of our world. For example, the
earth is not flat but also not round; our sun has a voracious appetite, and more.
Knowledge-base: The knowledge base is the main component of human intelligence. This
refers to a group of relevant data or information on any field, description, and more. For
example, a knowledge base on designing a car model.
Knowledge plays an essential role in intelligence. It is also responsible for the creation of
artificial intelligence. When it is needed to express intelligent behavior in the AI agents, it
plays a necessary role. An agent is unable to function accurately when it lacks experience
or knowledge of certain inputs.
For example, if you want to interact with a person but are unable to understand the
language, it is obvious that you can’t respond well and deliver any action. This works the
same for agents’ intelligent behavior. AI needs to have enough knowledge to carry out the
functionality as a decision-maker discovers the environment and applies the required
knowledge. However, AI can’t exhibit intellectual behavior without the components of
knowledge.
Types of Knowledge
Declarative knowledge: It represents the objects, concepts, and facts that help you
describe the whole world around you. Thus, it shares the description of something and
expresses in a declarative sentences.
This model changes its behavior with time and utilizes other specifications. A system
engineer or knowledge engineer utilizes various forms of meta-knowledge, such as
accuracy, assessment, purpose, source, life span, reliability, justification, completeness,
consistency, applicability, and disambiguation.
Heuristic Knowledge: This knowledge, which is also known as shallow knowledge, follows
the thumb rule principle. Hence, it is highly efficient in the process of reasoning as it can
solve issues based on past records or problems that are compiled by experts. However, it
gathers experiences of past problems and provides a better knowledge-based approach to
specify problems and take action.
Structural Knowledge: Structural knowledge is the most simple and basic knowledge
that is used and applied in solving complex problems. It tries to find an effective solution
by finding the relationship between objects and concepts. In addition, it describes the
relationship between multiple concepts, like part of, kind of, or grouping of something.
There are mainly four approaches to knowledge representation, which are given below:
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.
Player1 65 23
Player2 58 18
Player3 75 24
2. Inheritable knowledge:
In the inheritable knowledge approach, all data must be stored into a hierarchy of
classes.
All classes should be arranged in a generalized form or a hierarchal manner.
In this approach, we apply inheritance property.
Elements inherit values from other members of a class.
This approach contains inheritable knowledge which shows a relation between
instance and class, and it is called instance relation.
Every individual frame can represent the collection of attributes and its value.
In this approach, objects and values are represented in Boxed nodes.
We use Arrows which point from objects to their values.
Example:
3. Inferential knowledge:
1. Marcus is a man
2. All men are mortal
man(Marcus)
∀x = man (x) ----------> mortal (x)s
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.
It 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:
d) 5 is a prime number.
The syntax of propositional logic defines the allowable sentences for the knowledge
representation. There are two types of Propositions:
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:
Example:
Logical Connectives:
P=Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.
so we can write it as P ∨ Q.
We cannot represent relations like ALL, some, or none with propositional logic.
Example:
First-Order logic:
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, ......
Syntax
Semantics
The syntax of FOL determines which collection of symbols is a logical expression in first-
order logic. The basic syntactic elements of first-order logic are symbols. We write
statements in short-hand notation in FOL.
Variables x, y, z, a, b,....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
Atomic sentences:
Atomic sentences are the most basic sentences of first-order logic. These sentences are
formed from a predicate symbol followed by a parenthesis with a sequence of terms.
We can represent atomic sentences as Predicate (term1, term2, ......, term n).
Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
Complex Sentences:
Consider the statement: "x is an integer.", it consists of two parts, the first part x is the
subject of the statement and second part "is an integer," is known as a predicate.
These are the symbols that permit to determine or identify the range and scope of the
variable in the logical expression. There are two types of quantifier:
Universal Quantifier:
For all x
For each x
For every x.
Example:
It will be read as: There are all x where x is a man who drink coffee.
Existential Quantifier:
Existential quantifiers are the type of quantifiers, which express that the statement within
its scope is true for at least one instance of something.
It is denoted by the logical operator ∃, which resembles as inverted E. When it is used with
a predicate variable then it is called as an existential quantifier.
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
Example:
It will be read as: There are some x where x is a boy who is intelligent.
Resolution Principle:
Resolution is used, if there are various statements are given, and we need to prove a
conclusion of those statements. Unification is a key concept in proofs by resolutions.
Resolution is a single inference rule which can efficiently operate on the conjunctive
normal form
Example:
In the first step we will convert all the given statements into its first order logic.
In First order logic resolution, it is required to convert the FOL into CNF as CNF form
makes easier for resolution proofs.
Eliminate all implication (→) and rewrite
∀x ¬ food(x) V likes(John, x)
food(Apple) Λ food(vegetables)
∀x ¬ eats(Anil, x) V eats(Harry, x)
∀x ¬ alive(x) V ¬ killed(x)
likes(John, Peanuts).
∀x ¬ food(x) V likes(John, x)
food(Apple) Λ food(vegetables)
∀x ¬ eats(Anil, x) V eats(Harry, x)
∀x ¬killed(x) V alive(x)
∀x ¬ alive(x) V ¬ killed(x)
likes(John, Peanuts).
∀x ¬ food(x) V likes(John, x)
food(Apple) Λ food(vegetables)
∀g ¬killed(g) ] V alive(g)
∀k ¬ alive(k) V ¬ killed(k)
likes(John, Peanuts).
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.
In this step we will drop all universal quantifier since all the statements are not implicitly
quantified so we don't need it.
¬ food(x) V likes(John, x)
food(Apple)
food(vegetables)
alive(Anil)
¬ eats(Anil, w) V eats(Harry, w)
killed(g) V alive(g)
¬ alive(k) V ¬ killed(k)
likes(John, Peanuts).
In this statement, we will apply negation to the conclusion statements, which will be
written as ¬likes(John, Peanuts)
Now in this step, we will solve the problem by resolution tree using substitution. For the
above problem, it will be given as follows:
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.
Unification
It takes two literals as input and makes them identical using substitution.
Let Ψ1 and Ψ2 be two atomic sentences and 𝜎 be a unifier such that, Ψ1𝜎 = Ψ2𝜎, then it
can be expressed as UNIFY(Ψ1, Ψ2).
Substitution θ = {John/x} is a unifier for these atoms and applying this substitution, and
both expressions will be identical.
The UNIFY algorithm is used for unification, which takes two atomic sentences and
returns a unifier for those sentences (If any exist).
E.g. Let's say there are two different expressions, P(x, y), and P(a, f(z)).
In this example, we need to make both above statements identical to each other. For this,
we will perform the substitution.
Substitute x with a, and y with f(z) in the first expression, and it will be represented
as a/x and f(z)/y.
With both the substitutions, the first expression will be identical to the second expression
and the substitution set will be: [a/x, f(z)/y].
Predicate symbol must be same, atoms or expression with different predicate symbol
can never be unified.
Number of Arguments in both expressions must be identical.
Unification will fail if there are two similar variables present in the same expression.
SUBST θ= {f(a) / X}
S1 => Ψ1 = p(f(a), g(Y)), and Ψ2 = p(f(a), f(a))
SUBST θ={b/Z}
Semantic Net
Example: Following are some statements which we need to represent in the form of nodes
and arcs.
Statements:
a. Jerry is a cat.
b. Jerry is a mammal
c. Jerry is owned by Priya.
d. Jerry is brown coloured.
e. All Mammals are animal.
In the above diagram, we have represented the different type of knowledge in the form of
nodes and arcs. Each object is connected with another object by some relation.