ProLog - Department of Computer Engineering
Download
Report
Transcript ProLog - Department of Computer Engineering
ProLog
PROgramming in LOGic
Description of Prolog
• Prolog stands for PROgramming in LOGic. It is
a nonprocedural and declarative language.
When was the language first designed
or implemented?
in 1970
What were the goals and purpose
of this language?
• Prolog was originally used for natural language
processing. Currently, Prolog is most
commonly used in creating "intelligent"
databases but is not limited to just that. It is
also widely used in natural language
processing, in expert systems, in commercial
applications, and in some facets education.
What kind of problem domain was it
intended for?
1.For solving logic and decision problems
,Prolog is ideal.
2.Typical applications: AI, Database apps,
proving theorems, symbolic evaluation (i.e.
differentiation).
Who were the envisioned users?
• artificial intelligence.
Who designed the language (maybe
one person, a group, an organization)?
• This language first desinged or implemented
in 1970 by Alain Colmerauer and Phillippe
Roussel in the Artificial Intelligence Group at
the University of Aix-Marseille with Robert
Kowalski of the Department of Artificial
Intelligence at the University of Edinburgh
developed the fundamental design of Prolog.
Alain Colmerauer
Robert Kowalski
What are some main features or
distinctive features of the language?
• Prolog has a declarative semantics that the basic
concept of this semantics is that there is a simple
way to determine the meaning of each
statement, and it does not depend how the
statement might be used to solve a problem.
•
-In Data and control structures
Domains were easy to understand.
•
-Cost and Reliability
Many free compilers available.
What contribution(s) did the language
make to the field of computer languages?
• Prolog make We found ‘thinking logically’ odd
at times.
• Prolog’s facts and rules seemed strangely
minimal for solving problems.
• Prolog doesn’t have strict type checking,
however our compiler did have some loose
rules in place. (May cause headaches for
maintenance)
How widely is the language used
today?
• Prolog is the most widely used in logic
programming language.
• there are two causes why prolog has not
become more widely
1.with some nonimperative approaches
Prolog has proven to be highly inefficient.
2.Prolog is an effective approach for only a
few relatively small area of application.
Useful Applications
• some of database management system and
some areas of AI.
Arithmetic in Prolog
• Prolog provides built in functions for doing
arithmetic, similar to most major languages.
• Provides built in random number generator.
• Integers and reals have standard operations
defined (*,/,+,-)
• In-fix notation is used
Arithmetic conts
Order of operations (for all types):
1. Parentheses
2. Left to right *, /, div, mod
3. Left to right +, -
Relational operations
return succeed or fail
• Symbol Relation
<
Less than
>
Greater than
>=
Greater or equal
=<
Less than or equal
<> Or ><
Not equal
Example
% multiple of numbers
multiple(Total):write('Input a number: '),
read(X),
<<<<read the input and store in X
write('Input a number: '),
read(Y),
<<<<read the input and store in Y
Total is X * Y,
write('multiple is '), write(Total). << print the result .