:- true pred append(_1,_2,_3) : ( list(_1,num), list(_2,num), var(_3) ) => ( list(_1,num), list(_2,num), list(_3,num), length(_1,_A), length(_2,_B) ) + cost(ub,steps,2*_B+3*_A+8). :- true pred lnum(_A) : list(_A,num) => ( list(_A,num), length(_A,_B) ) + cost(ub,steps,2*_B+1).