:- true pred prefix_sum(X,Y) : ( list(X,num), var(Y) ) => ( list(X,num), list(Y,num), length(X,_A) ) + cost(ub,steps,_A+2). :- true pred prefix_sum_(_1,_A,_B) : ( rt2(_1), list(_A,num), var(_B) ) => ( nnegint(_1), list(_A,num), list(_B,num), length(_A,_C) ) + cost(ub,steps,_C+1). :- true pred prefix_sum_(_1,_A,_B) : ( num(_1), list(_A,num), var(_B) ) => ( num(_1), list(_A,num), list(_B,num), length(_A,_C) ) + cost(ub,steps,_C+1).