We consider the system Applicative_05__TreeMap. Alphabet: cons : [c * b] --> b map : [c -> c * b] --> b nil : [] --> b node : [a * b] --> c treemap : [a -> a] --> c -> c Rules: map(f, nil) => nil map(f, cons(x, y)) => cons(f x, map(f, y)) treemap(f) node(x, y) => node(f x, map(treemap(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]): map(F, nil) >? nil map(F, cons(X, Y)) >? cons(F X, map(F, Y)) treemap(F) node(X, Y) >? node(F X, map(treemap(F), Y)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[node(x_1, x_2)]] = node(x_2, x_1) We choose Lex = {cons, node} and Mul = {@_{o -> o}, map, nil, treemap}, and the following precedence: nil > treemap > node > @_{o -> o} = map > cons Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: map(F, nil) > nil map(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) @_{o -> o}(treemap(F), node(X, Y)) > node(@_{o -> o}(F, X), map(treemap(F), Y)) With these choices, we have: 1] map(F, nil) > nil because [2], by definition 2] map*(F, nil) >= nil because [3], by (Select) 3] nil >= nil by (Fun) 4] map(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) because [5], by (Star) 5] map*(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) because map > cons, [6] and [11], by (Copy) 6] map*(F, cons(X, Y)) >= @_{o -> o}(F, X) because map = @_{o -> o}, map in Mul, [7] and [8], by (Stat) 7] F >= F by (Meta) 8] cons(X, Y) > X because [9], by definition 9] cons*(X, Y) >= X because [10], by (Select) 10] X >= X by (Meta) 11] map*(F, cons(X, Y)) >= map(F, Y) because map in Mul, [7] and [12], by (Stat) 12] cons(X, Y) > Y because [13], by definition 13] cons*(X, Y) >= Y because [14], by (Select) 14] Y >= Y by (Meta) 15] @_{o -> o}(treemap(F), node(X, Y)) > node(@_{o -> o}(F, X), map(treemap(F), Y)) because [16], by definition 16] @_{o -> o}*(treemap(F), node(X, Y)) >= node(@_{o -> o}(F, X), map(treemap(F), Y)) because [17], by (Select) 17] treemap(F) @_{o -> o}*(treemap(F), node(X, Y)) >= node(@_{o -> o}(F, X), map(treemap(F), Y)) because [18] 18] treemap*(F, @_{o -> o}*(treemap(F), node(X, Y))) >= node(@_{o -> o}(F, X), map(treemap(F), Y)) because treemap > node, [19] and [27], by (Copy) 19] treemap*(F, @_{o -> o}*(treemap(F), node(X, Y))) >= @_{o -> o}(F, X) because treemap > @_{o -> o}, [20] and [22], by (Copy) 20] treemap*(F, @_{o -> o}*(treemap(F), node(X, Y))) >= F because [21], by (Select) 21] F >= F by (Meta) 22] treemap*(F, @_{o -> o}*(treemap(F), node(X, Y))) >= X because [23], by (Select) 23] @_{o -> o}*(treemap(F), node(X, Y)) >= X because [24], by (Select) 24] node(X, Y) >= X because [25], by (Star) 25] node*(X, Y) >= X because [26], by (Select) 26] X >= X by (Meta) 27] treemap*(F, @_{o -> o}*(treemap(F), node(X, Y))) >= map(treemap(F), Y) because [28], by (Select) 28] @_{o -> o}*(treemap(F), node(X, Y)) >= map(treemap(F), Y) because @_{o -> o} = map, @_{o -> o} in Mul, [29] and [31], by (Stat) 29] treemap(F) >= treemap(F) because treemap in Mul and [30], by (Fun) 30] F >= F by (Meta) 31] node(X, Y) > Y because [32], by definition 32] node*(X, Y) >= Y because [33], by (Select) 33] Y >= Y by (Meta) We can thus remove the following rules: map(F, nil) => nil treemap(F) node(X, Y) => node(F X, map(treemap(F), Y)) We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 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].3*y1 + G0(y1) + 2*y1*G0(y1) Using this interpretation, the requirements translate to: [[map(_F0, cons(_x1, _x2))]] = 9 + 3*x1 + 3*x2 + 2*x1*F0(3 + x1 + x2) + 2*x2*F0(3 + x1 + x2) + 7*F0(3 + x1 + x2) > 3 + x1 + 3*x2 + F0(x1) + F0(x2) + 2*x2*F0(x2) = [[cons(_F0 _x1, map(_F0, _x2))]] We can thus remove the following rules: 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.