social pharmacy d-pharm 1st year by Pragati K. Mahajan
Presentation1
1.
2. Topic:
Languages Of AI (lisp/prolog)
Group Members:
Shagufta Arif (027)
Sania Alyas (020)
Maryam Afza (006)
3. What is LISP??
LISP stands for (LIST
PROCESSING). It was invented
by John McCarthy in 1958. As its
name implies, LISP is a
programming language that
manipulates LISTS.
4. LISP Discription:
A list is either empty or non-empty.
[a, b, c, d]
Empty: []
Non-empty: head=[a] tail=[b, c, d]
5. Example:
We can implement a function to compute
factorials using recursion:
(defun factorial (N)
"Compute the factorial of N."
(if (= N 1)
1
(* N (factorial (- N 1)))))
6. Example:
Here are some simple example using the if
operator:
CL-USER(): (if (> 3 4)"yes“ "no")
ANS:
"no“
7. Applications of LISP:
Mathematics
Artificial intelligence and natural language
processing.
Expert Systems (diagnosis, identification,
design )
8. Advantages of LISP:
Common Lisp is :
a general-purpose programming language and an AI
language
Common Lisp programs are:
easy to test
easy to maintain (depending on programming
style)
intractive
9. Cont…
Provides clear syntax
LISP expressions are case-insensitive.
runtime typing:
the programmer need not bother about type
declarations
several data types:
numbers, strings, arrays, lists, char, symbols etc.
10. Disadvantages of LISP
The major disadvantage is due to the
lack of popularity and lack of
widespread support and knowledge.
It is relatively hard to find Lisp
programmers.
11. What is PROLOG?
PROLOG is a declarative language
where programs are expressed in
terms of relations.
A program in PROLOG can use logical
reasoning to answer questions that
can be inferred from the knowledge
base.
12. Cont …
A Prolog language designed in Europe to
support natural language processing.
It was created by Alain and Robert 1972 as an
alternative to the Lisp programming languages.
13. Conti…
There are three basic stratgies in Prolog:
facts, rules, and queries.
A collection of facts and rules which
describe some collection of relationships is
called a knowledge base.
That is, Prolog programs simply are
knowledge bases.
14. Conti…
Prolog includes an inference engine, which is
a process for reasoning logically about
information. The inference engine includes a
pattern matcher, which retrieves stored
(known) information by matching answers to
questions.
One important feature of Prolog is find all
possible solutions rather than only one.
15.
16.
17.
18.
19.
20.
21. PROLOG Example
mortal(X) :- man(X)
% Xismortal
if X is a man.
% Socrates is a man
man(socrates).
and then ask Prolog
?- mortal(socrates). % Is Socrates
mortal?
and it will immediately tell me yes
22. Applications of PROLOG
Expert systems
Relational queries
Parsing of context free language
Natural language processing
Natural support of
pattern-matching
23. Advantages of PROLOG
The language works well for tasks like
proving mathematical theorems
It has built-in list handling, very useful for
representing sequences, trees, and so on.
It is easy to read and write programs which
build structures.
24. Similarities:
One of the similarities that makes these
languages unique is their ability to rewrite
themselves as the program is running.
In Lisp, the program itself can be treated as
data that the program can manipulate.
The both languages are object oriented
programming languages.
25. Differences:
The main difference between the two languages
is the way problems are described.
In Lisp, the programmer must describe how the
computer will solve the problem (chess game).
In Prolog, the developer does not need to
describe how, but rules points the program
toward the desired results. (medical symptoms).
Prolog is not a general-purpose theorem prover.
LISP is a general purpose theorem
PROLOG has many functional languages other
than LISP.