An Introduction to Programming in Prolog by Patrick Saint-Dizier

By Patrick Saint-Dizier

This booklet is an advent to Prolog (£rQgramming in ~ic). It offers the fundamental foundations of Prolog and simple and basic programming tools. This booklet is written for programmers accustomed to different programming languages, in addition to for newcomers in desktop technological know-how, prepared to have an unique advent to programming. The strategy followed during this ebook is therefore in keeping with methodological parts including a few pragmatic features. The booklet consists of 2 elements. within the fIrst half the most important features of programming in Prolog are awarded step-by-step. each one new point is illustrated through brief examples and routines. the second one half consists of extra constructed examples, that are usually video games, that illustrate significant facets of man-made intelligence. extra complex books are given within the bibliography and should permit the reader to deepen his or her recognize ledge of Prolog. Prolog used to be first designed in France at OJ.A., Marseille, with a selected syntax. we've followed right here a extra universal notation, outlined at Edinburgh, which has a tendency to be an implicit norm. on the finish of every bankruptcy of the 1st half, there are routines that the reader is invited to do and to check on his or her desktop. entire solutions are given in Appendix A, on the finish of the book.

Show description

Read Online or Download An Introduction to Programming in Prolog PDF

Best compilers books

Ada 95 Rationale: The Language The Standard Libraries

Ada ninety five, the improved model of the Ada programming language, is now in position and has attracted a lot recognition locally because the foreign common ISO/IEC 8652:1995(E) for the language used to be licensed in 1995. The Ada ninety five reason is available in 4 elements. The introductory half is a basic dialogue of the scope and ambitions of Ada ninety five and its significant technical gains.

Pattern Calculus: Computing with Functions and Structures

Through the years, easy learn has a tendency to guide to specialization – more and more slim t- ics are addressed by means of more and more focussed groups, publishing in more and more con ned workshops and meetings, discussing more and more incremental contri- tions. Already the group of programming languages is divided into numerous s- groups addressing various points and paradigms (functional, valuable, relational, and object-oriented).

Automated Deduction - Cade-22: 22nd International Conference on Automated Deduction, Montreal, Canada, August 2-7, 2009. Proceedings

This e-book constitutes the refereed court cases of the twenty second foreign convention on computerized Deduction, CADE-22, held in Montreal, Canada, in August 2009. The 27 revised complete papers and five method descriptions offered have been conscientiously reviewed and chosen from seventy seven submissions. additionally, 3 invited lectures through exotic specialists within the zone have been incorporated.

Extra info for An Introduction to Programming in Prolog

Sample text

Is true. Here we represent arguments by ( ••• ) to indicate that they may be of any nature and number. a( ••• ) is called the head of the rule and b( ••• ), c( ••• ), ••• , z(••• ). constitutes the body of the rule. At a syntactic level, a rule is called a clause. The body is also called the constraints or the conditions. The conditions either make reference to facts or call new rules. If certain variables are bound to constants as a result of a call to a rule, then all occurrences of these variables in the head as well as in the condition part of the rule are bound to the constants for the duration of this particular call to the rule.

2. Paths in a Graph We now develop a more complex example: determining the existence of one (or several) paths between two nodes of a graph. Consider, for example, the following graph: a ----~) b e An arc expresses a relation between two nodes. It is therefore natural to represent a graph in Prolog by facts in the form arc(X, Y) to state the existence of an arc from X to Y, where X and Y are nodes of the graph. The above graph is expressed as follows: arc(a,b). arc(b,c). arc(c,e). arc(c,d). arc(a,e).

For example, g(l,al(U,_12» is not completely instantiated because it contains two variables, U and _12, whereas g(l,al(34,op» is a completely instantiated term. Note also that in most versions of Prolog, functors in a tenn must not be variables. The term X(a,b) is not accepted by Prolog, and neither, for example, is the tenn f(X(a,b),c). To overcome this problem, we can create a supplementary functor with a new name and include X among its arguments. In the following example f1 is such a functor: f(f1(X,a,b),c) 32 Chapter 4.

Download PDF sample

Rated 4.68 of 5 – based on 46 votes