We consider the system merge. Alphabet: cons : [nat * list] --> list map : [nat -> nat * list] --> list merge : [list * list * list] --> list nil : [] --> list Rules: merge(nil, nil, x) => x merge(nil, cons(x, y), z) => merge(y, nil, cons(x, z)) merge(cons(x, y), z, u) => merge(z, y, cons(x, u)) map(f, nil) => nil map(f, cons(x, y)) => cons(f x, map(f, y)) This AFS is converted to an AFSM simply by replacing all free variables by meta-variables (with arity 0). We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): merge(nil, nil, X) >? X merge(nil, cons(X, Y), Z) >? merge(Y, nil, cons(X, Z)) merge(cons(X, Y), Z, U) >? merge(Z, Y, cons(X, U)) map(F, nil) >? nil map(F, cons(X, Y)) >? cons(F X, map(F, Y)) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: cons = Lam[y0;y1].3 + y0 + y1 map = Lam[G0;y1].2 + 3*y1 + G0(0) + 3*y1*G0(y1) + 3*G0(y1) merge = Lam[y0;y1;y2].3 + 2*y2 + 3*y0 + 3*y1 nil = 0 Using this interpretation, the requirements translate to: [[merge(nil, nil, _x0)]] = 3 + 2*x0 > x0 = [[_x0]] [[merge(nil, cons(_x0, _x1), _x2)]] = 12 + 2*x2 + 3*x0 + 3*x1 > 9 + 2*x0 + 2*x2 + 3*x1 = [[merge(_x1, nil, cons(_x0, _x2))]] [[merge(cons(_x0, _x1), _x2, _x3)]] = 12 + 2*x3 + 3*x0 + 3*x1 + 3*x2 > 9 + 2*x0 + 2*x3 + 3*x1 + 3*x2 = [[merge(_x2, _x1, cons(_x0, _x3))]] [[map(_F0, nil)]] = 2 + 4*F0(0) > 0 = [[nil]] [[map(_F0, cons(_x1, _x2))]] = 11 + 3*x1 + 3*x2 + F0(0) + 3*x1*F0(3 + x1 + x2) + 3*x2*F0(3 + x1 + x2) + 12*F0(3 + x1 + x2) > 5 + x1 + 3*x2 + F0(0) + F0(x1) + 3*x2*F0(x2) + 3*F0(x2) = [[cons(_F0 _x1, map(_F0, _x2))]] We can thus remove the following rules: merge(nil, nil, X) => X merge(nil, cons(X, Y), Z) => merge(Y, nil, cons(X, Z)) merge(cons(X, Y), Z, U) => merge(Z, Y, cons(X, U)) map(F, nil) => nil map(F, cons(X, Y)) => cons(F X, map(F, Y)) All rules were succesfully removed. Thus, termination of the original system has been reduced to termination of the beta-rule, which is well-known to hold. +++ Citations +++ [Kop12] C. Kop. Higher Order Termination. PhD Thesis, 2012.