跳转至

Recursion

一、Recursion

1,A predicate is recursively defined if one or more rules in its definition refers to itself 2,example \(1\) image1 \(2\) image2 \(3\) image3 \(4\) image4 \(5\) image5 (6)

child(anna,bridget).

child(bridget,caroline).

child(caroline,donna).

child(donna,emily).

descend(X,Y):- child(X,Y).

descend(X,Y):- descend(Z,Y), child(X,Z).

?-descend(A,B).

image6

二、Prolog and Logic

1,Prolog was the first reasonable attempt to create a logic programming language 2,特点 not have to tell the computer what to do To get information, simply asks a query Prolog is not a full logic programming language!