0% found this document useful (0 votes)
9 views53 pages

Introduction To AI & Expert System

The document provides an overview of artificial intelligence (AI), defining it as the branch of computer science focused on automating intelligent behavior. It discusses various aspects of AI, including problem-solving, knowledge representation, and the Turing Test, which measures a machine's ability to exhibit intelligent behavior indistinguishable from a human. Additionally, it outlines the types of knowledge used in AI, such as declarative, procedural, and heuristic knowledge, and emphasizes the importance of knowledge representation for enabling machines to solve complex problems.

Uploaded by

subi3559
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)
9 views53 pages

Introduction To AI & Expert System

The document provides an overview of artificial intelligence (AI), defining it as the branch of computer science focused on automating intelligent behavior. It discusses various aspects of AI, including problem-solving, knowledge representation, and the Turing Test, which measures a machine's ability to exhibit intelligent behavior indistinguishable from a human. Additionally, it outlines the types of knowledge used in AI, such as declarative, procedural, and heuristic knowledge, and emphasizes the importance of knowledge representation for enabling machines to solve complex problems.

Uploaded by

subi3559
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
You are on page 1/ 53

AI - Artificial

“The art of creating “Computational


machines that perform intelligence is the study of

Intelligence
functions that require the design of intelligent
intelligence when agents” (Poole et al. ,
performed by people” 1998)
(Kurzwell, 1990)
Overview of artificial intelligence (AI), problem
solving in AI, knowledge representation in AI, “The study of how to “AI is concerned with
search methods, predicate and propositional make computers do intelligent behavior in
logic, Formal symbolic logic, LISP and PROLOG things at which, at the artifacts” (Nilson, 1998)
moment, people are
basics, network representations of knowledge,
better” (Rich and
natural language study in AI (seminar I), Fuzzy Knight, 1991)
sets and Fuzzy logic, Expert systems, rule based
expert systems, nonproduction system I. Acting humanly-Turing Test approach
architectures, examples of expert systems. The Turing test was proposed by Alan Turing in
(Chapters 1,2,4,5,7,9,12 & 15 of Patterson; 1950. The Turing test measures the performance
Chapter 1-5 and 8 of Rich and Knight) of an intelligent machine against that of a human
being. In this test, a machine and a human being
1. Overview of Artificial Intelligence are allowed to interact with another human being
Definition of AI who is referred as the interrogator. The
Artificial intelligence may be defined as
interrogator is not able to see or speak directly to
the branch of computer science that is concerned
either of them. He may communicate with the
with the automation of intelligent behavior.
human being or machine solely by the use of a
The definitions of AI as per various books textual device such as a terminal. The interrogator
are shown in the table. The ones on top are is asked to distinguish the computer from the
concerned with thought processes and reasoning, human being on the basis of the answer to the
whereas the ones on the bottom address behavior. questions asked over the textual device. IF the
The definitions on the left measure success in interrogator cannot distinguish the machine from
terms of fidelity to human performance, whereas
the human, then, Turing argues, the machine may
the ones on the right measure against an ideal
concept of intelligence, which we will call be assumed to be intelligent.
rationality. A system is rational if it does the
"right thing," given what it knows.
Systems that think like Systems that think rationally
human
“The exciting new effort “The study of mental
to make computers faculties through the use
think…machines with of computational models”
minds in the full and (Chamiak and
literal sense”
McDermott, 1985)
(Haugeland, 1985)
“[The automation of]
activities that we “The study of
associate with human computations that make it
thinking, activities such possible to perceive,
The computer would need to possess the
as decision making, reason and act.” (Winston,
problem solving, 1992) following capabilities
learning….” (Bellman, 1. natural language processing to enable it
1978) to communicate successfully in English
Systems that act like Systems that act rationally
humans

Jj MIC 2020 Page 1


2. knowledge representation: to store what used in knowledge representation, the
it knows or hears algorithms needed to apply that knowledge
3. automated reasoning to use the stored and the languages and the program
information to answer questions and to techniques used in their implementation.
draw new conclusions • AI is field of study that encompasses
4. machine learning to adapt to new computational techniques for performing
circumstances and to detect and tasks that apparently require intelligence
extrapolate patterns when performed by humans
• AI is the part of computer science concerned
Total Turing Test includes a video signal so that with designing intelligent computer systems
the interrogator can test the subject's perceptual i.e. computer systems that exhibit
abilities, as well as the opportunity for the characteristics we associate with intelligence
interrogator to pass physical objects "through the in human behaviour- understanding
hatch." To pass the total Turing Test, the language, learning, reasoning and solving
computer will need problems.
1. computer vision to perceive objects, and
2. robotics to manipulate objects and move
about 2. PROBLEM SOLVING IN AI
Searching for the solution of a problem is
II. Thinking humanly: The cognitive the basic operational task in almost all AI
modelling approach programs. Problems are typically defined in terms
Once we have a sufficiently precise theory of states and the solutions correspond to the goal
of the actual working of human mind, it states.
becomes possible to express the theory as a
computer program. The interdisciplinary Some of the task domain of AI
field of cognitive science brings together I. Mundane Tasks
computer models from A1 and experimental 1. Perception – Vision, Speech
techniques from psychology to try to 2. Natural Language- understanding,
construct precise and testable theories of the Generation, Translation
workings of the human mind. 3. Common Sense Reasoning
III. Thinking rationally: The "laws of II. Formal Tasks
thought" approach 1. Games-Chess, Checkers,
The laws of thought were supposed to ackgamon
govern the operation of the mind; their study 2. Mathematics-Geometry, Logic
initiated the field called logic. Logicians in 3. Integral Calculus
the 19th century developed a precise notation III. Expert Tasks
for statements about all kinds of things in the 1. Engineering-designing, fault
world and about the relations among them. finding, Manufacturing
IV. Acting rationally: The rational agent 2. Scientific analysis
approach 3. Medical diagnosis
An agent is just something that acts 4. Financial Analysis
(agent comes from the Latin agere, to do).
Rational agent is one that acts so as to It was believed that the first category of
achieve the best outcome or, when there is skills (mundane tasks) is easier and more
uncertainty, the best expected outcome. amenable to computerized duplications than the
specialized ones (expert tasks). Therefore much
• AI is the study of how to make computers do of the initial AI works were concentrated on these
things which at the moment people do better. areas. But it turns out that this assumption is not
• AI s the branch of computer science that is correct. Although expert skills require knowledge
concerned with the automation of intelligent that many of us do not have, they often require
behaviour. AI is based upon the principles of much less knowledge than mundane skills and
computer science namely data structures
Jj MIC 2020 Page 2
that the knowledge is usually easier to represent
and deal with inside programs.
As a result the problem areas where AI in
now flourishing most as a practical discipline are
primarily the domains that require only
specialized expertise without the assistance of
common sense knowledge. There are now 1000s
of programs called expert systems throughout all
areas of industry and government. In addition to An agent is anything that can be viewed as
expert systems, there is another important branch perceiving its environment through sensors and
called neural network which is a currently known acting upon that environment through actuators.
model of intelligence. Neural network is based on A human agent has eyes, ears and other organs
the structure of human brain. for sensors and hands, legs, mouth and other body
parts for actuators.
The two most fundamental concerns of AI
researches are search and knowledge The agent receives stimuli from the environment
representation. Search is a problem solving and carries out actions in the environment. An
technique that systematically explores a space of agent is made up of a body and a controller. The
problem states i.e., successive and alternative controller receives percepts from the body and
stages for the final goal. Knowledge sends commands to the body. A controller inside
representation means a means of capturing the agent is the brain of the agent. There are a
knowledge and manipulation of it for an number of ways an agent’s controller can be
intelligent behavior. used.
1. Embedded agent: an embedded agent is
AI application areas one that is run in the real world, where the
1. Game playing actions are carried out in a real domain
2. Automated reasoning and Theorem proving 2. A stimulated agent: is one that is run with
3. Natural language understanding and a stimulated body and environment
Semantic modelling 3. An agent system model: is where there are
4. Modelling human performance models of the controller, body and the
5. Planning and robotics environment that can answer questions
6. Machine learning about how the agent will behave.
7. Expert Systems
Expert knowledge is a combination of a
theoretical understanding of the problem and 3. Knowledge Representation in AI
a collection of heuristic problem-solving
rules that experience has shown to be
effective in the domain. Expert systems are 3.1 Knowledge progression
constructed by obtaining this knowledge Knowledge can be defined as the body of
from a human expert and coding it into a facts, and principles accumulated by human mind
form that a computer may apply to similar or the state of knowing. Additionally, knowledge
problems. requires familiarity with language, concepts,
Agent procedures, judgmental rules, ideas, abstractions,
places, customs, facts and associations, coupled
with an ability to use these notions effectively in
modeling different aspects of the world. For
knowledge based systems, additional sources like
historic data, codes of practice, standard
engineering procedures, experimental data,
technical literatures, established engineering
equations etc. are also used. Knowledge may

Jj MIC 2020 Page 3


therefore also be recognized as the steps to follow
in solving a problem, use of the right equation Cognitive psychologists sort knowledge
and /or data and the correct use of application into (i) declarative (ii) procedural and (iii)
programs. strategic.
Knowledge and data are different. Knowledge (i) Declarative knowledge is passive
includes and requires the use of data and knowledge expressed as statements or facts about
information. But it has additional things like it the world. Knowledge about “something is true or
combines relationships, correlations, false” e.g. A car has four tyres. Concepts,
dependencies, and the notion of gestalt with data objects, events, facts, propositions, relationships,
and information. Knowledge consists of facts, assertions, semantic nets, logic etc. are
prejudices, beliefs and heuristic knowledge. declarative in nature. All declarative knowledge
is explicit knowledge.
(ii) Procedural knowledge is compiled
knowledge related to the performance of some
tasks. That is knowledge about how to do
A physician treating a patient uses both something. (Eg. steps in solving an algebraic
data and knowledge. Case history and other equation). Procedures, rules, strategies, agendas,
details of the patient are data. Whereas, models are coming under procedural knowledge.
knowledge is what the physician has learned from All procedural knowledge may be viewed as tacit.
medical college, from his experience, and from
(iii) Strategic knowledge is knowledge about
reading and so on.
how to set about a problem, how to go around
Knowledge is information to help us solve difficulties, what to do when get struck etc. The
problems in a particular domain. The most effectiveness of a system to solve a problem
helpful knowledge is an expression of some depends on the strategic knowledge.
regularity that helps us to predict “what will
Heuristic knowledge is a special type of
happen next” or explain “how” and “why”
knowledge used by human beings to solve
something has happened.
problems. Heuristics are the knowledge used to
make good judgments or strategies or tricks used
3.2 Knowledge classification to simplify the solution of the problem (rule of
thumb). (Eg. Locating a fault in a TV by a
Knowledge is classified into two as (i) tacit
technician).
and (ii) explicit.
Tacit: Tacit is informal and implicit knowledge Human mind has common sense
which can be articulated knowledge and domain specific knowledge.
• Exist within a human being Intelligence requires the possession and access of
• Difficult to articulate formally, knowledge. But knowledge has some less
• Difficult to communicate or share desirable properties like
• Hard to steal or copy • It is voluminous
• Drawn from experience, action , • It is hard to characterize accurately
subjective insight • It is constantly changing
Explicit: formal type of knowledge
• It differs from data by being organized.
• Exists outside human being
• Can be articulated formally
• Can be shared, copied, processed and In biological organisms, knowledge is
stored likely stored as complex structures of
• Easy to steal or copy interconnected neurons. The structure
• Drawn from principles, procedures, corresponds to symbolic representation of the
process, concepts. knowledge possessed by the organism. The

Jj MIC 2020 Page 4


knowledge stored in humans is informal and hard Fruit is a kind of crop
to express in any natural languages. Crop information is a part of
agricultural information
A common way to represent knowledge (iii) Procedural Knowledge – This is
outside human being is written language. But still responsible for knowing how to do
it is difficult to express all elements of something and includes rules,
knowledge. It is easy for human beings to strategies, procedures, etc.
understand the meaning, analyze it and interpret (iv) Meta Knowledge – Meta Knowledge
or infer it when written in any natural language. defines knowledge about other types
But for a machine, the knowledge has to be of Knowledge.
represented in a convenient form such that it can Eg. Bibliographic data or catalogue of
do all the processes that are happening in a books
human brain. Problem solving requires formal (v) Heuristic Knowledge – This
knowledge representation, and conversion of represents some expert knowledge in
informal knowledge to formal knowledge, that is the field or subject. It is “rules of
conversion of implicit knowledge to explicit thumb” based on previous
knowledge. In AI, this process is called experiences, awareness of approaches,
knowledge representation. and which are good to work but not
guaranteed.
(vi) In exact and uncertain knowledge
Knowledge dealing of probabilities or
uncertain facts. Characterizes
situations in which information is
imprecise, unavailable, incomplete,
random or ambiguous
Eg. Rumours about something or
someone,
3.3 Knowledge Representation
terms like ‘more or less’, ‘too much’
Knowledge representation is representing ‘little’ etc
information (in symbolic language) from the real (vii) Common sense knowledge
world for a computer to understand and then It is knowledge of approximate
utilize this knowledge to solve complex real-life concepts and theories, general
problems like communicating with human beings hierarchies and analogies. It denotes
in natural language. Knowledge representation in vast amount of human knowledge
AI is not just about sorting data in a database, it about the world and cannot be stated
allows a machine to learn from that knowledge in precise theories. Collection of facts
and behave intelligently like a human being. and information that an ordinary
The kinds of knowledge represented in AI person is expected to know.
are (i) declarative knowledge (ii) structural E.g. shape of an apple
knowledge (iii) procedural knowledge (iv) Meta Knowledge about human emotions
knowledge (v) Heuristic knowledge (vi) in exact and reflexes.
or uncertain knowledge (vii) Common sense
knowledge
Approaches of knowledge
(i) Declarative knowledge: It includes Representation
concepts, facts, and objects and Approaches of knowledge representation are
expressed in declarative sentence (i) Simple relational knowledge (ii) Inheritable
(ii) Structural knowledge: It describes the knowledge (iii) Inferential knowledge (iv)
relationship between concepts and Procedural knowledge.
objects like ‘kind of ‘, ‘part of’ and
grouping (i) Simple relational knowledge.
Eg. Mango is a kind of fruit
Jj MIC 2020 Page 5
It is the simplest way to represent declarative Procedural knowledge approach uses small
facts. Here all the facts about a set of objects programs and codes which describes how to
are set out systematically in columns. do specific things, and how to proceed. One
Player Height Weight Age important rule in this approach is “if- then”
Sam 6.2 60 25 rule. Coding languages like LISP and
Mathew 5.8 70 26 PROLOG can be used in this approach. We
John 6.0 69 22 can represent heuristic or domain specific
The reason that this representation is simple knowledge using this approach.
is that standing alone it provides very weak
inferential capabilities. But knowledge
represented in this form may serve as the Schemes/Techniques of knowledge
input to more powerful inference engines. representation
(ii) Inheritable knowledge Numerous representational schemes have
In the inheritable approach, all data must be been proposed and implemented, each of them
stored into a hierarchy of classes and all having its own strength and weakness.
classes should be arranged in a generalized
form or a hierarchical manner. Elements According to Mylopoulos and Levesque (1984)
inherit property from other members of the they have been classified into four categories:
class. In this approach, objects and values are
represented in boxed nodes and arrows that 1. Logical Representation Scheme:
point from objects to their values.
This class of representation uses expressions in
Two attributes are used in this
formal logic to represent a knowledge base.
representation. The attribute ‘instance’ is
Inference rules and proof procedures apply this
used to show class membership. It has two
knowledge to problem solving. First order
arguments, the first one is an object and the
predicate calculus is the most widely used logical
second one is a class to which the object
representation scheme, and PROLOG is an ideal
belongs. The second attribute ‘is a’ is used to
programming language for implementing logical
show class inclusion. It is used to relate a
representation schemes.
subclass to a main class.
2. Procedural Representation Scheme:
Procedural scheme represents knowledge as a set
of instructions for solving a problem. In a rule-
based system, for example, an “if- then” rule may
be interpreted as a procedure for searching a goal
in a problem domain to arrive at the conclusion,
solve the premises in order. Production systems
are examples of a procedural representation
scheme.

(iii) Inferential knowledge 3. Network Representation Scheme:


Inferential knowledge approach represents Network representation captures knowledge as a
knowledge in the form of formal logics. This graph in which the nodes represent objects or
approach can be used to derive more facts. It concepts in the problem domain and the arcs
guarantees correctness. represent relations or associations between them.
Example Examples of network representations include
(a) Marcus is a man semantic network, conceptual dependencies and
(b) All men are mortal conceptual graphs.
Then it can be inferred that
Marcus is mortal 4. Structured Representation Scheme:
(iv) Procedural knowledge.

Jj MIC 2020 Page 6


Structured representation languages extend 4. Knowledge organisation
networks by allowing each node to be a complex
data structure consisting of named slots with 3.1 Knowledge acquisition
attached values. These values may be simple Knowledge acquisition is the process of
numeric or complex data, such as pointers to acquiring knowledge through experts in a raw
other frames, or even procedures. form, refining and representing the knowledge
into a form amenable for computation by a
machine. The two important parts of the
Requirements for knowledge knowledge acquisition side are the knowledge
Representation system: engineering and the machine learning.
A good knowledge representation system must The three components of a knowledge
possess the following properties. engineering are
1. Expert(s): A person solves a complex
1. Representational Accuracy: KR system should
problem by his wit, wisdom and
have the ability to represent all kind of required
experience in a particular domain. But the
knowledge.
experts may have their limitations in
2. Inferential Adequacy: KR system should have expressing the knowledge in a
ability to manipulate the representational computation form. The experts do not
structures to produce new knowledge follow textbook type expressive method;
corresponding to existing structure. hence it becomes difficult to knowledge
engineer to represent.
3. Inferential Efficiency: The ability to direct the 2. Knowledge Engineer: The knowledge
inferential knowledge mechanism into the most engineer is a person who is well acquitted
productive directions by storing appropriate or educated with the tools, techniques or
guides. methodology of computing science and
engineering in general and artificial
4. Acquisitional efficiency- The ability to acquire intelligence in particular. He is
the new knowledge easily using automatic transforming the raw form of knowledge
methods. i.e. intuition, tricks and technique of the
expert in a lucid and elicit form suitable
for symbolic computation.
Knowledge Based system (KB) 3. Computing Machine: A computing
machine is an inanimate entity which can
accelerate the computation at a higher rate
than a human being. The machine can
implement the symbolic computational
model developed by the Knowledge
Engineer.

Knowledge is acquired through the


interaction of the knowledge engineer with the
Knowledge based intelligent systems get
expert through dialogues, interviews and by
their power from the expert knowledge that has
watching the activities of an expert while
been coded into facts, rules, heuristics, and
executing a particular job of computing nature.
procedures.
The different types of knowledge may be in the
Key issues confronting the designer of a form of numerical data, simple propositions, facts
knowledge based AI system are: and figures, rules, procedures, concepts, and
1. Knowledge acquisition formulas, i.e. mathematical relations, etc. These
2. Knowledge Representation kinds of information bits are to be put in a form
3. Knowledge manipulation or to be transformed or represented in a standard

Jj MIC 2020 Page 7


formal structure or in any heuristic informal relationships, a formalism capable of representing
structure, which can be implemented in a and manipulating these relatively abstract entities
computing machine through a program. There are must be devised. This requires structuring and
various knowledge acquisition tools such as processing tools that go beyond what is used
TIERSIAS, MOLE, SALT, SEEK 2, Meta- today in computers which work essentially on
Dendral, which are used to acquire domain quantitative ideas. The more powerful knowledge
knowledge from experts. structures are called knowledge base. A
knowledge base is the representation of all the
The knowledge engineering side of the knowledge that is stored by an agent.
system helps the machine to understand (a) the
domain of the problem (b) identification of the
problem, (c) formulating the concept; that is
creating subtasks in a hierarchical order (d) 3.3 Knowledge Manipulation
problem implementation and (e) development to a The manipulative operations on these
model for knowledge representation. knowledge bases are done by the inference
engine programs. Decisions and actions kind
knowledge based systems come from
The development of the knowledge manipulation of the knowledge in specified way.
representation model is problem specific i.e. The steps involved in a typical manipulation is
domain specific. The selection of knowledge given below
representation scheme is based upon the nature,
characteristics and complexities of the problem or • Input given by the user will initiate a search
subtasks. for goal or decision
• Known facts in the knowledge base are
Learning Component learns from the captured located, compared
data by the perception component. The goal is to • Sometimes, this process may set up some sub
build computers that can be taught instead of goals
programming them. Learning focuses on the • Sometimes, more inputs are to be given by
process of self-improvement. the user
• Finally the solution to the problem is
3.2 Knowledge Representation obtained.
Knowledge is playing an important role in
intelligent behavior. Knowledge helps to how to The manipulations are the computational
act in a particular situation. Knowledge is the equivalent of reasoning.
information about a domain that can be used to
solve problems in that domain. In human beings, The main difficulty in knowledge manipulation is
knowledge is inside brain. But in a machine, the amount of computational time required for
knowledge is stored in it. To express knowledge search. Much research has been done to develop
we need a language. For even simple actions, we better search strategies.
need large amount of data. There in AI, a
language is needed to represent knowledge.
3.4 Knowledge Organization
Syntax is the grammar in knowledge The organization of knowledge in
representation and semantic is the meaning of memory is key factor for efficient processing.
the language. Knowledge based system requires tens and
thousands of facts and rules to perform a task. It
The knowledge representation problem is essential that the appropriate fact and rules be
concerns the mismatch between human and easy to locate and retrieve.
computer memory, i.e. how to encode knowledge
so that it is a faithful reflection of the expert’s Knowledge can be organized in memory
knowledge and can be manipulated by a for easy access by a method known as indexing.
computer. To program a computer to solve non- Grouping and use of key words etc. help to limit
quantitative problems dealing with non- the search in a fraction of knowledge rather than
quantitative things like ideas, concepts and their searching the whole chunk of knowledge.

Jj MIC 2020 Page 8


Frame linked together in a network • Specify a set of rules that describe the
represent a versatile organization structure. actions available.
The problem can be solved using the rules in
combination with an appropriate control strategy,
4. Search Methods to move through the problem space until a path
from an initial state to a goal state is found. Thus
AI problems te problem of search is fundamental to problem
In AI certain Agents are classified as goal based solving process.
agents. These types of agents are given a problem
and the solution of the problem is called the goal State space searching has assumes that
state. Search is the process through which an 1. The agent has perfect knowledge of the
intelligent agent reaches the goal state. state space and can observe what state it is
in
To solve a problem the following things have to 2. The agent has a set of actions that have
be done known deterministic effects
3. Some states are goal states, the agent
• Define the problem precisely wants to reach one of these goal states and
• Analyse the problem the agent can recognize a goal state.
• Isolate and represent the tasks knowledge 4. A solution is a sequence of actions that
that is necessary to solve the problem will get the agent from the current state to
• Choose the best problem solving a goal state.
technique and apply it to the particular
problem.
While in search an intelligent agent constructs a
set of potential partial solutions to a problem that
can be checked to see if they truly are solutions or
if they could lead to solutions. Search proceeds
by repeatedly selecting a partial solution,
stopping if it is a path to a goal. Search underlies
most of Artificial Intelligence. When an agent is
given a problem, it is usually given only a
description that lets it recognize a solution, not an
algorithm to solve it.

State space representation of a problem


Many problems in AI can be represented as a set
of states and set of rules of how one state is
transformed into another. The agent should
choose a sequence of actions to achieve the The important terminologies is in state space
desired goal. representation are
In this representation, to solve a problem we must 1. State space (S): Each state is an abstract
do the following representation of the agent’s environment.
• Define a state space that contains all It is an abstraction that denotes the
possible configurations of the relevant configuration of the agent.
objects 2. Initial state(S0): The description of the
• Specify one or more states within that starting configuration of the agent
space which describes the initial states 3. Action/operator (A): An action or
• Specify one or more states that could be operator takes the agent from one state
acceptable solutions to the problems. into another state. A state can have a
These are called goal states number of successor states.
4. A plan: is a sequence of action

Jj MIC 2020 Page 9


5. A Goal (G): is a description of set of a. Optimal solution: an optimal
desirable states. Goal states are often solution to a problem is one that is
specified by a goal test which any goal the best solution according to
state must satisfy. some measure of solution quality.
6. Path cost: is the sum of the path steps If the order only matters then the
solution is called ordinal and if
A problem can be defined formally by four the relative magnitudes are also
components considered the solution is called
1. The initial state: it is the state that the cardinal. For example, if time
agent starts in. required to complete a task is also
2. Successor function: The agent should be considered while evaluating the
given with a sequence of possible actions completeness of the solution then
available to the agent. The common way it is considered cardinal. One
is to give a successor function which general cardinal measure of
generates a set of <action, successor> desirability is utility.
pairs on its execution. Each pair gives the b. Satisficing solution: A satisficing
possible legal actions that can be done on solution is one that is good enough
any state x and the probable successors of according to some description of
x. The initial state and the successor which solutions are adequate.
functions together implicitly define the c. Approximately optimal solution:
state space. The state space forms a graph An approximately optimal solution
in which the modes are states and the arcs is one whose measure of quality is
between nodes are actions. A path in the close to the best that could
state apace is a sequence of states theoretically be obtained.
connected by a sequence of actions. d. Probable solution: A probable
3. The goal test: which determines whether a solution is one that, even though it
given state is a goal state or not. The goal may not actually be a solution to
state can be either explicitly defined or a the problem, is likely to be a
defined by an abstract property. solution.
4. Path cost: A path cost function that 2. Representations: After defining the
assigns a numeric cost to each path. requirements on the nature of the
solution, the problem must be
represented so a computer can solve it.
Problem solving methods Computers like human mind are
The key issues in problem solving are (1) examples of physical symbol systems.
what is the solution of the problem? How good A symbol is a meaningful pattern that
must a solution be? (2) How the problem can be can be manipulated. Examples of
represented? What knowledge is required to solve symbols are written words, sentences,
the problem and how it can be acquired? How the gestures, marks on paper, or sequence
knowledge can be debugged, maintained and of bits. An AI system is also based on
improved? (3) How can the agent compute an symbol system and it uses such a
output that can be interpreted as a solution to the system to model the world in which it
problem? Is it important for a human to is acting. A model of the world is
understand how the answer was derived? representation of that specifies what is
true in the world or of the dynamic of
1. Defining a solution: As in any software the world. The world does not have to
design, AI designer also should determine be modelled at the most detailed level
what would constitute a solution. The to be useful. All models are
solutions can be classified into four classes abstractions, they represent only part
according to its correctness or of the world and leave out many of the
completeness. details. There can be different levels
of abstractions. (i) knowledge level

Jj MIC 2020 Page 10


abstraction: this is a level of
abstraction that considers what an
agent knows and believes and what is Graph and tree representation
its goals are. (ii) symbol level: is a
Problem Graphs
level of description of an agent in
terms of the reasoning it does. An In Problem Graphs, the general
agent manipulates symbols to produce mechanism of searching is abstracted and
answers. presented in terms of searching for paths in
3. Reasoning and acting: The directed graphs. Many problem solving tasks can
manipulation of symbols to produce be transformed into the problem of finding a path
action is called reasoning. One way in a graph. Searching in graph provides an
that AI representation differs from appropriate level of abstraction within which to
computer program in traditional study simple problem solving independent of a
languages is that an AI representation particular domain.
typically specifies what need to be A graph consists of a set of nodes and a
computed, not how it is to be set of directed arcs between nodes. The idea is to
computed. AI reasoning involves find a path along these arcs from a start node to a
searching through the space of goal node. In terms of state-space searching,
possibilities to determine how to nodes represent states and arcs represent actions.
complete task. There are three aspects A directed graph consists of
of computations;
a. Design time reasoning: is the • A set of N of nodes and
reasoning that is carried out to • A set A of ordered pairs of nodes called
design the agent. It is carried out arcs
by the designer of the agent, and
not the agent itself. There can be infinitely many nodes and arcs. The
b. Offline computation: is the arc 〈𝑛1 , 𝑛2 〉 is an outgoing form n1 and an
computation done by the agent incoming arc to n2. A node n2 is a neighbor of n1
before it has to act. It can include if there is an arc from n1 to n2. 〈𝑛1 , 𝑛2 〉 ∈ 𝐴. n2 is
compilation and learning. The a neighbor of n1 does not mean that n1 is a
agent creates a knowledge base to neighbor of n2. A path from node s to node g is a
solve the problem. sequence of nodes 〈𝑛0 , 𝑛1 , 𝑛2, … 𝑛𝑘 〉 such that
c. Online computation: is the 𝑛0 = 𝑠 and 𝑛𝑘 = 𝑔.
computation done by the agent
between observing the A cycle is a nonempty path such that the end
environment and acting in the node is the same as the start node. A directed
environment. A piece of graph without any cycles is called a directed
information obtained online is acyclic graph (DAG).
called an observation. An agent
must use both its knowledge base
and its observations to determine
what to do.

Search Algorithm
The notion of search is computation inside the
agent. The agent constructs a set of potential
partial solutions to a problem that can be checked
to see if they truly are solutions or if they could
lead to solutions. Search proceeds by repeatedly
selecting a partial solution, stopping if it a path to A directed graph
a goal, and otherwise extending it by one or more
arc in all possible ways.

Jj MIC 2020 Page 11


A tree is a DAG where there is one node with no Uninformed (Blind) Search Strategies
incoming arcs and every other node has exactly In uninformed search strategies, the
one incoming arc. The node with no incoming arc searching agent does not use any information
is called the root of the tree and nodes with no about where they are trying to get to unless they
outgoing arcs are called leaves. Because each happen to reach on a goal state. Two important
node in a tree has only one path of access from uninformed search methods are (i) Breadth first
any other node, it is impossible for a path to loop Search and (ii) Depth first Search
or cycle continuously through a sequence of
nodes. (i) Depth First Search (DFS)
In depth first Strategy the each node is expanded
Terms used to describe relationship between
and the successors are added to the Fringe or
nodes include parent, child and sibling. Parent is
Frontier in Last – In – First - Out (LIFO) basis.
preceding a child along directed arc. The children
That is the next node which selected for
of a node are called siblings. An ancestor comes
expansion is the last element that was added.
before a descendent in some path of a directed
graph.

A rooted tree In the above figure, the initial fringe is


To encode problems as graphs, one set of nodes is {𝐴} with a single node A. Then the node A is
referred to as the start nodes and another set is expanded and the successors are added to the
called goal nodes. A solution is a path from a fringe after removing A. Then the new fringe is
start node to a goal node. {𝐵, 𝐶}. In the next step node B is expanded and
its successors D and E are added in the front of
Sometimes there is a cost- a positive number- the fringe after removing B. That is fringe is
associated with arcs. The cost of the arc is written {𝐷, 𝐸, 𝐶}. Then D is expanded so fringe is
as cost(〈𝑛1 , 𝑛2 〉). The costs of arcs induce a cost {𝐻, 𝐼, 𝐸, 𝐶}. On expanding the node H, the fringe
of paths. Given a path 𝑝 = 〈𝑛0 , 𝑛1 , 𝑛2, … 𝑛𝑘 〉, the is {𝑁, 𝐼, 𝐸, 𝐶}.
cost of the path p is the sum of the costs of the
arcs in the path. This type of search result in paths being
pursued in a depth first manner- searching one
cost(𝑝) =cost(〈𝑛0 , 𝑛1 〉) + ... + cost(〈𝑛𝑘−1 , 𝑛𝑘 〉) path to its completion before trying an alternative
path. This method is said to involve backtracking.
An optimal solution is one of the least-cost The algorithm selects a first alternative at each
solutions; that is, it is a path p from a start node to node, and it backtracks to the next alternative
a goal node such that there is no path p′ from a when it has pursued all of the paths from the first
start node to a goal node where cost(𝑝) = selection.
cost(𝑝′).
Depth first search can get trapped on
The branching factor is an important infinite branches and never find a solution, even
factor in search process. if a solution exist in infinite graphs or graphs with
loops. Depth first search is sensitive to the order
in which the neighbors are added to the frontier.

Jj MIC 2020 Page 12


Depth first Search is appropriate when either solution and b is the branching factor (i.e. the
• Space is restricted number of children) at each node.
• Many solutions exist, particularly for the
case where nearly all paths lead to a A complete search tree of depth d where each
solution non-leaf node has b children has a total of
𝑏 𝑑+1 −1
• The order of the neighbours of a node are 1+ b + b2 + b3 + …. + bd = 𝑏−1
nodes O(bd).
added to the stack can be tuned so that
solutions are found on the first try Eg. A search tree of depth 12, where each node
has 10 children, then there are 1012 nodes in the
(ii) Breadth First Search (BFS) search tree. If a computer can expand 1000 nodes
In Breadth First Search, the frontier is per second and each node uses 100 bytes of
implemented as a FIFO (first – In, storage memory, then BFS will take 32 years to
First – Out) queue. Thus the path that reach the goal node and it will use 111 terabytes
is selected from the frontier is the one of memory.
that was added earliest.
(iii) Depth Limited Search
In depth limited search, a limit of
depth value is fixed and on reaching
the limit the algorithm stops
generating its successors and search
will continue with the fringe. In
Depth First Iterative Deepening
Search, first do DFS to depth zero (ie.
Treat start node as having no
successors) then, if no solution is
found, do DFS to depth 1 and repeat
DFS after increasing the depth level
In the above figure, the first node is A the by 1 every time. This search method
initial frontier is {𝐴}. Then the node A is expands all nodes at a given depth
expanded and the successors are added to the before expanding nodes at a greater
fringe after removing A. Then the new fringe is depth. This guarantees a solution of
{𝐵, 𝐶}. In the next step node B is expanded and shortest path. The main disadvantage
its successors D and E are added in the last of the of this method is that it performs
fringe after removing B. That is fringe is wasted computations before reaching
{ 𝐶, 𝐷, 𝐸}. Then C is expanded so fringe is a goal depth.
{ 𝐷, 𝐸, 𝐹, 𝐺}. On expanding the node D, the fringe (iv) Bidirectional Search
In Bidirectional Search, Search start
is {𝐸, 𝐹, 𝐺, 𝐻, 𝐼 }.
from both initial state and goal state.
Breadth First Search is useful when
Both the trees may meet at a point.
• Space is not a problem
Search processes stops when two
• To find solutions containing the fewest frontiers intersect and works well only
arcs when there are unique start and goal
• Few solutions may exist, and at least one states.
has a short path lengths (v) Uniform Cost Search
• Infinite paths may exist, because it It is an extension of BFS. When we
explores all of the search space, even with put new nodes in the fringe, the
infinite paths. priority is given to that node which
It is a poor method when all solutions have a long has low cost. Let g(n) represents cost
path length or there is some heuristic knowledge of the path from the start node to the
unavailable. It is not used very often because of current node n. Sort nodes by
its space complexity. The space complexity is of increasing the values of g. Expand
the order of (O(bd)). where d is the depth of the lowest cost node at the fringe. The

Jj MIC 2020 Page 13


same process is repeated before h(n). Well defined heuristic functions can play an
expanding the next node in the fringe. important part in efficiently guiding a search
Uniform Cost Search is complete and process towards a solution. Sometimes very
it has exponential time and space simple heuristic functions can provide fairly good
complexity O(bd). We can find the estimate of whether a path is any good or not. In
minimum cost path from start to the other situations, more complex heuristic functions
goal state. should be employed.

Heuristic Functions (Heuristic is rule of The purpose of a heuristic function is to


thumb) guide the search process in the most profitable
direction by suggesting which path to follow first
Heuristics are criteria, methods or principles
when more than one is available. The more
for deciding which among several alternative
accurately the heuristic function estimates the
courses of action promises to be the most
true merits of each node in the search tree (or
effective in order to achieve some goal. We can
graph) the more direct the solution process. In the
use heuristics to identify the most promising
extreme, the heuristic function would be so good
search path.
that essentially no search would be required. The
A heuristic is a technique that improves the system would move directly to a solution. But for
efficiency of a search process. By using heuristic many problems, the cost of computing the value
approach, we can get good solutions to hard of such a function would outweigh the effort
problems. There are some good general purpose saved in the search process.
heuristic functions that are useful in a wide
The Heuristic Search approaches are
variety of problem domain. In addition, it is
possible to construct special purpose heuristics ➢ Generate-and-Test
that exploit domain-specific knowledge to solve ➢ Hill Climbing
particular problem. One example of a general- ➢ Best First Search
purpose heuristic that is useful for a variety of ➢ Branch and Bound Search
combinational problem is the nearest neighbor ➢ Problem Reduction
heuristic, which works by selecting the locally ➢ Constraint Satisfaction
superior alternative at each step. Applying it to ➢ Means-ends analysis
the travelling salesman problem the procedures 1. Generate-and-Test
are
Algorithm: The generate-and-test
➢ Arbitrarily select a starting city
➢ To select the next city, look at all cities 1. Generate a possible solution. For some
not yet visited, and select the one closest problems, this means generating a
to the current city. Go to its next particular point in the problem space. For
➢ Repeat step 2 until all cities have been others, it means generating a path form a
visited start state.
2. Test to see if this is actually a solution by
A heuristic function is a function that maps comparing the chosen point or the
from problem state description to measures of endpoint of the chosen path to the set of
desirability, usually represented as numbers. acceptable goal states.
Which aspect s of the problem state are 3. If a solution has been found, quit.
considered, how these aspects are evaluated, and Otherwise return to step 1.
the weights given to individual aspects are chosen
in such a way that the value of heuristic function If the generation of possible solutions is
at a given node in the search process gives as done systematically, then this procedure will find
good an estimate as possible of whether that nod a solution eventually, if one exists. But if the
is on the desired path to a solution. The heuristic problem space is very large may take a very long
function at a node n is an estimate of the optimum time.
cost from the current node to a goal denoted by

Jj MIC 2020 Page 14


The generate-and-test algorithm is a depth- ii. If it is not a goal state but it is
first search procedure since complete solutions better than the current state, then
must be generated before they can be tested. In mark it the current state
the most systematic form, it is an exhaustive iii. If it is not better than the
search of the problem spaces. But, since it current state, then continue in the
operate by generating solutions randomly, there is loop
no guarantee that a solution will ever be found.
Between these two extremes, there lies a middle The key difference between this algorithm
ground in which the search process proceeds and the generate-and test is the use of an
systematically, but some paths are not considered evaluation function as a way to inject task-
because they seem unlikely to lead to a solution. specific knowledge into the control process. It is
This evaluation is performed by a heuristic the use of such knowledge makes this a heuristic
function. search method.

2. Hill Climbing: 2.2 Steepest–Ascent Hill Climbing: A


Hill Climbing a variant of generate-and-test useful variation on simple hill climbing considers
in which feedback from the test procedure is used all the moves from the current state and selects
to help the generator decide which direction to the best one as the next one. This method is
move in the search space. In a pure generate-and- called steepest-ascent hill climbing or gradient
test procedure, the test function responds with search.
only a yes or no. But if the test function is
Algorithm: Steepest-Ascent Hill climbing
augmented with a heuristic function that provides
an estimate of how close a given state is to a goal 1. Evaluate the initial state. If it is also
state, the generate procedure can exploit it. a goal state, then return it and quit.
Hill climbing is often used when a good Otherwise, continue with the initial
heuristic function is available for evaluating state as the current state.
states but when no other useful knowledge is 2. Loop until a solution is found or
available. For example, suppose you are in an until a complete iteration produces
unfamiliar city without a map and you want to get no change to the current state:
downtown. You simply aim for tall buildings. a) Let SUCC be a state such that
The heuristic function is just distance between the any possible successor of the
current location and the location of the tall current state will be better
buildings and the desirable states are those in than SUCC.
which this distance is minimized. b) For each operator that applies
2.1 Simple hill climbing: The simplest way to the current state do:
to implement hill climbing is i. Apply the operator and
Algorithm: Simple Hill Climbing generate a new state.
1. Evaluate the initial state. If it is a ii. Evaluate the new sate. If it
goal state, then return it and quit. is a goal state, then return it
Otherwise, continue with the initial and quit. If not, compare it
state as the current state. to SUCC. If it is better,
2. Loop until a solution is found or then set SUCC to this state.
until there are no new operators left If it is not better, leave
to be applied in the current state: SUCC alone.
a) Select an operator that has not
been yet applied to the current state © If the SUCC is better than current
and apply it to produce a new state. state, then set current state to SUCC.
b) Evaluate the new state
i. If it is a goal state, the return it Both the basic and steepest-ascent hill
and quit climbing may fail to find a solution. Either
algorithm may terminate not by finding a goal
state but be getting to a state from which no better

Jj MIC 2020 Page 15


states can be generated. This will happen if the insensitive to the starting state. This
program has reached either a local maximum or a should lower the chances of getting
plateau or a ridge. caught at a local maximum, a plateau or a
ridge.
A local maximum is a state that is better
than all its neighbors but is not better than some 3. Best-First Search
other states farther away. At local maximum, all
moves appear to make things worse. Local Depth first Search is good because it allows
maxima are particularly frustrating because they a solution to be found without all competing
often occur almost within sight of a solution. In branches having to be expanded. Breadth First
this case they are called foothills. Search is good because it does not get trapped on
dead-end paths. One way combing the two is to
A plateau is a flat area of the search space follow a single path at a time, but switch paths
in which a whole set of neighboring states have whenever some competing path looks more
the same value. On a plateau, it is not possible to promising than the current one does.
determine the best direction in which to move by
making local comparisons. At each step of the best-first search process,
we select the most promising of the nodes we
A ridge is a special kind local maximum. It have generated so far. This is done by applying
is an area of the search space that is higher than an appropriate heuristic function to each of them.
surrounding areas and that itself has a slope. But We then expand the chosen node by using the
the orientation of the high region, compared to rules to generate its successors. If one of them is
the set of available moves and the directions in solution, we can quit. If not, all those new nodes
which they move, makes it impossible to traverse are added to the set of nodes generated so far.
ridge by single moves. Again the most promising node is selected and
process continues.
There are some ways of dealing with these
problems, Initially there is only one node (A), so it
will be expanded. Doing so generates three new
• Back track to some earlier node and
nodes. The heuristic function which in this
try going in a different direction.
example is an estimate of the cost of getting to a
This is particularly reasonable if at
solution from a given node, is applied to each of
that node there was another
these node. Since D with heuristic function value
direction that looked as promising
1 is the most promising, it is expanded next,
or almost promising as the one that
producing two successor nodes, E and F. The
was chosen earlier. This is a good
heuristic function is applied to them. Now
way of dealing with local maxima.
another path going through node B (3) is found
• Make a big jump in some direction more promising and so it pursued, generating
to try to get to a new section of the nodes G and H. But on evaluating the new nodes,
search space. This is a good way of the root through D to E is more promising and E
dealing with plateau. is expanded, yielding nodes I and J. Now J will
• Apply two or more rules before be expanded and this process continues until a
doing the test. This corresponds to solution is found.
moving in several directions at
once. This is a good strategy for The difference between hill climbing and
dealing with ridges. Best-first Search is that, in hill climbing, one
2.3 Stimulated Annealing move is selected and all others are rejected,
Stimulated annealing is a variation of hill never to be reconsidered. In best-first search, one
climbing in which, at the beginning of the move is selected, but the others are kept around
process, some downhill moves may be so that they can be revisited later if the selected
made. The idea is to do enough path becomes less promising.
exploration of the whole space early on so
that the final solution is relatively

Jj MIC 2020 Page 16


if the first path in the queue contains
a goal node (b) if the first path
contains a goal node exit with
success, (c) if the first path does not
contain a goal node, remove the
path from the queue and form new
paths by extending the removed
path by one step (d) compute the
cost the new paths and add them to
the queue (e) sort the paths on the
queue with lowest cost paths in
front.
• Otherwise exit with failure
5. Optimal Search and A*
This A* algorithm is a specialization of best
first search. It provides general guidelines
with which to estimate goal distances. At
To implement such a search procedure, two each node along a path to the goal, the A*
lists of nodes are required algorithm generates all successor nodes and
computes an estimate of the distance (cost)
• OPEN: nodes that have been generated and
from the start node to a goal node through
have had the heuristic function applied to each of the successors. It then chooses a
them but which have not been examined. successor with the shortest estimated
OPEN is actually a priority queue in which distance for expansion. The successors for
the elements with the highest priority are this node are then generated, their distances
those with the most promising value of the
estimated, and the process continues until a
heuristic function.
goal is found or the search ends in failure.
• CLOSED: nodes that have already been
examined. We need to keep these nodes in The form of the heuristic estimation
memory if we want to search a graph. We function for A*is
need to check whether it has been generated
before. F*(n) = g*(n) + h*(n)

A heuristic function is also needed that Where the two components g*(n) and
estimates the merits of each node generated. H*(n) are estimates of the cost (or distance)
from the start node to node n and cost from
4. Branch and Bound Search node n to a goal node, respectively. The
asterisks are used to designate estimate of
The branch and bound search strategy the corresponding true values f(n) = g(n) +
applies to problems having more than one h(n). For state space tree problems g*(n) =
alternative path existing between nodes. g(n) since there is only one path and for
This strategy saves all path lengths from a graphs there are alternative paths to the
node to all generated nodes and chooses the same node n.
shortest path for further expansion. It then
compares the new path lengths with all old The A* algorithm proceeds as follows
ones and again chooses the shortest path for
expansion. • Place the starting node s on open
• If open is empty, stop and return
• Place the start node of zero path failure
length on the queue • Remove from open the node n that
• Until the queue is empty or a goal has the smallest value of f*(n). If
node has been found (a) determine

Jj MIC 2020 Page 17


the node is a goal node, return You are given two jugs- a 4 gallon and a 3 gallon.
success and stop. Otherwise Neither have any measuring markers on it. There
• Expand n, generating all of its is a pump that can be used to fill the jugs with
successors n’ and place n on closed. water. How can you get exactly 2 gallons of
For every successor nʹ, if nʹ is not water into the 4 gallon jug?
already on open or closed attach a
back pointer to n , compute f*(nʹ) The state space for this problem can be described
and place it on open as the set of ordered pair of integers (x, y) such
• Each n’ that is already on open or that x = 0, 1, 2, … and y = 0, 1, 2, ….x represents
closed should be attached to back the number of gallons of water in the 4 gallon jug
pointers which reflect the lowest and y that in the 3 gallon jug. Let the initial state
g*(nʹ) path. If nʹ was on closed and be (0, 0). The goal state is (2, y).
its pointer was changed, remove it The operator used to solve the problem can be
and place it on open. described by the production system. They are
represented as rules whose left sides are matched
Desirable properties of Heuristic against the current states and whose right sides
algorithm describe the new state that result from applying
the rules.
Admissibility condition: Algorithm is For this problem there are several sequences of
admissible if it is guaranteed to return operation that can be used to solve it. One such
an optimal solution when one exists. sequence is shown. The shortest or cheapest is to
be found. Production rules for the water jug
Completeness condition: Algorithm is problem
complete if it always terminates with a 1. (x, y)
solution when one exists. If x < 4 → (4, y) Fill
Dominance property: Let A1 and A2 the 4 G jug
be admissible algorithms with heuristic 2. (x, y)
estimation function h*1 and h*2 If y < 3 → (x, 3) Fill
respectively. A1 is said to be more the 3 G Jug
informed than A2, whenever, h*1(n) > 3. (x, y)
h*2(n). A1 is said to dominate A2. If x > 0 →(x-d, y) Pour
some water out of the 4 G jug
Optimality property: Algorithm A is 4. (x, y)
optimal over a class of algorithms if A If y > 0 → (x, y-d) Pour
dominates all members of the class. some water out of the 3 G jug
5. (x, y)
The A* algorithm is both complete and If x > 0 → (0, y)
admissible. Empty the 4 G jug on to the
ground
6. Iterative Deepening A*
6. (x, y)
By combining a heuristic evaluation function If y > 0 → (x, 0)
with a modified version of the iterative deepening Empty the 3 g jug on to the ground
search method, we obtain iterative deepening A* 7. (x, y)
or IDA*. If x + y > 4 and y > 0 → (4, y-(4-x)) Pour
water from the 3G jug to the 4G jug until
Like A*, IDA* always find a cheapest path if h* 4G full
is admissible. 8. (x, y)
If x +y > 3 and x > 0 →(x-(3-y),3) Pour
IDA* expands same number of nodes as A*. water from the 4G jug into the 3 G jug
until the 3G jug is full
AI problems- Examples 9. (x, y)
1. Water –Jug Problem

Jj MIC 2020 Page 18


If x + y < 4 and y> 0 → (x + y, 0) Pour all
water from the 3G jug to the 4G jug
10. (x, y)
If x + y > 3 and x > 0 → (0, x +y) Pour
all water from the 4G jug to the 3G jug

Solution 1
4G 3G Rule
0 0
0 3 2
3 0 9 Two levels of BFS Tree
3 3 2 Continue process until some rule produces a goal
4 2 7 state.
0 2 5 Another systematic control strategy is
2 0 9 DFS.
Solution 2
0 0
4 0 1
1 3 8
1 0 6
0 1 10
4 1 1
2 3 8
Problem Tree in water jug problem
One systematic control strategy for water-jug
problem is to construct a tree with the initial
states as the roots. Continue the off-springs of the
root by applying each of the applicable rules to DFS Tree
the initial states. When a dead end which produces a previous state
is reached, backtracking occurs.
Search Graph Water-Jug problem
In search trees, the same node is generated more
than once. This is avoided in search graphs. In
this method, the set of new nodes created is
examined to see if the new node already exists or
not. If it doesn’t exist, it is added to the graph. In
One level of BFS tree the search graph, cycles are introduced. A cycle is
a path through the graph in which a given node
appears more than once.
In the graph drawn there are 2 cycles; 1st cycle
including (0,0) and (4,0) and a 2nd cycle including
the nodes (0,0) and (0,3). A search graph reduces
the effort that is spent to explore the same path
several times. But it requires additional effort
each time a node is generated to see if it has been

Jj MIC 2020 Page 19


generated before. In certain problems, the search To solve hard problems effectively we can make
graphs are advantageous. use of Heuristic Search. Nearest neighbor
heuristic can be applied to the travelling salesman
problem as follows.

1 Arbitrarily select a starting city


2 To select the next city, look at all cities not
yet visited and select the one closest to the
current city. Go to the next.
3 Repeat step 2 until all cities have been
visited
The procedure executes in time proportional
Search Graph for water-jug problem to N2 where N is the number of cities in this
problem.
2. Travelling Salesman Problem 3. 8 Puzzle Problem
A salesman has a list of cities each of which he
The 8 puzzle is a square tray in which 8 square
must visit exactly once. There are direct routes
tiles are placed. The remaining 9th square is
between each pair of cities on the list. Find the
uncovered. Each tile has a number on it. A tile
route the salesman should follow for the shortest
that is adjacent to the blank space is slit into that
possible round trip that both starts and finishes at
space. The game consists of a starting position
any one of the cities.
and a specified goal position. The problem is to
A simple motion causing systematic control transform the starting position into the goal
structure could solve this problem. It would position by sliding the tiles around.
explore all possible paths in the tree and return A simple game using 8 puzzle is shown
the one with the shortest length. This approach
will work in practice for very short list of cities.
But it breakdown if the number of cities grows. If
there are N cities, the number of different paths
among them is (N-1)!. The time to examine a
single path is proportional to N. Therefore the
total time required to perform the task is N(N-1)!
= N!. If there are only 10 cities, the time is Start Goal
proportional to 10! Which a very large number = Step 1 Slide 6 downwards
3628800. The phenomenon is called
combinational explosion and there for we use a
new control strategy. The new technique is called
branch and bound. Begin generating complete
paths keeping track of the shortest path found so
far. Give up exploring any path as soon as its
partial length becomes greater than the shortest
path found so far. Using this technique we can
find the shortest path and it is more efficient than Step 2 Slide 8 downwards
the first method explored. This still require
exponential time.

Jj MIC 2020 Page 20


numbers and formulae expressions that consists
of collection of numbers and arithmetic
operations. But human beings require expression
in a richer, more general language. Even in higher
mathematical applications like theorem proving
and symbolic solution of integral-differential
equations, etc. requires concepts and relationships
represented by symbols and strings of symbols.
Human knowledge is dynamic and any attempt to
Step 3 Slide 2 to the right represent it must involve extensible knowledge
structures.
AI systems require suitable languages that
allow acquisition, representation, storing, and
other manipulation of concepts and relationships
by information processing machines. Languages
can be classified into either conventional or AI.
Conventional languages are designed to work on
an algorithmic basis where a task is broken down
into a step-by-step specification and coded (e.g.
C, Pascal).
Step 4 Slide 1 upwards
In AI, various knowledge representation
schemes like First Order Predicate Logic (FOPL)
or predicate calculus, propositional logic etc are
used.
Logic is a formal method for reasoning.
Many concepts which can be verbalized can be
translated into symbolic representations which
closely approximate with the meaning of these
concepts. These symbolic structures can then be
Step 5 Slide 8 to the left
manipulated in programs to deduce various facts,
to carry out a form of automated reasoning.

5. Predicate and Propositional Logic


The word Logic is used in as “the art of
correct reasoning”. The purpose of symbolic
logic is to symbolize reasoning encountered not
only in mathematics but also in daily life.
Basically the logic process takes in some
information (called premises) and produces some
Which is the goal state. outputs (called conclusions). Logic is basically
classified into two, propositional logic and
predicate logic. Propositional logic is the simplest
5. Formal Symbolic Logic of the symbolic logic.
Artificial intelligence systems are
concerned with representing and manipulating 5.1 Propositional Logic
knowledge. Knowledge Base (KB) is a set of In propositional logic, this symbolization is done
sentences that contain some assertion about the by using declarative statements that can be either
world. Some knowledge, particularly in true or false, but not both. Hence, Propositional
mathematics and sciences is expresses as

Jj MIC 2020 Page 21


logic refers to the style of reasoning which Then the sentence” If humidity is high and the
reasons over a given set of declarative statements. temperature is high, then one does not feel
comfortable” may be represented as
Proposition or statement: Any ordinary ((P ˄ Q) → (~ C))
statement is a proposition (formulas or well- A compound proposition can express a
formed formulas). In propositional logic, complicated idea. The atoms like P, Q and
Proposition is a statement which may be true or expressions like the ((P ˄ Q) → (~ C)) are called
false, but not at the same time. When the well formed formula.
language is proposition associated with deductive
system of inference, it is called propositional 5.1.2 Semantics of PL
logic. Propositional Calculus deals with the Definition 3: Well formed formula or formula
formation of complex propositions using a set of in propositional logic are defined as follows
rules and connectives. Propositional Logic deals 1. An atom is a formula
with the validity, satisfiability, and 2. If G is a formula then (~ G) is a
unsatisfiability using equivalence laws. formula
3. If G and H are formulas, then
5.1.1 Syntax of PL (G ˄ H),
Definition 1: A proposition is a declarative (G ˅ H),
sentence that is either true or false but not both (G → H),
Anil is intelligent (Proposition) (G ↔ H) are formula
Anil is hardworking (Proposition)
In the proposition “Anil is Intelligent”, Anil is Truth Values of logical formula
object and Intelligent is Relation/ function. • ~ G is true when G is false and is false
The Proposition can be symbolically represented when G is true. G is called the negation
as Intelligent (Anil) and Hardworking (Anil) of G
• (G ˄ H) is true if G and H are both true,
Definition 2: The symbols such as P, Q and R otherwise (G ˄ H) is false. (G ˄ H) is
that are used to denote propositions are called called the conjunction of G and H.
atomic formulas or atoms • (G ˅ H) is true if at least one of G and H
is true, otherwise (G ˅ H) is false. (G ˅
From propositions, we can build compound H) is called the disjunction of G and H
propositions by using logical connectives. • (G → H) is false if G is true and H is
In propositional logic we shall use 5 false. Otherwise (G → H) is true. (G →
logical connectives H) is read as “If G, then H” or “G
1. ~ (not) implies H”. If G is true H is true.
2. ˄ (and) Eg. If it rains (G), then the roads are wet
3. ˅ (or) (H). IF the roads are wet, does not make
4. → (if …. Then) sure that it rains.
5. ↔ (if and only if) If 1 + 1 =2 then 4 > 0
These five connectives can be used to If 1 + 1 =3 then 4 > 0
build compound propositions form propositions. If 1 + 1 =3 then 4 < 0
If 1 + 1 =2 then 4 < 0
If Anil is intelligent and Anil is hardworking, If Then If--Then
then Anil scores high marks. (Compound T T T
Proposition) F T T
Intelligent(anil) ˄ hardworking(anil) → F F T
scorehighmarks(anil) T F F

In symbolic form we consider the propositions • (G ↔ H) is true whenever G and H have


“Humidity is high” by P, the same truth values, Otherwise (G ↔ H)
“Temperature is high” by Q and is false.
“One feels comfortable” by C
Jj MIC 2020 Page 22
Eg. If two sides of a triangle are equal,
then two base angles of the triangle are The truth table of another formula G = ((P → Q)
equal. i.e G → H means that H → G. ˄ ((P ˄ ~Q) is
~Q (P →
P Q (P ˄ ~Q) G
A table that displays the truth values of a Q)
formula for all possible assignments of T T F T F F
truth values to atoms occurring is called a T F T F T F
truth table F T F T F F
F F T T F F
~
G H (G ˄ H) (G ˅ H) (G → H) (G ↔ H) The formula G is False under all its
G
T T F T T T T interpretations. This formula will be called an
T F F F T F F inconsistent formula or contradiction.
F T T F T T F Definition 7: A formula is said to be
F F T F F T T inconsistent or unsatisfiable if and only if it is
false under all its interpretations. A formula is
said to be consistent or satisfiable if and only if
5.1.3 Properties of Statements it is not inconsistent.
Definition 4: Given a propositional 1. A formula is valid iff its negation is
formula G, let A1, A2, .... An be the atoms inconsistent
occurring in the formula G. Then an 2. A formula is inconsistent iff its negation
interpretation of G is an assignment of is valid
truth values to A1, A2, .... An in which 3. A formula is invalid iff it is false under at
every Ai is assigned either T of F, but not least one interpretation
both. 4. A formula is consistent iff it is true under
Definition 5: A formula G is said to be at least one interpretation
‘true under an interpretation’ if and only 5. If a formula is valid, then it is consistent,
if G is evaluated to T in the interpretation; but not vice versa
otherwise, G is said to be ’false under the 6. If a formula is inconsistent, then it is
interpretation’. invalid, but not vice versa.

• Two formulas F and G are said to be


5.1.4 Validity and inconsistency of equivalent (or F is equivalent to G)
Formulas denoted as F = G, if and only if truth
Let us consider the formula G = ((P → Q) ˄ P) values of F and G are the same under
→ Q). The atoms in the formula are P and Q and every interpretation of F and G.
G has 4 interpretations. The truth table is • A literal is an atom or negation of an
P Q (P → Q) ((P → Q) ˄ P G
atom
T T T T T
T F F F T 5.1.5 Laws in propositional Logic
F T T F T (Equivalent Logical Expressions)
F F T F T F, G and H are formulas and $ denotes a formula
The formula G is true under all its which is always true and # denotes the formula
interpretations. This formula will be called a that is always false.
valid formula or a tautology. If one of the 1. F ↔ G = (F→ G) ˄ (G → F)
conditions is not True, then it is called invalid F ↔ G =(~F ˅ G) ˄ (~G ˅ F)
formula. F ↔ G = (F ˄ G) ˅ (~F ˄ ~G)
Definition 6: A formula is said to be valid, if 2. F → G = ~F ˅ G
and only if it is true under all its interpretations. F → G = ~(F ˄ ~G)
A formula is said to be invalid if and only if it is F → G = ~G → ~F
not valid. Commutative Laws

Jj MIC 2020 Page 23


3. (a) F ˅ G = G ˅ F, ( b) F ˄ G ˄ F- If F1, F2, …. Fn are wffs which consist of
Associative Law conjunctions (˄ or AND) of literals only and an
4. (a) ( F ˅ G) ˅ H = F ˅ (G ˅ H ) expression of the form F1˅ F2 ˅ …˅Fn is called a
(b) (F ˄ G) ˄ H = F ˄ (G ˄ H)
DNF.
Distributive Law
5. (a) F ˅ (G ˄ H) = (F ˅ G) ˄ (F ˅ H) Steps to convert a given formula into its normal
(b) F ˄ (G ˅ H) = (F ˄ G) ˅ (F ˄ H) form
D’Morgan’s Laws Step1 : eliminate implications and biconditionals
6. (a) ~(F ˅ G) = ~F ˄ ~G, ➢ Conversion of →
(b) ~(F ˄ G) = ~F ˅ ~G
Other Laws A → B = ~A ˅ B
7. (a) F ˅ # = F ➢ Conversion of ↔
(b) F ˄ $ = F A ↔ B = (A → B) ˄ (B → A) = (~A ˅ B)
(c) F ˅ $ = $, ˄ (~B ˅ A)
(d) F ˄ # = # Step 2: Reduce the scope of NOT symbol
(e) F ˅ ~F = $, Negation or D’Morgan’s Law
(f) F ˄ ~F = #
Double Negation Step 3: Use distributive law and associative law
8. ~(~F) = F
Example 1
Contradiction
Convert the formula (A →((B ˄C) →D)) into
9. F ˄ ~F = False
DNF
Excluded Middle
Step 1: ~A ˅ ((B ˄C) →D)
10. F ˅ ~F = True
~A ˅ (~ (B ˄C) ˅ D)
Idempotence
Step 2
11. (a) F ˄ F = F (b) F ˅ F = F
~A ˅ (~B ˅ ~C) ˅ D)
5.1.6 CLAUSAL FORM ~A ˅ ~B ˅ ~C ˅ D
Example 2
A clausal sentence is a either a literal or a
Convert ((A →B) → C) into CNF
disjunction of literals (joined by ˅)
Step 1:
E.g. (i) P, (ii) ¬P, (iii) P ˅ ¬Q, (iv) P ˅ Q ˅R
((A →B) → C)
where P, Q, R are literals.
~ (A →B) ˅ C
A clause is a set of literals
Step 2
Eg. (i) {P}, {¬P}, { P, ¬Q}
~ (~A ˅ B) ˅ C
Normal forms in propositional logic (A ˄ ~B) ˅ C
Step 3
There are two major normal forms of statements
(A˅ C) ˄ (~B ˅ C)
in propositional logic. They are conjunctive
normal form (CNF) and disjunctive normal form
(DNF). 5.1.6 Inference Rules
Conjunctive Normal Form (CNF) If we want to prove something, we apply some
(product of sums) manipulation procedures on the given statements
to deduce new statements. If we are totally sure
If F1, F2, …. Fn are wffs which consist of
that the given statements are TRUE, then the
disjunctions (˅ or OR) of literals only and an newly derived statements are also TRUE.
expression of the form F1˄ F2 ˄ …˄ Fn is called a Manipulation procedures that help one to do so
CNF. are called rules of inference. The inference rules
of PL provide the means to perform logical
Disjunctive Normal Form (DNF) proofs or deductions. Some inference rules are
(sum of products) given below

Jj MIC 2020 Page 24


Addition Disjunctive Syllogism
P → (P ˅ Q) P ˅Q
In another form ~P
P -----------
Q
P ˅Q
Constrictive Dilemma
Simplification or AND-elimination
P→Q
i.e from a conjunction, any of the conjuncts can
R→S
be inferred
From P & Q infer P P˅R
P˄Q ------------
P Q˅S

Modus ponens Destructive Dilemma


Rule: If A is true then B is true P→Q
Observation: A is true R→S
Conclusion : B is true ~Q ˅ ~S
------------
From P and P → Q infer Q. This is written as
P→Q, P ~P ˅ ~R
Q Substitution
For example
If s is a valid sentence, s’ derived from s by
given: (joe is a father) → (joe has a child)
consistent substitution of propositions in s, is also
and: (joe is a father)
valid.
conclude: (joe has a child)
Transportation
Modus Tollens
From P →Q, infer –Q → –P
Rule: If A is true then B is true
Observation: B is false Operations out
Conclusion : A is false P ˅ Q ˅... ˅ W = { P, Q, ... ,W}
(removing disjunction)
(~Q ˄ (P → Q)) → ~P). This can be written as
~Q P ˄ Q ˄... ˄ W = P
P→Q Q
~P .
.
For example:
W
Given rule: If it rains, then the roads are wet (separating the literals)
Observation: Roads are not wet
Conclusion: It didn’t rain Resolution in Propositional Logic
Apart from the above inference rules, one
Hypothetical Syllogism (Chain rule) important rule of inference is resolution.
From P → Q, and Q → R, infer P → R
P→Q Given any two clauses A and B, if there is
Q→R a literal P in A which has a complimentary literal
P→R ~P in B, delete it form A and B and construct a
Example disjunction of the remaining clauses. The new
Given: (programmer likes LISP) → (programmer hates clause is called resolvant.
COBOL)
And: (programmer hates COBOL) → (programmer likes
recursion) For example consider the clauses
Conclude: (programmer likes LISP) → (programmer likes
recursion)
A: P ˅ Q ˅ R

Jj MIC 2020 Page 25


B: ~P ˅ Q ˅ R 4. Therefore if butler is guilty then he got the
C : ~Q ˅ R cream
Clause A contains the literal P and clause
B contains ~P. Hence both of them are deleted First assign predicates
and a resolvent is generated. The resolvent has
again a literal Q whose negation is available in C. P: maid stole the jewelry
Hence resolving the two gives the final resolvent.
A: P ˅ Q ˅ R Q: Butler is guilty
B: P ˅ Q ˅ R R: Maid milk the cow
C : ~Q ˅ R S: Butler got the cream
D: Q ˅ R resolvent of A and The axioms Clausal form
B 1. P → ¬Q ¬P ˅ ¬Q
E: R resolvent of C and
2. P ˅ R P˅R
D
3. R → S ¬R ˅ S
4. Q → S ¬Q ˅ S
These steps can be represented as a We can prove the last conclusion by the principle
resolution tree of refutation. In this method, the conclusion is
negated and added to the other clauses.
¬(¬Q ˅ S) = Q ˄ ¬S
= Q and
¬S
Now the clausal form is
¬P ˅ ¬Q
P˅R
¬R ˅ S
Sometimes the resolution might ultimately Q
lead to an empty set or NIL. ¬S
Example The resolution tree is
A: P ˅ Q ˅ R
B: ~P ˅ Q ˅ R
C : ~Q ˅ R
D: ~R

The result is a null vector showing the


negated statement is false or the statement is
TRUE.
Another way of getting a null vector is
Example of Inference
1. If maid stole jewelry, then butler is not guilty

2. Either maid stole jewelry or she milk the cow

3. If maid milk the cow, then butler got the cream

Jj MIC 2020 Page 26


Structure of predicate logic is flexible enough to
permit the accurate representation of natural
language statements reasonably well. Many
concepts which can be verbalized can be
translated into symbolic representations which
closely approximate the meaning of these
concepts and these symbolic structures can be
manipulated in programs to deduce facts to carry
out a form of automatic reasoning.

5.2.1 Syntax of predicate logic


This shows that the conclusion is correct. 1. Connectives

5.1.7 Definitions in PL ̴ or ¬ represents negation


& or ˄ represents conjunction or AND
Formal system ‫ ׀‬or ˅ represents disjunction or OR
A formal system is a set of axioms S and a → represents implication (If ....then)
set of inference rules L from which new ↔ represents equivalence or if and only if
statements can be logically derived. <S, L> (iff)
denotes a formal system. 2. Quantifiers
 Existential quantifier (There exists)
Soundness  Universal quantifier (For all values of)
Let <S, L> be a formal system. Inference 3. Constants
procedures L are said to be sound if and only if Fixed value terms, belong to a given
any statement in s that can be derived from <S, domain. Usually denoted by letters near
L> is a logical consequence of <S, L>. the beginning of the English alphabet and
numbers e.g. A, b, D, 10, 2.5,...
Completeness 4. Variables
Let <S, L> be a formal system. Then the Terms that can assume different values
inference procedure L is complete if and only if over a given domain. They are usually
any sentence s logically implied by <S, L> can be denote by word and letters near the end of
derived using that procedure. the English alphabet, e.g. x, y, z ...
5. Auxiliary Symbols
Limitations of propositional logic
), (, { }, [ ] are used for punctuation
• Expression containing “there exist” and 6. Functions
“for all” cannot be expressed Function symbols defined over a domain
• PL deal only with constants and not (say D) map n elements (n > 0) to a single
variables element of the domain. Here n is called
• PL can deal with only finite number of the rank or ary or degree of the function.
propositions Letters f, g, h and word such as age_of ( ),
cause_of ( ) represents functions.
FOPL is a generalization of PL that allows us to
express and infer arguments in infinite model.
An n-ary function is written as f(t1, t2, ...,
5.2 First Order Predicate Logic (FOPL) tn) where t are terms defined over the
same domain. A 0-ary function is a
FOPL or simply Predicate logic or
constant.
Predicate Calculus is one of the oldest and most
important knowledge representation schemes
TERM: constants, variables and functions are
used in artificial intelligence. Predicate logic is a
referred as terms
high level human oriented language for
7. Predicates
describing problems and problem-solving
Predicates are the relations within the
methods. Predicate logic is widely accepted as
domain to show how one element is
one of the most useful representation methods.

Jj MIC 2020 Page 27


related to another. It also maps the P P(x) → Q (x)
elements of domain D to the value of Universal quantifier cannot be applied to predicate
MAN (¬john)
assertion being TRUE or FALSE. Constant cannot be negated and only predicate can be
Predicates ware written as strings of upper negated
case letters followed by the related father-of (Q(x))
elements of atomic formulae which Predicate cannot be the argument of a function
become the basic building block of MARRIED(MAN, WOMAN)
predicate language. Capitalised letters Predicate cannot have two arguments
and words near the middle of the alphabet
such as P, Q, R, EQUAL,.... are used to Well Formed Formulas (WFFs)
represent predicates. A 0-ary predicate is Well formed Formulas (wffs) (pronounced as
a proposition. woofs) are
1. Any atomic formula is a wff
ATOM: Predicates are referred as atomic 2. Atomic formula combined by
formulas or atoms. A predicate which has no connectives are wffs
3. All quantified atomic formulas are
variables is called a ground atom. wffs
LITERALS: an atom or a negative atom is Properties of wffs
referred to as literals. Eg. P or ¬P 1. Interpretation
When assignment of values is given to
Representation of Simple Facts in Predicate each predicate symbol in wff, we say
interpretation is given to the wff. If value
Logic
of interpretation is true, then it is called
Consider the sentences the model of the wff.
S1: All employees earning Rs. 35,000 or more 2. Validity
per year pay tax A wff is said to be valid, if it is true under
S2: Some employees are on leave today every interpretation otherwise it is called
S3: No employee earns more than the president invalid wff.
3. Satisfiability
A wff which is true for some
To represent these statements in predicate logic, interpretation is satisfiable and wff which
we have to define abbreviations for the predicates is false under every interpretation is said
and functions. to be unsatisfiable (inconsistent)
4. Equality
EMP(x) for x is an employee If the truth table values of the two wffs
PRD(x) for x is president are same regardless of the interpretations,
we say these wffs are equivalent.
Inc(x) for income of x
GE(u,v) for u is greater than or equal to v Laws in predicate logic (Equivalent
ON_LEAVE(x) for x is on leave today Logical Expressions)
TAX(x) for x pays tax • Double Negation
¬ (¬A) = A
Using these abbreviations S1, S2 and S3 can be • Commutativity
written in logic as A˄B=B˄A
S1: x ((EMP (x) ˄ GE (inc(x), 35000)) → A˅B=B˅A
TAX (x) • Associativity
S2: y (EMP (y) → ON_LEAVE (y)) (A ˄ B) ˄ C = A ˄ (B ˄ C)
(A ˅ B) ˅ C = A ˅ (B ˅ C)
S3: xy ((EMP (x) ˄ PRD (y)) → ¬ GE (inc(x), • Distributivity
inc(y)) A ˅ (B ˄ C) = (A ˅ B) ˄ (A ˅B)
A ˄ (B ˅ C) = (A ˄ B) ˅ (A ˄ B)
Some invalid formula

Jj MIC 2020 Page 28


• D’Morgan’s Law xyz((¬A(x,y,z) ˄ B(x, z) ˄ C(y,z))
¬(A ˄ B) = ¬A ˅ ¬B
Steps to convert predicate logic formula into
¬(A ˅ B) = ¬A ˄ ¬B
Prenex normal form
• Other Laws
A → B = ¬A ˅ B Step 1:
A → B = ¬(A ˄ ¬B) Conversion of →
A→ B = (¬B→ ¬A) A → B = ¬A ˅ B
A ↔ B = (A → B) ˄ (B → A) = (¬A ˅ B) Conversion of ↔
˄ (¬B ˅ A) A ↔ B = (A → B) ˄ (B → A) = (¬A ˅ B)
˄ (¬B ˅ A)
x A(x) ˅ B = x(A(x) ˅ B)
Step 2
x A(x) ˄ B = x(A(x) ˄ B)
Negation or D’Morgan’s Law
x A(x) ˅ B = x(A(x) ˅ B)
Use the formulae
x A(x) ˄ B = x(A(x) ˄ B)
➢ ¬ ((x) A(x)) = x (¬ A(x))
¬ ((x) A(x)) = x (¬ A(x)) ➢ ¬ ((x) A(x)) = x (¬ A(x))
¬ ((x) A(x)) = x (¬ A(x)) Step3 Use other formulae related to the
quantifiers.
x A(x) ˄ x B(x) = x (A(x) ˄ B(x))
x A(x) ˅ x B(x) = x (A(x) ˅ B(x)) Example: Convert the formula x A(x) →y
(Q1x) A(x) ˅ (Q2x) B(x) = (Q1x) (Q2y) (A(x) ˅ B(y))
B(x, y) into Prenex normal form
(Q1x) A(x) ˄ (Q2x) B(x) = (Q1x) (Q2y) (A(x) ˄ B(y))
x A(x) → y B(x, y)
Note: Q represents either  or  and B is
a formula that does not contain x.
x (¬A(x) ˅ y B(x, y))
Sentence
Suppose the wff F(x) contains the variable x is x y (¬A(x) ˅ B(x, y))
bound if it follows or is within the scope of the
This is the Prenix normal form
quantifier naming the variable. If a variable is
not bound it is said to be free.
Resolution
In the expression x (P(x) → Q(x, y)), x is
bound and y is free. An expression can be Inference is done by a method called resolution.
evaluated only if all the variables are bound. It requires that all statements be converted into a
Such expressions are called sentences. normalized clausal form. A clause is a disjunction
of a number of literals. A ground clause is one
Normal forms
which no variables occur in the expression.
In addition to CNF and DNF, predicated logic
has yet another normal form called Prenex Steps to convert a predicate statement into
normal form. clausal form are
A formula A in predicate logic is said to be in 1. Eliminate all implications and
Prenex normal form if it has the form
A = (Q1x1) (Q2x2) (Q3x3)...(Qnxn) B equivalency connectives (same as PL)
Where (Q1x1) (Q2x2) (Q3x3)...(Qnxn) are 2. Move all negations into immediately
quantifiers and B is formula without the precede an atom, Use DeMorgan’s laws,
quantifiers. (Q1x1) (Q2x2) (Q3x3)...(Qnxn) is use x (¬A(x) in place of ¬x A(x) and
called the prefix and B is called the matrix of the x (¬A(x)) in place of ¬(x) A(x). (same
formula A.
as PL)
Examples:
xyz((A(x,y,z) ˄ B(y, z)) → C(x,z)

Jj MIC 2020 Page 29


3. Rename variables, so that all quantifiers existential quantifier is not replaced
have different variable assignment. One by a constant instead it is replaced
variable bound by one quantifier should with a function symbol not appearing
not be repeated for another quantifier. For elsewhere. The arguments assigned to
example in the statement the function should match all the
x A(x) → (x B(x)), rename the second variables appearing in the universal
dummy variable by different one say y, so quantifiers preceding the existential
that the statement becomes x A(x) → quantifier. After this, the existential
(y B(y)), quantifier can be deleted. The same
4. Replace all existential quantifier by a process can be repeated for all such
skolem function by the process called existential quantifiers following
skolemisation so that  can be deleted universal quantifiers.
from the equation. For example
5. Convert to Prenex form. Move all u v x y P(f(u), v, x, y) →
universal quantifier to the left of the Q(u,v,y)
expression and put the expression on the The Skolem form is
right into prenex normal form with prenex vxP(f(a),v,x,g(v,x))→ Q(a,v,
in the front and matrix following it. g(v,x))
6. Put the matrix in CNF. Any matrix can be The first existential quantifier is not
put into normal form by repeatedly using preceded by any universal quantifier
one of the distributive rules. and hence the first rule is valid for
7. Eliminate all universal quantifiers deleting it. Here a constant ‘a’ is used
8. Remove conjunctions. to replace the variable ‘u’.
The resulting expression is called clausal The second existential quantifier is
form in predicate logic. preceded by two universal quantifiers
with variables v and x. therefore the
Skolemization variable y is replaced by a function g
with arguments v and x which are the
Skolemization is a process of eliminating
variables appearing in the preceding
existential quantifier from an equation. It is done
universal quantifiers.
as follows
1. If the first (leftmost) quantifier in an Example of clausal conversion
expression is an existential quantifier, Consider the expression
replace all occurrences of the variable
it quantifies with an arbitrary constant x y (z P(f(x), y,z) → (u Q(x,u)˄ yR(y,v)))
not appearing elsewhere in the
Step 1
expression and delete the quantifier.
The same procedure is followed for all x y (¬z P(f(x), y,z) ˅ (u Q(x,u)˄ yR(y,v)))
existential quantifier not preceded by
a universal quantifier. In each Step 2
elimination use different constant x y (z ¬P(f(x), y,z) ˅ (u Q(x,u)˄ yR(y,v)))
symbols in the substitution.
2. If an existential quantifier is preceded Step 3 Not required
by one or more universal quantifier,
Step 4
the process is different. In such cases,
the variable appearing in the
Jj MIC 2020 Page 30
y ( ¬P(f(a), y,g(y)) ˅ (Q(a,h(y))˄ R(y,I(y)))) ¬(x (bird(x) → fly(x)))
x (bird(x) ˄ ¬fly(x))
Step 5 7. Man is mortal
x (man(x) → mortal (x))
y (¬P(f(a), y,g(y)) ˅ Q(a,h(y)) ˄ (¬P(f(a), y,g(y)
8. At least one planet has life on it
˅R(y,I(y)))) x (planet(x) ˄ haslife(x)
Step 6

¬P(f(a), b,g(y))˅ Q(a,h(b))


Inference rules
In addition to the rules for propositional
¬P(f(a), y,g(y)) ˅R(y,I(b)) logic, inference rules to predicate logic are

Convert the statement into clausal form Universal instantiation


x P(x)
Consider the statement P(a)
Universal generalization
All Romans who know Marcus either hate Caesar P(a)
or think that anyone who hates anyone is crazy x P(x)
Existential instantiation
The wff is x P(x)
P(c)
x[(Roman(x) ˄ know(x, Marcus)) → Hate(x, Existential generalization
Caesar) ˅ (y z : hate(y, z) → thinkcrazy(x, y))] P(c)
x P(x)
Step 1 remove implications
Theorem proving in predicate Calculus
x[¬(Roman(x) ˄ know(x, Marcus)) ˅ Hate(x, There are two basic method of theorem proving
Caesar) ˅ (y z : ¬hate(y, z) ˅ thinkcrazy(x, y))] Method 1: start with the given axioms, use the
rule of inference and prove the theorem
Step 2 Limit the use of negation Method 2: Prove that the negation of the result
cannot be TRUE
x[¬Roman(x) ˅ ¬know(x, Marcus)) ˅ Hate(x,
The second method is commonly known as
Caesar) ˅ (y z : ¬hate(y, z) ˅ thinkcrazy(x, y))] theorem proving using refutation. The
methodology for that is
Step 3 Move the quantifiers to the left Step 1 : Find the negation of the result to be
proved
xyz [¬Roman(x) ˅ ¬know(x, Marcus)) ˅
Step 2 : Add it as a valid statement to the given
hate(x, Caesar) ˅ ¬hate(y, z) ˅ thinkcrazy(x, y))] set of statements
Step 3 : Perform resolution on these statements
Convert the following statements in logical until a contradiction is encountered
form Step 4: Conclude that the contradiction is due to
1. Whoever can read is literate the assumed negation of the result
x R(x) → L(x) Step 5: So the negated assumption that is made is
2. Monkeys are not literate FALSE or the result to be proved is TRUE
x M(x) → ¬L(x)
3. Some monkeys are intelligent Example:
x (M(x) ˄ I(x)) A: x [physician (x) → knows_surgery(x)]
4. Some who are intelligent cannot read B: physician(Bhaskar)
x (I(x) ˄ ¬R(x)) Prove that
5. All dogs are faithful knows_surgery(bhaskar)
x (dog(x) → faithful(x))
6. All bird cannot fly
Jj MIC 2020 Page 31
Method 1 dexterous, the chair can be moved under the
By instantiation let x be replaced by bhaskar bananas, and so on.
Therefore the first statement becomes
physician(bhaskar) → knows_surgery(bhaskar) All items needed for the actual knowledge
Using Modus ponens, knows_surgery(bhaskar) base are listed as axioms. These are the essential
follows. facts and rules.
Method 2
Assume the negation of the result to be proved Relevant Factors for the problem
¬knows_surgery(bhaskar) …. (1)
The given axioms are Constants
x [physician (x) → knows_surgery(x)] … (2) {floor, chair, bananas, monkey}
physician(bhaskar) … (3)
the equation 2 can be written as Variables
physician (bhaskar) → knows_surgery(bhaskar) {x, y, z}
¬physician(bhaskar) ˅ knows_surgery(bhaskar)
(4) Predicates
can-reach(x, y) : x can reach y
Resolving 1 and 4 gives dexterous(x) : x is dexterous animal
¬physician(bhaskar) … (6) close(x, y) : x is close to y
get_on(x, y) : x can get on y
This result is a contradiction. This under(x, y) : x is under y
contradiction is due to the assumption that was tall(x) : x is tall
made i.e. the negation of the result. Hence the in_room(x) : x is in the room
negation of the result is false or the result is can_move(x,y,z) : x can move y near
TRUE. z
can_climb(x, y) : x can climb onto y
Example of Resolution Axioms
in_room(monkey)
Monkey Banana Problem in_room (bananas)
We envision a room containing a monkey, in_room(chair)
a chair, and some bananas that have been hung tall(chair)
from the centre of the ceiling, out of reach of the dexterous(monkey)
monkey. If the monkey is clever enough, he can close(bananas, floor)
reach on top of the chair. can_move(monkey, chair, bananas)
can_climb(monkey, chair)
The problem can be represented in FOPL dexterous(x) ˄close(x,y)→ can_reach (x,
and by using resolution one can prove that the y)
monkey can reach the bananas. get_on(x,y) ˄ under(y, bananas) ˄ tall(y)

In creating the knowledge base, it is close(x, bananas)
important to identify the relevant objects in the (in_room(x)˄in_room(y)˄in_room(z)˄can
inference process. In the current problem, the _move(x,y,z)) → close(y, floor) ˅ under(y,z)
monkey, bananas, and chair are essential. Also, can_climb(x,y) → get_on(x,y)
needed some reference objects such as floor or
ceiling to establish the height relationship Clausal form of knowledge base
between monkey and bananas. 1. in_room(monkey)
The next step is to establish the important 2. in_room (bananas)
properties of objects, relations between them, and 3. in_room(chair)
any assertion likely to be needed. These include 4. tall(chair)
such facts as the chair is tall enough to raise the 5. dexterous(monkey)
monkey within reach of bananas, the monkey is 6. can_move(monkey, chair, bananas)
7. can_climb(monkey, chair)

Jj MIC 2020 Page 32


8. ¬close(bananas, floor) LISP (LISt Processing) is one of the oldest
9. ¬can_climb(x,y) ˅ get_on(x,y) programming languages invented by John
10. ¬dexterous(x) ˅¬close(x,y) ˅ can_reach (x, McCarthy in the late 1950’s. It is currently one of
y) the most popular computer languages used in
11. ¬get_on(x,y) ˅ ¬under(y, bananas) ˅ ¬tall(y) artificial intelligence programming. It is designed
˅ close(x, bananas) for supporting symbolic manipulation and the
12. ¬in_room(x)˅¬in_room(y)˅¬in_room(z)˅ interactive, trial-and-error style of programming
¬can_move(x,y,z) ˅ close(y, floor) ˅ employed by many AI researchers. It is a
under(y,z) language with simple syntax and dynamic
13. ¬can_reach(monkey, bananas) memory management. There are several dialects
of LISP such as FRAZLISP, INTERSLISP,
This is a refutation proof and therefore the MACLISP, QLISP, SCHEME, COMMONLISP.
negation of the term can_reach(monkey, bananas)
added to the knowledge base after negation as 7.1.1 Syntax of LISP:
clause 13. The basic building blocks of LISP are the
14. ¬can_move(monkey,chair,bananas) atom, the list and the string.
close(bananas, floor) under(chair, bananas) An atom
(14 is a resolvent of 1, 2, 3 and 12 with An atom is a string of character including
substitution{monkey/x, chair/y, bananas/z} numbers and special characters.
15. close(bananas, floor) ˅under(chair, bananas)
A List
this is a resolvent of 6 and 14
A list is a sequence of atoms and/or other lists
16. under(chair, bananas)
enclosed within parenthesis.
this is a resolvent of 8 and 15
(a b c d), (a b (c d))
17. ¬get_on(x, chair) ˅¬tall(chair) ˅ close(x,
bananas) A string
This is a resolvent of 11 and 16 with A String is a group of characters enclosed in
substitution{chair/y} double quotation marks like “hello”.
18. ¬get_on(x,chair) ˅close(x,bananas)
a resolvent of 4 and 17 Valid atoms Invalid atoms
19. get_on(monkey, chair) This- is- symbolic- atom (a b c
a resolvent of 7 and 9 Bill (a b)
20. close(monkey, bananas) *var* a” b
a resolvent of 18 and 19 with substitution
{monkey/x} Valid list Invalid list
21. ¬close(monkey, y) ˅ can_reach(monkey,y) (this is a list) this is not a list
A resolvent of 10 and 5 with the substitution (a (ab) c d) (a b c d
{monkey/x} () )ab(
22. reach(monkey, bananas) (mm tue) ( a b ( c d)
a resolvent of 20 and 21 with substitution Valid string Invalid string
{bananas/y} “this is a string” this is not a string
23. [ ] “ ab % d” “ neither this
The null set indicates that the clause “hello” nor this”
¬can_reach(monkey, bananas) is FALSE i.e,
can_reach(monkey, bananas) is TRUE A list may contain atoms as well as other lists.
These basic unit members of a list are called top
elements. The top elements of a list (a b (c d) e
7. LISP and PROLOG basics (f)) are, a, b, (c d), e and (f). The elements c and d
Specialized AI languages LISP and are the top elements of the sub-list (c d).
PROLOG are symbolic and it allows more
flexibility for user to represent knowledge. Atoms, Strings and Lists are the only valid
objects in LISP. They are called symbolic
7.1 LISP

Jj MIC 2020 Page 33


expressions or S-=expressions. Any S-expression the same as the empty list ( ). It is the only object
is a valid program. in LISP that is both an atom and a list. Since the
special elements return their own value, the
LISP programs run either on an interpreter or as following are valid expressions.
compiled code. The interpreter examines the
source programs in a repeated loop called the ̶>6
read-evaluate-print loop. This loop reads the 6
program code, evaluates it and prints the values
returned by the program. The interpreter signals ̶>t
its readiness to accept the code for execution by T
printing a prompt such as ̶ > symbol. ̶ > nil
NIL
For example, to find the sum of the three
numbers 5, 6 and 9 we type after the prompt the 7.1.2 List
following function call: Lists are the central data type of LISP. Lists are
important because they can be made to represent
̶ > (+5 6 9)
practically anything: sets, tables, graphs, and
20
even English sentences. Functions can also be
̶>
represented in lists.
It may be noted that LISP uses prefix notation.
The + symbol is the function name of the sum of Lists has two forms: a printed representation and
the arguments that follow. The function name and an internal one. Examples for the printed form is
its arguments are enclosed in parentheses to
signify that it is to be evaluated as a function. The (RED GREEN BLUE)
read-evaluate-print loop reads this expression,
evaluates it and prints the value returned (20). (2 3 5 7 11 13 17)
The interpreter then prints the prompt to signal its Inside the computer memory, lists are organized
readiness to accept the next input. as chains of cons cells which are drawn as boxes.
To compute the centigrade equivalent of the
Fahrenheit temperature, the LISP function is
̶ > (+(*(/ 9 5)50)32)
122
̶> The cons cells are linked together by pointers
which are drawn by arrows. Each cons cell has
The operations are 9/5 X 50 +32 following the
two pointers. One of them always point to the
conversion equation (F = 32 + C x 9/5)
element of the list while the other points to the
Each function call is performed in the order in next cons cell in the chain.
which it occurs within the parentheses. The basic
The last cons cell is terminated in NIL.
numeric operations are +, -, * and /. Arguments
may be integers or real values (floating point). A list may contain other lists as elements. Such
The number of arguments a function takes will lists are called nested lists.
differ. + and * takes zero or more arguments -
and / takes two. ((BLUE SKY) (GREEN GRASS) (BROWN
EARTH))
LISP tries to evaluate everything including
arguments and function. There are three types of
special elements (i) the letter t (logical true) (ii)
numbers and (iii) nil (logical false).
They are constants and always evaluate to
themselves returning their own value. Nil is also

Jj MIC 2020 Page 34


Length of a list is the number of elements it has. This is called CAR of CDR and it is abbreviated
as CADR (kae-der). Other examples of
(A B C D) - length is 4 combination are given below.
(A (B C ) D) - length is 3 CDAR

7.1.3 Basic List Manipulation functions in LISP

FIRST, SECOND, THIRD and REST CDAR


Lisp provides primitive functions for extracting
elements from a list. The functions are FIRST,
SECOND and THIRD return the first, second,
and third element of a list.
CADDR

Common lisp provides built-in definitions for all


combinations of CAR and CDR up to and
including four As and Ds in the function name.
Common Lisp also provides built in definitions
for FIRST through TENTH.
The REST function is the compliment of FIRST CONS
Cons takes two arguments, an element and a list
and returns a list with the element inserted at the
beginning.
CAR and CDR
CAR and CDR are two basic list
manipulating functions. CAR is the abbreviation
of Contents of Address Register and CDR is
Contents of Decrement portion of Register. The
result of the function CAR is equivalent to the List
function FIRST and CDR is equivalent to REST. List takes any number of arguments and returns a
list with the arguments as elements.

Append
Merges two or more lists into a single list
CAR and CDR can be combined to get any
element in a list. Consider the operation given
below

LAST
Returns a list containing the last element

Jj MIC 2020 Page 35


(evenp 3) Nil 3 is not even
(number 10ab) Nil 10ab is not a number
(oddp 3) T 3 is an odd number
(zerop .00001) Nil .00001 is not zero
(greater 2 4 27) T Arguments are succedingly
larger from left to right
(lessp 5 3 1 2) Nil Arguments are not
MEMBER successively smaller from left
Returns remainder of second argument list to right
starting with element matching first argument Listp (a)) T (a) is a valid list
(null nil) T Nil is an empty list

The predicate atom takes one argument. It returns


t if the argument is an atom and nil otherwise.
Equal takes two arguments and returns t if they
REVERSE evaluate to the same value, and nil otherwise.
Returns list with top elements in reverse order Evenp, number, oddp and zerop are tests on a
single argument. They return t if their arguments
evaluates to an even number, a number, an odd
number, or zero respectively. Otherwise they
return nil.

7.1.4 Defining Functions, Predicates and Greaterp and lessp each take one or more
Conditionals arguments. If there is only one argument, each
returns t. If more than one argument is used,
The user can define a new function in LISP. For
greater returns t if they arguments, from left to
defining a new function, it requires three
right, successively larger; otherwise nil is
arguments: (1) the new function name (2) the
returned. Lessp requires that the arguments are
parameters of the function and (3) the function
successively smaller from left to right to return t.
body of LISP code which performs the desired
Otherwise it returns nil. The predicates >= and <=
function operation.
have the same meaning as greater and lessp
As an example, defining a new function named respectively, except they return t if successive
averagethree to compute the average of three elements are also equal. Finally listp and null
numbers both returns t if its argument evaluates to nil;
otherwise it returns nil.
->(defun averagethree (n1 n2 n3) (/(+ n1 n2
n3)3)) Conditional cond

-> AVERAGETHREE Predicates are one way to make tests in programs


and take different actions based on the outcome
To call averagethree use the function as of the test. Cond is like the if … then… else
construct. The syntax for cond is
->(averagethree 10 20 30)
(cond (<test 1> <action 1>)
-> 20
(<test2><action2>)
Predicate functions
Predicates are functions that test their arguments .
for some specific condition. Predicates return true
(t) or false (nil), depending on the arguments. The (<testk> <action>))
most common predicate are Each (<test i> <action i>), i = 1, 2, ..k is
Function call Value Remark called a clause. Each clause consists of a test
returned portion and an action portion. If the <test1>
(atom aabb) T aabb is a valid atom evaluates non nil, then the action1 is performed
(equal a (car (a b))) T a equals a
and other tests are skipped. If <test> is nil, then

Jj MIC 2020 Page 36


<test2> is performed and the procedure is Alan Colmerauer in the early 1970s. It is a higher
repeated. level language than LISP as it has some kinds of
deduction and search already built in. PROLOG
Eg. Defining a function ‘maximum2’ to return the uses the syntax of predicate logic to perform
maximum of two numbers logical computations. PROLOG can be viewed as
a theorem prover implemented in the form of a
->(defun maximum2 (a b)
language interpreter.
(cond ((>a b) a)
PROLOG is a programming language for
(t b))) symbolic, non-numeric computations. It is
specifically will suited for solving problems that
-> MAXIMUM2 involve objects and relations between objects.
Note that the t in the second clause preceding b Programming in PROLOG is
forces the last clause to be evaluated when the accomplished by creating a database or
first clause is not. knowledge base of facts and rules about the
objects, their properties and their relationships to
Eg. Defining maximum3 other objects. Queries can be posed about the
->(defun maximum3 (a b c) objects and valid conclusions will be determined
and returned by the program. Responses to user
(cond ((> a b) (cond ((>a c) a) queries are determined through a form of
inferencing control known as resolution.
(t c)))
Some important points related to PROLOG
((> b c) b) ➢ Facts are expressed in the form of clauses or
predicates
(t c)))
Facts in PROLOG are declared with
-> MAXIMUM3
predicates and constants written in lower case
letters. The arguments of predicates are enclosed
in parenthesis and are separated by commas. The
Input, Output and Local variables fact that Tom is the father of Bob can be written
in prolog as:
The most commonly used I/O function are read,
print, prinl, princ, terpri and format. parent(tom, bob).
Read takes no arguments. When read appears in a sister (sue, bill).
procedure, processing halts until a single s- Sue is the sister of Bill.
expression is entered from the keyboard. Then the
processing continues using the entered value. male (joe).
Joe is a male
->(+ 5 (read))
➢ A PROLOG program consists of clauses.
6 Each clause terminates with a full stop
11
-> For a family tree given in the figure, there are
six clauses or relations.
Print takes one argument. It prints the argument
as it is received

PROLOG
PROLOG is the abbreviation for
“PROgramming in LOGic”. It was invented by

Jj MIC 2020 Page 37


?- parent (X, liz)
Ans: X = tom
?- parent (bob, X)
The first answer is
X = ann;
If we put a semicolon, prolog will
find another solution
X = pat;
If we request more solutions,
prolog will answer ‘no’
If a more general question is asked like
?- parent (X, Y)
X = pam
parent(pam,bob). Y = bob;
parent(tom,bob). On putting a semicolon,
X = tom
parent(tom,liz). Y = bob;
.
parent(bob,ann). .
This continues till prolog finds the
parent(bob,pat).
last solution or goal. We can
parent(pat,jim). terminate the process by pressing
return instead of semicolon
➢ The user can easily query the Prolog system ➢ Queries can be combined to get goals of
about relations defined in the program. Given more complicated questions
a database of facts and rules, we can make Here goals can be combined by using
queries by typing the query symbol ?- commas or it means conjunction of goals.
?- parent (bob, pat) To find the grandparent of jim, the query can
Ans: yes be given to prolog
?- parent (liz, pat) ?- parent (X, Y), parent (Y, jim).
Ans: no Ans: X = bob
?- parent (tom, ben) Y = pat
Ans: no If we change the order of queries the logical
meaning remains the same and the same
➢ The program can be extended by adding answer will result.
more facts. To find the grandchildren of tom, the
female(pam). question is
male(tom). ?- parent (tom, X), parent (X, Y)
male(bob). Ans: X = bob
female(liz). Y = ann;
female(pat). X = bob
female(ann). Y = pat
male(jim).
➢ The arguments of relations can be concrete Rules
objects or constants like (like tom and ann), Rules in PROLOG are composed of a
or general objects such as X and Y. Concrete condition or “if” part and a conclusion or
objects or constants are called atoms and “then” part separated by the symbol :- which
general objects are called variables. is read as “if” Rules may contain variables
(Variables should start with a uppercase which must begin with uppercase letters.
letter.)

Jj MIC 2020 Page 38


For example, the idea of offspring relation Atoms are strings of the following
can be set like characters. Atoms should start with a
offspring (Y,X) :- parent (X, Y) lower case letter. No space is allowed.
Rules have Upper case letters A, B, ...,Z
• A condition part ( the right hand side Lower case letters a, b, c....,z
of the rule) or body of the clause and Digits 0, 1, 2 ,,....9
• A conclusion part (the left hand side Special characters +, _ *, /, < , >, +, :, , &,
of the rule) or the head of the clause _, ~
Eg. anna, nil, x25, x_25, sarah_jones
offspring (Y, X) :- parent (X, Y) ▪ Strings of special characters
head body <--->
= = = = =>
...
To represent the general rule for grandparent ::=
grandparent(X, Z):-parent(X,Y),parent(Y,Z). ▪ Strings of characters enclosed in quotes.
Other relations that can be included are This atom can start with upper case
‘Tom’
grandfather(X,Z):-parent(X,Y),parent(Y,Z),male ‘South-America’ ‘Sarah Jones’
(X).
grandmother(X, Z):-parent(X,Y),parent(Y,Z),
female(X). PROLOG lists are written as a sequence
of items separated by commas and enclosed in
mother(X,Y):-parent(X,Y),female(X). square brackets. For example, a list of students
Sam, Tom, Ann and Anu can be written in
sister(X,Y):-parent(Z,X), parent(Z,Y), female(X). PROLOG as [sam, tom, ann, anu]. PROLOG has
numeric functions and relations.
This can be extended to get relations like
grandchild, aunt etc. Other programming languages used in AI
include C, Object Oriented Extensions to LISP
Syntax
such as FLAVORS and languages like Smalltalk.
▪ Data objects
The monkey banana problem in PROLOG
The prolog system recognizes the type of
an object in the program by its syntactic %constants
form. This is possible because the syntax %{floor, chair, bananas, monkey}
of prolog specifies different form for each
type of data object. The data objects in % variables
prolog are %{X, Y, Z}

%predicates
can_reach(X, Y) : X can reach Y
dexterous(X) : X is dexterous animal
is_close(X,Y) : X is close to Y
can_climb(X, Y) : X can get on the top of Y
under(X, Y) : X is under Y
in_room(X) : X is in the room
can_move(X,Y,Z) : X can move Y near Z

%axioms
▪ Atoms and numbers %in_room(monkey)
%in_room (bananas)
%in_room(chair)

Jj MIC 2020 Page 39


%dexterous(monkey)
%can_move(monkey, chair, bananas)
%can_climb(monkey, chair) 8.1 Associative network
%can_reach(X,Z):-dexterous(X),is_close(X,Z) Network representation provides a means of
%is_close(X,Z):- can_climb (X,Y),under(Y, Z) structuring and exhibiting the structure in
%under(Y,Z):-in_room(X),in_room(Y), knowledge. In a network, pieces of knowledge
in_room(Z), can_move(X,Y,Z) are clustered together into coherent semantic
groups. Network representation gives a pictorial
Clauses presentation of objects, their attributes and the
in_room(bananas). relationships that exist between them and other
in_room(chair). entities.
in_room(monkey).
dexterous(monkey). Associative networks are directed graphs with
can_move(monkey,chair,bananas). labeled nodes and arcs or arrows. The graphical
can_climb(monkey,chair). portrayal of knowledge can be more expressive
than other representation schemes. Therefore, this
can_reach(X,Z):- dexterous(X),is_close(X,Z). scheme has been used widely in systems such as
is_close(X,Z):-can_climb(X,Y),under(Y,Z). natural language understanding, information
under(Y,Z):- retrieval, deductive data bases, learning systems,
in_room(X),in_room(Y),in_room(Z),can_move(X computer vision, and speech generation system
,Y,Z). etc.

When pose queries to the PROLOG system


?- can_reach (X,Y)
X = monkey
Y = bananas
?- can_reach(monkey, bananas)
Yes
?-can_reach (lion, bananas)
No
?- can_reach(monkey, apple)
No

8. Network representation of
Syntax and semantics of associative networks
knowledge The syntax of the associative network is
For AI problems with a small knowledge mostly designer dependent and varies from one
base, there is no importance in grouping or implementer to another. Most network systems
ordering of the knowledge. All the facts in the are based on PL or FOPL.
problem appear independently without any
linkage to other facts, even though they are The language of the associative network is
closely related. When the quantity of information formed from letters of the alphabet, relational
becomes large and more complex, the acquisition, symbols, set membership and subset symbols,
comprehension, use and maintenance of decimal digits, square and oval node and directed
knowledge can become difficult or even arcs. Nodes are used for objects or nouns and arcs
intractable. In such cases, some form of for relation. The direction of the arc is usually
knowledge structuring and organization become taken from the first to subsequent arguments as
necessary. Various schemes are used for they appear in a relational statement. Thus
structured representation of knowledge like OWNS(bob, house) would be written as
Associative networks, Frames, and scripts and
memory organization packets etc.

Jj MIC 2020 Page 40


where the words are depicted as concepts and
relationships.
Concepts are enclosed in boxes and
Some common relations used by various users relations between the concepts are enclosed in
are ISA, MEMBER-OF, SUBSET-OF, AKO (a- ovals. The direction of the arrow corresponds to
kind-of), HAS-PARTS, INSTANCE-OF, the order of the arguments in the relation they
AGENT and ATRIBUTES, SHAPED-LIKE etc. connect. Concept symbols refer to entities,
actions, properties, or events in the world.
Important features of associative networks
An example of such a graph which
➢ A network clearly shows an entity’s represents the sentence “Joe is eating soup with a
attribute and its relationships to other spoon” is depicted as
entities. This makes it easy retrieve
the properties an entity shares with
other entities.
➢ Networks can be constructed to
exhibit any hierarchical or taxonomic
structure inherent in a group of entities
or concepts.
➢ Network depict the way in which
knowledge is distributed or clustered
A concept may be individual or generic.
about entities in Knowledge base
Individual concepts have a type field followed by
Associative network structures permit the a referent field. The concept [PERSON:joe] has
implementation of property inheritance. For type PERSON and referent joe. [EAT] and
example it is possible to infer that a bird has [SPOON] has no referent fields since they are
wings and they can fly. The object in a node generic concepts. Relations like AGENT,
inherits its properties from the ancestral nodes. INSTRUMENT, OBJECT, PART etc are
This type of inheritance is called default obtained from a collection of standard relations.
inheritance. If an object does not inherit any
A linear conceptual graph form which is easier to
property by default, it would be assigned values
present as text can also be used. The linear
of its own.
equivalent form of the above graph is
The semantics of associative networks are [PERSON:joe] ←(AGENT) ←[EAT]-
defined in the same way as that of traditional
logics. Inference procedures for network can also (OBJECT) →[FOOD:soup]
be similar to traditional logics like PL and FOPL (INSTUMENT) →[SPOON]
such as unification, chaining, modus ponens, and
resolution. The language of conceptual graphs is formed
from upper and lower cases letters of the
There is no commonly accepted standard alphabets, boxes and circles, directed arcs and
syntax for the semantic network. Conceptual number of special characters including :, [, ], (, ),
graph can be used a primitive building block for →, ←, {, and }. These are used to construct
associative or semantic networks. graphs structures. Some other special characters
are
Conceptual Graphs
A conceptual graph is a graphical (a) - implies continuation of the linear graph
portrayal of a mental perception which consists of on the next line
basic or primitive concepts and the relationship (b) ? implies which for example [House:?]
that exist between the concepts. A single means which house?
conceptual graph is roughly equivalent to a (c) ! is used to draw attention
graphical diagram of a natural language sentence

Jj MIC 2020 Page 41


(d) * signifies a variable or unspecified typically have names and values or subfields
object called facets. Facets may also have names and
(e) # signifies a definite article. Example any number of values. An example is shown
[House: #432] house number 432. below
(f) @ relates to quantification. Example
(joan
[Houses:@n] means n houses
(g)  signifies every or all, the same as FOPL (PROFESSION (VALUE professor))
(h) ˉ is negation.
(AGE (VALUE 42))
(i) “” is used to delimit literal strings
(WIFE (VALUE reena))
Some symbols are used to exhibit the
structure of the graph, while others are used (CHILDREN (VALUE susy, jaac))
to determine the referents.
(ADDRESS (STREET (VALUE mi vidya nagar))
With some transformation procedures it is (CITY (VALUE tvm))
possible to convert conceptual graph to FOPL
and vice versa. (STATE (VALUE ker))

For example the sentence “Every car has (PIN (VALUE 695015)))
an engine” is written in Conceptual graph as

[CAR: ] →(PART) →[ENGINE] A general frame structure is


This can be converted into FOPL as (<frame name>

x y (CAR(x) →(ENGINE(y) ˄PART(y,x))) (<slot1> (<facet1><value1>…<valuek1>))

(<facet2><value1>…<valuek2>))
Inference can be accomplished by
modifying and combining graphs through the use .
of operators and basic graph inference rules.
Other important inference methods like Property .
inheritance and default reasoning are also (<slot2> (<facet1><value1>…<valuekm>))
possible with conceptual graphs. Heuristic
reasoning can also be accomplished within the .
theory of conceptual graphs. .)
Conceptual graph is an efficient means to It can be seen that a frame may have any
represent natural language statements accurately number of slots, and a slot may have any number
and to perform many form of inference found in of facets, each with any number of values.
common sense reasoning.
The slots in a frame specify general or
8.2 Frame structures specific characteristics of the entity for which the
Frames as data structure to represent a frame represents, and sometimes they include
mental model of stereotypical situation such as instructions on how to apply or use the slot
driving a car, attending a meeting, or eating in a values. Typically a slot contains information such
restaurant. Knowledge about an object or event is as attribute value pairs, default values, condition
stored together in memory as a unit. Then, when for filling a slot, pointers to other related frames,
a new situation is encountered, an appropriated and procedures that are activated when needed
frame is selected from memory for use in for different purposes.
reasoning about the situation.
Like associative network, frames are
Frames are general record like structures which usually linked together in a network through the
consists of a collection of slots and slot values. use of special pointers such as AKO (A Kind Of)
The slots may be of any size and type. Slots pointer. It is possible to implement property

Jj MIC 2020 Page 42


inheritance and default reasoning in frame MOVE- moving a part of the body
networks.
SPEAK- emitting a sound
Several frame languages have been
developed to aid in building frame bases systems. AA – Action Aiders are properties or attributes of
Most of these languages use LISP as the host primitive actions
language. Examples are Frame Representation Conceptual Cases
Language (FRL) and Knowledge Representation
All actions involve one or more of these
Language (KRL).
cases. The cases are four (i) Objective (ii)
8.3 Conceptual dependencies and Directive (iii) Instrumental (iv) Recipient
Scripts Conceptual Dependencies
Scripts are another structured Semantic rules for the formation of
representation scheme. They are used to represent dependency structures such as relationship
sequences of commonly occurring events. between an actor and an event or between a
primitive action and an instrument.
A script is a predefined frame-like
structure which contains expectations, inferences PP ↔ ACT Bird ↔ PTRANS Bird flew
and other knowledge that is relevant to a
PP ↔ PP Joe ↔ student Joe is a
stereotypical situation Scripts are constructed student
using basic primitive concepts and rules of
formation somewhat like the conceptual graphs.
10. Fuzzy Set and Fuzzy Logic
Conceptual dependencies are the basic
rules used to build the scripts. The concept of fuzzy set was introduced
by Lotfi A Zadeh (1965) who recognized that
Conceptual dependencies human problems were not amenable to standard
Conceptual Dependency (CD) theory is control system. Fuzzy Logic representations try
based on the use of a limited number of primitive to capture the way humans represent and reason
concepts and rules of formation to represent any the real world knowledge in the face of
natural language statement. uncertainty. Uncertainly could arise due to
generality, vagueness, ambiguity, chance, or
The building blocks are incomplete knowledge. It provides a simple way
to arrive at a definite conclusion based upon
Entities
imprecise, noisy or missing input information.
PP- Picture Produces are actors or physical
objects that perform different acts Fuzzy set theory is a generalisation of
classical or traditional set theory. Or we can say
PA- Picture Aiders are supporting properties or classical set is one specific example of fuzzy set.
attributes of PP In classical set theory, an element either belongs
Actions to or does not belong to a set and hence, such sets
are termed crisp sets. But in fuzzy set, many
ACT- Primitive actions
degrees of membership (between 0 and 1) are
Eg. allowed. That is every member in the set can
have a value which is representing the grade of
PTRANS- transfer from one location to membership. This value is assigned
another mathematically using a membership function f(x)
associated with a fuzzy set. The grade
ATTEND- focusing attention on an object corresponds to the degree to which that individual
CONC- to think about something is similar or compatible with the concept
represented by the fuzzy set. In other words,
GRASP- Grasping or holding an object fuzzy sets support a flexible sense of membership
of elements to a set.

Jj MIC 2020 Page 43


Fuzzy logic allows a degree of
E.g. Crisp Set → +ve -ve membership which is value given be a
Fuzzy Set → large +ve Large –ve
Small +ve Small –ve
membership function. Here for the speed of the
car, let us take the function as
The capability of fuzzy sets to express
𝑣 − 45
gradual transitions from membership (0 < f(x) 𝑓(𝑣) =
< 1) to non membership (f(x) = 0) and vice 10
versa has a broad utility. It not only provides
for a meaningful and powerful representation
of measurement of uncertainties, but also
provides for a meaningful representation of
vague concepts expressed in natural language.
Fuzzy relations associate crisp sets to varying
degree of membership and support operations
such as union, intersection, subsethood, and
compositions of relations.
Fuzzy Logic
Just as crisp set theory has influenced In fuzzy logic, the automatic
symbolic logic, fuzzy set theory has given navigation system can speed up or slow down
rise to fuzzy logic. It is an extension of smoothly with respect to the degree of
traditional symbolic logics like predicate logic. fastness.
Traditional logic uses a Boolean logic i.e. two
valued logics either true or false. Truth values Fuzzy inference rules and fuzzy rule
True and False alone are associated to each based systems have found wide applications
proposition. But in fuzzy logic, multi-valued in real world problems. Nowadays it is
truth values such as true, absolutely true, extensively used in consumer products,
fairly true, false, absolutely false, partly false control systems, pattern recognition
and so forth are supported. applications, and decision making etc.
To compare Boolean logic and fuzzy Fuzzy Set
logic, consider an example of automatic Let U be a set, and let x be an element
breaking and accelerating system in a vehicle. of U. A fuzzy subset A of U is a set of
Assume that speed above 50 km/hr as speedy ordered pairs {(x,µA(x)}, for all x in U. µA(x)
and below it as slow. is the grade of the membership determined by
a membership function.
For a crisp set, the membership value
will be either 0 or 1 and for a fuzzy set the
value will be between 0 ≤ µA(x) ≤1.
Eg. Consider a set A = {2, 3, 5, 7, 11}
Let S be a subset of A
S = {2,3,4,6,12}.
Then as per the Fuzzy set theory, it is
Crisp Logic expressed as
S ={(2,1), (3,1), (4,0), (6,0), (12,0)}
An automatic navigation system based on
It is usually represented as
crisp logic may produce an oscillation between
1 1 0 0 0
49.9 and 50.1 km/hr. 𝑆={ , , , , }
2 3 4 6 12

Jj MIC 2020 Page 44


Now consider a real world situation
like height of students in a class. Let the
height varies from 110 to 200 cm. The
heights of seven students in a class are given
in a set U = {110, 130, 140, 150, 160, 170, 200}.
For defining a fuzzy set of tall, consider
height below 130 cm as short (grade 0) and Membership functions
height above 170 as tall (grade 1). There are three types of membership
The first two students are coming under functions.
the category short with membership values 0, and (i) Triangular (ii) Trapezoid and
the last two students are having membership (iii) Gaussian
values 1. The membership value of the remaining
three students can be calculated by defining a
membership function.

Let us define the membership function


for degree of tallness as for students in the
range from 130 to 170 cm as
𝑥−𝑎
𝑓(𝑥) = Operations on Fuzzy set
𝑚−𝑎 Equality
Where x is the height of a student, a is the If A and B are two fuzzy sets defined in the
lower height limit (130) and m is the upper height same space X, then A and B are equal if and
limit (170). only if for all x in the set X, A(x) = B(x).
For example
For a student with height the membership A = {(1, 1 ), (3, 0.9), (5, 0.4), (7, 0.2), (11, 0), (12, 0)}
value is And
B = {(1, 1 ), (3, 0.9), (5, 0.4), (7, 0.2), (11, 0), (12, 0)}
140 − 130 Here A = B
µ(𝑥) = = 0.25
170 − 130 Union
Let A and B be fuzzy sets defined in the space X.
Therefore the student is represented as (140,0.25)
in the fuzzy set. Similarly the fuzzy set of The union is defined as the smallest fuzzy set that
student’s height can be created as contains both A and B.
U ={(110,0), (130,0), (140,0.25), (150,0.5), The union of A and B is denoted by A U B.
(160,0.75), (170,1), (200,1)}
For all x in the set X,
Take another example, a set µAUB(x) = max{µA(x),µB(x)}
representing the number of people going to For example
office in bus, train and cycle. A = {(1, 1 ), (3, 0.9), (4, 0.6), (5, 0.4), (7, 0.2), (8, 0.1), (11,
It can be represented as 0), (12, 0)}
And B = {(1, 0 ), (3, 0), (4, 0.2), (5, 0.5), (7, 1), (8, 1), (11,
0.5 0.2 0 0.1), (12, 0)}
𝐴={ , , }
𝑏𝑢𝑠 𝑡𝑟𝑎𝑖𝑛 𝑐𝑦𝑐𝑙𝑒 A U B ={(1,1), (3, 0.9), (4, 0.6), (5, 0.5), (7, 1), (8, 1), (11,
0.1), (12, 0)}
In this way all linguistic variations can
be expressed in fuzzy logic like too hot, very
cold, moderate, high, low, etc.

Jj MIC 2020 Page 45


A∩(B∪C)=(A∩B)∪(A∩C)
Associative Property
A∪(B∪C)=(A∪B)∪C,
A∩(B∩C)=(A∩B)∩C
Intersection Idempotency
Let A and B be fuzzy sets defined in A∪A = A
the space X. Intersection is defined as the
A∩A = A
greatest fuzzy set that include both A and B.
Intersection of A and B is denoted by A ∩ B. DeMorgan’s Law
The following relation must be satisfied for
the intersection operation : 𝐴∪B=A∩B
µA∩B(x) = min{µA(x),µB(x)}
𝐴∩B=A∪B

Measure of Performance
There are systems based on different
learning methods and different architectures,
“To evaluate the performance of a given system”
or to compare the relative performance of two
Negation or Complement
given systems we use the following definitions
Let A be a fuzzy set defined in the space X.
for performance measure. These include
Then the fuzzy set B is a complement of 1. Generality: It is the measure of the ease with
the fuzzy set A, if and only if, for all x in the set the method can be adopted
X, B(x) = 1 - A(x). 2. Efficiency: It is the measure of the average
time required to construct the target
The complement of the fuzzy set A is knowledge structures from initial structures.
often denoted by A' or Ac or Ā 3. Robustness: It is the ability of a learning
system to function with unreliable feedback.
A = {(1, 1 ), (3, 0.9), (4, 0.6), (5, 0.4), (7, 0.2), (8, 0.1), (11,
0), (12, 0)} 4. Efficacy: It is the measure of overall power
A' = {(1, 0 ), (3, 0.1), (4, 0.4), (5, 0.6), (7, 0.8), (8, 0.9), of the system
(11, 1), (12, 1)} 5. Ease of implementation: This term relates to
the complexity of programs and data
structures required to develop the system.

11. Expert Systems


An expert system is meant to solve real
world problems which generally would require
specialized human expertise. It is a computer
system which emulates the decision making
ability of a human expert. Expert systems are
products of AI. ES are effective in domains
Properties of Fuzzy Sets where the intelligence possessed by a human
expert is required. Application domains of expert
Commutative property systems include medicine, chemistry, law,
A∪B=B∪A, A∩B=B∩A industry, military, aerospace, geophysics, banking
meteorology, engineering, manufacture of
Distributive Property
computers etc.
A∪(B∩C)=(A∪B)∩(A∪C),

Jj MIC 2020 Page 46


An expert system is a set of programs that condition that must be satisfied. When the
manipulate encoded knowledge (coded form) to antecedent is satisfied, the rule is triggered and is
solve problems in a specialized domain that said to "fire". The consequent is the action that is
requires human expertise. An expert system performed when the rule fires. When rules are
acquires knowledge from expert sources (people satisfied by the program, they are added to a
in particular fields, books etc.) and the knowledge queue called the agenda.
is coded in a form suitable for a system to use in
its reasoning process. (ii) Inference Engine

Characteristic Features of Expert System The inference engine is the main processing
Expert Systems differ from conventional element of the expert system. The inference
computer systems in several ways engine chooses rules from the agenda to fire. If
there are no rules on the agenda, the inference
1. ES use knowledge rather than data engine must obtain information from the user in
2. Much of the knowledge is used is order to add more rules to the agenda. It makes
heuristic in nature (rather than algorithms) use of knowledge base, in order to draw
3. Knowledge is encoded and maintained as conclusions for situations. It is responsible for
an entity separate from control programs gathering the information from the user, by
4. ES are capable of explaining how a asking various questions and applying it wherever
particular conclusion was reached and necessary. It seeks information and relationships
why the required information is needed from the knowledge base and to provide answers,
during a consultation. predictions and suggestions the way a human
5. ES use symbolic representation for expert would.
knowledge and perform inference through
symbolic computations (iii) User Interfaces.
6. ES often reason with meta-knowledge i.e.
A user interface is the method by which the
they reason with knowledge about
expert system interacts with a user using
themselves and their own knowledge
interfaces such as editor, graphics, NLP,
limits and capabilities.
documentation etc.. These can be through dialog
boxes, command prompts, forms, or other input
methods. Some expert systems interact with other
computer applications, and do not interact
directly with a human.

Types of Expert Systems


1. Rule Based System (RBS) or
Production system: This is the most
common form of architecture. Knowledge
is represented in the form of production
rules that is if ... then.. rules.
2. Non-production systems
Components of ES
This is a less common type of
Expert systems are generally knowledge-based architecture. Instead of rules, these
systems (KBS) and there are three basic systems employs more structured
components for KBS representation schemes like associative or
semantic networks, frame and rule
(i) Knowledge Base structure, and decision trees or even
specialised networks like neural networks
The knowledge base is a collection of rules or etc.
other information structures derived from the 3. Frame Based Systems: Knowledge is
human expert. Rules are typically structured as represented as frames
If/Then statements. The antecedent is the

Jj MIC 2020 Page 47


4. Case based Systems: The system has the
ability to encode historical knowledge
directly. In many domains, cases can be
obtained directly from existing case
histories, repair logs, or other resources,
eliminating the need of intensive
knowledge acquisition from a human
expert.
5. Hybrid Systems: It is hybrid combination
of different reasoning models. With a
hybrid architecture, two or more
reasoning paradigm are integrated to get a
The structure of ES consists of
cooperative effect where the strength of
1. Knowledge base
one system can compensate the weakness
The knowledge base consists of
of the other.
facts, figures and their relationship. The
6. Model Based Systems: A model based
various knowledge representation
system is based on a model of a structure
schemes are utilized to have a formal
and behaviour of the device that the
relation among the various facts and also
system is designed to stimulate. It is used
facts and figures i.e. data. There are two
for well structured problems like
modes of storing the knowledge: (i) static,
engineering applications. The system can
and (ii) dynamic. The facts stored before
compute values and compare to observed
the processing of the knowledge is termed
values. The system has the ability to use
static. In the process of symbolic
functional/ structural knowledge of the
computation, some knowledge bits are
domain in problem solving. This increases
required to gather by on-line dialogue and
the reasoner’s ability to handle a variety
this is called dynamic mode.
of problems including those that may not
2. Inference Engine
have been anticipated by the system
The inference engine accepts input
designers.
queries and responses to questions
7. Fuzzy Based Systems: works with
through the I/O interfaces and uses this
uncertainties
dynamic information with the static
12. Rule based expert systems knowledge stored in the knowledge base.
Structure of Expert Systems The knowledge in the knowledge base is
Knowledge is represented in the form of used to derive conclusions about the
production rules that is “if ... then..” rules. The current case.
system has the ability to use the experimental The inferring process is carried out
knowledge acquired from a human expert. This is recursively in three stages- match, select,
particularly important in domains that have not and execute. During the match stage, the
been well formalized or that rely heavily on contents of the working memory are
heuristics to manage complexity or missing compared to facts and rules contained in
information. the knowledge base. When consistent
matches are found, the matched rules are
placed in a conflict set. Once a rule is
selected, it is executed or the action part is
carried out.
Forward chaining or (data driven) inference
When the left side of a sequence of rules
is instantiated first and the rules are executed
from left to right, the process is called forward
chaining. This also called data driven inference as
input data are used to guide the direction of

Jj MIC 2020 Page 48


inference process. In this case the problem solver the goal driven inference as an initial goal
begins with the given facts of the problem and a establishes the backward direction of the
set of legal moves or rules for changing states. inference process.
Search proceeds by applying rules to facts and to
produce new facts, which are in turn used by the 3. Knowledge acquisition (Editor)
rules to produce new facts. This process Editor is used by expert system
continues until it generates a path that satisfies developers to create new rules for addition
the goal condition. For e.g. We can chain to the knowledge base, to delete
forward to show that when a student is outmoded rules or modify existing rules.
encouraged, is healthy and has goals, the student The learning module and the history file
will succeed. are not common in all systems.
ENCOURAGED (Student) → MOTIVATED Building a knowledge base
(Student)
MOTIVATED (Student) ˄ HEALTHY (Student) → requires careful planning, accounting and
WORKHARD (Student) organisation of the knowledge structures.
WORKHARD (Student) ˄ HAS GOALS (Student) An intelligent editor can greatly simplify
→ EXELL (Student)
EXCELL (Student) → SUCCEED (student) the process of building a knowledge base.
Knowledge can be acquired from
an expert in different ways through on-
line question-answer session or going
through published literature written by an
expert on a particular domain.
THEIRESIUS is an example of an
intelligent editor. THEIRESIUS was
developed to work with systems like
MYCIN providing a direct user-to-system
dialogue. THEIRESIUS assists the user in
formulating, checking and modifying
Goal driven Inference rules.
4. Explanation module
The explanation module provides the user
with an explanation of the reasoning
process when requested. This is done
using a ‘how’ query or ‘why’ query.
The explanation module traces the
sequence of rules that led to the
conclusion. It is then printed. If the user
does not agree with the reasoning steps
presented, they may be changed using the
editor.
Data driven Inference 5. User’s interface
The interface permits the user to
Backward Chaining (Goal Driven communicate with the system in a natural
Inference) way. Expert systems use menus and
When the right hand side of the English prompts to communicate with the
rules are instantiated first, the left hand user. The prompts written in Standard
side conditions become sub-goals. These English are provided by the developer
sub-goals may in turn cause sub-goals to (manufacture) during the system building
be established and so on until facts are stages.
found to match the lowest sub-goal
condition. This form of inference is called
backward chaining. This is also known as

Jj MIC 2020 Page 49


13. non-production system the like) can be made through a decision tree
structure. Initial and intermediate nodes in the
architecture tree correspond to object attributes, and terminal
nodes correspond to the identities of objects.
13.1 Associative or Semantic Network Attribute values for an object determine a path to
Associative network is a network made up a leaf node in the tree which contains the object’s
of nodes connected by directed arcs. The nodes identification. Each object attribute corresponds
represent objects, attributes, concepts, or other to a non-terminal node in the tree and each
basic entities, and the arcs describe the branch of the decision tree corresponds to an
relationship between the two nodes they connect. attribute value or set of values.
Associative network representations are
especially useful in depicting hierarchical
knowledge structures, where property inheritance
is common. This inheritance can be treated as a
form of default reasoning. Objects belonging to a
class of other objects may inherit many of the
characteristics of the class. This helps in the
storage of information inherited by several
objects and inference process.
CASNET (Casual Associational Network)
is an expert system based on the use of
associative network representation. It is used to The knowledge base, which is the
diagnose and recommend treatment for glaucoma. decision tree for an identification system, can be
constructed with a special tree building editor or
13.2 Frame Architecture with a learning module.
Frames are structured sets of closely
related knowledge such as an object or concept 13.4 Blackboard system architecture
name, the object’s main attributes and their
relationship values, and possibly some attached
procedures (if –needed, if-added, if-removed
procedures). The attributes, values and
procedures are stored in specified slots and slot
facets of the frame. Individual frames are usually
linked together as a network much like the nodes
in an associative network. Thus frames have
many features of associative networks namely,
property inheritance and default reasoning.
An example of a frame based system is
PIP system (Present Illness Program) developed
by MIT. This system was used to diagnose
patients using low cost, easily obtained
information, the type of information obtained by Blackboard system architectures refer to a
general practitioner during an office examination. special type of knowledge based system which
uses a form of opportunistic reasoning. This
13.3 Decision tree architecture. differs from pure forward or pure backward
Knowledge for expert system may be chaining in production system in that either
stored in the form of a decision tree when the direction may be chosen dynamically at each
knowledge can be structured in a top-to-bottom stage in the problem solution process.
manner. For example, the identification of objects
(equipment faults, physical objects, diseases, and

Jj MIC 2020 Page 50


Blackboard systems are composed of serve to enhance or inhibit the input stimuli
three functional components values which are then added together at the
1. There are a number of knowledge nodes. If the sum of all the inputs to a node
sources which are separate and independent sets exceeds some threshold value T, the node
of coded knowledge. The sources may contain executes and produces an output which is passed
knowledge in the form of procedures, rules, or on to other nodes or is used to produce some
other schemes. output response. In the simplest case, no output is
2. A globally accessible data base produced if the total input is less than T. In more
structure, called blackboard, contains the current complex models, the output will depend on a
problem state and information needed by the nonlinear activation function.
knowledge sources. The knowledge sources make
changes to the blackboard data that incremental A single node is shown in the given
lead to a solution. Communication and interaction figure.
between the knowledge sources takes place solely
through the blackboard.
3. Control information may be contained
within the sources, on the blackboard, or possibly
in a separate module. The control knowledge
monitors the changes to the blackboard and
determines what the immediate focus of attention
should be in solving the problem. The inputs to the node are the values x1,
x2, .. xn, which typically take on values of -1, 0, 1
Blackboard systems have been gaining or real values within the range (-1, 1). The
popularity recently like speech understanding weights w1, w2, …, wn, correspond to the
systems, and to model the human cognitive synaptic strengths of the neuron. They serve to
processes. increase or decrease the effects of the
corresponding xi input values. The sum of the
13.5 Analogical reasoning architecture products xi * wi, i = 1, 2, …, n, serve as the total
This is considered to be one of the most combined input to the node. If this sum is large
promising areas of general problem solving. enough to exceed the threshold amount T, the
Expert system based on analogical architecture, node fires and produces an output y, an activation
to solve new problems like humans, by finding a function value placed on the node’s output links.
similar problem solution that is known and This output may then be the input to other nodes
applying the known solution to the new problem, or the final output response from the network.
possibly with some modification. Expert system
using analogical architecture will require a large
knowledge base having numerous problem
solutions and other previously encountered
situations. Each such situation should be stored as
a unit in memory and be content-indexed for
rapid retrieval.

13.6 Neural Network architecture


Neural networks are large networks of
simple processing elements or nodes which The above figure illustrates three layers of
process information dynamically in response to a number of interconnected nodes. The first layer
external inputs. The nodes are simplified models serves as the input layer, receiving inputs from
of neurons. some set of stimuli. The second layer (called the
The knowledge in a neural network is hidden layer) receives input from the first layer
distributed throughout the network in the form of and produces a pattern of inputs to the third layer,
internodes connections and weighted links which the output layer. The patterns of the outputs from
form the inputs to the nodes. The link weights

Jj MIC 2020 Page 51


the final layer are the network’s responses to the applied for detection, interpretation
input stimuli patterns. and classification of diseases, i.e.
Input links to layer j (j = 1, 2, 3) have diagnosis, treatment, and advice. ES
weights wij for i = 1, 2, …, n. used in medical fields are (i) MYCIN,
General multilayer networks having n (ii) INTERNIST–I, (iii) PUFF and (v)
nodes (number of rows) in each of m layers CASNET etc. MYCIN was a
(number of columns of nodes) will have weights programme for detection, diagnosis,
represented as an n x m matrix W. and treatment of antibacterial
A neural network can be thought of as a infection. It has features
black box that transforms the input vector x to the • It had LISP syntax
output vector y where the transformation • The inference mechanism was
performed is the result of the pattern of backward chaining and
connections and weights, that is according to the uncertainty measurement was
values of the weight matrix W. performed by a complex
The inputs to the nodes in a neural confidence factor
network are equivalent to the product of two • The knowledge acquisition
vectors. In the product x * w = ‫׀‬x‫׀ ׀‬w‫ ׀‬cosθ, the system is TIERSIAS was also
result is maximum when θ = 0 and minimum used for error checking and
when θ = 180o. Similarly the inputs affect the debugging of its rules.
weight matrix W. ii. Molecular Chemistry: DENDRAL
The interconnections and weights W in was the first ES that completed in the
the neural network store the knowledge possessed late 1960’s at the Stanford University.
by the network. These weights must be preset or It is an expert system to determine the
learned in some manner. When learning is used, molecular structure of an organic
the process may be either supervised or compound using mass spectrograph
unsupervised. In the supervised learning process and nuclear magnetic resonance as
there is a vector pair (x, y’), where x is the input two experimenting systems. It has
pattern and y’ is the desired output pattern. The three parts (i) PLAN: From the
weights are then adjusted until the actual output y histogram generated from the mass
and the desired output y’ are the same or until D spectrograph, it derives the constrains
= y – y’ = 0. showing the presence or absence of
One of the simpler supervised learning functional groups in the compound.
algorithm uses the formula to adjust the weights (ii) GENERATE: All the complete
W. structure of the given compound is
𝑥
𝑊𝑛𝑒𝑤 = 𝑊𝑜𝑙𝑑 + 𝑎 ∗ 𝐷 ∗ generated (iii) TEST: Test whether the
|𝑥|2 structure generated in step 2 matches
In the above equation ‘a’ is a learning with the experimental histogram.
constant which lies between 0 and 1. When D is iii. Automatic Cable Expertise (ACE):
large, the learning process adjust itself to get it ACE was developed by AT& to
minimum and when D = 0, the learning process detect, diagnosis and correct the faults
ends. In this situation, the output response is in the telephone networks. It had two
exactly equal to the desired output. databases (a) Cable Repair
Administrative system (CRAS), (b)
Cable Repair Evaluation and
14. Examples of expert systems Administrative Tool.
Expert systems are used in different fields iv. Mining: PROSPECTOR is an early
such as (i) medical diagnosis (ii) computer expert system that assisted geologist
science, (iii) minerals (iv) networking, and (v) in the discovery of mineral deposits.
miscellaneous. v. Computing: R1 (XCON) is a system
i. Medical diagnosis: Artificial used by Digital Equipment
intelligence in general and expert Corporation to select and configure
systems in particular have been

Jj MIC 2020 Page 52


components of complex computer George F Luger and William A
system. Subblefield
5. The elements of artificial intelligence an
Certainty factors introduction using LISP, Steven L
A certainty factor (cf), a number to Tanimoto
measure the expert’s belief. The maximum 6. Introduction to Artificial Intelligence,
value of the certainty factor is, say, +1.0 Rajendra Akerkar
(definitely true) and the minimum –1.0 7. Artificial Intelligence Foundations of
Computational Agents, David L Poole,
(definitely false). For example, if the expert
Alan K Mackworth
states that some evidence is almost certainly 8. Artificial Intelligence, RB Mishra
true, a cf value of 0.8 would be assigned to
this evidence.
CF is the measure of the extent to
which “the evidence that is described by the
antecedent of the rule” supports “the
conclusion that is given in the rule’s
consequent”
CF is given by the relation:
𝑴𝑩[𝒉𝒆] – 𝑴𝑫[𝒉𝒆]
𝑪𝑭[𝒉𝒆] =
𝟏 − 𝒎𝒊𝒏[𝑴𝑩[𝒉𝒆], 𝑴𝑫[𝒉𝒆]]
Where
h is hypothesis and e is evidence.
MB[he] is a measure (between 0 and
1) of belief in hypothesis h given the
evidence e. MB measures the extent to which
the evidence supports the hypothesis. It is
zero if the evidence fails to support the
hypothesis.
MD[he] is a measure (between 0 and
1) of disbelief in hypothesis h given the
evidence e. MD measures the extent to which
the evidence supports the negation of the
hypothesis. It is zero if the evidence supports
the hypothesis.
CF = -1 (certain belief) confirms
CF = +1 (certain belief) confirms
CF = 0 (If h and e are independent)

☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼
References
1. Artificial Intelligence, Rich
2. Introduction to artificial intelligence and
expert systems, pattenson
3. Artificial Intelligence a Modern
Approach, Stuart Russell and Peter
Norvig
4. Artificial Intelligence structure and
strategies for complex problem solving,

Jj MIC 2020 Page 53

You might also like