-


- - . 21


arca(a,b). arca(b,c). arca(c,d). arca(b,d).
:
- A = Z, P = [A];
- P1
Y Z, A Y, P1.

path1(A,P1,P),
, P1 - P.
path path1 :
path(A,Z,P) :- path1(A,[Z],P).
path1 :
- " ": P1 A P;
- X, : ) Y - , X, 2) X - P1,
3) P path(A,[Y|P1],P).
1. .
domains
s=symbol
list=s*
predicates
path(s,s,list)
path1(s,list,list)
member(s,list)
arca(s,s)
clauses
arca(a,b). arca(b,c). arca(c,d). arca(b,d).
member(X,[X|_]).
member(X,[_|Tail]):- member(X,Tail).
path(A,Z,Path):- path1(A,[Z],Path).
path1(A,[A|Path1],[A|Path1]).
path1(A,[Y|Path1],Path):- arca(X,Y), not(member(X,Path1)),
path1(A,[X,Y|Path1],Path).
path path1 (),
:
path(A,Z,P,C),
path1(A,P1,C1,P,C),
C C1 - P P1 .
arca - :
arca(X,Y,C).
2. .
domains
i=integer
s=symbol
list=s*
database
db_path(s,s,list,i)



- -  - -  - -