Prolog (programming language)
prolog | |
---|---|
Paradigms : | logical , declarative , often also constraint-based |
Publishing year: | 1972 |
Designer: | Alain Colmerauer |
Developer: | Philippe Roussell |
Typing : | weak , dynamic |
Important implementations : | SICStus, SWI-Prolog, GNU Prolog, XSB, YAP-Prolog |
Dialects: | ISO-Prolog, Edinburgh Prolog, BinProlog, Visual / Turbo Prolog; historical: micro-prologue |
Standardizations: | ISO / IEC 13211-1: 1995 |
Influenced by: | Planner, Q-Systems, theorem provers , Horn clauses |
Affected: | Erlang , Mercury , Mozart / Oz , Picat |
Prolog (from French : pro grammation en log ique , German : "programming in logic") is a programming language that was largely developed by the French computer scientist Alain Colmerauer in the early 1970s and enables declarative programming . It is considered the most important logical programming language .
First implementations differed greatly in their syntax , but the Edinburgh dialect soon established itself as the quasi-standard. However, it was not formally defined until it became the basis of an ISO standard in 1995 (ISO / IEC 13211-1), which is also known as the ISO prologue.
The first Prolog interpreter was implemented in ALGOL W in Marseille . The first approach to a compiler came from David HD Warren from Edinburgh. This had that of the logic processor Warren's Abstract Machine as its target language and therefore neither allowed dynamic changes nor a connection of resettable predicates in other programming languages. The first fully usable compiler that allowed both was developed by Preben Folkjaer and Christian Pichler in Munich . He used another intermediate code from TU Wien , which was incrementally compiled; if predicates were changed, the compilation was deleted and recompiled the next time it was called.
Basic principle
Prolog programs consist of a knowledge database whose entries are called facts and rules. The user formulates queries to this knowledge database. The Prolog interpreter uses the facts and rules to systematically find an answer. A positive result means that the query can be logically derived. A negative result only means that no derivation can be found based on the database. This is closely related to the closed world assumption (see below).
The typical first program in Prolog is not a hello-world example as it is in procedural programming languages , but a knowledge database with family tree information.
The following example represents a family tree of a small family. The first fact in the form of a statement mann(tobias).
reads as: Tobias is a man. vater(tobias, frank).
defines the fact: Tobias is Frank's father. For information on loading Prolog texts, see the relevant section:
% Prolog Text mit Fakten
mann(adam).
mann(tobias).
mann(frank).
frau(eva).
frau(daniela).
frau(ulrike).
vater(adam, tobias).
vater(tobias, frank).
vater(tobias, ulrike).
mutter(eva, tobias).
mutter(daniela, frank).
mutter(daniela, ulrike).
In a Prolog interpreter, queries can now be made to the database interactively. Running a Prolog program always means making a request. The system responds with either yes.
/ true.
or no.
/ false.
depending on whether the query could be proven.
With the prompt ?-
, the interpreter signals that it is expecting a request:
?- mann(tobias).
yes.
?- mann(heinrich).
no.
A query with a variable provides additional assignments as a response with which the query becomes true. Such a variable assignment is called unification and it is said that the variable is unified with this value. Variables in Prolog are tokens that start with an uppercase letter:
?- frau(X).
X=eva
X=daniela
X=ulrike
no is the answer to the fact list reduced by the previously given answers. The interpreter only provides positive answers to queries that are explicitly defined or inferred (closed world assumption). There is no information about Heinrich in the database:
?- mann(heinrich).
no.
?- frau(heinrich).
no.
In addition to facts, rules can be formulated in Prolog.
The rule operator :-
can be read like an inverted implication arrow . Example:
% Prolog Text mit Regel
grossvater(X, Y) :-
vater(X, Z),
vater(Z, Y).
The rule says: X is the grandfather of Y if there is a Z such that X is the father of Z and Z is the father of Y. This defines the paternal grandfather. A second rule for the maternal grandfather looks like this:
grossvater(X, Y) :-
vater(X, Z),
mutter(Z, Y).
The operator ,
in this rule defines a conjunction and is spoken and . The term to the left of the implication operator is also called head or consequence. If two rules (as above) have the same consequence, this follows if the precondition is fulfilled in at least one rule ( disjunction ).
By defining rules, facts can also be deduced that are not explicitly in the database:
?- grossvater(adam, ulrike).
yes.
?- grossvater(X, frank).
X=adam
syntax
Boolean algebra
The logical and is represented by a comma :
?- true,true.
true.
?- true,false.
false.
?- false,true.
false.
?- false,false.
false.
The logical or is represented by a semicolon :
?- true;true.
true.
?- true;false.
true.
?- false;true.
true.
?- false;false.
false.
Comparisons
?- 3 < 4.
true.
?- 3 > 4.
false.
?- anton == anton. % == prüft ob das muster links und rechts übereinstimmt
true.
?- 3 == 1+2. % muster stimmt nicht überein
false.
?- 3 \== 1+2. % \== prüft ob das muster links und rechts nicht übereinstimmt
true.
?- 3 =:= 1+2. % =:= ist der numerische vergleich
true.
?- 3 =\= 4. % =\= die numerische Ungleichheit
true.
?- 3 =\= 1+2. % 3=3
false.
?- 3 =< 4. % =< bedeutet kleiner/gleich; '<=' ist nicht zulässig
true.
?- 3 >= 4. % >= bedeutet größer/gleich
false.
?- 4 \= 2. % \= die muster können durch unifikation nicht ident gemacht werden
true.
?- X + 4 \= 2 + Y. % Durch X=2 und Y=4 werden die muster ident
false.
regulate
% Wenn X Vater von Z ist und Z Vater von Y ist, dann ist X Großvater von Y
grossvater(X, Y) :-
vater(X, Z),
vater(Z, Y).
% Adam ist der Vater von Tobias
vater(adam, tobias).
% Tobias ist der Vater von Frank
vater(tobias, frank).
% Abfrage ob Adam der Großvater von Frank ist
?- grossvater(adam, frank).
true.
Symmetrical relation
% anton und berta sind ein Ehepaar
ehepaar(anton, berta).
% das Ehepaar X Und Y ist genau dann ein Ehepaar,
% wenn ein Ehepaar Y Und X existiert
ehepaar(X, Y) :- ehepaar(Y, X).
% Abfrage ob Berta und Anton ein Ehepaar sind
?- ehepaar(berta, anton).
true.
arithmetic
Prolog knows the basic arithmetic operations, i.e. addition +
, subtraction -
, multiplication *
, division /
and modulo mod
. A value is assigned to a variable with the keyword is
. In contrast to imperative programming languages , variable values cannot be overwritten in Prolog.
Lists
Lists are recursive data structures composed of a head ( Head ) and a residue ( Tail ). The rest can again consist of lists.
% Head ist die Zahl 1
% Tail ist die Liste [2]
[1, 2]
% Head ist die Zeichenkette 'one'
% Tail ist die Liste ['two']
['one', 'two']
% Listen können auch gemischt sein
[1, 'two']
% Head ist die Ziffer 1
% Tail ist die Liste [2,3]
[1, 2, 3]
The predefined function is member
used to check whether a certain element is contained in a list :
member(X, [X|_]).
member(X, [_|T]) :-
member(X, T).
?- member(2, ['anton','berta','caesar']).
false.
?- member('berta', ['anton','berta','caesar']).
true.
Loading of prologue texts
A prologue text can be entered directly from the console. To do this, you can [user]
tap on the input line . The entry of the clauses must be concluded with an end-of-file character (^ D or ^ Z depending on the platform):
?- [user]. % tippe Prolog-Text direkt ein
append([], X, X).
append([X|Y], Z, [X|T]) :- append(Y, Z, T).
^D
Alternatively, a prologue text can be saved in a file and z. B. be consult
loaded with the predicate . The predicate takes a physical path to a prologue text:
?- consult('append.pl'). % lade Prolog Text-aus Datei
true.
More techniques
The techniques of recursion and the use of lists are decisive for Prolog programming .
If recursion is only an additional variant to iteration in most programming languages , it is the only way to produce loops in Prolog programming . If you need a general ancestor relation in the above example , this is implemented as follows (";" indicates the disjunction or the logical "or" in the clause):
% X ist genau dann ein elternteil von Y,
% wenn X die mutter von Y ist Oder
% wenn X der vater von Y ist.
elternteil(X, Y) :-
mutter(X, Y);
vater(X, Y).
% X ist einerseits dann ein vorfahr von Z,
% wenn X ein elternteil von Z ist.
vorfahr(X, Z) :- elternteil(X, Z).
% X ist andererseits dann ein vorfahr von Z, wenn
% X ein elternteil von Y ist Und
% Y ein vorfahre von Z ist
vorfahr(X, Z) :-
elternteil(X, Y),
vorfahr(Y, Z).
This can be as follows read: X is an ancestor of Z if X parent of Z (Rule 1) or there is a Y, the ancestor of Z while X parent of Y (Rule 2) (was here parent used instead of mother or father .)
Also lists are a crucial part of Prolog. Most Prolog implementations have many basic functions for this (“concat” = appending values, “count” = number of values, etc.), but all of which can be defined by yourself. In an imaginary family structure, the number of children must be variable. The following would be conceivable:
familie(heinz, jutta, [peter,laura]).
familie(karl, gertrud, []).
Then z. B. Display all men without children with one query:
?- familie(X, _, []).
X=karl
X is the variable whose various values are to be output. The underscore _ is the anonymous variable in Prolog, which causes Prolog to accept any value here. The square brackets stand for the empty list that represents the nonexistent children.
Another property and specialty compared to other programming languages is that Prolog is able to expand or delete its existing database during runtime. An example of deleting a single item:
auto(bmw, rot).
auto(bmw, blau).
autofarbe(Automarke, X) :-
retract(auto(bmw, _)),
auto(Automarke, X).
The query:
?- auto(bmw, X).
results (initially) quite normally:
X=rot;
X=blau;
No
The query:
?- autofarbe(bmw, X).
would the first time:
X=blau;
No
the second time only:
No
provide as the information:
auto(bmw, rot).
auto(bmw, blau).
have been deleted from the database. Also - auto (bmw, X) now provides only No . To delete all the same elements (e.g. auto () ) at once, use retractall (), to output asserta () (at the top of the database) and assertz () (at the bottom of the database).
Examples
Solve a math puzzle
ABB - CD = EED - - * FD + EF = CE = = = EGD * FH = ???
A to H each stand for a digit 0 to 9, although it is not clear which digit corresponds to which letter. Find the number that has to be next to the question mark. This problem is very easy to solve in Prolog. First you write a rule that causes A to H to be assigned all possible combinations from 0 to 9 later ( permutation ):
gen(A,B,C,D,E,F,G,H) :-
permutation([A,B,C,D,E,F,G,H,_,_], [0,1,2,3,4,5,6,7,8,9]).
Now only the five resulting equations ( ABB - CD = EED , FD + EF = CE , ABB - FD = EGD , CD - EF = FH and EED * CE = EGD * FH = X ) have to be written in Prolog syntax:
gl1(A, B, C, D, E) :-
((A * 100 + B * 10 + B) - (C * 10 + D)) =:= (E * 100 + E * 10 + D).
gl2(C, D, E, F) :-
((F * 10 + D) + (E * 10 + F)) =:= (C * 10 + E).
gl3(A, B, D, E, F, G) :-
((A * 100 + B * 10 + B) - (F * 10 + D)) =:= (E * 100 + G * 10 + D).
gl4(C, D, E, F, H) :-
((C * 10 + D) - (E * 10 + F)) =:= (F * 10 + H).
gl5(C, D, E, F, G, H, X) :-
((E * 100 + E * 10 + D) * (C * 10 + E)) =:=
((E * 100 + G * 10 + D) * (F * 10 + H)), X is ((E * 100 + G * 10 + D) * (F * 10 + H)).
If only X is interested , a solution rule is created that brings everything together and outputs X :
loesung :-
gen(A, B, C, D, E, F, G, H),
gl1(A, B, C, D, E),
gl2(C, D, E, F),
gl3(A, B, D, E, F, G),
gl4(C, D, E, F, H),
gl5(C, D, E, F, G, H, X),
write(X).
The query is now solution. is entered, the solution is displayed. As you can see, you hardly need any programming knowledge about loops or the like to solve this problem, you just enter the facts and what result you need. For this very reason, Prolog stands above imperative and object-oriented languages in the abstraction hierarchy.
Processing of hierarchical structures
A frequently asked task in programming languages is the processing of hierarchical structures, such as B. SGML or XML . Prolog is a very effective and expressive alternative to the most popular processing language XSLT, especially for XML .
A typical XML tree like
<buch titel="Peer Gynt">
<autor name="Henrik Ibsen" nat="norwegisch"/>
...
</buch>
is shown under Prolog as a recursive list of elements element (TagName, Attributes, Children) .
[element(buch, [titel='Peer Gynt'], [
element(autor, [name='Henrik Ibsen', nat='norwegisch'], []),
...])
]
A very simple paradigm (lower three clauses) allows each tree to be traversed recursively. The following examples delete (top clause with delete ) and concatenate (second clause from above with concat ) certain tags. The first unifier is the operation ( delete or concat ), the second the structure to be processed, the third the specified tag, the fourth the result tree . append is a command for concatenating lists.
transform(delete, [element(DelTag, _, _) | Siblings], DelTag, ResTree) :-
transform(delete, Siblings, DelTag, ResTree).
transform(concat, [Element1, Element2 | Siblings], ConTag, ResTree) :-
Element1 = element(Contag, Attr, Children1),
Element2 = element(Contag, _, Children2),
append(Children1, Children2, Children),
transform(concat, [element(ConTag, Attr, Children) | Siblings], ConTag, ResTree).
transform(_, [], _, []).
transform(Trans, [element(CTag, Attr, Children) | Siblings], Tag, ResTree) :-
\+ Tag = CTag,
transform(Trans, Children, Tag, ResChildren),
transform(Trans, Siblings, Tag, ResSiblings),
ResTree = [element(CTag, Attr, ResChildren) | ResSiblings].
transform(_, [Atom], _, [Atom]) :-
atomic(Atom).
If the backtracker encounters a tag with the same name as the one to be deleted during the delete operation , it is removed and the neighbors are searched for. A corresponding call is z. B. transform (delete, Tree, author, ResTree). removing all authors.
Similarly, transform (concat, Tree, paragraph, ResTree). all adjacent paragraphs are merged. For this purpose, their contents are first concatenated, from which a new paragraph structure is generated and processed further.
Planning systems
Planning systems are looking for a way to get from an initial state to a desired target state. They can be used to search for road or traffic connections, but also for more general problems. First of all, the most general approach for a blind depth-first search (i.e. it is unknown whether the individual step also leads closer to the goal):
weg(Ziel, Ziel, Zustandsliste) :-
write(Zustandsliste), nl. % Ziel erreicht, Abbruch der Rekursion und Ausgabe
weg(Start, Ziel, Zustandsliste) :- % Es gibt einen Weg vom Start zum Ziel, wenn ...
operator(Op), % ... es einen Operator gibt, ...
anwendbar(Op, Start), % ... der im Startzustand anwendbar ist, ...
fuehrt_zu(Op, Start, Neu), % ... von dort zu einem neuen Zustand fuehrt, ...
not(member(Neu, Zustandsliste)), % ... der noch nie da war (Verhinderung von Schleifen) ...
zulaessig(Neu), % ... und zulaessig ist, ...
weg(Neu, Ziel, [Neu|Zustandsliste]). % ... und es von dort einen Weg zum Ziel gibt.
Only the predicates operator , applicable , leads_to and admissible as well as the description of a state are to be formulated specifically for the problem. The predicate is called with a list of states containing the initial state.
Depending on the type of problem, some things can be simplified and / or left out; for a route search in a road network z. B.
weg(Ziel, Ziel, Ortsliste):-
write(Ortsliste), nl. % Ziel erreicht, Abbruch der Rekursion und Ausgabe
weg(Start, Ziel, Ortsliste):- % Es gibt einen Weg vom Start zum Ziel, wenn ...
strasse(Start, Neu), % ... es eine Strasse vom Start zu einem neuen Ort gibt, ...
not(member(Neu, Ortsliste)), % ... in dem man noch nicht war (Verhinderung von Schleifen), ...
weg(Neu, Ziel, [Neu|Ortsliste]). % ... und von dem es einen Weg zum Ziel gibt.
In the case of real problems, a blind search rarely leads to the goal; A breadth-first search is used in which all new states that can be reached from the start are determined, evaluated with a heuristic function and only the best ( heuristic search ) or a sorted list of the best ( best-first search ) are followed up. (The simple heuristic search can lead to the fact that the optimal solution is not always found, since certain solution steps that were wrongly sorted out as unfavorable would result in a better solution.) The art lies in the correct problem-specific formulation of the heuristic function. In many cases, the A-heuristic helps , which is the sum of the effort made so far and the estimated remaining effort to the destination (e.g. distance traveled + straight line distance to the destination):
weg(Ziel, Ziel, Ortsliste, Strecke):-
write(Ortsliste), nl, write(Strecke), nl. % Ziel erreicht, Abbruch der Rekursion und Ausgabe
weg(Start, Ziel, Ortsliste, Strecke):- % Es gibt einen Weg vom Start zum Ziel, wenn...
findall(Ort, strasse(Start, Ort), Neuliste), % ...es eine Liste erreichbarer neuer Orte gibt,...
bewerte(Neuliste, Start, Strecke, Ziel, BewerteteListe), % ...von denen jeder bewertet und ...
sort(BewerteteListe, SortierteListe), % ...durch Sortieren der Liste...
member([_, Sgesamt, Neu], SortierteListe), % ...der beste gesucht wird,...
not(member(Neu, Ortsliste)), % ...in dem man noch nicht war,...
weg(Neu, Ziel, [Neu|Ortsliste], Sgesamt). % ...und von dem es einen Weg zum Ziel gibt.
Each element of the RatedList has the structure [heuristic value, total distance traveled, location]; To calculate the A heuristic, the previous route, the last location and the destination (beeline) are required.
Einstein's riddle
This is a version of the zebra puzzle . It was supposedly written by Albert Einstein in the 19th century. Einstein is often credited with saying that only 2% of the world's population is able to solve the puzzle. However, there is no indication of any authorship. Here it is intended to be an example of a problem that can be solved with Prolog.
- There are five houses, each with a different color.
- A person of a different nationality lives in each house.
- Everyone in the house prefers a certain drink, smokes a certain brand of cigarette, and has a certain pet.
- None of the five people drinks the same drink, smokes the same cigarettes, or keeps the same animal as their neighbors.
Question: Who does the fish belong to?
Hints:
- The Brit lives in the red house.
- The Swede has a dog.
- The Dane likes to drink tea.
- The green house is directly to the left of the white house.
- The owner of the green house is drinking coffee.
- The person who smokes Pall Mall is holding a bird.
- The man who lives in the middle house is drinking milk.
- The owner of the yellow house smokes Dunhill.
- The Norwegian lives in the first house.
- The Marlboro smoker lives next to the one who has a cat.
- The man who keeps a horse lives next to the man who smokes Dunhill.
- The Winfield smoker likes to drink beer.
- The Norwegian lives next to the blue house.
- The German smokes Rothmans.
- The Marlboro smoker has a neighbor who drinks water.
Solution:
Each house is a list of the shape [color, nationality, drink, brand of cigarette, pet].
First four simple auxiliary predicates for list processing:
erstes(E, [E|_]).
mittleres(M, [_,_,M,_,_]).
links(A, B, [A,B|_]).
links(A, B, [_|R]) :- links(A, B, R).
neben(A, B, L) :-
links(A, B, L);
links(B, A, L).
Solution predicate:
run :-
X = [_,_,_,_,_], % Es gibt (nebeneinander) 5 (noch unbekannte) Häuser
member([rot,brite,_,_,_], X), % Der Brite lebt im roten Haus
member([_,schwede,_,_,hund], X), % Der Schwede hält einen Hund
member([_,daene,tee,_,_], X), % Der Däne trinkt gern Tee
links([gruen,_,_,_,_], [weiss,_,_,_,_], X), % Das grüne Haus steht links vom weißen Haus
member([gruen, _, kaffee, _, _], X), % Der Besitzer des grünen Hauses trinkt Kaffee
member([_,_,_,pallmall,vogel], X), % Die Person, die Pall Mall raucht, hält einen Vogel
mittleres([_,_,milch,_,_], X), % Der Mann, der im mittleren Haus wohnt, trinkt Milch
member([gelb,_,_,dunhill,_], X), % Der Besitzer des gelben Hauses raucht Dunhill
erstes([_,norweger,_,_,_], X), % Der Norweger wohnt im 1. Haus
neben([_,_,_,marlboro,_], [_,_,_,_,katze], X), % Der Marlboro-Raucher wohnt neben dem, der eine Katze hält
neben([_,_,_,_,pferd], [_,_,_,dunhill,_], X), % Der Mann, der ein Pferd hält, wohnt neben dem, der Dunhill raucht
member([_,_,bier,winfield,_], X), % Der Winfield-Raucher trinkt gern Bier
neben([_,norweger,_,_,_], [blau,_,_,_,_], X), % Der Norweger wohnt neben dem blauen Haus
member([_,deutsche,_,rothmans,_], X), % Der Deutsche raucht Rothmans
neben([_,_,_,marlboro,_], [_,_,wasser,_,_], X), % Der Marlboro-Raucher hat einen Nachbarn, der Wasser trinkt
member([_,N,_,_,fisch], X), % Der mit der Nationalität N hat einen Fisch
write(X), nl, % Ausgabe aller Häuser
write('Der '), write(N),
write(' hat einen Fisch als Haustier.'), nl. % Antwort auf die Frage
Definite Clause Grammar
To write rules for parsers , most Prolog systems have implemented a preprocessor . It allows the rules to be noted in a more legible form that corresponds in the form to the rules used to describe context-free language . The preprocessor adds placeholders and generates the above-mentioned Prolog logic formulas. By passing additional attributes, it is possible to use Definite Clause Grammars to describe more complex languages than the context-free ones.
Prologue from a logical point of view
A Prolog program is an ordered list of so-called Horn clauses , a restricted form of first-order predicate logic . If you send the system a query , it tries to prove it on the basis of this database by means of resolution . The result of a query is yes or no . Strictly speaking, a Prolog program develops its actual effect through side effects that occur during the search for evidence. So a Prolog system can also be understood as a very efficient - albeit limited - automatic theorem prover . The only evidence-finding strategy built into Prolog is depth-first search with backtracking .
application areas
In the 1980s, language played an important role in the construction of expert systems . The language is still used today in the fields of computational linguistics and artificial intelligence . For example, language processing components of the Jeopardy! well-known AI system Watson in Prolog. There are also some commercial applications in the area of system management in which asynchronous events are processed with the aid of Prolog or proprietary extensions based on it. An example of this is the Tivoli Enterprise Console (TEC) product from IBM , which is based on IBM Prolog.
See also
- List of programming languages
- Timeline of the programming languages
- Axiom , deduction
- Cutting rule
- Erlang (started as a prologue interpreter, the syntax is also inspired by it, also personal proximity, because the inventor of Erlang Joe Armstrong worked at the Swedish Institute of Computer Science (SICS))
literature
- Rüdeger Baumann: Prologue introductory course , Klett Verlag, 1991, ISBN 3-12-717721-6 .
- Patrick Blackburn, Johan Bos, Kristina Striegnitz: Learn Prolog Now! College Publications, 2006, ISBN 1-904987-17-6 .
- David L. Bowen, Lawrence Byrd, Fernando CN Pereira, Luís M. Pereira, and David HD Warren: DECsystem-10 Prolog User's Manual. Occasional Paper 27, 1982. Department of Artificial Intelligence, University of Edinburgh, Edinburgh, Scotland. ( Download ; Doc ; 192 kB)
- Hans Kleine Büning, Stefan Schmittgen: PROLOGUE: Basics and Applications . BG Teubner, Stuttgart 1986, ISBN 3-519-02484-5 .
- Ivan Bratko: Prolog Programming for Artificial Intelligence . 4th edition, Addison-Wesley, Harlow 2012, ISBN 0-321-41746-1 .
- William F. Clocksin: Clause and Effect. Prolog Programming for the Working Programmer . Springer, Berlin 2005, ISBN 3-540-62971-8 .
- William F. Clocksin, Christopher S. Mellish: Programming in Prolog . 5th edition, Springer, Berlin 2003, ISBN 3-540-00678-8 .
- Michael A. Covington, Donald Nute, André Vellino: Prolog Programming in Depth . Prentice Hall, 1996, ISBN 0-13-138645-X .
- H. Göhner, B. Hafenbrak: Workbook PROLOG . DÜMMLER, Bonn 1995, ISBN 3-427-46863-1 .
- Richard A. O'Keefe: The Craft of Prolog . MIT Press, Cambridge 1990, ISBN 0-262-15039-5 .
- Esther König, Roland Seiffert: Basic PROLOGUE course for linguists . UTB Linguistics, 1989, ISBN 3-7720-1749-5 .
- Leon S. Sterling, Ehud Shapiro: The Art of Prolog. Advanced Programming Techniques . 2nd ed., MIT Press, Cambridge 1994, ISBN 0-262-69163-9 .
- Leon S. Sterling: The Practice of Prolog . MIT Press, Cambridge 2003, ISBN 0-262-51445-1 .
- Gerhard Röhner: IT with a prologue . Office for Teacher Education (AfL), 2007, ISBN 3-88327-499-2 .
- Wilhelm Weisweber: Prologue. Logical programming in practice . Thomson, 1997, ISBN 3-8266-0174-2 .
Web links
Tutorials and courses
- Learn Prolog Now! Online book with an introduction to the prologue, also written in a way that is understandable for programming beginners. (engl.)
- Databases in Prolog. Implementation of SQL queries in Prolog.
- Natural Language Processing Techniques in Prolog (english)
Prolog implementations
- BProlog commercial Prolog system (free for education and research) with extensions for constraint programming (CLP), concurrency and interactive graphs
- GNU Prolog The free, open source GNU Prolog compiler
- Jekejeke Prolog is a pure interpreter implementation of Prolog, written entirely in Java. The implementation of the language essentially adheres to the ISO core standard.
- JIProlog is a commercial Prolog interpreter available as shareware, which strives for ISO compatibility and runs in Java ( J2SE , J2ME )
- Prolog.NET Prolog development environment for the .NET framework (English)
- SICStus Prolog commercial, ISO-compatible Prolog system from the Swedish Institute of Computer Science. B. Constraint programming (English)
- SWI-Prolog free, open source ( LGPL ), comprehensive ISO-compatible Prolog system with good community support (including editor , debugger , profiler and numerous program libraries ; English)
- tuProlog is a free, open source (LGPL) interpreter for a subset of Prolog in Java ( J2SE , J2ME ) and .NET
- YAP Prolog free, open source, fast, ISO-compatible Prolog interpreter
- C # Prolog , free, open source Prolog interpreter
Logical programming systems based on Prolog
- Ciao free, open source (LGPL), implements ISO Prolog, has language extensions for variable predicates (HiLog), constraint-based , object-oriented and concurrent programming (English)
- ECLiPSe Constraint Programming System free, open source ( MPL ), Prolog-based with extensions for constraint programming and additional search strategies (English)
- Logtalk is a free, open source ( Artistic License 2.0) object-oriented logical programming language (English)
- Mercury , a programming language based strongly on Prolog, combines elements from functional and logical programming (English)
- Poplog is a free, open source ( XFree86 license), integrated, interactive programming environment with incremental compilers for the languages POP-11 , Prolog, Common Lisp and Standard ML , which not only enables multiparadigmatic programming but also the mixing of these programming languages (English)
- QuProlog - an advanced, free Prolog compiler that v. a. serves to implement interactive theorem provers
- XSB- free, open source (LGPL), "almost" ISO-Prolog-compatible logical programming system with language extensions beyond Prolog ( HiLog ; full, tabulated resolution ; extended pattern matching ) and libraries for GUI programming, F-Logic and ontology processing ( English)
References and comments
- ^ A. Colmerauer and P. Roussel: The birth of prolog. History of programming languages II . 1996, pp. 331-367. (PDF document; 2.1 MB)
- ↑ In the absence of a formal specification for the Edinburgh Prologue , the DEC-10 PROLOG Manual was mostly used by Bowen et al. a. (1982) or Programming in Prolog by Clocksin and Mellish.
- ^ Adam Lally, Paul Fodor: Natural Language Processing With Prolog in the IBM Watson System. The Association for Logic Programming, March 31, 2011, accessed October 18, 2001 .