:-module(_,[append/3],[]).
'$applied_packages'([prelude,nonpure,condcomp,assertions,regtypes,nativeprops,rtchecks_shallow,predefres(res_steps),resdefs,resdefs/resources_decl,basicmodes,argnames,expander]).
:-add_clause_trans(expander_tr:expand_clause/4,9910).
:-pred append(A,B,C):(lnum(A),lnum(B),var(C))=>(lnum(A),lnum(B),lnum(C)).
:-prop lnum/1+regtype.

append(_1,_2,_3) :-
        'append$pre'(_1,_2,_3,_4),
        'append$cls'(_1,_2,_3),
        'append$post'(_1,_2,_3,_4).
'append$pre'(_1,_2,_3,_7) :-
        reify_check(lnum(_1),[_1],_5),
        reify_check(lnum(_2),[_2],_6),
        reify_check(var(_3),[_3],_4),
        _8 is _4/\(_5/\_6),
        _7 is _8,
        _9 is _7,
        warn_if_false(_9,'CP').
'append$post'(_1,_2,_3,_7) :-
        reify_check(lnum(_1),[_1],_5),
        reify_check(lnum(_2),[_2],_6),
        reify_check(lnum(_3),[_3],_4),
        _8 is _4/\(_5/\_6),
        _9 is _7#1\/_8,
        _10 is _9,
        warn_if_false(_10,'AP').
'append$cls'([],L,L).
'append$cls'([A|R],S,[A|L]) :-
        append(R,S,L).

lnum([]).
lnum([X|T]) :-
        num(X),
        lnum(T).