You are on page 1of 32


1. Introduction to AI
2. Problems in AI

1. Introduction to AI
1.1 AI definitions.
1.2 AI history.
1.3 AI techniques.
1.4 Comparison of AI programs and conventional software.

2. Problems in AI
2.1 Different methods of representing a problem.
2.2 Characteristics of AI problems.



- It’s a branch of computer science that deals with the automation of intelligent
behavior. It includes the data structures used in the knowledge representation,
the algorithms needed to apply that knowledge and the languages and
programming techniques used in their implementation.

- It is the science and engineering of making intelligent machines, especially

intelligent computer programs. It is related to the similar task of using
computers to understand human intelligence, but AI does not have to confine
itself to methods that are biologically observable.

- It is the study of how to make computers do things which at the moment

people do better.

- It is the study of mental faculties through the use of computational models

- It is the study of computations that make it possible to perceive reason and


i.e. the main goal of AI is to build intelligent systems that are capable
of performing tasks in an efficient and effective way.

AI includes area such as robotics, commonsense reasoning, learning
models etc.
AI began to emerge as a new field in the early 1940s and 1950s.AI
emerged as a new science from the following fields.




Artificial intelligence cannot avoid philosophy.

If a computer program is to behave intelligently in the real world, it must be provided
with some kind of framework into which to fit particular facts it is told or discovers.
This amounts to at least a fragment of some kind of philosophy,
Early work in AI include

5th Aristotle invented the first formal deductive reasoning system
17th Descartes proposed that bodies of animals are nothing more than
century complex machines.
17th Pascal created the first mechanical digital calculating machine
19th George Boole developed a binary algebra representing some laws of
century thought.
19th Charles Babbage worked on programmable mechanical calculating
century machines.
1943 McCulloch & Pitts: Boolean circuit model of brain
1950 A.M .Turing performed the Turing test as a way of operationalizing a test
of intelligent behavior.
1950 Emerged systems for automatic theorem proving and natural language
1957 Newell and Simon demonstrated the general problem solver architecture.
1961-65 A.L.Samuel developed a system to play checkers game.
1965 First expert system DENDRAL emerged
1968 Developed MACSYMA, a large interactive program which solves
numerous types of mathematical problems.
1969 Roger Schank (Stanford) defined conceptual dependency model for
natural language understanding
1970 Bill Woods described ATN's as a representation for natural language
1972 Alain Colmerauer developed PROLOG
1980 AI becomes an industry
1986 Neural networks return to popularity
1987 AI becomes a science
1995 The emergence of intelligent agents

Early work in AI concluded that intelligence requires knowledge. But

this knowledge possess some less desirable qualities like
- It is very vast
- It is hard to characterize accurately
- It is constantly changing

AI technique can be defined as a method that exploits knowledge. Knowledge is

defined as a body of facts and principles. There are basically 3 types of knowledge

1. Declarative knowledge – is passive knowledge expressed as statements of facts

about the world. Eg : Biodata

2. Procedural knowledge – is compiled knowledge related to the performance of

some tasks. Eg : steps used to solve an algebraic equation

3. Heuristic knowledge – is the knowledge that we acquire through experience.

While representing knowledge it should be represented in such a way that

- The knowledge captures generalization ie it is not necessary to represent

separately each and every individual situation, instead situations that share
common properties are grouped together. Otherwise large amounts of memory
will be lost.
- It can be easily modified to correct errors and reflect changes in the real world.
- It is used in a great many situation even if it is not totally accurate or complete.



Conventional s/w AI programs

Processing type is numeric Processing type is symbolic
Use algorithms to solve the problem Technique used is heuristic search
Solution steps must be explicit and precise Solution steps are not explicit
Solution obtained will be optimal Solution obtained may not be optimal
Control and data part intermingle Control and data part are separate
Knowledge used is precise Knowledge used is imprecise
Modification of program is rare Modification of program is frequent
Large amount of database is used Large amount of knowledge is used
Processes are repetitive in nature Inferential process

The main goal of AI is to build intelligent problem solvers. To build a system to

solve a particular problem we need 4 basic things.

1. Define the problem precisely; this definition must include the precise
specifications of what the initial situations are as well as what final situation
constitutes acceptable solutions.
2. Analyze the problem.
3. Isolate and represent the task knowledge that is necessary to solve the problem.
4. Choose the best problem solving technique and apply it to that particular


There are 2 types of problem representation.

- State space representation
- Problem reduction method.

State space representation – in this method we will be listing out all the possible solutions and search
the entire space until we reach the goal.
Eg: eight way puzzle

2 6 4

5 7 3 5 7 3 5 7 3
8 6 1 8 1 8 1
2 4 2 6 4 2 6 4


1 2 3
8 4 GOAL
7 6 5 STATE
Problem reduction method – various possibilities are represented in the form of
AND-OR graphs. The arcs between the links shows the AND operation.

Buy a TV

Earn Buy a TV Steal a TV



1. The problems that AI tackles have competorial explosion of solutions

2. To cope with the competorial explosion of solutions AI programs uses heuristics
to proon the search tree.
3. AI programs manipulate symbolic informations to a large extend in contrast to
conventional programs which deals with numeric processing.
4. AI programs have the ability to learn.
5. AI deals with real life problems (ie to recognize pattern, understand a language,
understand speech etc).
6. In order to classify a system as an AI program the fundamental criteria is that, it
must have vast quantities of knowledge and the knowledge must be represented in
such a way that the system working on it can easily manipulate the knowledge.

DAY : 2

3. Basics of LISP
4. Understand the various list manipulation functions

3. Basics of LISP
3.1 Features of LISP
3.2 Building blocks of LISP: Atom
4. List manipulation functions: car,cdr,cons,list,append,last,member,reverse.



• LISP stands for LISt Processing
• It is one of the oldest computer programming languages suited for AI
• It is one of the simplest languages with simple syntax, with little or no data
typing and dynamic memory management.
• Different versions of LISP are available FRANZ LISP ,QLISP,COMMON
• LISP uses prefix notations.
• Atoms, lists and strings are the only valid objects in LISP.
• LISP programs can either run on an interpreter or as compiled code(In case of
interpreter code the LISP uses a repeated read -evaluate-print loop).


The basic building blocks of LISP are atoms, lists and string. They are called
symbolic expressions or S-expressions.

Item Description Example

Atom A number or string of contiguous characters, abc,100,a123,*abc*
including numbers and special characters.
List A sequence of atoms and/or other lists enclosed (abc), (a(bc)), ( ) ,(this is
within parentheses. a list)

String A group of characters enclosed in double ”abc” ,”this is a

quotation marks. string”,”ab*#$”

Lisp uses prefix notations. For example(+(*(/ 9 5)50)32) will return 122.Each
function call is performed in the order in which it occurs within the parentheses.


Variables in LISP are symbolic non numeric atoms. They may be assigned
values with the function setq or setf.
setq or set takes two arguments the first of which must be a variable. It is never
evaluated and should not be in quotation marks. The second argument is evaluated
unless in quotation marks and the result is bound to the first argument. The variable
returns this value until a new assignment is made. When variables are evaluated they
return the last value assigned to them. If we want to take atoms or lists literally and
not to have them evaluated just precede the atom or the list with a single quotation
mark. The other list manipulation functions are car, cdr , cons, list, append, last,
member, reverse .

Item Description Example Return

setq/set Takes two arguments, the second argument is ( setq x 10 ) 10
f evaluated and the result is assigned to the first
car Takes one argument, a list and returns the first ( car ‘(a b c )) a
cdr Takes one argument, a list and returns a list with the ( cdr ‘(a b c )) (bc)
first element removed.
cons Takes two arguments, an element and a list and ( cons ’a ‘( b c )) (a b c)
returns a list with the element inserted at the
list Takes any number of arguments and returns a list with ( list ’a ‘( b c )) (a(b c))
the arguments as elements.
append Merges two or more lists into a single list. (append ‘(a )’( b c )) (a b c)
last Returns a list containing the last element. (last ‘( a b c d )) (d)
membe Returns remainder of the second argument list starting (member ’b ‘ (a b d )) (b d)
r with element matching first argument.
reverse Returns the list with the top elements in reverse order. (reverse’ (a (b c )d )) (d (b

We can also write cadadr to abbreviate the sequence car cdr car cdr.


5. Defining a function.
6. Getting familiarized with the various predicate functions.

5. Defining a function.
5.1 Basic structure of function: Function name
Parameters of the function
Function body
5.2 Example problems based on functions
6. Getting familiarized with the various predicate functions:
atom,equal,oddp,venp,lessp,greaterp,numberp etc



The function named defun is used to create user defined functions. It requires three
• The new function name.
• The parameters for the function.
• The function body which performs the desired function.

Basic syntax
(defun name (param1 param2…)

( defun avg3 (a b c)
( / (+ a b c)3))
The above defined function will find the average of three numbers .defun is
the standard keyword,avg3 is the function name ,a,b and c are the three numbers
whose average is to be find out.As LISP evaluates only prefix notations ((a+b+c)/3)
will be written like (/(+ a b c)3).

Predicates are functions that test their arguments for some specific condition.
Predicates return either a true (t) or a false(nil) value depending on the arguments. The
most common predicates are listed below.


atom Takes one argument and checks (atom ‘abc) T
whether it is an atom or not, if it is it
will return true otherwise nil.
equal Takes two arguments and returns true (equal ‘a(car T
if they evaluates to the same value ‘(a b c))
otherwise nil.
evenp Takes one argument and returns true if (evenp 3) Nil
it is an even number otherwise nil.
oddp Takes one argument and returns true if (oddp 3) T
it is an odd number otherwise nil.
numberp Takes one argument and returns true if (numberp 23) T
it is a number otherwise nil.
zerop Takes one argument and returns true if (zerop 00) T
it is zero otherwise nil.
greaterp Takes one or more arguments and (greaterp 2 3 T
returns true if the arguments from the 4)
left to right are larger(ascending
order)otherwise nil.
lessp Takes one or more arguments and (lessp 1 3 2 ) Nil
returns true if the arguments from the
left to right are smaller(descending
order)otherwise nil.
>= Similar to greaterp except that it (>=2 2 2 ) T
returns true if successive elements are
also equal otherwise nil.
<= Similar to lessp except that it returns (<= 1 1 1 ) T
true if successive elements are also
equal otherwise nil.
listp Takes one argument and returns true if (listp ‘(a)) T
it is a list otherwise nil.
null Takes one argument and returns true if (null nil) T
it’s argument evaluates to nil otherwise

DAY: 4

7. Understand the functioning of conditional statements.

7. Understand the functioning of conditional statements.
7.1 Use of predicates to perform branching
7.1.1 Basic structure of the conditional cond
7.1.2 Basic structure of the conditional if…then…else
7.1.3 Examples based on the branching statements.



Predicates are used to make tests in programs and take different actions based on the
outcome of the test. There are different methods to perform branching,one is by using
the conditional cond or by using if …then ….else conditional.


• The symbol cond is followed by clauses. Each clause contains a test and
zero or more forms called actions.
• cond moves through the clauses, evaluating the test forms, until a test form
evaluates to non-NIL. This clause is "triggered" and its action forms are
• The value returned by cond is the value of the last action form in the triggered
• If all test forms are NIL, the value returned by cond is also NIL.
• The last clause is called a T-triggered clause.
• With a T-triggered clause, the final clause is used when none of the others are

The basic syntax is:

(cond (<test 1> <action 1-1> <action 1-2> ...)

(<test 2) <action 2-1> <action 2-2> ...)


(<test m> <action k-1> <action k-2> ...))


if…then…else is used as a simple branching primitive. if returns the value of its

<then form> when <test> evaluates to T or anything other than NIL; otherwise, if
returns the value of its <else form>. If there's no <else-form> and if <test> evaluates
to NIL, NIL will be returned.

The basic syntax is:

(if < test > < then form > < else form >)


Define a function to find the maximum of two numbers

(defun max2 (a b)

( cond ( ( > a b) a )

( t b) ) )

Here defun is the standard keyword to define a function,max2 is the name of the
function and a and b are the arguments of the function max2.We have to find the
maximum of two numbers so we have to check whether a is greater than b ,if it is
greater then return a otherwise return b. The letter t forces the last clause to be
evaluated when the first clause is not.

Define a function to find the maximum of three numbers

(defun max3 ( a b c)

( cond ( ( > a b) ( cond ( ( > a c) a) ( t c ) ) )

( ( > b c) b ) ( t c) ) )

DAY: 5

8. List out the logical functions in LISP
9. Getting familiarized with the various I/O functions in LISP


8. List out the logical functions in LISP – NOT


9. Getting familiarized with the various I/O functions in LISP - READ



8.1 NOT

• NOT is the simplest

• It takes only one argument and turns non-NIL to NIL and NIL to T

setf pets '(dog cat))
not (member 'dog pets))
not (member 'tiger pets))

8.2 AND

• AND returns NIL if any of its argument evaluates to NIL.

• The arguments are evaluated from left-to-right, if any evaluates to NIL, none
of the remaining is evaluated, and the value returned is NIL.
• If all arguments evaluate to non-NIL values, the value returned by the AND
from is the value of the last argument.
• It takes any number of arguments.

Example :
(setf pets '(dog cat))
(and ( member ‘dog pets ) ( member ‘ tiger pets ))
(and (member 'dog pets) (member 'cat pets))

8.3 OR
• OR returns NIL if all of its arguments evaluates to NIL.
• The arguments are evaluated from left to right, if any evaluates to non-NIL, none
of the remaining is evaluated, and the value returned is that non-NIL value.
• If all arguments evaluates to NIL, the value returned by OR is NIL.
• It takes any number of arguments.

(setf pets '(dog cat))
(or (member 'dingo pets) (member 'tiger pets))
(or (member 'dog pets) (member 'cat pets))



9.1 READ
• It takes no arguments
• When it appers in aprocedure the processing halts until an s-expression is
entered from the keyboard.
• The s-expression is returned as the value of the read.

( + 5 ( read ))

• I t takes one argument.
• It prints the argument as it is received and then returns the argument.
(print ‘(a b c))
(A B C )
(A B C )

• It is the same as PRINT except that the new line characters and the space are
not provided.
((prinl ‘(hello))(prinl ‘(hello)))
• It is same as the PRINL except that it does not print the unwanted quotation
• It will eliminate the quotes but the echo still remains.(ie it will return the
(princ “hello”)

• It takes no arguments.
• It introduces a new line.

DAY: 6

10. List out the iteration constructs in LISP
11. Recursion in LISP

10. List out the iteration constructs in LISP
10.1 Repeating by Iteration - DO
10.2 Repeating by Iteration – LOOP
11.Recursion in LISP

10. List out the iteration and recursion constructs in LISP

10.1 Repeating by Iteration --- DO

DO expressions have the following parts:

1. A list of parameter specifications, each of which creates, sets, and resets one of
the DO form's parameters:

((<parameter> <initial value> <reset form>)

<body form>)

2. A body that consists of DO's subforms, which are evaluated over and over
until the DO is stopped:

The syntax of DO:

(DO ((<parameter 1> <initial value 1> <update form 1>)

(<parameter 2> <initial value 2> <update form 2>)
(<parameter n> <initial value n> <update form n>))
(<test form> <result form>)
<body form>)

( defun factorial (n)
( do (( count n( - count 1))
( product n (* product (- count 1 ))
(( equal 0 count ) product )))

• On entering the DO, the list of parameters are all bound to its corresponding
value (again, a virtual fence exists to isolate these parameters from the
variables outside DO).

The parameter specifications can include update forms. The parameters are
updated accordingly in each pass.

• The 2nd part of DO is the termination test and the result form. The test is
attempted before each pass, including the 1st one. The <result form> is
evaluated as the return value of DO only when the test succeeds.

There may be zero or more <result forms> after the <test form>. They are all
evaluated when the test succeeds. However, only the last one gives the return
value of the DO. If there is none, the return value is NIL.

• Whenever (RETURN <expression>) is encountered, DO is terminated

immediately. <expresion> is evaluated as the return value of the terminated
• All initializations and updates are done in parallel, i.e. all initial forms are
evaluated before bindings and all update forms are evaluted before

10.2 Repeating by Iteration --- LOOP

(loop <body>)

The body is evaluated over and over until a (RETURN <expression>) is encountered.
Again the <expression> is evaluated as the return value of the terminated LOOP.

11. Recursion in LISP

Many LISP procedures work by repeating a particular action over and over until a
certain condition is met. A recursive function is one which calls itself successively to
reduce a problem to a sequence of simpler steps. Recursion requires stopping
condition and recursive steps .

(defun factorial (n)
(cond (( zerop n)1)
(t ( * n (factorial (- n 1))))))


DAY: 7

12. Introducing the concept of property lists in LISP
13. Using arrays in LISP


12. Introducing the concept of property lists in LISP

12.1 Assigning properties
12.2 Retrieving properties
12.3 Removing properties
12.4 Replacing properties

13. Using arrays in LISP

12. Introducing the concept of property lists in LISP

It is one of the unique concepts in LISP .We can assign properties to atoms using
the property lists. Property list functions permits one to assign properties to atoms and
to retrieve, replace and remove them as required.The property value may be an atom
or a list.

12.1 Assigning properties

We can assign properties to an atom using the function putprop. It takes three
arguments an object name(an atom), attribute name,and a property or attribute value.

General syntax is:

(putprop object value attribute)

(putprop ‘car ‘ ford ‘ make)
(putprop ‘car ‘ red ‘ color)
(putprop ‘danny ‘ pets ‘(fluffy tim penny))

12.2 Retrieving properties

We can retrieve a property value by using the function get. It takes two arguments
object and attribute.

General syntax is:

(get object attribute)

(get ‘car ‘ make)
(get ‘car ‘ color)

12.3 Removing properties

We can remove the assigned properties using the remprop function.It takes two
arguments the object and the attribute.

General syntax is:

(remprop object attribute)

(remprop ‘car ‘ make)
(remprop ‘car ‘ color)

12.4 Replacing properties

We can replace the assigned properties using the same putprop function.The object
will retain the last property which is assigned to it.

(putprop ‘car ‘ red ‘ color)
(putprop ‘car ‘ blue ‘ color)
(get ‘car ‘ color)

13. Using arrays in LISP

Single and multi dimensional arrays are possible in LISP using the make-array
function. The items stored in the array may be any LISP objects.
(setf myarray (make-array ‘(10)))

This will create an array with name myarray and the size of the array will be
10.Initially the array contents will be nil. The function make-array will return a # sign
followed by A.
To store items into the array we use the function setf and to access the contents
of the cells we use the function aref which takes two arguments the name of the array
and the index value.
(aref myarray 9)
(setf (aref myarray 9) 25)
(aref myarray 9)

DAY: 1
1. Introduction to Symbolic Logic

Introduction to Symbolic Logic

- Propositional Logic.
- Properties of statements.

Introduction to Symbolic Logic

The main objective of knowledge representation is to express

knowledge in a computer tractable form; such that it can be used to help agents
perform well .A knowledge representation language is defined by two aspects:

1. The syntax of a language describes the possible configurations that can constitute
sentences. We usually describe syntax in terms of how sentences are represented on
the printed page.

2. The semantics describe the facts in the world to which the sentences refer. Without
semantics the sentence is just an arrangement or collection of marks on a page. In
logic, the meaning of a sentence is what it states about the world.

Propositional Logic
In propositional logic, symbols represent whole propositions
(facts).Propositions are elementary atomic sentences. It can be either true of false but
may take on no other value.
Example: D: The bird is dead.
This may or may not be a true proposition. The propositions can be
combined using the Boolean connectives to generate sentences with more complex

Syntax and Semantics of Propositional logic

The syntax of a propositional logic is simple.
The symbols of propositional logic are
- Logical constants True or False.
- Proposition symbols such as P and Q
- Logical connectives (→, ‫ך‬, , , ↔,( ) )
A sentence can be formed by combining simpler sentences with one of the five
logical connectives. Eg: ( P Q R ) .

The semantics of propositional logic is defined by specifying the interpretation of the

propositional symbols and constants, and specifying the meaning of the logical
connectives. The semantics or meaning of the sentence is just the value True or it is an assignment of a truth value to the sentence.


P Q ~P (~P V Q ) ( P→Q ) ( Q→ P) ( P→Q ) & ( Q→ P)
True True False True True True True
True False False False False True False
False True True True True False False
False False True True True True True

Properties of statements

A statement is satisfiable if there is some interpretation for which it is true.Eg: P
A statement is contradictory (unsatisfiable) if there is no interpretation for which it is
Eg: (P & ~ P)
A sentence is valid if it is true for every interpretation. Valid sentences are also called
tautologies.Eg :( P V~P)
Two sentences are equivalent if they have the same truth value under every
Eg: P and ~ (~P)
Logical consequences:
A sentence is a logical consequence of another if it is satisfied by all interpretations
which satisfy the first.Eg: P is a logical consequence of (P & Q)
Note: A valid statement is satisfiable and a contradictory statement is invalid, but the
converse is not necessarily true.
DAY: 2
- First order predicate logic
- Syntax and Semantics of FOPL.

First Order Predicate Logic (FOPL)

FOPL was developed by logicians to extend the expressiveness of PL.
It is a generalisation of PL that permits reasoning about world objects as relational
entities as well as classes or subclasses of objects. The syntax for FOPL, like PL, is
determined by allowable symbols and rules of combination. The semantics of FOPL
are determined by interpretations assigned to predicates, rather than propositions. This
means that an interpretation must also assign values to other terms including
constants, variables and functions, since predicates may have arguments consisting of
any of these terms.

Syntax of FOPL
The symbols and rules of combination permitted in FOPL are defined as follows:
There are five connective symbols: ~ (not or negation),& (and or conjunction), V (or
or inclusive disjunction),→(implication),↔(equivalence or if and only if).

The two quantifier symbols are existential quantification and universal
Universal quantification - means for all
Existential quantification - for some x or there is an x.
They are fixed value terms that belong to a given domain of discourse. They are
denoted by numbers, words and small letters near the beginning of the alphabet such
as a,b,c,5.3,-21,flight 102 and john.
Variables are terms that can assume different values over a given domain. They are
denoted by words and small letters near the end of the alphabet, such as aircraft –type,
individuals, x, y
and z.
Function symbols denote relations defined on a domain D. They map n elements
(n≥0) to a single element of the domain. Symbols f, g ,h and words such as father-of
,or age-of represent functions. An n-ary function is written as f (t1,t2,t3,………,
tn)where ti are terms defined over some domain.

Predicate symbols denote relations or functional mapping from the elements of a
domain D to the values true or false. Capital letters and capitalized words such as P,
Q, R, EQUAL and MARRIED are used to represent predicates. Like functions
predicates can have n terms for arguments.

The following are a set of natural language statements we have to convert it to

symbolic logic
E1: All employees earning $1400 or more per year pay taxes.
E2: Some employees are sick today.
E3: No employee earns more than the President.
To represent these statements in FOPL first we have to define the predicate and
E(x): for x is an employee.
P(x): for x is President.
i(x): for income of x.
GE (u,v): for u is greater than or equal to v.
S(x): for x is sick today.
T(x): for x pay taxes.
Using these abbreviations, we can represent E1, E2 and E3 as
E1’ : x (( E(x) &GE (i(x), 1400)) →T(x))
E2’: y (E(y) →S(y))
E3’: x y ((E(x) &P(y)) → ~GE (i(x),i(y)))
The expressions E1’, E2’, E3’ are known as well formed formulas or wffs.
DAY: 3

- Sample problems in FOPL
- Clausal conversion procedure

Sample problems:
Convert the following natural language statements to FOPL statements.
1. Marcus was a man.
2. Marcus was a Pompeian.
3. All Pompeians were Romans.
4. Caesar was a ruler.
5. All Romans were either loyal to Caesar or hated him.
6. People only tried to assassinate rulers they are not loyal to.
7. Everyone is loyal to someone.
8. Marcus tried to assassinate Caesar.

The following are the corresponding FOPL statements.

1. Man (Marcus).
2. Pompeian (Marcus)
3. x Pompeian(x)→Roman(x)
4. Ruler Caesar)
5. x Roman(x)→loyalto x ,Caesar) V hated(x ,Caesar)
6. x y People(x) Ruler(y) tryassassinate(x,y)→ ┐loyalto(x,y)
7. x y loyalto(x,y)
8. tryassassinate(Marcus,Ceasar)

The following are a set of natural language statements .Convert them into FOPL
1. If x is on top of y, y supports x.
2. If x is above y and then they are touching each other, x is on top of y.
3. A cup is above a book.
4. A cup is touching a book.

Clausal conversion procedure

In order to do the inferencing process (resolution) it requires that all statements be
converted into normalised clausal form. We define clause as a disjunction of a number
of literals. A ground clause is one which has no variable in the expression.

To transform a statement to clausal form it requires the following steps.

1. Eliminate all equivalency and implication connectives (Use ‫ך‬P V Q in place of
P→Q and ‫ ))ך‬P V Q) ‫ )ך‬Q V P)) in place of P ↔Q )

2. Move all negations into immediately preceding atom (in place of

~( x ‫ ך‬F(x)) we use x F(x).
3. Rename variables if necessary so that all quantifiers have different variable
assignments. That is rename variables so that variables bound by one quantifier are
not the same as the variable bound by a different quantifier.

4. Skolemize by replacing all existentially quantified variables with skolem functions.

a. If the first (leftmost) quantifier in an expression is an existential quantifier,
replace all occurrences of the variable it quantifies with an arbitrary constant not
appearing elsewhere in the expression and delete the quantifier. This same procedure
should be followed for all other existential quantifiers not proceeded by a universal
quantifier, in each case, using different constant symbols in the substitution.

b. For each existential quantifier that is preceded by one or more universal

quantifiers, replace all occurrences of the existentially quantified by a function
symbol not appearing else where in the expression. The arguments assigned to
function should match all the variables appearing in each universal quantifier which
precedes the existential quantifier. This existential quantifier should then be deleted.
The same process should be repeated for each remaining existential quantifier using a
different function symbol and choosing function arguments that correspond to all
universally quantified variables that precede the existentially quantified variable being

5. Move all universal quantifiers to the left of the expression and put the expression
on the right into CNF.

6. Eliminate all universal quantifiers and conjunctions since they are retained
implicitly. The resulting expressions and the set of such expression is said to be in
clausal form.

Convert the following statements to clausal form

1. x [Roman(x) know(x,Marcus)]→[hate(x,Ceasar)V( y z

2. x y( z P (f (x),y,z)→( u Q(x,u) & vR(y,v)))


-Resolution principle
-Resolution procedure

Resolution principle
The resolution procedure is a simple iterative process, at each step two
clauses called parent clauses are compared (resolved) yielding a new clause that has
been inferred from them.
This process is similar to the process of obtaining a proof by contradiction.
Let C1,C2,C3……….Cn)be the set of given clauses and D be the clause to be proved.
To prove that D is a logical consequence of the statements C1&C2&………Cn first
we negate the D and ~ D to the set of clauses. Then, using resolution along with
factorizing we can prove that the set is unsatisfiable by deducing a contradiction. Such
a proof is called a proof by refutation.

Resolution procedure

Assume the set of given statements be F and the statement to be proved be P.

1. Convert all statements of F to clause form.

2. Negate P and convert the result to clause form. Add it to the set of clauses
obtained in step 1.
3. Repeat until a contradiction is found, no progress can be made, or a
predetermined amount of effort has been expended.
a) Select two clauses, call these the parent clauses.
b) Resolve them together. The resolvent will be the disjunction of all the
literals of both parent clauses with appropriate substitutions performed and
with the following exceptions.
1. Only resolve pairs of clauses that contain complementary literals, since
only such literals produce new clauses.
2. Two kinds of clauses should be eliminated: tautologies and clauses that
are subsumed by other clauses
3. Whenever possible resolve either with one of the clauses that is part of
the statement that we are trying to resolve or with a clause generated by a
resolution with such a clause. This is called the set of support strategy and
corresponds to the intuition that the contradiction we are looking for must
involve the statement we are trying to prove.
4. Whenever possible resolve with clauses that have a single literal. Such
resolutions generate new clauses with fewer literals than their parent clauses
and they are probably closer to the goal of a resolvent with zero terms. This
method is called the unit preference strategy.

Sample problem
Consider the statements
1. P
2. ( P Q)→ R
3. (S V T) →Q
4. T
Prove using resolution that the statement R holds.
First convert the statements into clausal form
1. P
2. ‫ ך‬P V ‫ ך‬Q V R
3. ‫ ך‬S V Q
4. ‫ ך‬T V Q
5. T
Negate R and add it to the set of clauses
6. ‫ ך‬R

Start resolving by selecting two parent clauses.

‫ ך‬PV‫ך‬QVR ‫ך‬R

‫ך‬PV ‫ך‬Q P

‫ך‬T VQ ‫ך‬Q

‫ך‬T T

Since our assumption ends up in a contradiction its inverse is true. So R

Problems using resolution procedure

1. Consider the following facts

a) If x is on top of y, y supports x.
b) If x is above y and they are touching each other,x is on top of y.
c) A cup is above a book.
d) A cup is touching a book.
Translate the statements into clausal form .Show that the predicate supports
(book,cup) is true using resolution.

2. Given the following information for a database:

1) Marcus was a man.
2) Marcus was a Pompeian.
3) All Pompeians were Romans.
4) Caesar was a ruler.
5) All Romans were either loyal to Caesar or hated him.
6) People only tried to assassinate people they are not loyal to.
7) Everyone is loyal to someone.
8) Marcus tried to assassinate Caesar.
Prove using resolution Marcus hated Caesar
DAY: 5

-Unification algorithm
- Unification problem

Unification algorithm
Any substitution that makes two or more expressions equal is called a unifier for the
expressions. Applying a substitution to an expression E produces an instance E’ of E
where E’=Eβ.Given two expressions C1 and C2 that are unifiable,let β be the unifier
with C2=C1β.We say that β is the most general unifier(mgu).Unification can be
applied to literals within the same single clause. When an mgu exists such that two or
more literals within a clause are unified, the clause remaining after deletion of all but
one of the unified literals is called a factor of the original clause.

Let S be the set of expressions.
1. Set k =0 and σk = e (the empty set).
2. If the set Sσk is a singleton then stop; σk is an mgu of S.Otherwise find the
disagreement set Dk of Sσk.
3. If there is a variable v and term t in Dk such that v does not occur in t, put
σk+1= σk{t/v},set k = k+1 ,and return to step 2 .Otherwise stop .S is not

1. Unify the literals P(x, x) and P (y, z)

The two instances of P match. Next we compare x and y, and decide if we

can substitute y for x .We will write that substitution as y/x. After finding the first
substitution we have to make that substitution throughout the literals. Then it will
P(y, y)
P(y, z)
Next we have to unify the arguments y and z, so substitute z in place of y
(z/y).The entire unification process has now succeeded with a substitution that is a
composition of the two substitutions we found
i.e. β = { y/x , z/y}

1. Unify the literals f(x ,x) and f(g(x),g(x)).
2. Unify the literals f (Marcus) and f(Ceasar).
3. Unify the literals f (Marcus,g(x,y)) and f(x, g(Ceasar,Marcus)).
DAY: 6

Objectives :
• Introduction to nonmonotonic systems
• Architecture of a general problem solver with TMS

Key points :

Introduction to nonmonotonic reasoning

o Limitations of Monotonic reasoning
Architecture of a general problem solver with TMS
o General working
o Support Lists and Conceptual Dependencies

Introduction to nonmonotonic reasoning

The traditional logics like PL and FOPL do not provide realistic

representations of the world. The conclusions derived from such logics are valid
deductions and they remain as such and hence the knowledge base increase
Limitations of Monotonic reasoning
• It is not possible to describe real world concepts ,ie it has limited expressive
• There is no way to express uncertain, imprecise or vague knowledge.
• Available inference methods are insufficient.
• There is no way to produce new knowledge about the world. It is only
possible to add what is derivable from the given axioms.

Architecture of a general problem solver with TMS


The main job of TMS is to maintain the consistency of the
knowledge base being used by the problem solver. It will not perform any inferencing
process. TMS also gives the inference component the latitude to perform
nonmonotonic inferences. When new discoveries are made the more recent
information is can displace previous knowledge which are no longer valid. So the set
of knowledge available to the user always remains consistent.

Inference Engine
Inference Engine solves domain problems based on the current
belief set while the TMS maintains the currently active belief set. The updating
process is incremental. After each inference information is exchanged between the
inference engine and the TMS. The IE tells the TMS what inferences it has made and
the TMS in turn asks questions about the current beliefs and the reasons for failure. It
maintains a consistent set of beliefs for the IE to work with.

Working of the General Problem Solver

Let us consider one example to explain the working of the general
problem solver. Fig 1 shows the content of the KB at time T1.From this the IE would
conclude Q and add it to the KB by applying Modus Ponens rule. Later after some
time (T2) it was learned that instead of P,~P was appropriate. So we will add ~P to
the KB .Now the TMS checks for the consistency of the new KB(Fig 2) and reports a
contradiction(P and ~P).So it is necessary to remove P to eliminate the inconsistency,
but with P now removed Q is no longer a justified belief. So it too should be removed.
This type of belief revision is the job of TMS. But the TMS does not discard the
beliefs permanently as they may again become valid at a later time T3,so they are
temporarily moved to a dependency record .

Fig 1( KB at time T1) Fig 2 (KB at time T2)

P→ Q P→ Q

The TMS maintains the dependency records to reflect retractions and

additions so that the IE will always know the current belief set. The records are
maintained in the form of a dependency network. The nodes in the network represent
KB entries such as premises ,conclusions, inference rules and the like. Attached to the
nodes are justifications which represent the inference steps from which the nodes are
derived. Nodes in the belief set have valid justifications. A Premise is a fundamental
belief which is always true and which needs no justification. The nodes have two
types of justification records.

•Support Lists (SL)

•Conceptual Dependencies (CP)
Support Lists are the most common type. They provide the
supporting justifications for nodes. The data structures used for the SL contains two
lists of other dependent nodes names, an in-list and an out -list. It has the form
(SL<in-list> <out-list>)
In order for a node to be active the SL must have atleast one valid node in its in-
list and all nodes in the out-list must be marked out of the belief set. To represent a
belief network we must know the following symbol conventions.
1) Premises - are true propositions which require no justification.
2) Assumption - is a current belief that could change.
3) Datum -is either a currently assumed or IE derived belief.
4) Justification - are belief supports consisting of antecedent node links and
consequent node links.

Conceptual Dependencies are less commonly used than SL's. They

justify a node as a type of valid hypothetical argument. The internal form of CP
justification is as follows:
A CP is valid if the consequent node is IN whenever each node among the in-
hypotheses is IN and each node among the out-hypotheses is OUT.CP's corresponds
to conditional proofs typically found in deduction systems. The procedures for
manipulating CP's are quite complicated so they are usually converted into SL's.


DAY : 7

Objectives :
• Nonmonotonic reasoning methods

Keypoints :
Nonmonotonic reasoning methods
o Default reasoning
o Closed World Assumption
o Predicate Completion
o Circumscription

Nonmonotonic Reasoning Methods

1. Default Reasoning

Default reasoning is a form of nonmonotonic reasoning. It eliminates the

need to explicitly store all facts regarding a situation. A default is expressed as
a(x) : Mb1(x),............Mbk(x)

where a(x) is a pre condition wff for the conclusion wff c(x),M is the consistency
operator and b1(x),b2(x),.......... are conditions, each of which must be separately
consistent with the KB for the conclusion c(x) to hold.
Default theories consists of a set of axioms and a set of default inference rules .The
theorems derivable from a default system are those that follow from first order logic
and the assumptions assumed from default rules. Default rules are especially useful in
hierarchical KB's since default rules are transitive property inheritance becomes

2. Closed World Assumption(CWA)

It is another form of nonmonotonic reasoning. It is based on the
assumption that the KB is complete. This type of assumption is useful in applications
where most of the facts are known and it reasonable to assume that if a proposition
cannot be proven then it is false. This is also known as CWA with failure as negation.
ie failure to prove a fact F results in assuming its negation ~F.
A KB is said to be complete if and only if every ground atom or its negation is in
the system. So by augmenting a KB with the negation of all ground atoms which are
not derivable we can make it complete.

3. Predicate Completion and Circumscription

Limiting default assumptions to only parts of the KB can be achieved
through the completion and circumscription formulas.

Completion formulas
Completion formulas are axioms which are added to the KB to
restrict the applicability of specific predicates.If it is known that only certain objects
should satisfy the given predicates , formulas which make the KB explicit are added
to the KB .This technique also needs the addition of Unique Names
Assumptions(UNA) ie formulas which state that distinguished named entries in the
KB are unique.Once completion formulas are added to the KB ordinary first order
proof methods can be used to prove the statements.Predicate completion formulas
perform the same function as that of the CWA but with respect to the completed
predicates only.It is possible to default both positive and negative statements.

Example :
OWNS(joe , ford)
OWNS(sam , bike)
STUDENT (mary)
If it is known that Joe is the only person who owns a ford we can make the fact
explicit by adding the completion formula.
x OWNS(x,ford)→EQUAL(x,joe)
Once we add this completion formula we have to add the inequality formula
~EQUAL(a,joe) which means that it is true for all constants a which are
different from joe.

It is another form of default reasoning introduced by John Mc Carthy.It
is similar to predicate completion in that all objects that can be shown to have some
property P are in fact the only objects that satisfy P.

DAY : 8

Objectives :
• Modal and temporal logics
• Fuzzy logic

Keypoints :
• Modal and temporal logics
• Fuzzy logic
o Introduction to fuzzy logic
o Fuzzy sets
o Fuzzy set theory

Fuzzy Logic (FL) is a multivalued logic, that allows intermediate
values to be defined between conventional evaluations like true/false,
yes/no, high/low, etc. Notions like rather tall or very fast can be formulated
mathematically and processed by computers, in order to apply a more
human-like way of thinking in the programming of computers.Additional benefits of
fuzzy logic include its simplicity and its flexibility. Fuzzy logic can handle problems
with imprecise and incomplete data, and it can model nonlinear functions of arbitrary
complexity.Fuzzy logic models, called fuzzy inference systems, consist of a number
of conditional "if-then" rules.

In fuzzy logic, unlike standard conditional logic, the truth of any

statement is a matter of degree. (How cold is it? How high should we set the heat?)
We are familiar with inference rules of the form p -> q (p implies q). With fuzzy logic,
it's possible to say (.5* p ) -> (.5 * q). For example, for the rule if (weather is cold)
then (heat is on), both variables, cold and on, map to ranges of values. Fuzzy
inference systems rely on membership functions to explain to the computer how to
calculate the correct value between 0 and 1. The degree to which any fuzzy statement
is true is denoted by a value between 0 and 1. Not only do the rule-based approach
and flexible membership function scheme make fuzzy systems straightforward to
create, but they also simplify the design of systems and ensure that you can easily
update and maintain the system over time.

A Fuzzy Set is any set that allows its members to have different grades of
membership (membership function) in the interval [0,1].

The following rules which are common in classical set theory also apply to
Fuzzy set theory.

De Morgans law




University Questions:

1.Explain the clausal conversion procedure with one example.

2.Explain the Unification algorithm with one example.

3. Convert the following statements to clausal form

a) x [Roman(x) know(x,Marcus)]→[hate(x,Ceasar)V( y z


b) x y( z P (f (x),y,z)→( u Q(x,u) & vR(y,v)))

4.Consider the following facts

e) If x is on top of y, y supports x.
f) If x is above y and they are touching each other,x is on top of y.
g) A cup is above a book.
h) A cup is touching a book.
Translate the statements into clausal form .Show that the predicate supports
(book,cup) is true using resolution.

5.Write short notes on

1. TMS 2. Nonmonotonic logic
3. Default logic 4. Closed World Assumption (4*5)

6. Explain statistical reasoning and nonmonotonic reasoning(10)

7. Explain the principle of Fuzzy logic and explain the use of Fuzzy sets(10)
8.Why precicate caculus is said to be undecidable(5)