We consider the system 05height. Alphabet: cons : [t * f] --> f heightf : [f] --> N heightt : [t] --> N leaf : [] --> t max : [N * N] --> N nil : [] --> f node : [f] --> t s : [N] --> N z : [] --> N Rules: heightf(nil) => z heightf(cons(x, y)) => max(heightt(x), heightf(y)) heightt(leaf) => z heightt(node(x)) => s(heightf(x)) 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]): heightf(nil) >? z heightf(cons(X, Y)) >? max(heightt(X), heightf(Y)) heightt(leaf) >? z heightt(node(X)) >? s(heightf(X)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[z]] = _|_ We choose Lex = {} and Mul = {cons, heightf, heightt, leaf, max, nil, node, s}, and the following precedence: cons > leaf > max > nil > heightf = node > heightt = s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: heightf(nil) > _|_ heightf(cons(X, Y)) > max(heightt(X), heightf(Y)) heightt(leaf) >= _|_ heightt(node(X)) >= s(heightf(X)) With these choices, we have: 1] heightf(nil) > _|_ because [2], by definition 2] heightf*(nil) >= _|_ by (Bot) 3] heightf(cons(X, Y)) > max(heightt(X), heightf(Y)) because [4], by definition 4] heightf*(cons(X, Y)) >= max(heightt(X), heightf(Y)) because [5], by (Select) 5] cons(X, Y) >= max(heightt(X), heightf(Y)) because [6], by (Star) 6] cons*(X, Y) >= max(heightt(X), heightf(Y)) because cons > max, [7] and [10], by (Copy) 7] cons*(X, Y) >= heightt(X) because cons > heightt and [8], by (Copy) 8] cons*(X, Y) >= X because [9], by (Select) 9] X >= X by (Meta) 10] cons*(X, Y) >= heightf(Y) because cons > heightf and [11], by (Copy) 11] cons*(X, Y) >= Y because [12], by (Select) 12] Y >= Y by (Meta) 13] heightt(leaf) >= _|_ by (Bot) 14] heightt(node(X)) >= s(heightf(X)) because heightt = s, heightt in Mul and [15], by (Fun) 15] node(X) >= heightf(X) because node = heightf, node in Mul and [16], by (Fun) 16] X >= X by (Meta) We can thus remove the following rules: heightf(nil) => z heightf(cons(X, Y)) => max(heightt(X), heightf(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]): heightt(leaf) >? z heightt(node(X)) >? s(heightf(X)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[s(x_1)]] = x_1 [[z]] = _|_ We choose Lex = {} and Mul = {heightf, heightt, leaf, node}, and the following precedence: heightf = node > leaf > heightt Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: heightt(leaf) >= _|_ heightt(node(X)) > heightf(X) With these choices, we have: 1] heightt(leaf) >= _|_ by (Bot) 2] heightt(node(X)) > heightf(X) because [3], by definition 3] heightt*(node(X)) >= heightf(X) because [4], by (Select) 4] node(X) >= heightf(X) because node = heightf, node in Mul and [5], by (Fun) 5] X >= X by (Meta) We can thus remove the following rules: heightt(node(X)) => s(heightf(X)) We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): heightt(leaf) >? z We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[z]] = _|_ We choose Lex = {} and Mul = {heightt, leaf}, and the following precedence: heightt > leaf Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: heightt(leaf) > _|_ With these choices, we have: 1] heightt(leaf) > _|_ because [2], by definition 2] heightt*(leaf) >= _|_ by (Bot) We can thus remove the following rules: heightt(leaf) => z 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.