Artificial Intelligence

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

Knowledge Representation

Knowledge is the information extracted from huge amount of data that


is applicable in a particular domain.

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. Hence 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.

Approach to knowledge representation:

A good system for the representation of knowledge in a particular


domain should possess the following properties:

1. Representational Adequacy- the ability to represent all of the kinds


of knowledge that are needed in that domain.
2. Inferential Adequacy- the ability to manipulate the representational
structures in such a way as to derive new structures corresponding to
new knowledge inferred from old.

3. Inferential Efficiency- The ability to direct the inferential mechanisms


into the most productive directions by storing appropriate guides.

4. Acquisitional Efficiency- the ability to acquire new information easily.


The simplest case involves direct insertion of new knowledge into the
database.

Logic:
Logic is a method of reasoning process in which conclusion are
drawn from premises using rule of inference. It is one way of
representing facts. The language of logic is appealing because it
immediately suggests a powerful way of deriving new knowledge from
old. In this formalism, we can conclude that a new statement is true by
proving that it follows from the statements that are already known.

To define a language, we need to specify the syntax of the language


and the semantics. To specify syntax of a language, we must say what
symbols are allowed in the language and what are legal constructions
(sentences) using those symbols. To specify the semantics of a
language, we must say how the legal sentences are to be read, i.e. what
they mean.

Some popular logics are:

1. Propositional Logic
2. First Order Predicate Logic
3. Higher Order Predicate Logic
4. Fuzzy Logic

Propositional Logic:

A proposition is a statement either true or false, but not both. so


a propositional logic is also called as a Boolean logic.

For example:

1. The statement ”1+1 > 3” is false, while the statement ”5 > 3” is


true. Both statements are propositions.

2. The statement ”What a great book!” is not a proposition.


Someone is expressing an opinion.

In Propositional Logic, there are two types of sentences – simple


(atomic) sentences and compound (complex) sentences. Simple
sentences express simple facts about the world. Compound sentences
express logical relationships between the simpler sentences of which
they are composed. The simple sentences consist of a single
proposition symbol. Each such symbol stands for a proposition that can
be true or false. We will use uppercase names for symbols: P, Q, R, and
so on.

Complex sentences are constructed from simpler sentences using


logical connectives. There are five connectives in common use:

¬ (not): A literal is either an atomic sentence (a positive literal) or a


negated atomic sentence (a negative literal).

E.g. p: You shall pass


¬p: You shall not pass

Ʌ (and): A sentence whose main connective is Ʌ called a conjunction; its


parts are the conjuncts. True only when `both’ of them (p and q) are
true.

V (or): A sentence whose main connective is V called a disjunction;

True when `at least one’ of them (p or q) is true.

 (implies): A sentence called an implication (or conditional). Its


premise or antecedent is conclusion or consequent.

 if p then q: p → q i.e. p is sufficient to define q.


 p⇒q means ‘if p is true, then q is true’. If p is false, then we
don’t care about q, and by default, make p⇒q evaluate to T
in this case.

 (If and only if) or (iff): By definition p ↔ q means (p → q)∧(q → p).

For Example: we have a knowledge as below:

It is hot. It is humid. It is raining. If it is humid, then it is hot. If it is


hot and (other examples: but, since) humid then it not raining.
This knowledge can be represented in propositional logic, First of all
the atomic sentences are represented in symbols as follows:

P: it is hot

Q: it is humid

R: it is raining

Now, the knowledge representation will be:

i) QP
ii) (P^Q) ¬R

Inference Rules:

Inference rules are the templates for generating valid arguments.


Inference rules are applied to derive proofs in artificial intelligence, and
the proof is a sequence of the conclusion that leads to the desired goal.

Some popular inference rules in propositional logic are:

1. Modus Ponens:

The Modus Ponens rule is one of the most important rules of inference,
and it states that if P and P → Q is true, then we can infer that Q will be
true. It can be represented as:
Example:

Statement-1: "If I am sleepy then I go to bed" ==> P→ Q


Statement-2: "I am sleepy" ==> P
Conclusion: "I go to bed." ==> Q.
Hence, we can say that, if P→ Q is true and P is true then Q will be true.

2. Modus Tollens:

The Modus Tollens rule state that if P→ Q is true and ¬ Q is true, then
¬ P will also true. It can be represented as:

Example
Statement-1: "If I am sleepy then I go to bed" ==> P→ Q
Statement-2: "I do not go to the bed."==> ~Q
Statement-3: Which infers that "I am not sleepy" => ~P

3. Hypothetical Syllogism:

The Hypothetical Syllogism rule state that if P→R is true whenever


P→Q is true, and Q→R is true. It can be represented as the following
notation:
Example:

Statement-1: If you have my home key then you can unlock my home.
P→Q
Statement-2: If you can unlock my home then you can take my money.
Q→R
Conclusion: If you have my home key then you can take my money.
P→R

4. Disjunctive Syllogism:

The Disjunctive syllogism rule state that if P∨Q is true, and ¬P is true,
then Q will be true. It can be represented as:

Example:

Statement-1: Today is Sunday or Monday. ==>P∨Q


Statement-2: Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q

5. Addition:

The Addition rule is one the common inference rule, and it states that If
P is true, then P∨Q will be true.

Example:

Statement: I have a vanilla ice-cream. ==> P


Statement-2: I have Chocolate ice-cream.
Conclusion: I have vanilla or chocolate ice-cream. ==> (P∨Q)
6. Simplification:

The simplification rule state that if P∧ Q is true, then Q or P will also be


true. It can be represented as:

7. Conjunction:

The conjunction rule states that if P is True and Q is True then P^Q
will also be true.

P, Q

P^Q
NOTE:- Tautology is a formula or assertion that is true in every possible
interpretation. For e.g. ¬ (¬p)p , the formula is true in every possible
interpretation.

Semantic Network:

• The idea behind a semantic network is that knowledge is often best


understood as a set of concepts (nodes) that are related to one
another. The meaning of a concept is defined by its relationship to
other concepts.

• A semantic network consists of a set of nodes that are connected by


labeled arcs (links). The nodes represent concepts and the arcs
represent relations between concepts.

Common Semantic Relations:

There is no standard set of relations for semantic networks, but the


following relations are very common:

INSTANCE: X is an INSTANCE of Y if X is a specific example of the


general concept Y.

Example: Elvis is an INSTANCE of Human

ISA: X ISA Y if X is a subset of the more general concept Y.

Example: sparrow ISA bird

HASPART: X HASPART Y if the concept Y is a part of the concept X. (Or


this can be any other property)

Example: sparrow HASPART tail


Semantic Tree:

A semantic tree is a representation that is a semantic net in which


Certain links are called branches. Each branch connects two nodes; the
head node is called the parent node and the tail node is called the child
node

· One node has no parent; it is called the root node. Other nodes have
exactly one parent.

· Some nodes have no children; they are called leaf nodes.


· When two nodes are connected to each other by a chain of two or
more branches, one is said to be the ancestor; the other is said to be
the descendant.

Inheritance:

• Inheritance is a key concept in semantic networks and can be


represented naturally by following ISA links.

• In general, if concept X has property P, then all concepts that are a


subset of X should also have property P.

Multiple Inheritances:

• Multiple inheritances allow an object to inherit properties from


multiple concepts.

• Multiple inheritances can sometimes allow an object to inherit


conflicting properties.

• Conflicts are potentially unavoidable, so conflict resolution strategies


are needed.

Predicate calculus (Predicate logic):

In mathematical logic, predicate logic is the generic term for symbolic


formal systems like first-order logic, second-order logic, many-sorted
logic, or infinitary logic. This formal system is distinguished from other
systems in that its formulae contain variables which can be quantified.
Two common quantifiers are:

a. Existential ∃ ("there exists")


In a set of variable, we use this quantifier if there exists at
least one variable that satisfies that situation.
b. Universal ∀ ("for all")

In a set of variable, we use this quantifier if all the variables


satisfy the situation.

A function or predicate is a expression which contains function symbol


followed by arguments. The arguments are the elements from the
domain of the function. The arguments are enclosed in parenthesis and
separated by commas. E.g. f(X,Y)

father(david)

price(apple)

First-order logic (FOL) / First order predict logic (FOPL):

First order predicate logic is a knowledge representation


technique. The natural language is translated to FOPL in the form of
facts and rules, use of quantifiers and variables, syntax and semantics
of FOPL, and conversion of predicate expressions to clause forms.

Propositional logic assumes the world contains facts that are true or
false. FOPL not only assumes 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 …


 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 …

Examples:

1. Some boys are intelligent


∃x: boys(x) ∧ intelligent(x)
2. All birds fly
∀x bird(x) →fly(x)
3. Every man respect his parents
∀x man(x) → respects (x, parent)
4. Some boys play cricket
  ∃x boys(x) → play(x, cricket)

5. Not all student like both science and mathematics


¬∀x [student(x) → like(x, Mathematics) ∧ like(x, Science)]
6. Brothers are siblings
∀x,y Brother(x,y)  Sibling(x,y)
7. Only one student failed in mathematics
∃x [ student(x) → failed (x, Mathematics) ∧∀y [¬(x==y) ∧
student(y) → ¬failed (x, Mathematics)]
8. Anyone who has any cats will not have any mice
∀ x ∀ y (HAVE (x,y) ∧ CAT (y) → ¬ ∃ z (HAVE(x,z) ∧ MOUSE (z)))
9. ∀ x Married(Father(x), Mother(x)) ∃y Certificate(y) ∧ Names(y,
Father(x), Mother(x))
English:

Frames:

A frame is a record or perhaps a data structure that contains data.


It is also known as slot-filler knowledge representation method. A
frame is a collection of attributes and associated values that describes
some real world entity.

The frame technique includes a number of frames or nodes that


are related to each other by relationships. Frame-based representation
is an important knowledge representation formalism permitting us to
show the concept of inheritance. i.e. one frame could inherit the
characteristics of the other frame. The frame technique has a set of
frames that can be joined together. The attribute value of one of the
frames may become another frame.

A frame basically contains two things:

1. Object:
An object is an instance of class as like object oriented
programming. Every real world entity is represented as an
object which is the instance of the entity (class). i.e. if
person is the entity then Ram, Bob etc are its instances
(objects).
2. Slots:
The slot defines the relationship between the object and the
slot values (fillers) or other object. It is like the edge in a
semantic network.

You might also like