0% found this document useful (0 votes)
3 views56 pages

Module III

Propositional logic (PL) is a fundamental form of logic that uses propositions, which are statements that can be true or false, and employs logical connectives to form complex sentences. First-order logic (FOL) extends PL by allowing the representation of relationships and properties of objects, making it more suitable for expressing natural language statements. Key components of FOL include quantifiers, predicates, and the process of unification, which is essential for logical inference in artificial intelligence.

Uploaded by

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

Module III

Propositional logic (PL) is a fundamental form of logic that uses propositions, which are statements that can be true or false, and employs logical connectives to form complex sentences. First-order logic (FOL) extends PL by allowing the representation of relationships and properties of objects, making it more suitable for expressing natural language statements. Key components of FOL include quantifiers, predicates, and the process of unification, which is essential for logical inference in artificial intelligence.

Uploaded by

n5504130ab
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Propositional logic:

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.

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.
o Connectives can be said as a logical operator which connects two sentences.
o A proposition formula which is always true is called tautology, and it is also called a
valid sentence.
o A proposition formula which is always false is called Contradiction.
o A proposition formula which has both true and false values is called
o Statements which are questions, commands, or opinions are not propositions such as
"Where is Rohini", "How are you", "What is your name", are not propositions.

Syntax of propositional logic:

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

Atomic Propositions

Compound propositions

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

1. a) 2+2 is 4, it is an atomic proposition as it is a true fact.


2. b) "The Sun is cold" is also a proposition as it is a false fact.
3. Compound proposition: Compound propositions are constructed by combining
simpler or atomic propositions, using parenthesis and logical connectives.
Example:

1. a) "It is raining today, and street is wet."


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

First-Order Logic in Artificial intelligence:

In the topic of Propositional logic, we have seen that how to represent statements using
propositional logic. But unfortunately, in propositional logic, we can only represent the facts,
which are either true or false. PL is not sufficient to represent complex sentences or natural
language statements. The propositional logic has very limited expressive power. Consider the
following sentence, which we cannot represent using PL logic.

o "Some humans are intelligent", or


o "Sachin likes cricket."
To represent the above statements, PL logic is not sufficient, so we required some more
powerful logic, such as first-order logic.

First-Order logic:
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:

Following are the basic elements of FOL syntax:

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

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

Predicates Brother, Father, >,....


Function sqrt, LeftLegOf, ....

Connectives ∧, ∨, ¬, ⇒, ⇔

Equality ==

Quantifier ∀, ∃

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 cat so all x can be represented in UOD 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.
Points to remember:
o The main connective for universal quantifier ∀ is implication →.
o The main connective for existential quantifier ∃ is and ∧.

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

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)].

Free and Bound Variables:

The quantifiers interact with variables which appear in a suitable way. There are two types of
variables in First-order logic which are given below:

Free Variable: A variable is said to be a free variable in a formula if it occurs outside the scope
of the quantifier.
Example: ∀x ∃(y)[P (x, y, z)], where z is a free variable.

Bound Variable: A variable is said to be a bound variable in a formula if it occurs within the
scope of the quantifier.

Example: ∀x [A (x) B( y)], here x and y are the bound variables.

Unification:

o Unification is a process of making two different logical atomic expressions identical by


finding a substitution. Unification depends on the substitution process.
o It takes two literals as input and makes them identical using substitution.
o 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).
o Example: Find the MGU for Unify{King(x), King(John)}

Let Ψ1 = King(x), Ψ2 = King(John),

Substitution θ = {John/x} is a unifier for these atoms and applying this substitution, and both
expressions will be identical.

o The UNIFY algorithm is used for unification, which takes two atomic sentences and
returns a unifier for those sentences (If any exist).
o Unification is a key component of all first-order inference algorithms.
o It returns fail if the expressions do not match with each other.
o The substitution variables are called Most General Unifier or MGU.

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.

P(x,y).........(i)
P(a, f(z))......... (ii)

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

Conditions for Unification:

Following are some basic conditions for unification:


o Predicate symbol must be same, atoms or expression with different predicate symbol
can never be unified.
o Number of Arguments in both expressions must be identical.
o Unification will fail if there are two similar variables present in the same expression.

Unification Algorithm:

Algorithm: Unify(Ψ1, Ψ2)

Step. 1: If Ψ1 or Ψ2 is a variable or constant, then:


a) If Ψ1 or Ψ2 are identical, then return NIL.
b) Else if Ψ1is a variable,
a. then if Ψ1 occurs in Ψ2, then return FAILURE
b. Else return { (Ψ2/ Ψ1)}.
c) Else if Ψ2 is a variable,
a. If Ψ2 occurs in Ψ1 then return FAILURE,
b. Else return {( Ψ1/ Ψ2)}.
d) Else return FAILURE.
Step.2: If the initial Predicate symbol in Ψ1 and Ψ2 are not same, then return FAILURE.
Step. 3: IF Ψ1 and Ψ2 have a different number of arguments, then return FAILURE.
Step. 4: Set Substitution set(SUBST) to NIL.
Step. 5: For i=1 to the number of elements in Ψ1.
a) Call Unify function with the ith element of Ψ1 and ith element of Ψ2, and put the
result into S.
b) If S = failure then returns Failure
c) If S ≠ NIL then do,
a. Apply S to the remainder of both L1 and L2.
b. SUBST= APPEND(S, SUBST).
Step.6: Return SUBST.
Implementation of the Algorithm

Step.1: Initialize the substitution set to be empty.

Step.2: Recursively unify atomic sentences:

a. Check for Identical expression match.


b. If one expression is a variable vi, and the other is a term ti which does not contain
variable vi, then:
a. Substitute ti / vi in the existing substitutions
b. Add ti /vi to the substitution setlist.
c. If both the expressions are functions, then function name must be similar, and
the number of arguments must be the same in both the expression.

For each pair of the following atomic sentences find the most general unifier (If exist).
Hence, unification is not possible for these expressions.

4. Find the MGU of UNIFY(prime (11), prime(y))


FOL inference rules for quantifier:

As propositional logic we also have inference rules in first-order logic, so following are some
basic inference rules in FOL:

o Universal Generalization
o Universal Instantiation
o Existential Instantiation
o Existential introduction

1. Universal Generalization:

o Universal generalization is a valid inference rule which states that if premise P(c) is
true for any arbitrary element c in the universe of discourse, then we can have a
conclusion as ∀ x P(x).

o It can be represented as: .


o This rule can be used if we want to show that every element has a similar property.
o In this rule, x must not appear as a free variable.

Example: Let's represent, P(c): "A byte contains 8 bits", so for ∀ x P(x) "All bytes contain
8 bits.", it will also be true.

2. Universal Instantiation:

o Universal instantiation is also called as universal elimination or UI is a valid inference


rule. It can be applied multiple times to add new sentences.
o The new KB is logically equivalent to the previous KB.
o As per UI, we can infer any sentence obtained by substituting a ground term for
the variable.
o The UI rule state that we can infer any sentence P(c) by substituting a ground term c (a
constant within domain x) from ∀ x P(x) for any object in the universe of discourse.

o It can be represented as: .


o Example:1.
o IF "Every person like ice-cream"=> ∀x P(x) so we can infer that
"John likes ice-cream" => P(c)
o Example: 2.
o Let's take a famous example,
o "All kings who are greedy are Evil." So let our knowledge base contains this detail as
in the form of FOL:

∀x king(x) ∧ greedy (x) → Evil (x),

So from this information, we can infer any of the following statements using Universal
Instantiation:
o King(John) ∧ Greedy (John) → Evil (John),
o King(Richard) ∧ Greedy (Richard) → Evil (Richard),
o King(Father(John)) ∧ Greedy (Father(John)) → Evil (Father(John)),

3. Existential Instantiation:

o Existential instantiation is also called as Existential Elimination, which is a valid


inference rule in first-order logic.
o It can be applied only once to replace the existential sentence.
o The new KB is not logically equivalent to old KB, but it will be satisfiable if old KB
was satisfiable.
o This rule states that one can infer P(c) from the formula given in the form of ∃x P(x)
for a new constant symbol c.
o The restriction with this rule is that c used in the rule must be a new term for which P(c
) is true.

o It can be represented as:

Example:

From the given sentence: ∃x Crown(x) ∧ OnHead(x, John),

So we can infer: Crown(K) ∧ OnHead( K, John), as long as K does not appear in the
knowledge base.

o The above used K is a constant symbol, which is called Skolem constant.


o The Existential instantiation is a special case of Skolemization process.

4. Existential introduction

o An existential introduction is also known as an existential generalization, which is a


valid inference rule in first-order logic.
o This rule states that if there is some element c in the universe of discourse which has a
property P, then we can infer that there exists something in the universe which has the
property P.

o It can be represented as:


o Example: Let's say that,
"Priyanka got good marks in English."
"Therefore, someone got good marks in English."

Resolution in FOL

Resolution

Resolution is a theorem proving technique that proceeds by building refutation proofs, i.e.,
proofs by contradictions. It was invented by a Mathematician John Alan Robinson in the year
1965.

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 or clausal form.

Clause: Disjunction of literals (an atomic sentence) is called a clause. It is also known as a unit
clause.

Conjunctive Normal Form: A sentence represented as a conjunction of clauses is said to


be conjunctive normal form or CNF.

The resolution inference rule:

The resolution rule for first-order logic is simply a lifted version of the propositional rule.
Resolution can resolve two clauses if they contain complementary literals, which are assumed
to be standardized apart so that they share no variables.

Where li and mj are complementary literals.

This rule is also called the binary resolution rule because it only resolves exactly two
literals.

Example:

We can resolve two clauses which are given below:

[Animal (g(x) V Loves (f(x), x)] and [¬ Loves(a, b) V ¬Kills(a, b)]

Where two complimentary literals are: Loves (f(x), x) and ¬ Loves (a, b)

These literals can be unified with unifier θ= [a/f(x), and b/x] , and it will generate a resolvent
clause:
[Animal (g(x) V ¬ Kills(f(x), x)].

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

To better understand all the above steps, we will take an example in which we will apply
resolution.

Example:
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.
g. Step-1: Conversion of Facts into FOL
h. 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.

o Eliminate all implication (→) and rewrite


a. ∀x ¬ food(x) V likes(John, x)
b. food(Apple) Λ food(vegetables)
c. ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y)
d. eats (Anil, Peanuts) Λ alive(Anil)
e. ∀x ¬ eats(Anil, x) V eats(Harry, x)
f. ∀x¬ [¬ killed(x) ] V alive(x)
g. ∀x ¬ alive(x) V ¬ killed(x)
h. likes(John, Peanuts).
o Move negation (¬)inwards and rewrite
a. ∀x ¬ food(x) V likes(John, x)
b. food(Apple) Λ food(vegetables)
c. ∀x ∀y ¬ eats(x, y) V killed(x) V food(y)
d. eats (Anil, Peanuts) Λ alive(Anil)
e. ∀x ¬ eats(Anil, x) V eats(Harry, x)
f. ∀x ¬killed(x) ] V alive(x)
g. ∀x ¬ alive(x) V ¬ killed(x)
h. likes(John, Peanuts).
o Rename variables or standardize variables
a. ∀x ¬ food(x) V likes(John, x)
b. food(Apple) Λ food(vegetables)
c. ∀y ∀z ¬ eats(y, z) V killed(y) V food(z)
d. eats (Anil, Peanuts) Λ alive(Anil)
e. ∀w¬ eats(Anil, w) V eats(Harry, w)
f. ∀g ¬killed(g) ] V alive(g)
g. ∀k ¬ alive(k) V ¬ killed(k)
h. likes(John, Peanuts).
o 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.
o 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.
a. ¬ food(x) V likes(John, x)
b. food(Apple)
c. food(vegetables)
d. ¬ eats(y, z) V killed(y) V food(z)
e. eats (Anil, Peanuts)
f. alive(Anil)
g. ¬ eats(Anil, w) V eats(Harry, w)
h. killed(g) V alive(g)
i. ¬ alive(k) V ¬ killed(k)
j. likes(John, Peanuts).

Note: Statements "food(Apple) Λ food(vegetables)" and "eats (Anil, Peanuts) Λ


alive(Anil)" can be written in two separate statements.
o 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 follows:
Hence the negation of the conclusion has been proved as a complete contradiction with the
given set of statements.

Explanation of Resolution graph:


o 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)
o 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) .
o 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) .
o 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) .
o In the last step of the resolution graph ¬ alive(Anil) and alive(Anil) get resolved.

Normal Forms

The problem of finding whether a given statement is tautology or contradiction or satisfiable


in a finite number of steps is called the Decision Problem. For Decision Problem, construction
of truth table may not be practical always. We consider an alternate procedure known as the
reduction to normal forms.

There are two such forms:

1. Disjunctive Normal Form (DNF)


2. Conjunctive Normal Form

Disjunctive Normal Form (DNF): If p, q are two statements, then "p or q" is a compound
statement, denoted by p ∨ q and referred as the disjunction of p and q. The disjunction of p and
q is true whenever at least one of the two statements is true, and it is false only when both p
and q are false

p q p∨q

T T T

T F T

F T T

F F F
Example: - if p is "4 is a positive integer" and q is "√5 is a rational number", then p ∨ q is true
as statement p is true, although statement q is false.

Conjunctive Normal Form: If p, q are two statements, then "p and q" is a compound
statement, denoted by p ∧ q and referred as the conjunction of p and q. The conjunction of p
and q is true only when both p and q are true, otherwise, it is false

p q p∧q

T T T

T F F

F T F

F F F

Example: if statement p is "6<7" and statement q is "-3>-4" then the conjunction of p and q is
true as both p and q are true statements.
Structured Representation of Knowledge

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:

a. Propositional Logics
b. 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.

Drawbacks in Semantic representation:


1. Semantic networks take more computational time at runtime as we need to traverse the
complete network tree to answer some questions. It might be possible in the worst case
scenario that after traversing the entire tree, we find that the solution does not exist in
this network.
2. 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.
3. These types of representations are inadequate as they do not have any equivalent
quantifier, e.g., for all, for some, none, etc.
4. Semantic networks do not have any standard definition for the link names.
5. These networks are not intelligent and depend on the creator of the system.

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.

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.

Frames are derived from semantic networks and later evolved into our modern-day classes and
objects. A single frame is not much useful. Frames system consist of a collection of frames
which are connected. In the frame, knowledge about an object or event can be stored together
in the knowledge base. The frame is a type of technology which is widely used in various
applications including Natural language processing and machine visions.

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

Example 2:

Let's suppose we are taking an entity, Peter. Peter is an engineer as a profession, and his age is
25, he lives in city London, and the country is England. So following is the frame representation
for this:

Slots Filter

Name Peter

Profession Doctor

Age 25

Marital status Single

Weight 78

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.

If there is a new situation (state) generates, then multiple production rules will be fired together,
this is called conflict set. In this situation, the agent needs to select a rule from these sets, and
it is called a conflict resolution.

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.
Knowledge can be represented in different ways. The structuring of knowledge and how
designers might view it, as well as the type of structures used internally are considered.
Different knowledge representation techniques are

a. Logic

b. Semantic Network

c. Frame
d. Conceptual Graphs

e. Conceptual Dependency

f. Script

Logic

A logic is a formal language, with precisely defined syntax and semantics, which supports
sound inference. Different logics exist, which allow you to represent different kinds of things,
and which allow more or less efficient inference. The logic may be different types like
propositional logic, predicate logic, temporal logic, description logic etc. But representing
something in logic may not be very natural and inferences may not be efficient.
Semantic Network

A semantic network is a graphical knowledge representation technique. This knowledge


representation system is primarily on network structure. The semantic networks were basically
developed to model human memory. A semantic net consists of nodes connected by arcs. The
arcs are defined in a variety of ways, depending upon the kind of knowledge being represented.

The main idea behind semantic net is that the meaning of a concept comes, from the ways in
which it is connected to other concepts. The semantic network consists of different nodes and
arcs. Each node should contain the information about objects and each arc should contain the
relationship between objects. Semantic nets are used to find relationships among objects by
spreading activation about from each of two nodes and seeing where the activation met this
process is called intersection search.

For example: Ram is a boy.

Semantic network by using Instances

The semantic network based knowledge representation mechanism is useful where an object
or concept is associated with many attributes and where relationships between objects are
important. Semantic nets have also been used in natural language research to represent complex
sentences expressed in English. The semantic representation is useful because it provides a
standard way of analyzing the meaning of sentence. It is a natural way to represent relationships
that would appear as ground instances of binary predicates in predicate logic. In this case we
can create one instance of each object. In instance based semantic net representations some
keywords are used like: IS A, INSTANCE, AGENT, HAS-PARTS etc.

Consider the following examples:

1. Suppose we have to represent the sentence “Sima is a girl”.

2. Ram is taller than Hari


3. “Mouse is a Rodent and Rodent is a mammal. Mouse ha s teeth and etas grass”. Check
whether the sentence mammal has teeth is valid or not. ]
Partitioned Semantic Network

Some complex sentences are there which cannot be represented by simple semantic nets and
for this we have to follow the technique partitioned semantic networks. Partitioned semantic
net allow for

1. Propositions to be made without commitment to truth.

2. Expressions to be quantified.

In partitioned semantic network, the network is broken into spaces which consist of groups of
nodes and arcs and regard each space as a node.

Let us consider few examples.

Draw the partitioned semantic network structure for the followings:

a) Sima is eating an apple.


b) All Sima are eating an apple.

c) All Sima are eating some apple.

d) All men are mortal


e) Every dog has bitten a shopkeeper

f) Every dog in town has bitten a shopkeeper.

NOTE: On the above semantic network structures, the instance “IS A” is used. Also two terms
like assailant and victim are used. Assailant means “by which the work is done” and that of
victim refers t o “on which the work is applied”. Another term namely GS, which refers to
General Statement. For GS, make a node g which is an instance of Gs. Every element will have
at least two attributes. Firstly, a form that states which a relation is being asserted. Secondly,
one or more for all (") or there exists ($) connections which represent universally quantifiable
variables.

FRAME

A frame is a collection of attributes and associated values that describe some entity in the world.
Frames are general record like structures which consist of a collection of slots and slot values.
The slots may be of any size and type. Slots typically have names and values or subfields called
facets. Facets may also have names and any number of values. A frame may have any number
of slots, a slot may have any number of facets, each with any number of values. A slot contains
information such as attribute value pairs, default values, condition for filling a slot, pointers to
other related frames and procedures that are activated when needed for different purposes.
Sometimes a frame describes an entity in some absolute sense, sometimes it represents the
entity from a particular point of view. A single frame taken alone is rarely useful. We build
frame systems out of collection of frames that are connected to each other by virtue of the fact
that the value of an attribute of one frame may be another frame. Each frame should start with
an open parenthesis and closed with a closed parenthesis.

Syntax of a frame
Let us consider the below examples.

1) Create a frame of the person Ram who is a doctor. He is of 40. His wife name is Sita.
They have two children Babu and Gita. They live in 100 kps street in the city of Delhi in
India. The zip code is 756005.

(Ram

(PROFESSION (VALUE Doctor))

(AGE (VALUE 40))

(WIFE (VALUE Sita))

(CHILDREN (VALUE Bubu, Gita))

(ADDRESS

(STREET (VALUE 100 kps))

(CITY(VALUE Delhi))

(COUNTRY(VALUE India))

(ZIP (VALUE 756005))))

2) Create a frame of the person Anand who is a chemistry professor in RD Women’s


College. His wife name is Sangita having two children Rupa and Shipa.

(Anand
(PROFESSION (VALUE Chemistry Professor))

(ADDRESS (VALUE RD Women’s College))

(WIFE (VALUE Sangita))

(CHILDREN(VALUE RupaShipa)))

3) Create a frame of the person Akash who has a white maruti car of LX-400 Model. It
has 5 doors. Its weight is 225kg, capacity is 8, and mileage is 15 km /lit.

(Akash

(CAR (VALUE Maruti))

(COLOUR (VALUE White))

(MODEL (VALUE LX-400))

(DOOR (VALUE 5))

(WEIGHT (VALUE 225kg))

(CAPACITY (VALUE 8))

(MILAGE (VALUE 15km/lit)))

The frames can be attached with another frame and can create a network of frames. The main
task of action frame is to provide the facility for procedural attachment and help in reasoning
process. Reasoning using frames is done by instantiation. Instantiation process begins, when
the given situation is matched with frames that are already in existence. The reasoning process
tries to match the current problem state with the frame slot and assigns them [Link]
valuesassigned to the slots depict a particular situation and by this, the reasoning process moves
towards a goal. The reasoning process can be defined as filling slot values in frames.

Conceptual Graphs

It is a knowledge representation technique which consists of basic concepts and the relationship
between them. As the name indicates, it tries to capture the concepts about the events and
represents them in the form of a graph. A concept may be individual or generic. An individual
concept has a type field followed by a reference field. For example person : Ram. Here person
indicates type and Ram indicates reference.

An individual concept should be represented within a rectangle in graphical representation and


within a square bracket in linear representation. The generic concept should be represented
within an oval in graphical representation and within a parenthesis in linear representation.
Conceptual graph is a basic building block for associative network. Concepts like AGENT,
OBJECT, INSTRUMENT, PART are obtained from a collection of standard concepts. New
concepts and relations can be defined from these basic ones. These are also basic building block
for associative network. A linear conceptual graph is an elementary form of this structure. A
single conceptual graph is roughly equivalent to a graphical diagram of a natural language
sentence where the words are depicted as concepts and relationships.

Consider an example

“Ram is eating an apple “


Conceptual Dependency

It is an another knowledge representation technique in which we can represent any kind of


knowledge. It is based on the use of a limited number of primitive concepts and rules of
formation to represent any natural language statement. Conceptual dependency theory is based
on the use of knowledge representation methodology was primarily developed to understand
and represent natural language structures. The conceptual dependency structures were
originally developed by Roger C SChank in 1977.

If a computer program is to be developed that can understand wide phenomenon represented


by natural languages, the knowledge representation should be powerful enough to represent
these concepts. The conceptual dependency representation captures maximum concepts to
provide canonical form of meaning of sentences. Generally there are four primitives from
which the conceptual dependency structure can be described. They are

a. ACTS : Actions
b. PPs : Objects (Picture Producers)
c. AAs : Modifiers of Actions (Action Aiders)
d. Pas : Modifiers of PPs (Picture Aiders)
e. TS : Time of action

Conceptual dependency provides both a structure and a specific set of primitives at a particular
level of granularity, out of which representation of particular pieces of information can be
constructed.
For example

Where ←: Direction of dependency

Double arrow indicates two way link between actor and action.

P: Past Tense

ATRANS: One of the primitive acts used by the theory

O: The objective case relation

R: Recipient case Relation

In CD, representation of actions are built from a set of primitive acts.

1) ATRANS: Transfer of an abstract relationship (give, accept, take)

2) PTRANS: Transfer the physical location of an object ( Go, Come, Run, Walk)

3) MTRANS: Transfer the mental information (Tell)

4) PROPEL: Application of physical force to an object (push, pull, throw)

5) MOVE: Movement of a body part by its owner (kick).


6) GRASP: Grasping of an object by an action (clutch)

7) INGEST: Ingestion of an object by an animal (eat)

8) EXPEL: Expel from an animal body (cry)

9) MBUILD: Building new information out of old (decide)

10) SPEAK: Production of sounds (say)

ATTEND: Focusing of a sense organ towards a stimulus (Listen)


The main goal of CD representation is to capture the implicit concept of a sentence and make
it explicit. In normal representation of the concepts, besides actor and object, other concepts of
time, location, source and destination are also mentioned. Following conceptual tenses are used
in CD representation.

1) O: Object case relationship


2) R: Recipient case relationship
3) P : Past
4) F : Future
5) Nil : Present
6) T : Transition
7) Ts : Start Transition
8) Tf : Finisher Transition
9) K : Continuing
10) ? : Interrogative
11) / : Negative
12) C : Conditional
SCRIPT

It is an another knowledge representation technique. Scripts are frame like structures used to
represent commonly occurring experiences such as going to restaurant, visiting a doctor. A
script is a structure that describes a stereotyped sequence of events in a particular context. A
script consist of a set of slots. Associated with each slot may be some information about what
kinds of values it may contain as well as a default value to be used if no other information is
available. Scripts are useful because in the real world, there are no patterns to the occurrence
of events. These patterns arise because of clausal relationships between events. The events
described in a script form a giant casual chain. The beginning of the chain is the set of entry
conditions which enable the first events of the script to occur. The end of the chain is the set of
results which may enable later events to occur. The headers of a script can all serve as indicators
that the script should be activated.

Once a script has been activated, there are a variety of ways in which it can be useful in
interpreting a particular situation. A script has the ability to predict events that has not explicitly
been observed. An important use of scripts is to provide a way of building a single coherent
interpretation from a collection of observation. Scripts are less general structures than are
frames and so are not suitable for representing all kinds of knowledge. Scripts are very useful
for representing the specific kinds of knowledge for which they were designed.

A script has various components like:

1) Entry condition: It must be true before the events described in the script can occur. E.g.
in a restaurant script the entry condition must be the customer should be hungry and the
customer has money.

2) Tracks: It specifies particular position of the script e.g. In a supermarket script the tracks
may be cloth gallery, cosmetics gallery etc.
3) Result: It must be satisfied or true after the events described in the script have
occurred. e.g. In a restaurant script the result must be true if the customer is pleased. The
customer has less money.
4) Probs: It describes the inactive or dead participants in the script e.g. In a supermarket
script, the probes may be clothes, sticks, doors, tables, bills etc.
5) Roles: It specifies the various stages of the script. E.g. In a restaurant script the scenes
may be entering, ordering etc.
Now let us look on a movie script description according to the above component.

a) Script name : Movie


b) Track : CINEMA HALL
c) Roles : Customer(c), Ticket seller(TS), Ticket Checker(TC), Snacks
Sellers (SS)
d) Probes : Ticket, snacks, chair, money, Ticket, chart
e) Entry condition : The customer has money
The customer has interest to watch movie.

6) Scenes:

a. SCENE-1 (Entering into the cinema hall)

CPTRANS C into the cinema hall

C ATTEND eyes towards the ticket counter C PTRANS C towards the ticket counters C
ATTEND eyes to the ticket chart

C MBUILD to take which class ticket C MTRANS TS for ticket

C ATRANS money to TS

TS ATRANS ticket to C

b. SCENE-2 (Entering into the main ticket check gate)

C PTRANS C into the queue of the gate C ATRANS ticket to TC

TC ATTEND eyes onto the ticket

TC MBUILD to give permission to C for entering into the hall

TC ATRANS ticket to C

C PTRANS C into the picture hall.


c. SCENE-3 (Entering into the picture hall)
CATTEND eyes into the chair

TC SPEAK where to sit

C PTRANS C towards the sitting position

C ATTEND eyes onto the screen d. SCENE-4 (Ordering snacks)


C MTRANS SS for snacks

SS ATRANS snacks to C

C ATRANS money to SS

C INGEST snacks e. SCENE-5 (Exit)


C ATTEND eyes onto the screen till the end of picture

C MBUILD when to go out of the hall

C PTRANS C out of the hall

7) Result:

The customer is happy

The customer has less money

Example 2: Write a script of visiting a doctor in a hospital

1) SCRIPT_NAME : Visiting a doctor


2) TRACKS : Ent specialist
3) ROLES : Attendant (A), Nurse(N), Chemist (C), Gatekeeper(G), Counter clerk(CC),
Receptionist(R), Patient(P), Ent specialist Doctor (D), Medicine Seller (M).
4) PROBES : Money, Prescription, Medicine, Sitting chair, Doctor’s table, Thermometer,
Stetho scope, writing pad, pen, torch, stature.
5) ENTRY CONDITION: The patient need consultation. Doctor’s visiting time on.
6) SCENES:

a. SCENE-1 (Entering into the hospital)

PPTRANS P into hospital

P ATTEND eyes towards ENT department

P PTRANS P into ENT department

P PTRANS P towards the sitting chair b. SCENE-2 (Entering into the


Doctor’s Room)
P PTRANS P into doctor’s room

P MTRANS P about the diseases

P SPEAK D about the disease

D MTRANS P for blood test, urine test

D ATRANS prescription to P

P PTRANS prescription to P.

P PTRANS P for blood and urine test c. SCENE-3 (Entering into the Test
Lab)
P PTRANS P into the test room

P ATRANS blood sample at collection room

P ATRANS urine sample at collection room

P ATRANS the examination reports

d. SCENE-4 (Entering to the Doctor’s room with Test reports)

P ATRANS the report to D

D ATTEND eyes into the report

D MBUILD to give the medicines

D SPEAK details about the medicine to P

P ATRANS doctor’s fee

P PTRANS from doctor’s room

e. SCENE-5 (Entering towards medicine shop)

P PTRANS P towards medicine counter

P ATRANS Prescription to M

M ATTEND eyes into the prescription


M MBUILD which medicine to give

M ATRANS medicines to P

P ATRANS money to M

P PTRANS P from the medicine shop

7) RESULT:

The patient has less money

Patient has prescription and medicine.

Advantages And Disadvantages Of Different Knowledge Representation


CYC:

CYC is an example of a frame-based representational system of knowledge, which is, in


a way, the opposite of an expert system. Whereas an expert system has detailed knowledge
of a very narrow domain, the developers of CYC have fed it information on over 100,000
different concepts from all fields of human knowledge. CYC also has information of over
1,000,000 different pieces of “common sense” knowledge about those concepts.

The system has over 4000 different types of links that can exist between concepts, such as
inheritance, and the “is–a” relationship that we have already looked at.
The idea behind CYC was that humans function in the world mainly on the basis of a large
base of knowledge built up over our lifetimes and our ancestors’ lifetimes.
By giving CYC access to this knowledge, and the ability to reason about it, they felt they would
be able to come up with a system with common sense. Ultimately, they predict, the system will
be built into word processors.

Then word processors will not just correct your spelling and grammar, but will also point out
inconsistencies in your document.
For example, if you promise to discuss a particular subject later in your document, and then
forget to do so, the system will point this out to you. They also predict that search engines and
other information retrieval systems will be able to find documents even though they do not
contain any of the words you entered as your query.

CYC’s knowledge is segmented into hundreds of different contexts to avoid the problem of
many pieces of knowledge in the system contradicting each other.

You might also like