:- module( _, [fib/2], [assertions , regtypes , basicmodes , nativeprops] ).

fib([[num(int(A))]],[num(int(1))]) :-
        A=<0 .
fib([[num(int(A))]],[B]) :-
        A>0,
        C is A+ -1,
        execute_notrace_1(C,_1,_2,_3,_4,_5,B,_6) .

execute_notrace_1(A,[],_1,_2,_3,_4,num(int(2)),[]) :-
        A=<0 .
execute_notrace_1(A,B,C,D,E,F,G,H) :-
        A>0,
        I is A+ -1,
        execute_notrace_2(I,2,3,B,C,D,E,F,G,H) .

execute_notrace_2(A,_1,B,[],_2,_3,_4,_5,num(int(B)),[]) :-
        A=<0 .
execute_notrace_2(A,B,C,D,E,F,G,H,I,J) :-
        A>0,
        K is B+C,
        L is A+ -1,
        execute_notrace_2(L,C,K,D,E,F,G,H,I,J) .


