Ciao Preprocessor (integrated Alpha version)
| This is an alpha distribution, meant only for testing. Please do let us
| know at ciaopp-bugclip.dia.fi.upm.es any problems you may have.
{loaded in 3336.209 msec.}
{preprocessed for plai in 4.001 msec.}
{analyzed by plai using det with local-control off in 56.003 msec.}
{written file /tmp/tmpVMM85Q/psk09-cycle_det_co.pl}
:- module(_1,[cycle/3],[assertions]).
:- entry cycle(A,B,C)
: ( ground(A), ground(B) ).
:- true pred cycle(A,B,C)
: ( native_props:mshare([[C]]), ground([A,B]), gnd(A), gnd(B), term(C) )
=> ( ground([A,B,C]), arithexpression(A), arithexpression(B), rt33(C) )
+ ( is_det, mut_exclusive ).
cycle(Dividend,Divisor,Repetition) :-
Remainder is Dividend mod Divisor,
RemQuotList=[],
divide(Remainder,Divisor,RemQuotList,Repetition).
:- true pred divide(Remainder,_1,RemQuotList,Repetition)
: ( native_props:mshare([[Repetition]]), ground([Remainder,_1,RemQuotList]), num(Remainder), arithexpression(_1), rt0(RemQuotList), term(Repetition) )
=> ( ground([Remainder,_1,RemQuotList,Repetition]), num(Remainder), arithexpression(_1), rt48(RemQuotList), rt33(Repetition) )
+ ( is_det, mut_exclusive ).
:- true pred divide(Remainder,_1,[_3*_4|_2],Repetition)
: ( native_props:mshare([[Repetition]]), ground([Remainder,_1,_2,_3,_4]), num(Remainder), arithexpression(_1), term(Repetition), rt0(_2), num(_3), num(_4) )
=> ( ground([Remainder,_1,Repetition,_2,_3,_4]), num(Remainder), arithexpression(_1), rt33(Repetition), rt48(_2), num(_3), num(_4) )
+ ( is_det, mut_exclusive ).
:- true pred divide(Remainder,_1,[_3*_4|_2],Repetition)
: ( native_props:mshare([[Repetition]]), ground([Remainder,_1,_2,_3,_4]), num(Remainder), arithexpression(_1), term(Repetition), rt39(_2), num(_3), num(_4) )
=> ( ground([Remainder,_1,Repetition,_2,_3,_4]), num(Remainder), arithexpression(_1), rt33(Repetition), rt47(_2), num(_3), num(_4) )
+ ( is_det, mut_exclusive ).
divide(Remainder,_1,RemQuotList,Repetition) :-
find_repetition(RemQuotList,Remainder,[],Repetition),
!.
divide(Remainder,Divisor,RemQuotList,Repetition) :-
Remainder10 is 10*Remainder,
Quot is Remainder10//Divisor,
NewRemainder is Remainder10-Divisor*Quot,
divide(NewRemainder,Divisor,[Remainder*Quot|RemQuotList],Repetition).
:- true pred find_repetition(_1,Remainder,[],Out)
: ( native_props:mshare([[Out]]), ground([_1,Remainder]), rt3(_1), num(Remainder), term(Out) )
=> ( ground([_1,Remainder,Out]), rt7(_1), num(Remainder), rt33(Out) )
+ ( is_det, mut_exclusive ).
:- true pred find_repetition(_1,Remainder,[_2|_3],Out)
: ( native_props:mshare([[Out]]), ground([_1,Remainder,_2,_3]), rt4(_1), num(Remainder), term(Out), num(_2), rt8(_3) )
=> ( ground([_1,Remainder,Out,_2,_3]), rt11(_1), num(Remainder), rt26(Out), num(_2), rt25(_3) )
+ ( is_det, mut_exclusive ).
:- true pred find_repetition(_1,Remainder,[_2|_3],Out)
: ( native_props:mshare([[Out]]), ground([_1,Remainder,_2,_3]), rt4(_1), num(Remainder), term(Out), num(_2), rt14(_3) )
=> ( ground([_1,Remainder,Out,_2,_3]), rt18(_1), num(Remainder), rt17(Out), num(_2), rt23(_3) )
+ ( is_det, mut_exclusive ).
:- true pred find_repetition(_1,Remainder,[],Out)
: ( native_props:mshare([[Out]]), ground([_1,Remainder]), rt0(_1), num(Remainder), term(Out) )
+ fails.
find_repetition([X*Quot|RemQuotList],Remainder,In,Out) :-
Remainder==X,
!,
Out=[Quot|In].
find_repetition([X*Quot|RemQuotList],Remainder,In,Out) :-
find_repetition(RemQuotList,Remainder,[Quot|In],Out).
:- regtype rt36/1.
rt36([]).
rt36([A|B]) :-
num(A),
rt36(B).
:- regtype rt35/1.
rt35([]).
rt35([A|B]) :-
num(A),
rt36(B).
:- regtype rt34/1.
rt34([]).
rt34([A|B]) :-
num(A),
rt35(B).
:- regtype rt33/1.
rt33([A|B]) :-
num(A),
rt34(B).
:- regtype rt0/1.
rt0([]).
:- regtype rt48/1.
rt48([]).
rt48([A*B|C]) :-
num(A),
num(B),
rt48(C).
:- regtype rt40/1.
rt40([]).
rt40([A*B|C]) :-
num(A),
num(B),
rt40(C).
:- regtype rt39/1.
rt39([]).
rt39([A*B|C]) :-
num(A),
num(B),
rt40(C).
:- regtype rt47/1.
rt47([]).
rt47([A*B|C]) :-
num(A),
num(B),
rt47(C).
:- regtype rt3/1.
rt3([]).
rt3([A*B|C]) :-
num(A),
num(B),
rt4(C).
:- regtype rt7/1.
rt7([A*B|C]) :-
num(A),
num(B),
rt4(C).
:- regtype rt4/1.
rt4([]).
rt4([A*B|C]) :-
num(A),
num(B),
rt4(C).
:- regtype rt8/1.
rt8([]).
:- regtype rt11/1.
rt11([A*B|C]) :-
num(A),
num(B),
rt4(C).
:- regtype rt29/1.
rt29([]).
rt29([A|B]) :-
num(A),
rt29(B).
:- regtype rt28/1.
rt28([]).
rt28([A|B]) :-
num(A),
rt29(B).
:- regtype rt27/1.
rt27([A|B]) :-
num(A),
rt28(B).
:- regtype rt26/1.
rt26([A|B]) :-
num(A),
rt27(B).
:- regtype rt25/1.
rt25([]).
rt25([A|B]) :-
num(A),
rt25(B).
:- regtype rt15/1.
rt15([]).
rt15([A|B]) :-
num(A),
rt15(B).
:- regtype rt14/1.
rt14([]).
rt14([A|B]) :-
num(A),
rt15(B).
:- regtype rt18/1.
rt18([A*B|C]) :-
num(A),
num(B),
rt4(C).
:- regtype rt16/1.
rt16([A|B]) :-
num(A),
rt14(B).
:- regtype rt17/1.
rt17([A|B]) :-
num(A),
rt16(B).
:- regtype rt23/1.
rt23([]).
rt23([A|B]) :-
num(A),
rt23(B).