ifte(TRUE,x,y) -> x
ifte(FALSE,x,y) -> y

leq(Z,y) -> TRUE
leq(x,Z) -> FALSE
leq(S(x),S(y)) -> leq(x,y)

insert(a,NIL) -> CONS(a,NIL)
insert(a,CONS(b,l)) -> ifte(leq(a,b),
                            CONS(a,CONS(b,l)),
                            CONS(b,insert(a,l)))

sort(NIL) -> NIL
sort(CONS(a,l)) -> insert(a,sort(l))


[TRUE] = 1
[FALSE] = 1
[ifte](b,x,y) = max(b,max(x,y))
[Z] = 1
[S](x) = x+1
[leq](x,y) = max(x,y)
[insert](a,l) = a+l+1
[NIL] = 1
[CONS](a,l) = a+l+1
[sort](l) = l

