Prolog 有没有人在Aleph中遇到过递归问题?

Prolog 有没有人在Aleph中遇到过递归问题?,prolog,swi-prolog,aleph-ilp,Prolog,Swi Prolog,Aleph Ilp,我目前正在做我的符号人工智能作业,我已经做了几个小时了,但我仍然在我刚开始的地方,我希望你们中的一些人能帮助我或给我一些提示 因此,第一个练习是查看Aleph中关于member/2实现的递归示例,并检查其工作原理,我认为,我理解: 成员b: % Simple illustration of the learning of recursive predicates % in Aleph % To run do the following: % a. Load Aleph %

我目前正在做我的符号人工智能作业,我已经做了几个小时了,但我仍然在我刚开始的地方,我希望你们中的一些人能帮助我或给我一些提示

因此,第一个练习是查看Aleph中关于member/2实现的递归示例,并检查其工作原理,我认为,我理解:

成员b:

% Simple illustration of the learning of recursive predicates
%       in Aleph
% To run do the following:
%       a. Load Aleph
%       b. read_all(mem).
%       c. induce.

% :- modeh(*,mem(+any,+list)).
% :- modeb(*,mem(+any,+list)). 
% :- modeb(1,((+list) = ([-any|-list]))).

:- mode(*,mem(+any,+list)).
:- mode(1,((+list) = ([-any|-list]))).

 :- set(i,3).
 :- set(noise,0).


 :- determination(mem/2,mem/2).
 :- determination(mem/2,'='/2).
下一个练习是为另一个递归问题实现Aleph算法,例如rev/2或append/3,我尝试了几个小时,但我真的不知道如何开始或做什么。下面是我目前是如何实现它的:

rev.b(我尝试了很多东西,现在把所有的东西都评论了出来,但是我真的很困惑):

如果有人想看我的正面和负面示例文件,请让我知道,但我认为主要问题是背景知识文件,我真的不太明白,tbh。有人有任何提示/提示/帮助吗

% Simple illustration of the learning of recursive predicates
%       in Aleph
% To run do the following:
%       a. Load Aleph
%       b. read_all(rev).
%       c. induce.

% :- mode(*, rev(+startlist,+startreversed,+result)).
% :- mode(1, ((+startlist) = ([-any|-startlistlist]))).
% :- mode(1, ((-result) = ([+any|+result]))).
% :- mode(1, ((-list) = (+result))).

% :- mode(*,rev(+startlist,+endlist)).
% :- mode(1, (length(+startlist, -length) = length(+endlist, -length))).
% :- mode(*,rev(+startlist,-result)).
% :- modeb(*,mem(+any, ([+any|+list]))).
% :- modeb(1, ((-result) = ([+any|+result]))).
% :- modeb(1, ((+list) = (-endlist))).
% :- modeb(1, ((+list) = (-startlist))).
% :- modeb(1, ((+endlist) = ([-any|-endlist]))).
% :- modeb(1, ((+startlist) = ([-any|-startlist]))).
% :- modeb(1, ((-result) = ([+any]))).

%:- mode(*, rev(+startlist, +list)).
%:- modeb(*, ((+startlist) = (+list), (+startlist) = ([-any|-startlist]))).
%:- modeb(*, ((-startlist) = ([+anyend|+anystart]))).
% :- modeb(1, ((+startlist) = ([-any|-startlist]))).
%:- modeb(*, ((+startlist) = ([-anystart|-anyend]))).
%:- modeb(1, ((+startlist) = ([-any|-startlist]))).
%:- modeb(1, ((+list) = ([-any|-list]))).

:- mode(*, rev(+list, +list)).
:- mode(1, ((+list) = ([-anystart|-anyend]))).
:- mode(1, ((-list) = ([+anystart]))).
:- mode(1, ((-list) = ([+anyend]))).
:- mode(1, ((-list) = ([+anyend|+anystart]))).


% :- mode(1, (([+endlist]) = ([+list|+any]))).%, (+starlist) = ([-any|-startlist]))).
% :- mode(1, ((+startlist) = ([-any|-list]))).%, (+endlist) = ([-anyt|-listt]))).

:- set(i,2).
:- set(noise,0).

:- determination(rev/2, rev/2).
% :- determination(rev/3, rev/3).
% :- determination(rev/2, mem/2).
% :- determination(rev/2,rev/2).
% :- determination(rev/2,length/2).
:- determination(rev/2,'='/2).
% :- determination(rev/3, '='/2).