Вы находитесь на странице: 1из 56

# Chapter 7

## Introduction to Nonmonotonic Reasoning:

Before we can explain non-monotonic reasoning, we can consider the following example.
Ex:
Suppose we take, there are 3 persons to be suspects in a murder case. Let Abbott, Babbitt, Cabot be
suspects in a murder case. Abbott was an alibi in the register of respected hotel in Albany. Babbitt
also has alibi for his brother-in-law testified that Babbitt was visiting him in Brooklyn at the time.
Cabot pleads alibi too, claiming to have been watching a ski meet in Catskills.
Based on the above statements, we believe
1. That Abbott did not commit the crime,
2. That Babbitt did not,
3. That Abbott or Babbitt or Cabot did,
4. That Cabot did not.
The explanation of the statements can be considered “Who might commit the crime?” we cannot
identify that who has committed the crime. Because of that knowledge base is not enough.
There are two systems to explain the statements and avoid the uncertainty is
 Nonmonotonic Reasoning
 Statistical Reasoning
Nonmonotonic Reasoning, in which the axioms and/or the rules of inferences are extended to
make it possible to reason with incomplete information.
Statistical Reasoning, in which each of the rules is inferences, should be assigned with some
numerical measure. It consider either true or false but not both.
Nonmonotonic system principles:
There are three principles in Nonmonotonic reasoning. They are as follows
1. Knowledge base is complete.
3. Each statement will be true or false but not both.

## A.Rakesh Babu M.C.A., M.Tech. 69

Asst.Prof
Logics for Nonmonotonic reasoning
Monotonicity is fundamental to the definition of first-order predicate logic, we need some
logics to support nonmonotonicity.
The formal approach should posses all the features given,
 Defines the set of possible words according to the facts we have.
 Provides a way to say, it is preferable to believe in some model rather others.
 Provides the basis for implementation.
Nonmonotonic Reasoning:
It is basically extension of first order predicate logic to include model operator say M. the
purpose of this is allow for consistency.
Ex: (x): play-instrument(x) ^ Mimprovise (x)  musician (x)
It states that for all x if play an instrument and the fact that x can improve consistent with all
other knowledge then we can infer that x is musician. How we can define consistency? One
common solution is, to show that fact p is true attempt to prove, &p. If we fail we may say that p is
consistent.
Ex: x: Republican(x) ^ M pacifist(x)  pacifist(x)

DEFAULT REASONING:

Default reasoning is one type of non-monotonic reasoning, which treats conclusions as,
believed until a better reason is found to believe something else.
Two different approaches to deal with non-monotonic system are:
 Nonmonotonic logic
 Default logic

Nonmonotonic logic: Nonmonotonic logic is one in which the language of first order predicate
logic is augmented with a modal operator M, which can be read as “is consistent”.
Non-monotonic Logic defines the set of theorems that can be derived from a set of wff’s A
to be the intersection of the sets of theorems that results from the various ways in which the wff’s of
A might be combined.
A Λ MB  B
¬A Λ MB  B
We conclude:
MB  B.
A.Rakesh Babu M.C.A., M.Tech. 70

Asst.Prof
Default Logic:
Default reasoning is another form of non-monotonic reasoning .it eliminates the need to
explicitly store all the facts regarding a situation. Default logic introduces a new inferences rule.
A:B
C
This states that if A is provable and it is consistent to assume B then conclude C. This is similar to
Nonmonotonic logic. In the place of ‘M’ in NML, we substitute ‘:’ in Default Logic.
Based on the above example, we can provide the 2 rules as
1. A:B
C
2. ¬A:B
C
Similarly, we can write these statements as
If A is a republican: if we assume that B is not pacifist
B is not Pacifist
If A is a Quaker: if we assume that B is not pacifist
B is Pacifist

Two kinds of Nonmonotonic reasoning that can define in these logics are:
1. Abduction
2. Inheritance
Abduction:
It is opposite process of deduction.
We present the abductive inference rule as
Assertion Q
Implication PC Q
Conclusion P
The arrow mark () represent the possible casual relationship.abductive inference in based on the
issue of known casual knowledge to explain a conclusion or to justify a conclusion.
(x): measles (x) spots (x)

## A.Rakesh Babu M.C.A., M.Tech. 71

Asst.Prof
Inheritance:
Inheritance is a basis for inheriting attribute values from a prototype description of a class to
individual entities that belong to the class. Inheritance says that “An object inherits attribute values
from all the classes which it is member unless doing so leads to contradiction, in which case a value
from a more restricted class has precedence over a value from a broader class”.
Ex: Base Ball Game
In this we can combine more than one statement in the following way.
1. Adult Male (x): height (x, 5’10”)
Height (x, 5’10”)
2. Baseball player (x): height(x, 6’ 1”)
Height(x, 6’ 1”)
If it is considered to assume that, x is not a baseball player then x height is 5’ 10”.
x:Adult Male (x): ¬Baseball player (x) ^ Height (x, 5’10”)
Height (x, 5’10”)
MINIMALIST REASONING:
Minimalist reasoning follows the idea that “there are many fewer true statements than false
ones. If something is true and relevant it makes sense to assume that is has been entered into our
knowledgebase. Therefore, assume that the only true statements are those that necessarily must be
true in order to maintain the consistency of knowledge base”.
Two kinds of minimalist reasoning are:
(1) Closed world assumption (CWA).
(2) Circumscription.
Closed world assumption: Another form of assumption made with regard to incomplete
knowledge, is more global in nature than single defaults. This type of assumption is useful in
application where most of the facts are and it is, therefore, reasonable to assume that if a proposition
cannot be proven, it is false. This is known as the closed world assumption with failure as negation.
This means that in a kb if the ground literal p(a) is not provable, then ~p(a) is assumed to hold true.
CWA is another form of non-monotonic reasoning. CWA is essentially the formalism under which
prolog operates and prolog has been shown to be effective in numerous application.
1. A knowledge base augmented with CWA is not consistent.
2. CWA assumptions are not always true in the world.
A.Rakesh Babu M.C.A., M.Tech. 72

Asst.Prof
3. CWA forces completion of a knowledge base by adding the negation assertion ¬P whenever
it is consistent to do so. But the assignment of a property to some predicate P and its
complement to the negation of P may be arbitrary.
Example:
Define a predicate SINGLE and create knowledge base.
SINGLE (john)
SINGLE (Mary)
SINGLE (john). Suppose we choose the predicate married. Then the knowledge base may be
¬Married (john)
¬Married (Mary)
Circumscription:
Circumscription is a procedure in which we add new axioms to the existing knowledge base
and the effect of these is to force a minimal interpretation on a selected portion of the knowledge
base. Each specific axiom describes a way that the set of values for which a particular axiom of the
original theory is true is to be circumscribed.
CWA does not capture all of the idea. It has two limitations:
 CWA operates on individual predicates with out considering the interactions among
predicates that are there in the knowledge base.
 CWA assumes that all predicates have all of their instances listed. But this is not true in
many knowledge-based systems.
Circumscription overcomes that above limitations.
Example:
Suppose we have a university world situation in which there are two known students. We may wish
to state that the known students are the only students to circumscribe the students.
i.e. Student (a)
Student (b)
We have the circumscriptive inferences as even Student (a) & Student (b) infer as,
X: Student (x)  (x= a v x = b)

## A.Rakesh Babu M.C.A., M.Tech. 73

Asst.Prof
Augmenting problem solver:
It deals with how we can write a program that solves problems using these facts. We will
now discuss how to write programs for logical formulas. We knew that the problem solving can be
done using either forward or backward reasoning. Problem can be solved by using uncertain
knowledge can also be done by using these two methods.
 Reason forward from what is known. Treat monotonically derivable conclusions the same
way monotonically derivable ones are handled. Nonmonotonic reasoning systems that
support this kind of reasoning allow standard forward chaining rules to be augmented with
unless clauses, which introduce a basis for reasoning by default. Control is handled in the
same way that all other control decisions in the systems are made.
 Reason backward to determine whether some expression P is true. Nonmonotonic reasoning
systems that support this type of reasoning may do either one or both of the following two
things.
 Allow default clauses in backward reasoning rules.
 Support a kind old discussion in which an attempt is made to construct argument both in
favor of p and opposed to that.

## DFS and BFS:

DFS:
In this first search, the search proceeds along with a branch of tree. This method can be
implemented in three ways as follows.
1. Dependency Directed Backtracking.
2. Justification Based Truth Maintenance System.
3. Logic Based Truth Maintenance System.
1. Dependency Directed Backtracking
The effective depth first search tree may be reduced by doing one search from in an abstract to
get rough solution and then doing another search formalism in the actual space to refine the
solution.
Backtracking in ordinary depth-first search is called chronological backtracking because
decisions are retracted and changed according to the order in which they were made, with the most
recent decision being changed first. In some domains this is appropriate, since there is a time
dependency between actions. In chess, for example, moves must be made in order. Other domains,
however, do not have this restriction.

## A.Rakesh Babu M.C.A., M.Tech. 74

Asst.Prof
Example:
The dependency directed backtracking can use in finding the route such as search for a path
between two locations first on a map that includes only major cities and inter state highways, then
refine paths to get to the inter state highways
2. Justification Based Truth Maintenance System
The idea of truth maintenance system or TMS arose as a way of providing the ability to do
dependency directed backtracking and to support Nonmonotonic reasoning.
The main job of the TMS is to maintain consistency of the knowledge being used by the
problem solves and not to perform any inference functions. The TMS also gives the inference
component the latitude to perform Nonmonotonic inferences. When new discovers are made, this
more recent information can displace previous conclusions that are no longer valid .in this way the
set of beliefs available to the problem solver will continue to be current and consistent.
Diagram:

Tell
Inference engine TMS

Knowledge

## Fig: Architecture of the problem solver with a TMS

The role played by the TMS a part of the problem solver. the inference engine solves domain
problems based on its current belief set, while the TMS maintains the currently active belief set .the
updating process is incremented .after each inference ,information is exchanged between the 2
components .the IE tells the TMS what the deductions has made. The TMS in turn, asks questions
about current beliefs and reasons for failures. It maintains a consistent set of beliefs for the I.e. to
work with even if now knowledge is added & removed.
The TMS maintains complete records of reasons of justifications for beliefs. Each
proposition having at least 1 valid justification is made a part of current belief set. Statements
lacking acceptable justifications are excluded from this set. When a contradiction is discovered the
statements responsible for the contradiction are identified & an appropriate one is retracted. This in
turn may result in other retractions & additions. The procedure used to perform this process is
called dependency back tracking.
The TMS maintains records to reflect retractions and additions & that will always know its
current belief set. The records are maintained in the form of dependency network. The node in the
network represents KB entries such as premises, conclusions, inference rules and the like. Attached

## A.Rakesh Babu M.C.A., M.Tech. 75

Asst.Prof
to the nodes are justifications, which represent steps from which the node was derived. Nodes in the
belief set must have valid justifications. a premise is a fundamental belief which is assumed to be
always true. Premises need no justifications. They form a base from which all other currently active
nodes can be explained in terms of valid justifications.

## Example: ABC murder story.

Initially Abbottt is believed to be the primary suspect the reason is non-monotonic. The three
assertions believed initially are.
 Suspect Abbottt (Abbottt is the primary suspect)
 Beneficiary Abbott (Abbottt is a beneficiary of the victim)
 Alibi Abbottt (Abbottt was at on Albany hotel at that time.)

Representation in TMS:
A TMS dependency network offers a purely syntactic, domain-independent way to represent
belief and change it consistently.

Justification

## Beneficiary Abbott Alibi Abbott

Justification:

1. The assertion “Suspect Abbott” has an associated TMS justification. An arrow to the
assertion it supports connects the justification.
2. Assertions in a TMS dependency network are believed when they have a valid justification.
3. Each justification has two parts:
a. An IN-list [connected to justification by ‘+’]
b. An OUT-list [connected to justification by ‘-‘]
4. If the assertion corresponding to the node should be believed, then in the TMS it is labeled
IN.
5. If there is no reason to believe the assertion, then it is labeled OUT.

Premise Justification: Premise justifications are always considered to valid. Premises need no
justifications.

Labeling task of a TMS: The labeling task of a TMS is to label each node so that three major
criteria of dependency network are met.
1. Consistency
2. Well-founded-ness
A.Rakesh Babu M.C.A., M.Tech. 76

Asst.Prof
Ex : Consistency criterions:

The following two cases show how consistency is maintained while changing Abbott’s state.

Case (i).Abbott is beneficiary. We have no further justification for this fact. We simply accept it.
The following figure shows a consistent labeling for the network with premise justification.

+ _

## Beneficiary Alibi Abbott [Out]

Abbott [IN]
Empty IN and OUT lists
Fig: Labeled nodes with premise Justification.

Case (ii): If Abbott’s alibi is obtained, and then some more justifications are added. Then
consistency is maintained in the following ways, by making the following inclusions.

## Abbott was registered is a hotel Premise justification So IN

Hotel is far away Premise justification. SO IN
Register might be forged Lacks any justification. SO OUT
Above 3, shows that “Suspect about” no longer has a justification SO OUT

+ _

Abbott [IN]

## Fig: Changed labeling

A.Rakesh Babu M.C.A., M.Tech. 77

Asst.Prof
Well-Founded ness criterion:
(1) It is defined as the proper grounding of a chain of justifications on a set of nodes that do not
themselves depend on the nodes they support.
(2) For example: Cabot justification for his alibi that he was at a ski show is hardly valid.

The only support for the alibi of attending the ski show is that Cabot is telling the truth. ------ (1)
The only support for his telling the truth would be if we knew he was at the ski show. --------(2)

Above (1) and (2) statements show a chain of IN- List links to support the “Alibi Cabot “ Node.
So, in such cases the node should be labeled OUT for well-founded ness.

## Beneficiary Cabot [IN] Alibi Cabot [OUT] +

+ TellsTruthCabot [OUT]

## (1) A contradiction in TMS is a state of the database explicitly declared to be undesirable.

(2) Example: In our example, a contradiction occurs if we do not have at least one murder
suspect or if there are suspects other than Abbott, Babbitt, and Cabot.

Other suspect

## A.Rakesh Babu M.C.A., M.Tech. 78

Asst.Prof
(3) Initially there is no valid justification for other suspects so, contradiction is labeled
OUT.
(4) Suppose Cabot was seen on T.V that he was at the ski slopes, and then is causes
“Alibi Cabot” node to be labeled IN. So, it makes ‘Suspect Cabot’ node to be labeled
OUT.
(5) The above point gives a valid justification for contradiction and hence is labeled IN.

## Alibi Abbott Alibi Babbit Alibi Cabot [IN] Other suspects

(6) The job of TMS is to determine how the contradiction can be made OUT. I.e. The
(7) Non monotonic justifications can be invalidated, by asserting some fact whose
absence is required by the justification
(8) That is we should install a justification that should be valid only as long as it needs to
be.
(9) A TMS have algorithms to create such justifications, which is called Abductive
justification.

## 3. Logic Based Truth Maintenance System

LTMS stands for logic based truth maintenance system. It is combination of both DDB and JTMS.
In ABC murder story example in an LTMS system, we would not have created an explicit
contradiction corresponding to the assertion that there was no suspect.

BFS:
The breadth first search proceeds by employing all the nodes at a given depth before
proceeding to the next level. Here all immediate children of nodes are explored before any of the
children.
The Assumption-based truth maintenance system (ATMS) is an alternative way of
implementing Nonmonotonic reasoning. In both JTMS and LTMS systems a single line of
reasoning is pursued at a time, and dependency directed backtracking occurs whenever it is
necessary to change the system’s assumptions. In an ATMS, alternative paths are maintained in
parallel. Backtracking is avoided at the expense of maintaining multiple contexts

## A.Rakesh Babu M.C.A., M.Tech. 79

Asst.Prof
Chapter 9
WEAK SLOT AND FILLER STRUCTURES
A Weak Slot and Filler Structures are data structures to identify different objects in a
statement and also provide the relationship between the objects using of “isa” and “instance”
classes.
Weak Slot and Filler Structures can be divided into two types.
1. Semantic nets
2. Frames

Semantic Nets
In a semantic net, information is represented as a set of nodes connected to each other by a
set of labeled arcs, which represent relationship among the nodes.
Network representations provide a means of structuring and exhibiting the structure in
knowledge. In a network, pieces of knowledge are clustered together into coherent semantic groups.
Networks also provide a more natural way to map to and from natural language than do other
representation schemes. Network representation gives a pictorial presentation of objects, their
attributes and the relationships that exist between them and other entities. These are also known as
associative networks. Associative networks are directed graph with label nodes and arcs or arrows.
A semantic network or semantic net is a structure for representing knowledge as a pattern of
interconnected nodes and arcs. It is also defined as a graphical representation of knowledge.

Mammal

isa

## Persons has-part Eyes

Uniform instance
Color team
Blue Pee-Wee-Reese Brooklyn-Dodgers

## Fig: A semantic Network

This network contains examples of both the isa and instance relations. The domain specific
relations like team and uniform-color. We would use inheritance to derive the additional relation.

## has-part (Pee-Wee-Reese, Eyes)

A.Rakesh Babu M.C.A., M.Tech. 80

Asst.Prof
A semantic Net can be further classified into different techniques as follows.

1. Intersection search.
2. Representing Nonbinary Predicates.
3. Making some important distinctions.
4. Partitioned Semantic Nets.
5. The evolution into frames.

Intersection search

Semantic nets were used to find relation ship among objects by spreading activation out from
each of two nodes seeing where the activation meets.

## Representing Nonbinary Predicates:

Semantic nets are a natural way to represent nonbinary predicates. It would be similar to isa
and instance. Some of the arcs in the below example are as follows.

Game

isa
Visiting
team G23 score 5-3
Cubs
home-team

Dodgers

## isa (G23, Game)

home-team (G23, Dodgers)
visiting team (G23, Cubs)
Score (G23, 5-3)

## In this example, we can represent an arc more than 2 objects is

Score (Cubs, Dodgers, 5-3)
The above statement is binary predicate. Suppose we take a unary predicate Man (Marcus), it can be
converted into a binary predicate as
Instance (Marcus, Man)
A.Rakesh Babu M.C.A., M.Tech. 81

Asst.Prof
Making some important distinctions

## In this we can show difference between two semantic nets.

Ex:
1. John height is 72.

height
John 72

## 2. John is taller than Bill.

JOHN Bill

Height height

H1 Greater than H2

## The above two statements can we represent in only one form is

JOHN Bill

Height height

H1 Greater than H2

72

## Partitioned Semantic net

Suppose we want to represent simple quantified expressions in semantic nets. One way to do
this is to partition the semantic net into a hierarchical set of spaces, each of which corresponds to
the scope of one or more variables. This net corresponds to the statement

## A.Rakesh Babu M.C.A., M.Tech. 82

Asst.Prof
Dog Bite Mail-carrier
Isa isa isa
Assailant victim
d b m

The nodes dog, bite and mail carrier represent the class of dog, biting and mail carriers
respectively, while the nodes d, b and m represent a particular biting and a particular mail carrier.
This fact can be easily be represented by a single net with no partitioning.
But now suppose that we want to represent the fact

## Every dog has bitten a mail carrier.

SA
GS Dogs Bite Mail carrier

## isa Isa isa isa SI

form
g d b m
Assailant victim

To represent this fact, it is necessary to encode the scope of the universally quantified x. The
node g stands for the assertion given above. Node g is an instance of the special class GS of general
statement about the world. Every element of GS has as least two attributes. A form, which states
the relation that is being asserted, and one or more  connections, one for each of the universally
quantified variables. There is only one such variable d., which and stand for any element of the
class dogs. The other two variables in the form, b and m are under stood to be existentially
quantified. In other words, for every dog d, there exists a betting event b, and mail Carrie n, such
that d is the assailant of b and m is the victim.

## A.Rakesh Babu M.C.A., M.Tech. 83

Asst.Prof
SA
Gs Dogs Bite Constables

Town-Dogs
isa
isa

form SI
isa isa

g d b c

assailant victim

In this net, the node c representing the victim lies out side the form of the general statement.
Thus it is not viewed as an existentially quantified variable whose value may depend on the value of
d, instead it is interpreted as standing for a specific entity. (In this case, a particular constant), just
as do other nodes in a standard, non partitioned.

## Every dog has bitten every mail carrier

SA
Dogs Bite Mail-carrier

## isa isa isa SI

assailant victim
d b m

GS g

isa

In this case, g has two  links, one pointing to d, which represents any dog, and one pointing to m,
representing any mail carrier.

## A.Rakesh Babu M.C.A., M.Tech. 84

Asst.Prof
Frames:
Frames were first introduced by Marvin Minsky (1975) and a data structure to represent a
mental model of a stereotypical situation such as driving a car, attending a meeting or eating in a
restaurant.
Frames are general record like structures, which consist of a collection of slots and slot
values. The slots may be of any size and any type. Slots typically have names and any number of
values.
A frame can be defined as a data structure that has slots for various objects and collection of
frames consists of expectations for a given situation.
A frame structure provides facilities for describing objects, facts about situations, procedures
on what to when a situation is encountered because of these facilities a frame provides, frames are
used to represent the two types of knowledge.

## A general structure of a frame system as follows.

Person
Isa: Mammal
Cardinality: 6,000,000,000
*handed: Right

Isa: Person
Cardinality: 2,000,000,000
*height: 5-10

ML-Base-ball Player

Cardinality: 624
*height: 6-1
*Bats: equal to handed
*batting-avg: .252
*team:
*uniform Color:
Fielder

## Isa: ML-Base-ball Player

Cardinality: 376
*batting-avg: .262

Pee-Wee-Reese

Instance: Fielder
Height: 5-10

## A.Rakesh Babu M.C.A., M.Tech. 85

Asst.Prof
Bats: right
Batting-avg: .309
Team: Brooklyn-Dodgers
Uniform-Color: Blue

ML-BaseBall-Team

Isa: team
Cardinality: 26
*team-size: 24
*manager:

Brooklyn-Dodgers

Instance: ML-BaseBall-Team
Team-size: 24
Manager: Leo-Durocher
Players: { Pee-Wee-Reese,… }

Suppose we want to represent the classes of all teams as a Meta classes. We have two
classes, which does not have any cardinality.

Class
Instance: class
Isa: class
*cardinality:

Team
Instance: class
Isa: class
Cardinality: {the number of teams that exist}
*team-size: {each team has a size}

ML-BaseBall-Team

Instance: class
Isa: class
Cardinality: {the number of teams that exist}
*team-size: {each team has a size}
*manager:

Brooklyn-Dodgers

Instance: class
Isa: class
team-size: 24
manager: Leo-Durocher
uniform-color: blue
A.Rakesh Babu M.C.A., M.Tech. 86

Asst.Prof
Pee-Wee-Reese

Instance: Brooklyn-Dodgers
Instance: Fielder
Batting-avg: .309
Uniform-Color: Blue

## Suppose we have to represent the relationship among the classes as follows.

ML-Baseball-Player

## Pitcher Catcher Fielder American- National

Leaguer Leaguer

Instance instance

Three-Finger-Brown

ML-Baseball-Player
Is-covered-by: {pitcher. Catcher, Fielder},
{American-Leaguer, National-Leaguer}

Pitcher
Isa: ML-baseball-Player
Mutually-disjoint-with: {Catcher, Fielder}

Catcher:
Isa: ML-Baseball-Player
Mutually-disjoint-with: {pitcher, Fielder}

Fielder:
Isa: ML-Baseball-Player
Mutually-disjoint-with: {pitcher, Fielder}

American-Leaguer
Isa: ML-Baseball-Player
Mutually-disjoint-with: {National-Leaguer}

## A.Rakesh Babu M.C.A., M.Tech. 87

Asst.Prof
National-Leaguer
Isa: ML-Baseball-Player
Mutually-disjoint-with: {American-Leaguer}

Three-finger-brown
Instance: pitcher
Instance: National-leaguer

## Reasoning using frames:

The task of action frames is to provide facility for procedural attachment and help
transforming from initial to goal state. It also helps in breaking the entire problem in to sub-tasks,
which can be described as top-down methodology. It is possible for one to represent any tasks using
these action frames.

Reasoning using frames is done by instantiation. Instantiation process begins when the given
situation is batches with frames that already exist. The reasoning process tries to match the frame
with the situation and latter fills up slots for which values must be assigned. The values assigned to
the slot depict a particular situation and but this reasoning process tries to move from one frame to
another to match the current situation. This process builds up a wide network of frames, there by
facilitating one to build a knowledge base for representing knowledge about common sense.

## Frame-based representation language:

Frame representations have become popular enough that special high level frame-based
representation languages have been developed. Most of languages use LISP as the host language.
They typically have functions to create access, modify updates and display frames.

## Implementation of frame structures:

One way to implement frames is with property lists. An atom is used as the frame name and
slots are given as properties. Facts and values with in slots become lists of lists for the slot property.
Another way to implement frames is with an association list ( an-a-list), that is, a list of sub
lists where each sub list contains a key and one or more corresponding values.

It is also possible to represent frame like structures using Object oriented programming
extensions to LISP languages such as Flavors.

## A.Rakesh Babu M.C.A., M.Tech. 88

Asst.Prof
Chapter
Strong Slot and Filler Structure
Frame-based representation language:

Frame representations have become popular enough that special high level frame-based
representation language has been developed. Most of languages use LISP as the host language. They
typically have functions to create access, modify updates and display frames.

Implementation of frame structures: One way to implement frames is with property lists. An atom is used as
the frame name and slots are given as properties. Facets and values with in slots become lists of lists for the
slot property.

## Putprop ‘train((type(value passenger))

(class(value first second sleeper))
(food(restaurant(value hot-meals))
(fast-food(value cold snacks)))’ land transport)

Another way to implement frames is with an association list ( an-a-list), that is, a list of sub lists
where each sub list contains a key and one or more corresponding values. The same train frame would be
represented using an a-list as

## (set Q train ‘((AKO land transport)

(type(value passenger))
(class(value first second sleeper))
(food(restaurant(value hot-meals))
(fast-food(value cold snacks)))

It is also possible to represent frame like structures using Object oriented programming extensions to LISP languages
such as Flavors.

Scripts: Scripts are another structures representation scheme introduced by “Roger Schank” (1977). They
are used to represent sequences of commonly accruing events. They were originally developed to capture
the meanings of stories or to understand natural language test.

A script is a predefined frame-like structure, which contains expectations, inferences and other
knowledge that is relevant to a stereotypical situation.

Frames represented a general knowledge representation structure, which can accommodate all kinds
of knowledge. Scripts on the other hand help exclusive in representing stereotype events that takes place in
day-to-day activity.

## 1. Going to hotel, eating something, paying the bill and exiting.

A.Rakesh Babu M.C.A., M.Tech. 89

Asst.Prof
2. Going to theatre, getting a ticket, viewing the film and leaving.
3. Going to super market, with a list of items to be purchased, putting the items needed on a trolley,
paying for them.
4. Leaving home for office in a two-wheeler, parking the two-wheeler at the railway station, boarding
the train to the place of work and going to the place of work.
5. Going the bank for with drawl, filling the with drawl slip/check, presenting to the cashier, getting the
money and leaving the bank.

All the situations are stereotype in nature and specific properties of the restricted domain can be
exploited with special purpose structures.

A script is a knowledge representation structure that is extensively used for describing stereo typed
sequences of action. It is a special case of frame structure. These are interested for capturing situations
in which behavior is very stylized. Scripts tell people what can happen in a situation, what events follow
and what role every actor plays. It is possible to visualize the same and scripts present a way of
representing them effectively what a reasoning mechanism exactly understand what happens at that
situation.

## Reasoning with Scripts:

Reasoning in a script begins with the creation of a partially filled script named to meet the current
situation. Next a known script which matches the current situation is recalled from memory. The script
name, preconditions or other key words provide index values with which to search for the appropriate
script. An inference is accomplished by filling in slots with inherited and defaults values that satisfy
certain conditions.

1. Permits one to identify what scenes must have been proceed when an event takes place.
2. It is possible using scripts to describe each and every event to the minutest detail so that enough light
is thrown on implicitly mentioned events.
3. Scripts provide a natural way of providing a single interpretation from a variety of observations.
4. Scripts are used in natural language understanding system and serve their purpose effectively in
areas for which they are applied.

2. It is difficult to share knowledge across scripts what is happening in a script is true only for that
script.
3. Scripts are designed to represent knowledge in stereo type situations only and hence cannot be
generalized.

Important components:

1. Entry condition: Basic conditions that must be fulfilled. Here customer is hungry and has money to
pay for the eatables.
2. Result: Presents the situations, which describe what, happens after the script has occurred. Here, the
customer after satisfying his hungry is no hungrier. The amount of money he has is reduced and the

## A.Rakesh Babu M.C.A., M.Tech. 90

Asst.Prof
owner of the restaurant has now more money. Captioned results can also be stated here like the
customer is pleased with the quality of food, quality of service etc., or can be displeased.
3. Properties: These indicate the objects that ate existing in the script. In a restaurant on has tables,
4. Roles: What various characters play is brought under the slot of roles. These characters are implicitly
involved but some of them play an explicit role. For example waiter and cashier play an explicit role
where the cook and owner are implicitly involved.
5. Track: Represents a specific instance of a generic pattern. Restaurant is a specific instance of a hotel.
This slot permits one to inherit the characteristics of the generic node.
6. Scenes: Sequences of activities are described in detail.

## Ex1: Going to a restaurant

Scene 1: Entering the restaurant
Customer enter into the restaurant .
Script: Going to a restaurant Customer PTRANS restaurant
Entry Conditions: Customer is hungry Customer scans the tables.
Customer has money Customer ATTEND eyes to the tables
Owner has food Customer decides where to sit.
Props: Food, tables, menu, money Customer MBUILD to sit there
Roles: 1.Explicit: customer, waiter, Scene 2: Ordering the food
2. Implicit: Owner, Coocker Waiter brings it. Waiter PTRANS the menu
Track: Restaurant Customer decides choice of food.
Results: Customer is not hungry Customer MBUILD choice of food
Owner has more money Customer orders that food. Customer MTRANS that food.
Customer has less money Scene 3: Eating the food
Owner has less food. Cook gave food to waiter. Cook ATRANS food to waiter.
Waiter gave the food to customer.
Waiter ATRANS food to customer.
Customer eats the food with a spoon.
Customer INGESTS the food with a spoon.
Scene 4: Paying the bill
Customer asks for bill. Customer MTRANS for bill.
Waiter brings it. Waiter PTRANS it.
Customer gave a check to waiter.
Customer ATRANS a check to waiter.
Waiter brings the balance amount.
Waiter PTRANS the balance amount.
Customer gave tip to waiter. Customer ATRANS to him
Customer moves out. Customer PTRANS out .

## A.Rakesh Babu M.C.A., M.Tech. 91

Asst.Prof
Ex 2 : Going to super market
Scene 1: Enter market
Script: Going to a super market Shopper Ptrans into market
Track: Super market Shopper Ptrans shopping cart to shopper
Roles: Implicit Roles: Owner of Scene 2: Shop for items
supermarket. Shopper MOVES shopper through aisles
Producer of items. Shopper ATTENDS eyes to display items
Explicit Roles: Shopper, Shopper Ptrans items to shoppers’ cart
attendants, Clerks, cashier. Scene 3 : Check out
Entry Conditions: Shopper needs Shopper MOVES to check out stand
groceries food market open Shopper ATTENDS eyes to charges
Prop: Shopping cart, display aisles, Shopper Atrans money to cashier
Market items, checkout stands, cashier, Sacker Atrans bags to shopper
money Scene 4: Exit market
Results: Shopper has less money Shopper Ptrans shopper to exit to market
Shopper has grocery items
Market has less grocery items
Market has more money

Conceptual Dependency (CD): Conceptual dependency is a theory of how to represent the kind of
knowledge about events that is usually contained in natural sentences. The goal is to represent the
knowledge in a way that

##  Facilitates drawing interference from the sentences.

 Is independent of the language in which the sentences were originally stated.

The theory was first described in Schank 1973 and was further developed in Schank 1975. It has been
implemented in a variety of programs that read and understand natural language text. Unlike semantic nets
provide only a structure in to which nodes representing information at any level can be placed. Conceptual
dependency provides both structure and a specific set of primitives, at a particular level of granularity out of
which representations of particular pieces of information can be constructed.

Conceptual dependency (CD) is a theory of natural language processing which mainly deals with
representation of semantics of a language. The main motivation for the development of CD as a knowledge
representation techniques are given below.

To construct computer programs that can understand natural language. To make inferences from the
statements and also to identify conditions in which two sentences can have similar meaning.
To provide facilities for the system to take part in dialogues and answer questions.
To provide a necessary plank those sentences in one language can be easily translated into other languages.
To provide means of representation which are language dependent

## A.Rakesh Babu M.C.A., M.Tech. 92

Asst.Prof
Apart from the primitive CD actions one has to make use of the six following categories of objects

## PP’s (Picture producers): Only physical objects are physical procedures.

Acts: Actions are done by an actor to an object.

## O- Object case relationship

R- Recipient case relationship
P- Past tense
F- Future tense
T- Transition
Ts - Start transition
Tf - finished transition
K- Continuing
?- Interrogative
/- negative, nil-present, delta-timeless, c-conditional

CD brought forward the notation of language independence because all acts are language
independent primitives.
CD is a special purpose of semantic networks in which specific primitives are used in rebuilding
representations. It still remains today as a fundamental knowledge representation structure in natural
language processing system.

## Act PP Joe PROPEL door Joe pushed the door

PP Sue
Act Joe Atrans Joe gave a flower sue
PP Joe

flower

Joe
Act Joe INGEST

do
soup
spoon
Joe ate some soup

## A.Rakesh Babu M.C.A., M.Tech. 93

Asst.Prof
CD representation is to
man
I ATRANS o book
I
from
Where the symbols have the following meanings
 Arrows indicate direction of dependency
 Double arrow indicates two way link between actor and action.
 P Indicates past tense.
 A trans is one of the primitive acts used by the theory, it indicates transfer
possession
 O indicates the direct case relation
 R indicates the recipient case relation
Since smoking can kill you, I stopped.
ONE
One INGEST o smoke
I CIGARETTE

C TfP
I
INGEST o smoke

ALIVE

The vertical causality link indicates that smoking kills one. Since it is marked, however we know
only that smoking can kill one, hot that it necessarily does.
The horizontal causality link ordinates that it is first causality that made me stop smoking. The qualification
p attached to the depending between I and INGEST indicates that the smoking has stopped and that the
stopping happened.

There are three important ways in which representing knowledge using the CD model
facilities reasoning with the knowledge.
1. Fewer inference rules are needed would be required if knowledge were not broken down into
primitives.
2. Many inferences are already contained in the representation it self.
3. The initial structure that is built to represent the information contained in one sentence will have
that need to be billed. These holes can serve as an attention focuser for the program that must
understand using sentences.

## A.Rakesh Babu M.C.A., M.Tech. 94

Asst.Prof
Chapter
Planning
Planning problems are hard problems:

##  They are certainly non-trivial.

 Solutions involve many aspects that we have studied so far:
o Search and problem solving strategies.
o Knowledge Representation schemes.
o Problem decomposition -- breaking problem into smaller pieces and trying to solve these
first.

We have seen that it is possible to solve a problem by considering the appropriate form of knowledge
representation and using algorithms to solve parts of the problem and also to use searching methods.

Search in Planning

Search basically involved moving from an Initial state to a Goal State. Classic search techniques could be
applied to planning state in this manner:

A* Algorithm
-- best first search,
Problem decomposition
-- Synthesis, Frame Problem.
AO* Algorithm
-- Split problem into distinct parts.
Heuristic reasoning
-- ordinary search backtracking can be hard so introduce reasoning to devise heuristics and to control
the backtracking.

The first major method considered the solution as a search from the initial state to a goal state through a
state space. There are many ways of moving through this space by using operators and the A* algorithm
described the best first search through a graph. This method is fine for simpler problems but for more

## A.Rakesh Babu M.C.A., M.Tech. 95

Asst.Prof
realistic problems it is advisable to use problem decomposition. Here the problem is split into smaller sub
problems and the partial solutions are then synthesised. The danger in this method occurs when certain
paths become abortive and have to be discarded. How much of the partial solution can be saved and how
much needs to be recomputed.

The frame problem -- deciding which things change and which do not -- gave some guidance on enabling us
to decide on what stays the same and on what changes as we go from state to state. If the problem concerned
designing a robot to build a car then mounting the engine on the chassis would not affect the rear of the car

The AO* algorithm enabled us to handle the solution of problems where the problem could be split into
distinct parts and then the partial solutions reassembled. However difficulties arise if parts interacted with
one another. Most problems have some interaction and this implies some thought into the ordering of the
steps; for example if the robot has to move a desk with objects on it from one room to another; or to move a
sofa from one room to another and the piano is near the doorway. The thought process involved in
recombining partial solutions of such problems is known as planning. At this point we run into a discussion
about the role of the computer in the design of a plan as to how we can solve a problem. It is extremely
unlikely at this stage that a computer will actually solve the problem unless it is a game and here some
interaction with a person is needed.

Generally the computer is used to decide upon or to offer words of wisdom on the best method of
approaching the solution of a problem. In one sense this can be interpreted as a simulation; if we are
considering the handling of queues at an airport or a post office there are no actual people and so we can try
a range of possibilities; likewise in a traffic control problem there are no cars or aircraft piling up at a
junction or two miles over an airport. Once the computer based investigation has come up with the best
solution we can then implement it at the real site.

This approach assumes that there is continuity in the way of life. It cannot budget for rapid change or
revolution. How can this approach cater for unexpected events such as a faulty component or a spurious
happening such as two items stuck together or a breakdown in the path somewhere vital such as in a camera
reel. When a fault or some unrecognizable state is encountered it is not necessary to restart for much of what
has been successfully solved is still useful. Consider a child removing the needles from a partially

## A.Rakesh Babu M.C.A., M.Tech. 96

Asst.Prof
completed knitted sweater. The problem lies in restarting from a dead end and this will need some
backtracking. This method of solution is pursued to reduce the level of complexity and so to ensure
successful handling we must introduce reasoning to help in the backtracking required to cater for faults. To
assist in controlling backtracking many methods go backward from the goal to an initial state.

##  A flat surface such as a tabletop

 An adequate set of identical blocks which are identified by letters.
 The blocks can be stacked one on one to form towers of apparently unlimited height.
 The stacking is achieved using a robot arm which has fundamental operations and states which can
be assessed using logic and combined using logical operations.
 The robot can hold one block at a time and only one block can be moved at a time.

## We shall use the four actions:

UNSTACK(A,B)
-- pick up clear block A from block B;
STACK(A,B)
-- place block A using the arm onto clear block B;
PICKUP(A)
-- lift clear block A with the empty arm;
PUTDOWN(A)
-- place the held block A onto a free space on the table.

## and the five predicates:

ON(A,B)
-- block A is on block B.
ONTABLE(A)
-- block A is on the table.
CLEAR(A)
A.Rakesh Babu M.C.A., M.Tech. 97

Asst.Prof
-- block A has nothing on it.
HOLDING(A)
-- the arm holds block A.
ARMEMPTY
-- the arm holds nothing.

Using logic but not logical notation we can say that If the arm is holding a block it is not empty If block A is
on the table it is not on any other block If block A is on block B,block B is not clear.

##  it is sufficiently simple and well behaved.

 easily understood
 yet still provides a good sample environment to study planning:
o problems can be broken into nearly distinct subproblems
o we can show how partial solutions need to be combined to form a realistic complete solution.

## 1. Choose the best rule based upon heuristics.

2. Apply this rule to create a new state.
3. Detect when a solution is found.
4. Detect dead ends so that they can be avoided.

1. Detect when a nearly solved state occurs and use special methods to make it a solved state.

Now let us look at what AI techniques are generally used in each of the above tasks. We will then look a t
specific methods of implementation.

## A.Rakesh Babu M.C.A., M.Tech. 98

Asst.Prof
Choice of best rule

## Methods used involve

 finding the differences between the current states and the goal states and then
 choosing the rules that reduce these differences most effectively.
 Means end analysis good example of this.

##  the first thing to do is to fill up the car with fuel.

 If we do not have a car then we need to acquire one.
 The largest difference must be tackled first.

Rule application

 Previously rules could be applied without any difficulty as complete systems were specified and
rules enabled the system to progress from one state to the next.
 Now we must be able to handle rules which only cover parts of systems.
 A number of approaches to this task have been used.

## Green's Approach (1969)

Basically this states that we note the changes to a state produced by the application of a rule.

Consider the problem of having two blocks A and B stacked on each other (A on top).

## Then we may have an initial state which could be described as:

ON(

ONTABLE(

CLEAR(
A.Rakesh Babu M.C.A., M.Tech. 99

Asst.Prof
If we now wish to UNSTACK(A, B). We express the operation as follows:

## [CLEAR(x,s) ON(x, y, s)]

[HOLDING(x, DO(UNSTACK(x,y),s))

CLEAR(y,DO(UNSTACK(x,y),s))]

where x,y are any blocks, s is any state and DO() specifies that an new state results from the given action.

## The result of applying this to state to give state then we get:

HOLDING( ) CLEAR( ).

## The frame problem

-- In the above we know that B is still on the table. This needs to be encoded into frame axioms that
describe components of the state not affected by the operator.

## The qualification problem

-- If we resolve the frame problem the resulting description may still be inadequate. Do we need to
encode that a block cannot be places on top of itself? If so should this attempt fail?

If we allow failure things can get complex -- do we allow for a lot of unlikely events?

## The ramification problem

-- After unstacking block A, previously, how do we know that A is no longer at its initial location?

Not only is it hard to specify exactly what does not happen ( frame problem) it is hard to specify
exactly what does happen.

## A.Rakesh Babu M.C.A., M.Tech. 100

Asst.Prof
STRIPS
STIPS proposed another approach:

 Basically each operator has three lists of predicates associated with it:
o a list of things that become TRUE called ADD.
o a list of things that become FALSE called DELETE.
o a set of prerequisites that must be true before the operator can be applied.
 Anything not in these lists is assumed to be unaffected by the operation.
 This method initial implementation of STRIPS -- has been extended to include other forms of
reasoning/planning (e.g. Nonmonotonic methods, Goal Stack Planning and even Nonlinear planning
-- see later)

Consider the following example in the Blocks World and the fundamental operations:

STACK
-- requires the arm to be holding a block A and the other block B to be clear. Afterwards the block A
is on block B and the arm is empty and these are true -- ADD; The arm is not holding a block and
block B is not clear; predicates that are false DELETE;

UNSTACK
-- requires that the block A is on block B; that the arm is empty and that block A is clear. Afterwards
block B is clear and the arm is holding block A - ADD; The arm is not empty and the block A is not
on block B -- DELETE;
See Exercises for more examples.

We have now greatly reduced the information that needs to be held. If a new attribute is introduced we do
not need to add new axioms for existing operators. Unlike in Green's method we remove the state indicator
and use a database of predicates to indicate the current state

## A.Rakesh Babu M.C.A., M.Tech. 101

Asst.Prof
ONTABLE(B) CLEAR(B) HOLDING(A) CLEAR(A)

Detecting Progress

## The final solution can be detected if

 we can devise a predicate that is true when the solution is found and is false otherwise.
 requires a great deal of thought and requires a proof.

## Detecting false trails is also necessary:

 E.g. A* search -- if insufficient progress is made then this trail is aborted in favour of a more hopeful
one.
 Sometimes it is clear that solving a problem one way has reduced the problem to parts that are harder
than the original state.
 By moving back from the goal state to the initial state it is possible to detect conflicts and any trail or
path that involves a conflict can be pruned out.
 Reducing the number of possible paths means that there are more resources available for those left.

Supposing that the computer teacher is ill at a school there are two possible alternatives

##  transfer a teacher from mathematics who knows computing or

 bring another one in.

Possible Problems:

 If the maths teacher is the only teacher of maths the problem is not solved.
 If there is no money left the second solution could be impossible.

If the problems are nearly decomposable we can treat them as decomposable and then patch them, how?

Consider the final state reached by treating the problem as decomposable at the current state and noting the
differences between the goal state and the current state and the goal state and the initial state and use
appropriate Means End analysis techniques to move in the best direction.

## A.Rakesh Babu M.C.A., M.Tech. 102

Asst.Prof
Better is to work back in the path leading to the current state and see if there are options. It may be that one
optional path could lead to a solution whereas the existing route led to a conflict.

Generally this means that some conditions are changed prior to taking an optional path through the problem.

Another approach involves putting off decisions until one has to, leaving decision making until more
information is available and other routes have been explored. Often some decisions need not be taken as
these nodes are never reached.

## Goal Stack Planning

Basic Idea to handle interactive compound goals uses goal stacks, Here the stack contains :

 goals,
 operators -- ADD, DELETE and PREREQUISITE lists
 a database maintaining the current situation for each operator used.

Consider the following where wish to proceed from the start to goal state.

##  Initially the goal stack is the goal state.

 We then split the problem into four subproblems
 Two are solved as they already are true in the initial state -- ONTABLE(A), ONTABLE(D).
A.Rakesh Babu M.C.A., M.Tech. 103

Asst.Prof
 With the other two -- there are two ways to proceed:
1. ON(C,A)
2.
3. ON(B,D)
4.
5. ON(C,A) ON(B,D)
6.
7. ONTABLE(A)
8. ONTABLE(D)
9.
10.
11. ON(B,D)
12.
13. ON(C,A)
14.
15. ON(C,A) ON(B,D)
16.
17. ONTABLE(A)
18. ONTABLE(D)
19.
20.

The method is to

##  Investigate the first node on the stack ie the top goal.

 If a sequence of operators is found that satisfies this goal it is removed and the next goal is
attempted.
 This continues until the goal state is empty.

## Consider alternative 1 above further:

 The first goal ON(C,A) is not true and the only operator that would make it true is STACK (C,A) which replaces
ON(C,A) giving:

## A.Rakesh Babu M.C.A., M.Tech. 104

Asst.Prof
 B<>STACK (C,A)

 ON(B,D)

 ON(C,A) ON(B,D)

 ONTABLE(A)
 ONTABLE(D)

 STACK has prerequisites that must be met which mean that block A is clear and the arm is holding
block C. So we must do:
 B<>CLEAR(A)

 HOLDING(C)

 CLEAR(A) HOLDING(C)

 STACK (C,A)

 ON(B,D)

 ON(C,A) ON(B,D)

 ONTABLE(A)
 ONTABLE(D)

 Now top goal is false and can only be made true by unstacking B. This leads to:
 B<>ON(B,A)

 CLEAR(B)

## A.Rakesh Babu M.C.A., M.Tech. 105

Asst.Prof

 ARMEMPTY

 ON(B,A) CLEAR(B)

 ARMEMPTY

 UNSTACK(B,A)

 HOLDING(C)

 CLEAR(A) HOLDING(C)

 Now the first goal is true, the second is universally true, and the arm is empty. Thus all top three
goals are true means that we can apply the operator UNSTACK(B,A) as all prerequisites are met.
This gives us the first node in database

## ONTABLE(A) ONTABLE(C) ONTABLE(D) HOLDING(C) CLEAR(A)

 Note as a future reference of the use of UNSTACK(B,A) that HOLDING(B) is true as well as
CLEAR(A)
 The goal stack becomes
 HOLDING(C)

 CLEAR(A) HOLDING(C)

 STACK (C,A)

 ON(B,D)

## A.Rakesh Babu M.C.A., M.Tech. 106

Asst.Prof

 ONTABLE(D)

 There are two ways we can achieve HOLDING(C) by using the operators PICKUP(C) or
UNSTACK(C,x) where x is an unspecified block. This leads to two alternative paths:
1. ON(C, x)
2.
3. CLEAR(C)
4.
5. ARMEMPTY
6.
7. ON(C, x) CLEAR(C)
8.
9. ARMEMPTY
10.
11. UNSTACK(C,x)
12.
13. CLEAR(A) HOLDING(C)
14.
15. STACK (C,A)
16.
17. ON(B,D)
18.
19. ON(C,A) ON(B,D) ONTABLE(A)
20.
21.
22. ONTABLE(D)
23.
24.

1. ONTABLE(C)
2.
3. CLEAR(C)
4.
5. ARMEMPTY
6.
7. ONTABLE(C) CLEAR(C)
8.
9. ARMEMPTY
10.
11. PICKUP(C)
12.
A.Rakesh Babu M.C.A., M.Tech. 107

Asst.Prof
13. CLEAR(A) HOLDING(C)
14.
15. STACK (C,A)
16.
17. ON(B,D)
18. ONTABLE(D)
19.
20.
21. ON(C,A) ON(B,D) ONTABLE(A)
22.
23.
24. ONTABLE(D)

In this first route we can see three references to some block, x and these must refer to the same block,
although in the search it is conceivable several blocks will become temporarily attached. Hence the binding
of variables to blocks must be recorded. Investigating further we need to satisfy the first goal and this
requires stacking C on some block which is clear.

CLEAR(x)

HOLDING(C)

CLEAR(x) HOLDING(C)

STACK (C, x)

CLEAR(C)

ARMEMPTY

We now notice that one of the goals created is HOLDING(C) which was the goal we were trying to achieve
by applying UNSTACK(C, some block) in this case and PICKUP(C) in the other approach. So it would
appear that we have added new goals and not made progress and in terms of the A* algorithm it seems best
to try the other approach.
 So looking at the second approach

 We can see that the first goal is achieved block C is on the table.
 The second goal is also achieved block C is clear. Remember that HOLDING(B) is still true which
means that the arm is not empty. This can be achieved by placing B on the table or planting it on
block D if it is clear.

## A.Rakesh Babu M.C.A., M.Tech. 108

Asst.Prof
 Lookahead could be used here to compare the ADD lists of the competing operators with the goals
in the goal stack and there is a match with ON(B,D) which is satisfied by STACK (B,D). This also
binds some block to block D.
 Applying STACK (B,D) generates extra goals CLEAR(D) and HOLDING(B)

## The new goal stack becomes;

CLEAR(D)

HOLDING(B)

CLEAR(D) HOLDING(B)

STACK (B, D)

## ONTABLE(C) CLEAR(C) ARMEMPTY

PICKUP(C)

 At this point the top goal is true and the next and thus the combined goal leading to the application
of STACK (B,D), which means that the world model becomes
ONTABLE(A) ONTABLE(C) ONTABLE(D) ON(B,D) ARMEMPTY
 This means that we can perform PICKUP(C) and then STACK (C,A)
 Now coming to the goal ON(B,D) we realise that this has already been achieved and checking the
final goal we derive the following plan
1. UNSTACK(
2. PICKUP(C)
3. STACK (C,A) B,A)
4. STACK (B,D)

This method produces a plan using good Artificial Intelligence techniques such as heuristics to find
matching goals and the A* algorithm to detect unpromising paths which can be discarded.

## A.Rakesh Babu M.C.A., M.Tech. 109

Asst.Prof
Reasoning with qualitative information

## Fig. 25 Sussman's Anomaly

The start state is given by:
ON(C, A) ONTABLE(A) ONTABLE(B) ARMEMPTY
The goal by:
ON(A,B) ON(B,C)
This immediately leads to two approaches as given below
1. ON(A,B)
2.
3. ON(B,C)
4.
5. ON(A,B) ON(B,C)
6.
7.
8. ON(B,C)
9.
10. ON(A,B)
11.
12. ON(A,B) ON(B,C)
13.
14.
Choosing path 1 and trying to get block A on block B leads to the goal stack:
ON(C,A)

CLEAR(C)

ARMEMPTY

## ON(C,A) CLEAR(C) ARMEMPTY

UNSTACK(C,A)

ARMEMPTY

CLEAR(A) ARMEMPTY

PICKUP(A)

CLEAR(B) HOLDING(A)

STACK(A,B)

ON(B,C)

ON(A,B) ON(B,C)

This achieves block A on block Bwhich was produced by putting block C on the table.
The sequence of operators is

1. UNSTACK(C,A)
2. PUTDOWN(C)

## A.Rakesh Babu M.C.A., M.Tech. 110

Asst.Prof
3. PICKUP(A)
4. STACK (A,B)

Working on the next goal of ON(B,C) requires block B to be cleared so that it can be stacked on block C.
Unfortunately we need to unstack block A which we just did. Thus the list of operators becomes

1. UNSTACK(C,A)
2. PUTDOWN(C)
3. PICKUP(A)
4. STACK (A,B)
5. UNSTACK(A,B)
6. PUTDOWN(A)
7. PICKUP(B)
8. STACK (B,C)

To get to the state that block A is not on block B two extra operations are needed:

1. PICKUP(A)
2. STACK(A,B)

## Analysing this sequence we observe that

 Steps 4 and 5 are opposites and therefore cancel each other out,
 Steps 3 and 6 are opposites and therefore cancel each other out as well.

## So a more efficient scheme is:

1. UNSTACK(C,A)
2. PUTDOWN(C)
3. PICKUP(B)
4. STACK (B,C)
5. PICKUP(A)
6. STACK(A,B)

To produce in all such cases this efficient scheme where this interaction between the goals requires more
sophisticated techniques.

## A.Rakesh Babu M.C.A., M.Tech. 111

Asst.Prof
Chapter
Commonsense
True Intelligent systems exhibit common sense -- they possess more than enough knowledge to be able to
work in a given environment.

We have already mentioned the CYC system which is an ambitious attempt to code up common sense.
However as this example illustrates you require a very large knowledge base for this type of system.

##  Descriptions of everyday objects -- Frames.

 Typical sequences of everyday events -- Scripts.
 Default reasoning -- Nonmonotonic logics.

Common sense strategies illustrate many important AI topics. We will study how this can be implemented
drawing on many of the topics we have studied previously.

## The Physical World -- Qualitative Physics

Qualitative Physics is an area of AI concerned with reasoning about the behavior of physical systems.
 They can predict that a falling ball will bounce many times.
 They can predict the projection of cricket ball and even catch it.
 They know a pendulum swings back and fore finally coming to rest in the middle.
However most humans whilst being to operate in this world have no notion of the laws of physics that
govern this world.
We can clearly look up the information and derive equations to describe, say pendulum motion. Indeed
computers are very good at this sort of computation when they have been programmed by experienced
programmers.
Is this how an intelligent system functions in this world?
Three year old children can and cannot even read or do elementary math’s?
One other motivation is that whilst complex computer models can be assembled many problems remain
difficult or impossible to solve analytically. Systems of equations (differential etc.) might hard to derive and
even impossible to solve.

## A.Rakesh Babu M.C.A., M.Tech. 112

Asst.Prof
 Modelling the Qualitative World.
 Reasoning with qualitative information
 It is a good area to study since humans know a great deal about this world:
 They can predict that a falling ball will bounce many times.
 They can predict the projection of cricket ball and even catch it.
 They know a pendulum swings back and fore finally coming to rest in the middle.
 However most humans whilst being to operate in this world have no notion of the laws

## A model may consist of the following entities:

Variables
-- make take on values as in a traditional physics model but with a restricted set of values, e.g. temperature as

.
Quantity Spaces
-- a small set of discreet values for a variable.
Rate of Change
-- Variables take on different values at different times. A real valued rate of change can be modelled qualitatively with a

## quantity space, e.g. .

Expressions
-- Combination of variables.
Equations
-- Assignment of expression to variables.
States
-- Sets of variables who's values change over time.
Note that qualitative algebra is different:

## Say we describe the volume of glass as

Then when we add two qualitative values together we get:

## A.Rakesh Babu M.C.A., M.Tech. 113

Asst.Prof
Reasoning with qualitative information

## The basic idea being:

 Construct a sequence of discrete episodes that occur as qualitative variable value changes.
 States are linked by qualitative rules that may be general.
 Rules may be applied to many objects simultaneously as they may all influence each other --
constraint satisfaction used.
 Ambiguity may arise so split outcomes into different paths and form a network of all possible states
and transitions.
 Each path is called a history the network an envisionment.
 In order to achieve effective programs for this we must know how to represent the behaviour of
many kinds of processes, materials and the world in which they act.

 Time
 Space
 Material

## A.Rakesh Babu M.C.A., M.Tech. 114

Asst.Prof
Time

Here we address notions of time familiar to most people as opposed to the philosophical nature of time.

For instance:

 Jimi Hendrix recorded albums between the mid 1960's and 1970.
 Jimi Hendrix died in 1970.
 Beautiful People released an album based on samples of all of Hendrix's recorded music.
 We can easily infer that Beautiful People's album was released after 1970.

##  Events occur during intervals -- continuous spaces of time.

 An interval has a start and end point and a duration (of time) between them.
 Intervals can be related to one another -- descriptions such as is-before, is-after, meets, is-met-by, starts, is-
started-by, during, contains, ends, is-ended-by and equals.
 We can build a axioms with intervals to describe events in time.

SPACE:

The Blocks World is a simple example of we can model and describe space.
However common sense notions such a place object x near object y are not accommodated.
Now objects have a spatial extent while events have a temporal extent.
So we might try to extend of common sense theory of time.
However space is 3D and there are many more relationships than those for time so it is not a good idea.
Another approach is view objects and space at various levels of abstraction. E.g. We can view most printed
circuit boards as being a 2D object.
Choosing a representation means selecting relevant properties at particular levels of granularity.
For instance we can define relations over spaces such as inside, adjacent etc.
We can also define relations for curves, lines, surfaces, planes and volumes. E.g. along, across,
perpendicular etc.

## A.Rakesh Babu M.C.A., M.Tech. 115

Asst.Prof
Materials
We need to describe properties of materials:
 You cannot walk on water.
 If you knock a cup of coffee over what happens?
 If you pour a full kettle into a cup what happens?
 You can squeeze a sponge but not a brick.
Liquids (as can be seen from above) provide many interesting points.
It is useful to think of spaces occupied by objects. Thus we can define properties such as:
 Capacity -- a bound to an amount of liquid.
 Amount -- volume occupied by a liquid.
 Full -- if amount equals capacity.
Other properties materials can posses include:
 Free -- if a space is not wholly contained inside another object.
 Surround -- if enclosed by a very thin free space.
 Rigid
 Flexible
 Particulate -- e.g. sand
Memory Organization
Memory is central to common sense behavior and also the basis for learning.
Human memory is still not fully understood however psychologists have proposed several ideas:
 Short term memory (STM) -- only a few items at a time can be held here. Perceptual information
stored directly here.
 Long term memory (LTM) -- capacity for storage is very large and fairly permanent.
LTM is often divided up further:
 Episodic memory -- contains information about personal experiences.
 Semantic memory -- general facts with no personal meaning. E.g. Birds fly. Useful in natural
language understanding.
In terms of AI research work started by Quillian on semantic memory led to semantic networks and frames
and other slot and filler structures.
Work on episodic memory grew out of scripts.
Production systems are an example of STN-LTM computer models.
A.Rakesh Babu M.C.A., M.Tech. 116

Asst.Prof
Let us finish this topic by seeing how memory is employed in problem solving.
We have seen that many problems are solved by analogy. Computer systems that perform this task are
sometimes called case based reasoning (CBR) systems.
CBR systems employ large case libraries rather than descriptions from first principles.
They therefore rely heavily on memory organisation and retrieval.
 A rich indexing system must be employed -- when reasoning with a problem only relevant past
experience should be recalled.
o Index by features present in problem.
 Require some measure of relevance of retrieved information.
o Some features only important in a certain context.
o Inductive and explanation based learning suitable here.
 The data structures used will be important as the number of cases represented will be large.
o Do we retrieve all information about a case or fragment of it?
 A number of cases are usually retrieved. We need to select the best one using some heuristic which
may include:
o Goal directed preference -- cases that include same goal as current problem.
o Salient feature preference -- cases that include the most important (or largest number of)
features.
o Specificity preference -- certain match features identified.
o Frequency preference -- select frequently matched cases.
o Recency preference -- select recently matched cases.
o Ease of adaptation preference -- cases whose features easily modified for new problem.

## A.Rakesh Babu M.C.A., M.Tech. 117

Asst.Prof
Chapter-12
EXPERT SYSTEMS
Expert Systems are computer programs that are derived from a branch of computer science research called
Artificial Intelligence (AI). AI's scientific goal is to understand intelligence by building computer programs
that exhibit intelligent behavior. It is concerned with the concepts and methods of symbolic inference, or
reasoning, by a computer, and how the knowledge used to make those inferences will be represented inside
the machine.
Of course, the term intelligence covers many cognitive skills, including the ability to solve problems, learn,
and understand language; AI addresses all of those. But most progress to date in AI has been made in the
area of problem solving -- concepts and methods for building programs that reason about problems rather
than calculate a solution.
AI programs that achieve expert-level competence in solving problems in task areas by bringing to bear a
body of knowledge about specific tasks are called knowledge-based or expert systems. Often, the term
expert systems is reserved for programs whose knowledge base contains the knowledge used by human
experts, in contrast to knowledge gathered from textbooks or non-experts. More often than not, the two
terms, expert systems (ES) and knowledge-based systems (KBS), are used synonymously. Taken together,
they represent the most widespread type of AI application. The area of human intellectual endeavor to be
captured in an expert system is called the task domain. Task refers to some goal-oriented, problem-solving
activity. Domain refers to the area within which the task is being performed. Typical tasks are diagnosis,
planning, scheduling, configuration and design.
Building an expert system is known as knowledge engineering and its practitioners are called knowledge
engineers. The knowledge engineer must make sure that the computer has all the knowledge needed to solve
a problem. The knowledge engineer must choose one or more forms in which to represent the required
knowledge as symbol patterns in the memory of the computer -- that is, he (or she) must choose a
knowledge representation. He must also ensure that the computer can use the knowledge efficiently by
selecting from a handful of reasoning methods. The practice of knowledge engineering is described later.
We first describe the components of expert systems.

## A.Rakesh Babu M.C.A., M.Tech. 118

Asst.Prof
The Building Blocks of Expert Systems
Every expert system consists of two principal parts: the knowledge base; and the reasoning, or inference,
engine.
The knowledge base of expert systems contains both factual and heuristic knowledge. Factual knowledge is
that knowledge of the task domain that is widely shared, typically found in textbooks or journals, and
commonly agreed upon by those knowledgeable in the particular field.
Heuristic knowledge is the less rigorous, more experiential, more judgmental knowledge of performance. In
contrast to factual knowledge, heuristic knowledge is rarely discussed, and is largely individualistic. It is the
knowledge of good practice, good judgment, and plausible reasoning in the field. It is the knowledge that
underlies the "art of good guessing."
Knowledge representation formalizes and organizes the knowledge. One widely used representation is the
production rule, or simply rule. A rule consists of an IF part and a THEN part (also called a condition and
an action). The IF part lists a set of conditions in some logical combination. The piece of knowledge
represented by the production rule is relevant to the line of reasoning being developed if the IF part of the
rule is satisfied; consequently, the THEN part can be concluded, or its problem-solving action taken. Expert
systems whose knowledge is represented in rule form are called rule-based systems.
Another widely used representation, called the unit (also known as frame, schema, or list structure) is based
upon a more passive view of knowledge. The unit is an assemblage of associated symbolic knowledge about
an entity to be represented. Typically, a unit consists of a list of properties of the entity and associated
values for those properties.
Since every task domain consists of many entities that stand in various relations, the properties can also be
used to specify relations, and the values of these properties are the names of other units that are linked
according to the relations. One unit can also represent knowledge that is a "special case" of another unit, or
some units can be "parts of" another unit.
The problem-solving model, or paradigm, organizes and controls the steps taken to solve the problem. One
common but powerful paradigm involves chaining of IF-THEN rules to form a line of reasoning. If the
chaining starts from a set of conditions and moves toward some conclusion, the method is called forward
chaining. If the conclusion is known (for example, a goal to be achieved) but the path to that conclusion is
not known, then reasoning backwards is called for, and the method is backward chaining. These problem-
solving methods are built into program modules called inference engines or inference procedures that
manipulate and use knowledge in the knowledge base to form a line of reasoning.
A.Rakesh Babu M.C.A., M.Tech. 119

Asst.Prof
The knowledge base an expert uses is what he learned at school, from colleagues, and from years of
experience. Presumably the more experience he has, the larger his store of knowledge. Knowledge allows
him to interpret the information in his databases to advantage in diagnosis, design, and analysis.
Though an expert system consists primarily of a knowledge base and an inference engine, a couple of other
features are worth mentioning: reasoning with uncertainty, and explanation of the line of reasoning.
Knowledge is almost always incomplete and uncertain. To deal with uncertain knowledge, a rule may have
associated with it a confidence factor or a weight. The set of methods for using uncertain knowledge in
combination with uncertain data in the reasoning process is called reasoning with uncertainty. An important
subclass of methods for reasoning with uncertainty is called "fuzzy logic," and the systems that use them are
known as "fuzzy systems."
Because an expert system uses uncertain or heuristic knowledge (as we humans do) its credibility is often in
question (as is the case with humans). When an answer to a problem is questionable, we tend to want to
know the rationale. If the rationale seems plausible, we tend to believe the answer. So it is with expert
systems. Most expert systems have the ability to answer questions of the form: "Why is the answer X?"
Explanations can be generated by tracing the line of reasoning used by the inference engine (Feigenbaum,
McCord et al. 1988).
The most important ingredient in any expert system is knowledge. The power of expert systems resides in
the specific, high-quality knowledge they contain about task domains. AI researchers will continue to
explore and add to the current repertoire of knowledge representation and reasoning methods. But in
knowledge resides the power. Because of the importance of knowledge in expert systems and because the
current knowledge acquisition method is slow and tedious, much of the future of expert systems depends on
breaking the knowledge acquisition bottleneck and in codifying and representing a large knowledge
infrastructure.
Knowledge engineering
It is the art of designing and building expert systems, and knowledge engineers are its practitioners. Gerald
M. Weinberg said of programming in The Psychology of Programming: "'Programming,' -- like 'loving,' --
is a single word that encompasses an infinitude of activities" (Weinberg 1971). Knowledge engineering is
the same, perhaps more so. We stated earlier that knowledge engineering is an applied part of the science of
artificial intelligence which, in turn, is a part of computer science. Theoretically, then, a knowledge engineer
is a computer scientist who knows how to design and implement programs that incorporate artificial

## A.Rakesh Babu M.C.A., M.Tech. 120

Asst.Prof
intelligence techniques. The nature of knowledge engineering is changing, however, and a new breed of
knowledge engineers is emerging. We'll discuss the evolving nature of knowledge engineering later.
Today there are two ways to build an expert system. They can be built from scratch, or built using a piece of
development software known as a "tool" or a "shell." Before we discuss these tools, let's briefly discuss
what knowledge engineers do. Though different styles and methods of knowledge engineering exist, the
basic approach is the same: a knowledge engineer interviews and observes a human expert or a group of
experts and learns what the experts know, and how they reason with their knowledge. The engineer then
translates the knowledge into a computer-usable language, and designs an inference engine, a reasoning
structure, that uses the knowledge appropriately. He also determines how to integrate the use of uncertain
knowledge in the reasoning process, and what kinds of explanation would be useful to the end user.
Next, the inference engine and facilities for representing knowledge and for explaining are programmed,
and the domain knowledge is entered into the program piece by piece. It may be that the inference engine is
not just right; the form of knowledge representation is awkward for the kind of knowledge needed for the
task; and the expert might decide the pieces of knowledge are wrong. All these are discovered and modified
as the expert system gradually gains competence.
The discovery and cumulation of techniques of machine reasoning and knowledge representation is
generally the work of artificial intelligence research. The discovery and cumulation of knowledge of a task
domain is the province of domain experts. Domain knowledge consists of both formal, textbook knowledge,
and experiential knowledge -- the expertise of the experts.
Tools, Shells, and Skeletons
Compared to the wide variation in domain knowledge, only a small number of AI methods are known that
are useful in expert systems. That is, currently there are only a handful of ways in which to represent
knowledge, or to make inferences, or to generate explanations. Thus, systems can be built that contain these
useful methods without any domain-specific knowledge. Such systems are known as skeletal systems, shells,
or simply AI tools.
Building expert systems by using shells offers significant advantages. A system can be built to perform a
unique task by entering into a shell all the necessary knowledge about a task domain. The inference engine
that applies the knowledge to the task at hand is built into the shell. If the program is not very complicated
and if an expert has had some training in the use of a shell, the expert can enter the knowledge himself.
Many commercial shells are available today, ranging in size from shells on PCs, to shells on workstations,
to shells on large mainframe computers. They range in price from hundreds to tens of thousands of dollars,

## A.Rakesh Babu M.C.A., M.Tech. 121

Asst.Prof
and range in complexity from simple, forward-chained, rule-based systems requiring two days of training to
those so complex that only highly trained knowledge engineers can use them to advantage. They range from
general-purpose shells to shells custom-tailored to a class of tasks, such as financial planning or real-time
process control.
Although shells simplify programming, in general they don't help with knowledge acquisition. Knowledge
acquisition refers to the task of endowing expert systems with knowledge, a task currently performed by
knowledge engineers. The choice of reasoning method, or a shell, is important, but it isn't as important as
the accumulation of high-quality knowledge. The power of an expert system lies in its store of knowledge
about the task domain -- the more knowledge a system is given, the more competent it becomes.
Bricks and Mortar
The fundamental working hypothesis of AI is that intelligent behavior can be precisely described as symbol
manipulation and can be modeled with the symbol processing capabilities of the computer.
In the late 1950s, special programming languages were invented that facilitate symbol manipulation. The
most prominent is called LISP (LISt Processing). Because of its simple elegance and flexibility, most AI
research programs are written in LISP, but commercial applications have moved away from LISP.
In the early 1970s another AI programming language was invented in France. It is called PROLOG
(PROgramming in LOGic). LISP has its roots in one area of mathematics (lambda calculus), PROLOG in
another (first-order predicate calculus).
PROLOG consists of English-like statements which are facts (assertions), rules (of inference), and
questions. Here is an inference rule: "If object-x is part-of object-y then a component-of object-y is object-
x."
Programs written in PROLOG have behavior similar to rule-based systems written in LISP. PROLOG,
however, did not immediately become a language of choice for AI programmers. In the early 1980s it was
given impetus with the announcement by the Japanese that they would use a logic programming language
for the Fifth Generation Computing Systems (FGCS) Project. A variety of logic-based programming
languages have since arisen, and the term prolog has become generic.
The basic categories of research in knowledge-based systems include: knowledge representation, knowledge
use (or problem-solving), and knowledge acquisition (i.e., machine learning and discovery).
Knowledge Representation
In knowledge representation, the key topics are concepts, languages, and standards for knowledge
representation. There are many issues involved in scaling up expert systems: defining the problems

## A.Rakesh Babu M.C.A., M.Tech. 122

Asst.Prof
encountered in the pursuit of large knowledge bases; developing the infrastructure for building and sharing
large knowledge bases; and actually accumulating a large body of knowledge, for example, common sense
knowledge or engineering and technical knowledge.
Knowledge Use
Knowledge use, or problem-solving, research efforts involve the development of new methods for different
kinds of reasoning, such as analogical reasoning, reasoning based on probability theory and decision theory,
and reasoning from case examples.
The first generation of expert systems was characterized by knowledge bases that were narrow and, hence,
performance that was brittle. When the boundary of a system's knowledge was traversed, the system's
behavior went from extremely competent to incompetent very quickly. To overcome such brittleness,
researchers are now focusing on reasoning from models, principles and causes. Thus, the knowledge-based
system will not have to know everything about an area, as it were, but can reason with a broader base of
knowledge by using the models, the principles, and the causation.
Knowledge Acquisition
The quest for a large knowledge base boils down to the problem of access to distributed knowledge bases
involving multiple expert systems and developers. The effort to develop the infrastructure needed to obtain
access is a research area called knowledge sharing. The goal of the knowledge sharing research is to
overcome the isolation of first-generation expert systems, which rarely interchanged any knowledge. Hence,
the knowledge bases that were built for expert systems in the 1980s did not accumulate.
Other Areas of Investigation
A major issue of expert systems research involves methods for reasoning with uncertain data and uncertain
knowledge. One of the most widely adopted methods is called "fuzzy logic" or "fuzzy reasoning," especially
in Japan, where fuzzy reasoning is the object of much research attention and much scrutiny on the part of
American researchers.
Very lately, there has come on the scene the research topic of neural networks -- networks of distributed
components operating in parallel to make classification decisions. The links between neural networks
technology and expert system technology are being explored.
Finally, research is underway to explore the use of new parallel computing methods in the implementation
of expert systems and advanced knowledge-based systems. The new wave of computing is multi-processor
technology. The question is, what will be the impact of such high-performance parallel computing activities
on expert system techniques?

## A.Rakesh Babu M.C.A., M.Tech. 123

Asst.Prof
o Knowledge Representation schemes.
o Problem decomposition -- breaking problem into smaller pieces and trying to solve these
first.
We have seen that it is possible to solve a problem by considering the appropriate form of knowledge
representation and using algorithms to solve parts of the problem and also to use searching methods.

**************end**************

Asst.Prof