We consider the system h43. Alphabet: 0 : [] --> nat rec : [] --> nat -> nat -> (nat -> nat -> nat) -> nat s : [] --> nat -> nat xplus : [] --> nat -> nat -> nat xtimes : [] --> nat -> nat -> nat Rules: xplus x 0 => x xplus x (s y) => s (xplus x y) 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)) xtimes x y => rec y 0 (/\z./\u.xplus x u) 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 * nat * nat -> nat -> nat] --> nat s : [nat] --> nat xplus : [nat * nat] --> nat xtimes : [nat * nat] --> nat ~AP1 : [nat -> nat -> nat * nat] --> nat -> nat Rules: xplus(X, 0) => X xplus(X, s(Y)) => s(xplus(X, Y)) 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) xtimes(X, Y) => rec(Y, 0, /\x./\y.xplus(X, y)) rec(0, X, /\x./\y.xplus(x, y)) => X rec(0, X, /\x./\y.xtimes(x, y)) => X rec(s(X), Y, /\x./\y.xplus(x, y)) => xplus(X, rec(X, Y, /\z./\u.xplus(z, u))) rec(s(X), Y, /\x./\y.xtimes(x, y)) => xtimes(X, rec(X, Y, /\z./\u.xtimes(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. Additionally, we can remove some (now-)redundant rules. This gives: Alphabet: 0 : [] --> nat rec : [nat * nat * nat -> nat -> nat] --> nat s : [nat] --> nat xplus : [nat * nat] --> nat xtimes : [nat * nat] --> nat Rules: xplus(X, 0) => X xplus(X, s(Y)) => s(xplus(X, Y)) 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))) xtimes(X, Y) => rec(Y, 0, /\x./\y.xplus(X, 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]): xplus(X, 0) >? X xplus(X, s(Y)) >? s(xplus(X, Y)) 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))) xtimes(X, Y) >? rec(Y, 0, /\x./\y.xplus(X, y)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ We choose Lex = {} and Mul = {rec, s, xplus, xtimes}, and the following precedence: xtimes > rec > xplus > s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: xplus(X, _|_) >= X xplus(X, s(Y)) >= s(xplus(X, Y)) rec(_|_, 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))) xtimes(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) With these choices, we have: 1] xplus(X, _|_) >= X because [2], by (Star) 2] xplus*(X, _|_) >= X because [3], by (Select) 3] X >= X by (Meta) 4] xplus(X, s(Y)) >= s(xplus(X, Y)) because [5], by (Star) 5] xplus*(X, s(Y)) >= s(xplus(X, Y)) because xplus > s and [6], by (Copy) 6] xplus*(X, s(Y)) >= xplus(X, Y) because xplus in Mul, [7] and [8], by (Stat) 7] X >= X by (Meta) 8] s(Y) > Y because [9], by definition 9] s*(Y) >= Y because [10], by (Select) 10] Y >= Y by (Meta) 11] rec(_|_, X, /\x./\y.Y(x, y)) >= X because [12], by (Star) 12] rec*(_|_, X, /\x./\y.Y(x, y)) >= X because [13], by (Select) 13] X >= X by (Meta) 14] rec(s(X), Y, /\x./\y.Z(x, y)) > Z(X, rec(X, Y, /\x./\y.Z(x, y))) because [15], by definition 15] rec*(s(X), Y, /\x./\y.Z(x, y)) >= Z(X, rec(X, Y, /\x./\y.Z(x, y))) because [16], by (Select) 16] 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 [17] and [21], by (Meta) 17] rec*(s(X), Y, /\x./\y.Z(x, y)) >= X because [18], by (Select) 18] s(X) >= X because [19], by (Star) 19] s*(X) >= X because [20], by (Select) 20] X >= X by (Meta) 21] rec*(s(X), Y, /\x./\y.Z(x, y)) >= rec(X, Y, /\x./\y.Z(x, y)) because rec in Mul, [22], [24] and [25], by (Stat) 22] s(X) > X because [23], by definition 23] s*(X) >= X because [20], by (Select) 24] Y >= Y by (Meta) 25] /\x./\z.Z(x, z) >= /\x./\z.Z(x, z) because [26], by (Abs) 26] /\z.Z(y, z) >= /\z.Z(y, z) because [27], by (Abs) 27] Z(y, x) >= Z(y, x) because [28] and [29], by (Meta) 28] y >= y by (Var) 29] x >= x by (Var) 30] xtimes(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) because [31], by (Star) 31] xtimes*(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) because xtimes > rec, [32], [34] and [35], by (Copy) 32] xtimes*(X, Y) >= Y because [33], by (Select) 33] Y >= Y by (Meta) 34] xtimes*(X, Y) >= _|_ by (Bot) 35] xtimes*(X, Y) >= /\y./\z.xplus(X, z) because [36], by (F-Abs) 36] xtimes*(X, Y, x) >= /\z.xplus(X, z) because [37], by (F-Abs) 37] xtimes*(X, Y, x, y) >= xplus(X, y) because xtimes > xplus, [38] and [40], by (Copy) 38] xtimes*(X, Y, x, y) >= X because [39], by (Select) 39] X >= X by (Meta) 40] xtimes*(X, Y, x, y) >= y because [41], by (Select) 41] y >= y 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))) We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): xplus(X, 0) >? X xplus(X, s(Y)) >? s(xplus(X, Y)) rec(0, X, /\x./\y.Y(x, y)) >? X xtimes(X, Y) >? rec(Y, 0, /\x./\y.xplus(X, y)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ We choose Lex = {} and Mul = {rec, s, xplus, xtimes}, and the following precedence: xtimes > xplus > rec > s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: xplus(X, _|_) >= X xplus(X, s(Y)) >= s(xplus(X, Y)) rec(_|_, X, /\x./\y.Y(x, y)) > X xtimes(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) With these choices, we have: 1] xplus(X, _|_) >= X because [2], by (Star) 2] xplus*(X, _|_) >= X because [3], by (Select) 3] X >= X by (Meta) 4] xplus(X, s(Y)) >= s(xplus(X, Y)) because [5], by (Star) 5] xplus*(X, s(Y)) >= s(xplus(X, Y)) because xplus > s and [6], by (Copy) 6] xplus*(X, s(Y)) >= xplus(X, Y) because xplus in Mul, [7] and [8], by (Stat) 7] X >= X by (Meta) 8] s(Y) > Y because [9], by definition 9] s*(Y) >= Y because [10], by (Select) 10] Y >= Y by (Meta) 11] rec(_|_, X, /\x./\y.Y(x, y)) > X because [12], by definition 12] rec*(_|_, X, /\x./\y.Y(x, y)) >= X because [13], by (Select) 13] X >= X by (Meta) 14] xtimes(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) because [15], by (Star) 15] xtimes*(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) because xtimes > rec, [16], [18] and [19], by (Copy) 16] xtimes*(X, Y) >= Y because [17], by (Select) 17] Y >= Y by (Meta) 18] xtimes*(X, Y) >= _|_ by (Bot) 19] xtimes*(X, Y) >= /\y./\z.xplus(X, z) because [20], by (F-Abs) 20] xtimes*(X, Y, x) >= /\z.xplus(X, z) because [21], by (F-Abs) 21] xtimes*(X, Y, x, y) >= xplus(X, y) because xtimes > xplus, [22] and [24], by (Copy) 22] xtimes*(X, Y, x, y) >= X because [23], by (Select) 23] X >= X by (Meta) 24] xtimes*(X, Y, x, y) >= y because [25], by (Select) 25] y >= y 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]): xplus(X, 0) >? X xplus(X, s(Y)) >? s(xplus(X, Y)) xtimes(X, Y) >? rec(Y, 0, /\x./\y.xplus(X, y)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ We choose Lex = {} and Mul = {rec, s, xplus, xtimes}, and the following precedence: xtimes > rec > xplus > s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: xplus(X, _|_) > X xplus(X, s(Y)) >= s(xplus(X, Y)) xtimes(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) With these choices, we have: 1] xplus(X, _|_) > X because [2], by definition 2] xplus*(X, _|_) >= X because [3], by (Select) 3] X >= X by (Meta) 4] xplus(X, s(Y)) >= s(xplus(X, Y)) because [5], by (Star) 5] xplus*(X, s(Y)) >= s(xplus(X, Y)) because xplus > s and [6], by (Copy) 6] xplus*(X, s(Y)) >= xplus(X, Y) because xplus in Mul, [7] and [8], by (Stat) 7] X >= X by (Meta) 8] s(Y) > Y because [9], by definition 9] s*(Y) >= Y because [10], by (Select) 10] Y >= Y by (Meta) 11] xtimes(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) because [12], by (Star) 12] xtimes*(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) because xtimes > rec, [13], [15] and [16], by (Copy) 13] xtimes*(X, Y) >= Y because [14], by (Select) 14] Y >= Y by (Meta) 15] xtimes*(X, Y) >= _|_ by (Bot) 16] xtimes*(X, Y) >= /\y./\z.xplus(X, z) because [17], by (F-Abs) 17] xtimes*(X, Y, x) >= /\z.xplus(X, z) because [18], by (F-Abs) 18] xtimes*(X, Y, x, y) >= xplus(X, y) because xtimes > xplus, [19] and [21], by (Copy) 19] xtimes*(X, Y, x, y) >= X because [20], by (Select) 20] X >= X by (Meta) 21] xtimes*(X, Y, x, y) >= y because [22], by (Select) 22] y >= y by (Var) We can thus remove the following rules: xplus(X, 0) => 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]): xplus(X, s(Y)) >? s(xplus(X, Y)) xtimes(X, Y) >? rec(Y, 0, /\x./\y.xplus(X, y)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ We choose Lex = {} and Mul = {rec, s, xplus, xtimes}, and the following precedence: xtimes > rec > xplus > s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: xplus(X, s(Y)) >= s(xplus(X, Y)) xtimes(X, Y) > rec(Y, _|_, /\x./\y.xplus(X, y)) With these choices, we have: 1] xplus(X, s(Y)) >= s(xplus(X, Y)) because [2], by (Star) 2] xplus*(X, s(Y)) >= s(xplus(X, Y)) because xplus > s and [3], by (Copy) 3] xplus*(X, s(Y)) >= xplus(X, Y) because xplus in Mul, [4] and [5], by (Stat) 4] X >= X by (Meta) 5] s(Y) > Y because [6], by definition 6] s*(Y) >= Y because [7], by (Select) 7] Y >= Y by (Meta) 8] xtimes(X, Y) > rec(Y, _|_, /\x./\y.xplus(X, y)) because [9], by definition 9] xtimes*(X, Y) >= rec(Y, _|_, /\x./\y.xplus(X, y)) because xtimes > rec, [10], [12] and [13], by (Copy) 10] xtimes*(X, Y) >= Y because [11], by (Select) 11] Y >= Y by (Meta) 12] xtimes*(X, Y) >= _|_ by (Bot) 13] xtimes*(X, Y) >= /\y./\z.xplus(X, z) because [14], by (F-Abs) 14] xtimes*(X, Y, x) >= /\z.xplus(X, z) because [15], by (F-Abs) 15] xtimes*(X, Y, x, y) >= xplus(X, y) because xtimes > xplus, [16] and [18], by (Copy) 16] xtimes*(X, Y, x, y) >= X because [17], by (Select) 17] X >= X by (Meta) 18] xtimes*(X, Y, x, y) >= y because [19], by (Select) 19] y >= y by (Var) We can thus remove the following rules: xtimes(X, Y) => rec(Y, 0, /\x./\y.xplus(X, 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]): xplus(X, s(Y)) >? s(xplus(X, Y)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. We choose Lex = {} and Mul = {s, xplus}, and the following precedence: xplus > s With these choices, we have: 1] xplus(X, s(Y)) > s(xplus(X, Y)) because [2], by definition 2] xplus*(X, s(Y)) >= s(xplus(X, Y)) because xplus > s and [3], by (Copy) 3] xplus*(X, s(Y)) >= xplus(X, Y) because xplus in Mul, [4] and [5], by (Stat) 4] X >= X by (Meta) 5] s(Y) > Y because [6], by definition 6] s*(Y) >= Y because [7], by (Select) 7] Y >= Y by (Meta) We can thus remove the following rules: xplus(X, s(Y)) => s(xplus(X, 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 +++ [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.