I am currently working on my Symbolic AI homework in Aleph and I have been working on it for hours, but I am still where I was at the beginning, I hope some of you can help me or give me hints.
So the first exercise was to look at the recursive example in Aleph of the implementation of member/2 and check how this works, and I think, I understand that:
mem.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).
The next exercise is to implement an Aleph algorithm for another recursive problem, for example rev/2 or append/3, I tried this for hours, but I don't really know how to start or what to do. Here is how I implemented it at the moment:
rev.b ( I tried many things and commented all things out for now, but tbh I am really confused atm):
% 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).
If anyone wants to see my positive and negative example files, please let me know, but I think the main issue is in the background knowledge file, I dont really understand much of it, tbh. Has anyone any hints/tips/help?