:- true pred nreverse(Xs,Ys)
         : ( list(Xs), var(Ys) )
        => ( list(Xs), list(Ys), length(Xs,_A) )
         + cost(ub,steps,0.5*(_A+1)**2+0.5*_A+0.5).

:- true pred appendlast(_A,X,_B)
         : ( list(_A), term(X), var(_B) )
        => ( list(_A), term(X), non_empty_list(_B), length(_A,_C) )
         + cost(ub,steps,_C+1).