A system for predicting integer sequence

177 Views Asked by At

I am now working on a system(ALEPH) for predicting next integers and need to impprt real integer sequence to test it. Here is one of my prolog programmming in aleph to induce the Fibonacci sequence theory:

:- use_module(library(aleph)).
:- if(current_predicate(use_rendering/1)).
:- use_rendering(prolog).
:- endif.
:- aleph.
:- modeh(*,add_sequence(+integer,+integer,+integer,+integer,-integer)).
:- modeb(*,add(+integer,+integer,-integer)).
:- determination(add_sequence/5,add/3).

:- begin_bg.
integer(1,1).
integer(2,2).
integer(3,3).
integer(4,4).
integer(5,5).
integer(8,8).
integer(7,7).
integer(11,11).
add(1,2,3).
add(2,3,5).
add(3,5,8).
add(1,3,4).
add(3,4,7).
add(4,7,11).
add(X,Y,Z):- Z=X+Y.
:- end_bg.

:- begin_in_pos.
add_sequence(1,2,3,5,8).
add_sequence(1,3,4,7,11).
:- end_in_pos.

:- begin_in_neg.
add_sequence(1,2,4,5,2).
add_sequence(1,2,1,2,3).
add_sequence(1,3,1,3,3).
add_sequence(2,3,2,3,3).
:- end_in_neg.
:-aleph_read_all.

Here is my aleph induce rules(take the Fibonacci sequence for example). Aleph will show me the theory about next number(here I use 4 numbers to predict the 5th number).

[theory]

[Rule 1] [Pos cover = 2 Neg cover = 0]
add_sequence(A,B,C,D,E) :-
add(B,C,D), add(C,D,E).

My problem is how I can get the 5th number as my input number and then use the 5th number to predict the 6th number like a loop. My teacher said I need to do an interface to import data to test it. I wonder there is interface in prolog or not? Do I need to learn other language like Python to call my prolog program?

0

There are 0 best solutions below