0% found this document useful (0 votes)
11 views14 pages

AI Unit-5

Uploaded by

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

AI Unit-5

Uploaded by

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

P.GANDHI PRAKASH M.Tech.,(Ph.D) LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING MYLAVARAM.

UNIT-5
Techniques of knowledge representation

There are mainly four ways of knowledge representation which are given as follows:

1. Logical Representation
2. Semantic Network Representation
3. Frame Representation
4. Production Rules
1. Logical Representation

Logical representation is a language with some concrete rules which deals with propositions and has no
ambiguity in representation. Logical representation means drawing a conclusion based on various
conditions. This representation lays down some important communication rules. It consists of precisely
defined syntax and semantics which supports the sound inference. Each sentence can be translated into
logics using syntax and semantics.

Syntax:
o Syntaxes are the rules which decide how we can construct legal sentences in the logic.
o It determines which symbol we can use in knowledge representation.
o How to write those symbols.

Semantics:
o Semantics are the rules by which we can interpret the sentence in the logic.
o Semantic also involves assigning a meaning to each sentence.

Logical representation can be categorised into mainly two logics:

1. Propositional Logics
2. Predicate logics

Advantages of logical representation:


1. Logical representation enables us to do logical reasoning.
2. Logical representation is the basis for the programming languages.

Disadvantages of logical Representation:


1. Logical representations have some restrictions and are challenging to work with.

2. Logical representation technique may not be very natural, and inference may not be so efficient.
2. Semantic Network Representation

Semantic networks are alternative of predicate logic for knowledge representation. In Semantic
networks, we can represent our knowledge in the form of graphical networks. This network consists of
nodes representing objects and arcs which describe the relationship between those objects. Semantic
networks can categorize the object in different forms and can also link those objects. Semantic networks
are easy to understand and can be easily extended.

This representation consist of mainly two types of relations:

a. IS-A relation (Inheritance)

b. Kind-of-relation

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 colored.
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.
Advantages of Semantic network:

1. Semantic networks are a natural representation of knowledge.


2. Semantic networks convey meaning in a transparent manner.
3. These networks are simple and easily understandable.
Drawbacks in Semantic representation:
1. Semantic networks try to model human-like memory (Which has 1015 neurons and links) to
store the information, but in practice, it is not possible to build such a vast semantic network.
2. These types of representations are inadequate as they do not have any equivalent quantifier,
e.g., for all, for some, none, etc.
3. Semantic networks do not have any standard definition for the link names.
4. These networks are not intelligent and depend on the creator of the system.
3. Frame Representation

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 situations. It consists of a collection of slots and slot values. These slots may be
of any type and sizes. Slots have names and values which are called facets.

Facets: The various aspects of a slot is known as Facets. Facets are features of frames which enable us to
put constraints on the frames. Example: IF-NEEDED facts are called when data of any particular slot is
needed. A frame may consist of any number of slots, and a slot may include any number of facets and
facets may have any number of values. A frame is also known as slot-filter knowledge representation in
artificial intelligence.

Example: 1

Let's take an example of a frame for a book

Slots Filters

Title Artificial Intelligence

Genre Computer Science

Author Peter Norvig

Edition Third Edition

Year 1996

Page 1152

Advantages of frame representation:

1. The frame knowledge representation makes the programming easier by grouping the related
data.
2. The frame representation is comparably flexible and used by many applications in AI.
3. It is very easy to add slots for new attribute and relations.
4. It is easy to include default data and to search for missing values.
5. Frame representation is easy to understand and visualize.

Disadvantages of frame representation:


1. In frame system inference mechanism is not be easily processed.
2. Inference mechanism cannot be smoothly proceeded by frame representation.
3. Frame representation has a much generalized approach.
4. Production Rules

Production rules system consist of (condition, action) pairs which mean, "If condition then action". It has
mainly three parts:

o The set of production rules

o Working Memory

o The recognize-act-cycle

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. And the action part carries out the associated problem-solving steps. This
complete process is called a recognize-act cycle.

The working memory contains the description of the current state of problems-solving and rule can
write knowledge to the working memory. This knowledge match and may fire other rules.

Example:

o IF (at bus stop AND bus arrives) THEN action (get into the bus)

o IF (on the bus AND paid AND empty seat) THEN action (sit down).

o IF (on bus AND unpaid) THEN action (pay charges).

o IF (bus arrives at destination) THEN action (get down from the bus).

Advantages of Production rule:

1. The production rules are expressed in natural language.

2. The production rules are highly modular, so we can easily remove, add or modify an individual
rule.

Disadvantages of Production rule:

1. Production rule system does not exhibit any learning capabilities, as it does not store the result
of the problem for the future uses.

2. During the execution of the program, many rules may be active hence rule-based production
systems are inefficient.

Propositional logic in Artificial intelligence


Propositional logic (PL) 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:
a) It is Sunday.
b) The Sun rises from West (False proposition)
c) 3+3= 7(False proposition)
d) 5 is a prime number.
Following are some basic facts about propositional logic:
o Propositional logic is also called Boolean logic as it works on 0 and 1.
o In propositional logic, we use symbolic variables to represent the logic, and we can use any
symbol for a representing a proposition, such A, B, C, P, Q, R, etc.
o Propositions can be either true or false, but it cannot be both.
o Propositional logic consists of an object, relations or function, and logical connectives.
o These connectives are also called logical operators.
o The propositions and connectives are the basic elements of the propositional logic.

Syntax of propositional logic:

The syntax of propositional logic defines the allowable sentences for the knowledge representation. There
are two types of Propositions:

a) Atomic Propositions
b) 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:
a) 2+2 is 4, it is an atomic proposition as it is a true fact.
b) "The Sun is cold" is also a proposition as it is a false fact.
 Compound proposition: Compound propositions are constructed by combining simpler or
atomic propositions, using parenthesis and logical connectives.

Example:
a) "It is raining today, and street is wet."
b) "Ankit is a doctor, and his clinic is in Mumbai."

Logical Connectives:

Logical connectives are used to connect two simpler propositions or representing a sentence logically. We
can create compound propositions with the help of logical connectives. There are mainly five connectives,
which are given as follows:
1.Negation: A sentence such as ¬ P is called negation of P. A literal can be either Positive literal or
negative literal.

2. Conjunction: A sentence which has ∧ connective such as, P ∧ Q is called a conjunction.


Example: Rohan is intelligent and hardworking. It can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.

3.Disjunction: A sentence which has ∨ connective, such as P ∨ Q. is called disjunction, where P and Q are
the propositions.
Example: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is Engineer, so we can write it as P ∨ Q.
4.Implication: A sentence such as P → Q, is called an implication. Implications are also known as if-then
rules. It can be represented as
If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is represented as P → Q

5.Biconditional: A sentence such as P⇔ Q is a Biconditional sentence, example If I am breathing, then I


am alive
P= I am breathing, Q= I am alive, it can be represented as P ⇔ Q.

Following is the summarized table for Propositional Logic


Connectives:
Truth Table:
In propositional logic, we need to know the truth values of propositions in all possible scenarios. We can
combine all the possible combination with logical connectives, and the representation of these
combinations in a tabular format is called Truth table. Following are the truth table for all logical
connectives:

Limitations of Propositional logic:

o We cannot represent relations like ALL, some, or none with propositional logic. Example:

a. All the girls are intelligent.


b. Some apples are sweet.
Propositional logic has limited expressive power.
In propositional logic, we cannot describe statements in terms of their properties or logical
relationships.

First-Order Logic OR Predicate Logic in Artificial intelligence

o First-order logic is another way of knowledge representation in artificial intelligence. It is


an extension to propositional logic.

o FOL is sufficiently expressive to represent the natural language statements in a concise


way.

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

o 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:

o Objects: A, B, people, numbers, colors, wars, theories, squares, pits,


wumpus, ......
o 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
o Function: Father of, best friend, third inning of, end of, ......
o As a natural language, first-order logic also has two main parts:

a. Syntax
b. Semantics
Syntax of First-Order logic:
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.

Basic Elements of First-order logic:

tant 1, 2, A, John, Mumbai, cat,....

Variables x, y, z, a, b,....

Predicates Brother, Father, >,....

Function sqrt, LeftLegOf, ....

Connectives ∧, ∨, ¬, ⇒, ⇔

Equality ==

Quantifier ∀, ∃
Following are the basic elements of FOL syntax:
Atomic sentences:
o 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.

o 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:

o Complex sentences are made by combining atomic sentences using connectives.

First-order logic statements can be divided into two parts:

o Subject: Subject is the main part of the statement.


o Predicate: A predicate can be defined as a relation, which binds two atoms together in a
statement.
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.

Quantifiers in First-order logic:


o A quantifier is a language element which generates quantification, and quantification specifies the
quantity of specimen in the universe of discourse.
o 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:
a. Universal Quantifier, (for all, everyone, everything)
b. Existential quantifier, (for some, at least one).

Universal Quantifier:
Universal quantifier is a symbol of logical representation, which specifies that the statement
within its range is true for everything or every instance of a particular thing.
The Universal quantifier is represented by a symbol ∀, which resembles an inverted A.
Note: In universal quantifier we use implication "→".
If x is a variable, then ∀x is read as:
o For all x
o For each x
o For every x.
Example:
All man drink coffee.
Let a variable x which refers to a man so all x can be represented as below:
∀x man(x) → drink (x, coffee).
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.

Note: In Existential quantifier we always use AND or Conjunction symbol (∧).

If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
o There exists a 'x.'
o For some 'x.'
o For at least one 'x.'
Example:
Some boys are intelligent.

∃x: boys(x) ∧ intelligent(x)


It will be read as: There are some x where x is a boy who is intelligent.
Properties of Quantifiers:

o In universal quantifier, ∀x∀y is similar to ∀y∀x.


o In Existential quantifier, ∃x∃y is similar to ∃y∃x.
o ∃x∀y is not similar to ∀y∃x.
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).
Difference between Propositional Logic and Predicate Logic :

Propositional Logic Predicate Logic

Predicate logic is an expression consisting of


Propositional logic is the logic that deals with variables with a specified domain. It consists of
a collection of declarative statements which objects, relations and functions between the
1
have a truth value, true or false. objects.

It is the basic and most widely used logic. It is an extension of propositional logic covering
2
Also known as Boolean logic. predicates and quantification.

A proposition has a specific truth value, A predicate’s truth value depends on the variables’
3
either true or false. value.

Predicate logic helps analyze the scope of the


subject over the predicate. There are three
quantifiers : Universal Quantifier (∀) depicts for all,
Existential Quantifier (∃) depicting there exists some
Scope analysis is not done in propositional and Uniqueness Quantifier (∃!) depicting exactly
4
logic. one.

Propositions are combined with Logical


Operators or Logical Connectives like
Negation(¬), Disjunction(∨), Conjunction(∧),
Exclusive OR(⊕), Implication(⇒), Bi- Predicate Logic adds by introducing quantifiers to
5
Conditional or Double Implication(⇔). the existing proposition.

6
It is a more generalized representation. It is a more specialized representation.

It can deal with set of entities with the help of


7
It cannot deal with sets of entities. quantifiers.

Reasoning in AI
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.

In artificial intelligence, the reasoning is essential so that the machine can also think rationally as a
human brain, and can perform like a human.
Types of Reasoning
In artificial intelligence, reasoning can be divided into the following categories:
o Deductive reasoning
o Inductive reasoning
o Abductive reasoning
o Common Sense Reasoning
o Monotonic Reasoning
o Non-monotonic Reasoning

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.
It is sometimes referred to as top-down reasoning, and contradictory to inductive reasoning.
 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.
Example:
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:

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, we use historical data or various premises to generate a generic rule, for
which premises support the conclusion.
 In inductive reasoning, premises provide probable supports to the conclusion, so the truth of
premises does not guarantee the truth of the conclusion.
Example:
Premise: All of the pigeons we have seen in the zoo are white.
Conclusion: Therefore, we can expect all the pigeons to be white.
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.
Example:
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.
 It relies on good judgment rather than exact logic and operates on heuristic
knowledge and heuristic rules.
Example:
1. One person can be at one place at a time.
2. 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.

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.
Example:
o 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.

Advantages of Monotonic Reasoning:


o In monotonic reasoning, each old proof will always remain valid.
o If we deduce some facts from available facts, then it will remain valid for always.
Disadvantages of Monotonic Reasoning:
o We cannot represent the real world scenarios using Monotonic reasoning.
o Hypothesis knowledge cannot be expressed with monotonic reasoning, which means facts
should be true.
o Since we can only derive conclusions from the old proofs, so new knowledge from the real world
cannot be added.
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.

Example: Let suppose the knowledge base contains the following knowledge:

o Birds can fly


o Penguins cannot fly
o 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.

Advantages of Non-monotonic reasoning:

o For real-world systems such as Robot navigation, we can use non-monotonic reasoning.

o In Non-monotonic reasoning, we can choose probabilistic facts or can make assumptions.

Disadvantages of Non-monotonic Reasoning:

o In non-monotonic reasoning, the old facts may be invalidated by adding new sentences.

o It cannot be used for theorem proving.

P.GANDHI PRAKASH M.Tech.,(Ph.D) LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING MYLAVARAM.

You might also like