:- 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,_1,_2,_3,_4,_5,B,_6) .

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

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


