Adding elements in two lists as numbers
When describing lists, always consider using DCGs. In this case, try for example:

sum(Xs0, Ys0, Ls) :-
    reverse(Xs0, Xs),
    reverse(Ys0, Ys),
    phrase(sum(Xs, Ys, 0), Ls0),
    reverse(Ls0, Ls).

sum([], [], Carry) --&gt;
    (   { Carry &gt; 0 } -&gt; [Carry]
    ;   []
    ).
sum([X|Xs], [Y|Ys], Carry0) --&gt;
    { N0 is X + Y + Carry0,
      (  N0 &gt; 9 -&gt;  N is N0 - 10, Carry = 1
      ;  N = N0, Carry = 0
      ) },
    [N],
    sum(Xs, Ys, Carry).


Exampe queries and their results:

?- sum([1,9,9], [0,9,9], Ls).
Ls = [2, 9, 8].

?- sum([8,1,9], [1,8,2], Ls).
Ls = [1, 0, 0, 1].