





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A set of lecture notes on logic programming with prolog by tevfik koşar. The notes cover topics such as logic languages, prolog programming language, logic programming, prolog queries, resolution, unification, lists, and arithmetic. The document also includes examples and exercises.
Typology: Study notes
1 / 9
This page cannot be seen from the preview
Don't miss anything!






1
Lecture - XIX March 28th, 2006
2
3
4
7
8
rainy(seattle).
rainy(newyork).
?- rainy(X).
X = seattle;
X = newyork;
no
9
rainy(seattle).
rainy(rochester).
cold(rochester).
snowy(X) :- rainy(X), cold(X).
?- snowy(X).
X = rochester;
no
10
13
takes_lab(S) :- takes(S, C), meets_in(C, R), is_lab(R).
14
15
append([], A, A). append(H | T), A, [H | L]) :- append(T, A, L).
?- append([a, b, c], [d, e], L). L = [a , b, c, d, e] ?- append(X, [d, e], [a, b, c, d, e]). X = [a, b, c] ?- append([a, b, c], Y, [a, b, c, d, e]). Y = [d, e]
Prolog predicates do not have a clear distinction between input and output arguments!
16
?- is(X, 1+2). X = 3 ?- X is 1+2. X = 3 ?- 3 is 1+2. yes ?- 1+2 is 3. no ?- X is Y.