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: [[nil]] = _|_ We choose Lex = {} and Mul = {@_{o -> o}, cons, map, node, treemap}, and the following precedence: @_{o -> o} = map > node > treemap > cons Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: map(F, _|_) >= _|_ 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, _|_) >= _|_ by (Bot) 2] map(F, cons(X, Y)) > cons(@_{o -> o}(F, X), map(F, Y)) because [3], by definition 3] map*(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) because map > cons, [4] and [9], by (Copy) 4] map*(F, cons(X, Y)) >= @_{o -> o}(F, X) because map = @_{o -> o}, map in Mul, [5] and [6], by (Stat) 5] F >= F by (Meta) 6] cons(X, Y) > X because [7], by definition 7] cons*(X, Y) >= X because [8], by (Select) 8] X >= X by (Meta) 9] map*(F, cons(X, Y)) >= map(F, Y) because map in Mul, [5] and [10], by (Stat) 10] cons(X, Y) > Y because [11], by definition 11] cons*(X, Y) >= Y because [12], by (Select) 12] Y >= Y by (Meta) 13] @_{o -> o}(treemap(F), node(X, Y)) > node(@_{o -> o}(F, X), map(treemap(F), Y)) because [14], by definition 14] @_{o -> o}*(treemap(F), node(X, Y)) >= node(@_{o -> o}(F, X), map(treemap(F), Y)) because @_{o -> o} > node, [15] and [22], by (Copy) 15] @_{o -> o}*(treemap(F), node(X, Y)) >= @_{o -> o}(F, X) because @_{o -> o} in Mul, [16] and [19], by (Stat) 16] treemap(F) >= F because [17], by (Star) 17] treemap*(F) >= F because [18], by (Select) 18] F >= F by (Meta) 19] node(X, Y) > X because [20], by definition 20] node*(X, Y) >= X because [21], by (Select) 21] X >= X by (Meta) 22] @_{o -> o}*(treemap(F), node(X, Y)) >= map(treemap(F), Y) because @_{o -> o} = map, @_{o -> o} in Mul, [23] and [25], by (Stat) 23] treemap(F) >= treemap(F) because treemap in Mul and [24], by (Fun) 24] F >= F by (Meta) 25] node(X, Y) > Y because [26], by definition 26] node*(X, Y) >= Y because [27], by (Select) 27] Y >= Y by (Meta) We can thus remove the following rules: 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 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 We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[nil]] = _|_ We choose Lex = {} and Mul = {map}, and the following precedence: map Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: map(F, _|_) > _|_ With these choices, we have: 1] map(F, _|_) > _|_ because [2], by definition 2] map*(F, _|_) >= _|_ by (Bot) We can thus remove the following rules: map(F, nil) => nil 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.