Unit3 &4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

In AI to make a agent or machine intelligent one of the key factor is knowledge.

Knowledge: It is facts or skills , which we accumulate through education and


experience.

Intelligence : It is an ability to use that knowledge.

Reasoning : It is a processing of the knowledge ( thinking ).

Knowledge representation means that we have to store the knowledge so that


we can understand the knowledge at the right time and make proper decision.

To represent the knowledge we have to follow 2 rules :

A. Syntax : It means we should follow grammatical rules The knowledge should


be grammatically correct .If we doesn’t follow grammatical rules then it leads to
Syntax Errror.

Ex: I is going to school -- Here using of “is” is not acceptable it leads to Syntax
Error.

I am going to school . – It gives perfect meaning.

B.Semantic : It means the knowledge should be meaning full.

Ex: I watched the food by eating cricket .

Knowledge representation Methods:

Knowledge Representation Methods


K

hkkhkk
Logic Rules Semantic Nets Frame Script
There are 5 types knowledge representation methods are there :

1.Logic :
 Logical Representation is a language with some proper rules which deals
with propositions and has no ambiguity in representation.
 Propositions means the symbols we use ( AND,OR..)

Logical representation can be categorised into 2 types

1.Propositional Logic

2.Predicate Logic

1.Propositional Logic
 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.
 Propositions can be either true or false, but it cannot be both
 Propositional logic consists of an object, relations or function, and logical
connectives.These connectives are called as Logical Operators

Syntax of propositional logic:


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

I . Atomic Propositions - Atomic propositions are the simple propositions. It consists of a


single proposition symbol. These are the sentences which must be either true or false.

Ex: 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.

II .Compound propositions - Compound propositions are constructed by combining simpler


or atomic propositions, using parenthesis and logical connectives.

Ex: 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 Doctor, 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.
2. Predicate Logic
 Predicate logic is another way of knowledge representation in artificial
intelligence. It is an extension to propositional logic.
 Predicate logic also known as First-order 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

 Predicate 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, ......
Basic Elements of Predicate Logic

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.

Predicate 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 Predicate logic:
Quantifiers 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).

1.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 ∀

Note: In universal quantifier we use implication "→".

Example:
All man drink coffee.

Let a variable x which refers to a man

∀x man(x) → drink (x, coffee).

It will be read as: There are all x where x is a man who drink coffee

2.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 ∃.


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

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.

Some more examples of Predicate Logic


2.Rules :
Rule based reasoning system have played important
role in evolution of AI.

We consider a set of rules to represent both knowledge about


relationship in world and knowledge about how to solve problem.

A.Procedural vs Declarative Knowledge

B.Forward vs Backward Reasoning

A.PROCEDURAL & DECLARATIVE KNOWLEDGE

Procedural Knowledge:

 Procedural knowledge is the knowledge of how to perform or


how to operate or how to do something.
 It’s a representation in which the control information that is
necessary to use the knowledge is embedded in the knowledge
itself.
 For example :Computer programs ,directions ,and recipes ;these
indicate specific use or implementation.
 Example: how to cook vegetable or how to prepare a particular
dish is procedural knowledge .
 Moreover, knowledge encoded in some procedures, small
programs that know how to do specific things and how
examined.
 Procedural knowledge includes rules,stratagies,agendas

Declarative Knowledge:

 Declarative knowledge refers to facts or information stored in


the memory, that is considered static in nature. Declarative
knowledge, also referred to as conceptual, propositional or
descriptive knowledge, describes things, events, or processes;
their attributes; and their relation to each other
 Declarative knowledge includes: concepts, objects, facts.
 In declarative knowledge, a statement in which knowledge is
specified, but how the knowledge is to be put is not given.
 So to use declarative representation, we must have a program
that explains what is to do with the knowledge and how.
 It is more general than procedural knowledge
 Example 1: The first step in cooking a vegetable is chopping it
 Example 2: To prepare a dish one needs to gather its
ingredients.
B.Forward Reasoning vs Backward Reasoning
We can solve the problem in 2 ways

1.Reasoning forward from the initial state (Forward Reasoning):

In forward reasoning the left hand sides of the rules are matched against
the current state and right sides are used to generate the new state, until
the goal is reached.

Reason forward from the initial state:

Step 1: Begin building a tree of move sequences by starting with the initial
configuration at the root of the tree.

Step 2: Generate the next level of tree by finding all rules whose left hand
side matches against the root node. The right hand side is used to create
new configurations.

Step 3: Generate the next level by considering the nodes in the previous
level and applying it to all rules whose left hand side match.
2.Backward Reasoning :

In backward reasoning the right hand sides of the rules are matched against the current
state and left sides are used to generate the new state.

Reasoning backward from the goal states:

Step 1: Begin building a tree of move sequences by starting with the goal node
configuration at the root of the tree.

Step 2: Generate the next level of tree by finding all rules whose right hand side
matches against the root node. The left hand side is used to create new configurations.

Step 3: Generate the next level by considering the nodes in the previous level and
applying it to all rules whose right hand side match it. Then use corresponding left hand
sides to generate the new nodes. Continue until the node that matches the initial
state is generated

3.Semantic Networks :
we can store our knowledge in the form of a graph, with nodes
representing objects in the world, and arrows or links representing
relationships between those objects.

Components:
 Lexical components: nodes, links, labels
 Structural components: node or link (Directed)
 Semantic components: define relation between nodes through link
 Procedural components

 Constructor – creation of links


 Destructor – removal of links

4.Frames:
Frames are record like structure that have slots & slot values for
an entity.

A slot in a frame specify a characteristic of the entity which the


frame represents.

A slot in a frame contains information as attribute-value pairs,


default values etc.
Examples:

Ex1:

Employee details

Eswar(

(Profession (Value Faculty))

(EmpID (Value 1000123))

(Address (Value East Godavari))

Ex2:

Tweety is a yellow bird having wings to fly.

Tweety(

(Species (Value bird))

(Color (Value yellow))

(Action (Value fly))

5.Script:
 Script is used to represent knowledge
 It contains structure similar to frame
 It also contain slots
 Each slot represent situation or event
o What can happen in a situation
o Which event follows
Example:
1.Going to market ,purchasing and paying bill
2.Going to restuarent , ordering food, paying bill
The components of script includes :
o Entry conditions – These must be satisfied before events
in a script can occur
o Results - Conditions that will be true after events in script
occurs
o Props – Slots representing objects involved in events
o Roles – Persons involved in the events
o Track – Variations on the script , different tracks may share
components of the same script
o Scenes – The sequence of events that occur . Events are
represented in conceptual dependency form .

Instance & IS-A Relation:


Instance Relation (Object , class):
Instance relation is called as class membership
Examples:
1.Marcus was a man
Instance( marcus , man )
Here marcus is an object and man is a class
2.Marcus was a Pompeian
Instance( marcus , Pompeian )
IS – A Relation : (class , class)
IS-A relation is called as class inclusion
Ex: All pompeians are romans
IS-A ( Pompeian , Roman) – Here Pompeian is a class
and roman is a class

Computable function & predicate :


It can be used when number of facts is not very large or when
facts are not sufficiently structured .It uses “greater than” and
“less than” relations to express simplefacts.

gt(1,0),gt(2,1),lt(0,1) ………….

Simple facts can be denoted using predicate logic such as

Marcus tried to assassinate caeser.

tryassassinate( marcus , caeser )

Example :
No mortal lives longer than 150 years
Ɐx: Ɐt1: Ɐt2:mortal(x)ꓥborn(x,t1) ꓥ gt(t2-t1,150)->died(x,t2)
Alive means not dead
Ɐt1: Ɐx:alive(x,t1) -> Ꞁdead(x,t1)

You might also like