We consider the system h59. Alphabet: 0 : [] --> nat rec : [] --> nat -> a -> (nat -> a -> a) -> a s : [] --> nat -> nat Rules: rec 0 x (/\y./\z.f y z) => x rec (s x) y (/\z./\u.f z u) => f x (rec x y (/\v./\w.f v w)) Using the transformations described in [Kop11], this system can be brought in a form without leading free variables in the left-hand side, and where the left-hand side of a variable is always a functional term or application headed by a functional term. We now transform the resulting AFS into an AFSM by replacing all free variables by meta-variables (with arity 0). This leads to the following AFSM: Alphabet: 0 : [] --> nat rec : [nat * a * nat -> a -> a] --> a s : [nat] --> nat ~AP1 : [nat -> a -> a * nat] --> a -> a Rules: rec(0, X, /\x./\y.~AP1(F, x) y) => X rec(s(X), Y, /\x./\y.~AP1(F, x) y) => ~AP1(F, X) rec(X, Y, /\z./\u.~AP1(F, z) u) ~AP1(F, X) => F X Symbol ~AP1 is an encoding for application that is only used in innocuous ways. We can simplify the program (without losing non-termination) by removing it. This gives: Alphabet: 0 : [] --> nat rec : [nat * a * nat -> a -> a] --> a s : [nat] --> nat Rules: rec(0, X, /\x./\y.Y(x, y)) => X rec(s(X), Y, /\x./\y.Z(x, y)) => Z(X, rec(X, Y, /\z./\u.Z(z, u))) We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): rec(0, X, /\x./\y.Y(x, y)) >? X rec(s(X), Y, /\x./\y.Z(x, y)) >? Z(X, rec(X, Y, /\z./\u.Z(z, u))) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[rec(x_1, x_2, x_3)]] = rec(x_1, x_3, x_2) We choose Lex = {rec} and Mul = {0, s}, and the following precedence: rec > 0 > s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: rec(0, X, /\x./\y.Y(x, y)) > X rec(s(X), Y, /\x./\y.Z(x, y)) >= Z(X, rec(X, Y, /\x./\y.Z(x, y))) With these choices, we have: 1] rec(0, X, /\x./\y.Y(x, y)) > X because [2], by definition 2] rec*(0, X, /\x./\y.Y(x, y)) >= X because [3], by (Select) 3] X >= X by (Meta) 4] rec(s(X), Y, /\x./\y.Z(x, y)) >= Z(X, rec(X, Y, /\x./\y.Z(x, y))) because [5], by (Star) 5] rec*(s(X), Y, /\x./\y.Z(x, y)) >= Z(X, rec(X, Y, /\x./\y.Z(x, y))) because [6], by (Select) 6] Z(rec*(s(X), Y, /\x./\y.Z(x, y)), rec*(s(X), Y, /\z./\u.Z(z, u))) >= Z(X, rec(X, Y, /\x./\y.Z(x, y))) because [7] and [11], by (Meta) 7] rec*(s(X), Y, /\x./\y.Z(x, y)) >= X because [8], by (Select) 8] s(X) >= X because [9], by (Star) 9] s*(X) >= X because [10], by (Select) 10] X >= X by (Meta) 11] rec*(s(X), Y, /\x./\y.Z(x, y)) >= rec(X, Y, /\x./\y.Z(x, y)) because [12], [7], [14] and [16], by (Stat) 12] s(X) > X because [13], by definition 13] s*(X) >= X because [10], by (Select) 14] rec*(s(X), Y, /\x./\y.Z(x, y)) >= Y because [15], by (Select) 15] Y >= Y by (Meta) 16] rec*(s(X), Y, /\x./\y.Z(x, y)) >= /\x./\y.Z(x, y) because [17], by (Select) 17] /\x./\z.Z(x, z) >= /\x./\z.Z(x, z) because [18], by (Abs) 18] /\z.Z(y, z) >= /\z.Z(y, z) because [19], by (Abs) 19] Z(y, x) >= Z(y, x) because [20] and [21], by (Meta) 20] y >= y by (Var) 21] x >= x by (Var) We can thus remove the following rules: rec(0, X, /\x./\y.Y(x, y)) => 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]): rec(s(X), Y, /\x./\y.Z(x, y)) >? Z(X, rec(X, Y, /\z./\u.Z(z, u))) We use a recursive path ordering as defined in [Kop12, Chapter 5]. We choose Lex = {} and Mul = {rec, s}, and the following precedence: rec > s With these choices, we have: 1] rec(s(X), Y, /\x./\y.Z(x, y)) > Z(X, rec(X, Y, /\x./\y.Z(x, y))) because [2], by definition 2] rec*(s(X), Y, /\x./\y.Z(x, y)) >= Z(X, rec(X, Y, /\x./\y.Z(x, y))) because [3], by (Select) 3] Z(rec*(s(X), Y, /\x./\y.Z(x, y)), rec*(s(X), Y, /\z./\u.Z(z, u))) >= Z(X, rec(X, Y, /\x./\y.Z(x, y))) because [4] and [8], by (Meta) 4] rec*(s(X), Y, /\x./\y.Z(x, y)) >= X because [5], by (Select) 5] s(X) >= X because [6], by (Star) 6] s*(X) >= X because [7], by (Select) 7] X >= X by (Meta) 8] rec*(s(X), Y, /\x./\y.Z(x, y)) >= rec(X, Y, /\x./\y.Z(x, y)) because rec in Mul, [9], [11] and [12], by (Stat) 9] s(X) > X because [10], by definition 10] s*(X) >= X because [7], by (Select) 11] Y >= Y by (Meta) 12] /\x./\z.Z(x, z) >= /\x./\z.Z(x, z) because [13], by (Abs) 13] /\z.Z(y, z) >= /\z.Z(y, z) because [14], by (Abs) 14] Z(y, x) >= Z(y, x) because [15] and [16], by (Meta) 15] y >= y by (Var) 16] x >= x by (Var) We can thus remove the following rules: rec(s(X), Y, /\x./\y.Z(x, y)) => Z(X, rec(X, Y, /\z./\u.Z(z, u))) 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 +++ [Kop11] C. Kop. Simplifying Algebraic Functional Systems. In Proceedings of CAI 2011, volume 6742 of LNCS. 201--215, Springer, 2011. [Kop12] C. Kop. Higher Order Termination. PhD Thesis, 2012.