We consider the system reverse. Alphabet: app : [list * list] --> list cons : [nat * list] --> list foldl : [list -> nat -> list * list * list] --> list iconsc : [] --> list -> nat -> list nil : [] --> list reverse : [list] --> list reverse1 : [list] --> list Rules: app(nil, x) => x app(cons(x, y), z) => cons(x, app(y, z)) foldl(f, x, nil) => x foldl(f, x, cons(y, z)) => foldl(f, f x y, z) iconsc => /\x./\y.cons(y, x) reverse(x) => foldl(iconsc, nil, x) reverse1(x) => foldl(/\y./\z.app(cons(z, nil), y), nil, 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]): app(nil, X) >? X app(cons(X, Y), Z) >? cons(X, app(Y, Z)) foldl(F, X, nil) >? X foldl(F, X, cons(Y, Z)) >? foldl(F, F X Y, Z) iconsc >? /\x./\y.cons(y, x) reverse(X) >? foldl(iconsc, nil, X) reverse1(X) >? foldl(/\x./\y.app(cons(y, nil), x), nil, X) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[@_{o -> o}(x_1, x_2)]] = @_{o -> o}(x_2, x_1) [[foldl(x_1, x_2, x_3)]] = foldl(x_3, x_1, x_2) [[nil]] = _|_ We choose Lex = {@_{o -> o}, foldl} and Mul = {@_{o -> o -> o}, app, cons, iconsc, reverse, reverse1}, and the following precedence: reverse1 > reverse > @_{o -> o} = foldl > iconsc > @_{o -> o -> o} > app > cons Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: app(_|_, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) foldl(F, X, _|_) >= X foldl(F, X, cons(Y, Z)) >= foldl(F, @_{o -> o}(@_{o -> o -> o}(F, X), Y), Z) iconsc >= /\x./\y.cons(y, x) reverse(X) > foldl(iconsc, _|_, X) reverse1(X) >= foldl(/\x./\y.app(cons(y, _|_), x), _|_, X) With these choices, we have: 1] app(_|_, X) >= X because [2], by (Star) 2] app*(_|_, X) >= X because [3], by (Select) 3] X >= X by (Meta) 4] app(cons(X, Y), Z) >= cons(X, app(Y, Z)) because [5], by (Star) 5] app*(cons(X, Y), Z) >= cons(X, app(Y, Z)) because app > cons, [6] and [10], by (Copy) 6] app*(cons(X, Y), Z) >= X because [7], by (Select) 7] cons(X, Y) >= X because [8], by (Star) 8] cons*(X, Y) >= X because [9], by (Select) 9] X >= X by (Meta) 10] app*(cons(X, Y), Z) >= app(Y, Z) because app in Mul, [11] and [14], by (Stat) 11] cons(X, Y) > Y because [12], by definition 12] cons*(X, Y) >= Y because [13], by (Select) 13] Y >= Y by (Meta) 14] Z >= Z by (Meta) 15] foldl(F, X, _|_) >= X because [16], by (Star) 16] foldl*(F, X, _|_) >= X because [17], by (Select) 17] X >= X by (Meta) 18] foldl(F, X, cons(Y, Z)) >= foldl(F, @_{o -> o}(@_{o -> o -> o}(F, X), Y), Z) because [19], by (Star) 19] foldl*(F, X, cons(Y, Z)) >= foldl(F, @_{o -> o}(@_{o -> o -> o}(F, X), Y), Z) because [20], [23], [25] and [34], by (Stat) 20] cons(Y, Z) > Z because [21], by definition 21] cons*(Y, Z) >= Z because [22], by (Select) 22] Z >= Z by (Meta) 23] foldl*(F, X, cons(Y, Z)) >= F because [24], by (Select) 24] F >= F by (Meta) 25] foldl*(F, X, cons(Y, Z)) >= @_{o -> o}(@_{o -> o -> o}(F, X), Y) because foldl = @_{o -> o}, [26], [29] and [32], by (Stat) 26] cons(Y, Z) > Y because [27], by definition 27] cons*(Y, Z) >= Y because [28], by (Select) 28] Y >= Y by (Meta) 29] foldl*(F, X, cons(Y, Z)) >= @_{o -> o -> o}(F, X) because foldl > @_{o -> o -> o}, [23] and [30], by (Copy) 30] foldl*(F, X, cons(Y, Z)) >= X because [31], by (Select) 31] X >= X by (Meta) 32] foldl*(F, X, cons(Y, Z)) >= Y because [33], by (Select) 33] cons(Y, Z) >= Y because [27], by (Star) 34] foldl*(F, X, cons(Y, Z)) >= Z because [35], by (Select) 35] cons(Y, Z) >= Z because [21], by (Star) 36] iconsc >= /\x./\y.cons(y, x) because [37], by (Star) 37] iconsc* >= /\y./\z.cons(z, y) because [38], by (F-Abs) 38] iconsc*(x) >= /\z.cons(z, x) because [39], by (F-Abs) 39] iconsc*(x, y) >= cons(y, x) because iconsc > cons, [40] and [42], by (Copy) 40] iconsc*(x, y) >= y because [41], by (Select) 41] y >= y by (Var) 42] iconsc*(x, y) >= x because [43], by (Select) 43] x >= x by (Var) 44] reverse(X) > foldl(iconsc, _|_, X) because [45], by definition 45] reverse*(X) >= foldl(iconsc, _|_, X) because reverse > foldl, [46], [47] and [48], by (Copy) 46] reverse*(X) >= iconsc because reverse > iconsc, by (Copy) 47] reverse*(X) >= _|_ by (Bot) 48] reverse*(X) >= X because [49], by (Select) 49] X >= X by (Meta) 50] reverse1(X) >= foldl(/\x./\y.app(cons(y, _|_), x), _|_, X) because [51], by (Star) 51] reverse1*(X) >= foldl(/\x./\y.app(cons(y, _|_), x), _|_, X) because reverse1 > foldl, [52], [61] and [62], by (Copy) 52] reverse1*(X) >= /\y./\z.app(cons(z, _|_), y) because [53], by (F-Abs) 53] reverse1*(X, x) >= /\z.app(cons(z, _|_), x) because [54], by (F-Abs) 54] reverse1*(X, x, y) >= app(cons(y, _|_), x) because reverse1 > app, [55] and [59], by (Copy) 55] reverse1*(X, x, y) >= cons(y, _|_) because reverse1 > cons, [56] and [58], by (Copy) 56] reverse1*(X, x, y) >= y because [57], by (Select) 57] y >= y by (Var) 58] reverse1*(X, x, y) >= _|_ by (Bot) 59] reverse1*(X, x, y) >= x because [60], by (Select) 60] x >= x by (Var) 61] reverse1*(X) >= _|_ by (Bot) 62] reverse1*(X) >= X because [63], by (Select) 63] X >= X by (Meta) We can thus remove the following rules: reverse(X) => foldl(iconsc, nil, 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]): app(nil, X) >? X app(cons(X, Y), Z) >? cons(X, app(Y, Z)) foldl(F, X, nil) >? X foldl(F, X, cons(Y, Z)) >? foldl(F, F X Y, Z) iconsc >? /\x./\y.cons(y, x) reverse1(X) >? foldl(/\x./\y.app(cons(y, nil), x), nil, X) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[@_{o -> o}(x_1, x_2)]] = @_{o -> o}(x_2, x_1) [[foldl(x_1, x_2, x_3)]] = foldl(x_3, x_2, x_1) We choose Lex = {@_{o -> o}, foldl} and Mul = {@_{o -> o -> o}, app, cons, iconsc, nil, reverse1}, and the following precedence: iconsc > reverse1 > @_{o -> o} = foldl > app > nil > @_{o -> o -> o} > cons Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: app(nil, X) >= X app(cons(X, Y), Z) > cons(X, app(Y, Z)) foldl(F, X, nil) >= X foldl(F, X, cons(Y, Z)) > foldl(F, @_{o -> o}(@_{o -> o -> o}(F, X), Y), Z) iconsc > /\x./\y.cons(y, x) reverse1(X) >= foldl(/\x./\y.app(cons(y, nil), x), nil, X) With these choices, we have: 1] app(nil, X) >= X because [2], by (Star) 2] app*(nil, X) >= X because [3], by (Select) 3] X >= X by (Meta) 4] app(cons(X, Y), Z) > cons(X, app(Y, Z)) because [5], by definition 5] app*(cons(X, Y), Z) >= cons(X, app(Y, Z)) because app > cons, [6] and [10], by (Copy) 6] app*(cons(X, Y), Z) >= X because [7], by (Select) 7] cons(X, Y) >= X because [8], by (Star) 8] cons*(X, Y) >= X because [9], by (Select) 9] X >= X by (Meta) 10] app*(cons(X, Y), Z) >= app(Y, Z) because app in Mul, [11] and [14], by (Stat) 11] cons(X, Y) > Y because [12], by definition 12] cons*(X, Y) >= Y because [13], by (Select) 13] Y >= Y by (Meta) 14] Z >= Z by (Meta) 15] foldl(F, X, nil) >= X because [16], by (Star) 16] foldl*(F, X, nil) >= X because [17], by (Select) 17] X >= X by (Meta) 18] foldl(F, X, cons(Y, Z)) > foldl(F, @_{o -> o}(@_{o -> o -> o}(F, X), Y), Z) because [19], by definition 19] foldl*(F, X, cons(Y, Z)) >= foldl(F, @_{o -> o}(@_{o -> o -> o}(F, X), Y), Z) because [20], [23], [25] and [34], by (Stat) 20] cons(Y, Z) > Z because [21], by definition 21] cons*(Y, Z) >= Z because [22], by (Select) 22] Z >= Z by (Meta) 23] foldl*(F, X, cons(Y, Z)) >= F because [24], by (Select) 24] F >= F by (Meta) 25] foldl*(F, X, cons(Y, Z)) >= @_{o -> o}(@_{o -> o -> o}(F, X), Y) because foldl = @_{o -> o}, [26], [29] and [32], by (Stat) 26] cons(Y, Z) > Y because [27], by definition 27] cons*(Y, Z) >= Y because [28], by (Select) 28] Y >= Y by (Meta) 29] foldl*(F, X, cons(Y, Z)) >= @_{o -> o -> o}(F, X) because foldl > @_{o -> o -> o}, [23] and [30], by (Copy) 30] foldl*(F, X, cons(Y, Z)) >= X because [31], by (Select) 31] X >= X by (Meta) 32] foldl*(F, X, cons(Y, Z)) >= Y because [33], by (Select) 33] cons(Y, Z) >= Y because [27], by (Star) 34] foldl*(F, X, cons(Y, Z)) >= Z because [35], by (Select) 35] cons(Y, Z) >= Z because [21], by (Star) 36] iconsc > /\x./\y.cons(y, x) because [37], by definition 37] iconsc* >= /\y./\z.cons(z, y) because [38], by (F-Abs) 38] iconsc*(x) >= /\z.cons(z, x) because [39], by (F-Abs) 39] iconsc*(x, y) >= cons(y, x) because iconsc > cons, [40] and [42], by (Copy) 40] iconsc*(x, y) >= y because [41], by (Select) 41] y >= y by (Var) 42] iconsc*(x, y) >= x because [43], by (Select) 43] x >= x by (Var) 44] reverse1(X) >= foldl(/\x./\y.app(cons(y, nil), x), nil, X) because [45], by (Star) 45] reverse1*(X) >= foldl(/\x./\y.app(cons(y, nil), x), nil, X) because reverse1 > foldl, [46], [55] and [56], by (Copy) 46] reverse1*(X) >= /\y./\z.app(cons(z, nil), y) because [47], by (F-Abs) 47] reverse1*(X, x) >= /\z.app(cons(z, nil), x) because [48], by (F-Abs) 48] reverse1*(X, x, y) >= app(cons(y, nil), x) because reverse1 > app, [49] and [53], by (Copy) 49] reverse1*(X, x, y) >= cons(y, nil) because reverse1 > cons, [50] and [52], by (Copy) 50] reverse1*(X, x, y) >= y because [51], by (Select) 51] y >= y by (Var) 52] reverse1*(X, x, y) >= nil because reverse1 > nil, by (Copy) 53] reverse1*(X, x, y) >= x because [54], by (Select) 54] x >= x by (Var) 55] reverse1*(X) >= nil because reverse1 > nil, by (Copy) 56] reverse1*(X) >= X because [57], by (Select) 57] X >= X by (Meta) We can thus remove the following rules: app(cons(X, Y), Z) => cons(X, app(Y, Z)) foldl(F, X, cons(Y, Z)) => foldl(F, F X Y, Z) iconsc => /\x./\y.cons(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]): app(nil, X) >? X foldl(F, X, nil) >? X reverse1(X) >? foldl(/\x./\y.app(cons(y, nil), x), nil, X) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[nil]] = _|_ We choose Lex = {} and Mul = {app, cons, foldl, reverse1}, and the following precedence: reverse1 > foldl > app > cons Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: app(_|_, X) >= X foldl(F, X, _|_) >= X reverse1(X) > foldl(/\x./\y.app(cons(y, _|_), x), _|_, X) With these choices, we have: 1] app(_|_, X) >= X because [2], by (Star) 2] app*(_|_, X) >= X because [3], by (Select) 3] X >= X by (Meta) 4] foldl(F, X, _|_) >= X because [5], by (Star) 5] foldl*(F, X, _|_) >= X because [6], by (Select) 6] X >= X by (Meta) 7] reverse1(X) > foldl(/\x./\y.app(cons(y, _|_), x), _|_, X) because [8], by definition 8] reverse1*(X) >= foldl(/\x./\y.app(cons(y, _|_), x), _|_, X) because reverse1 > foldl, [9], [18] and [19], by (Copy) 9] reverse1*(X) >= /\y./\z.app(cons(z, _|_), y) because [10], by (F-Abs) 10] reverse1*(X, x) >= /\z.app(cons(z, _|_), x) because [11], by (F-Abs) 11] reverse1*(X, x, y) >= app(cons(y, _|_), x) because reverse1 > app, [12] and [16], by (Copy) 12] reverse1*(X, x, y) >= cons(y, _|_) because reverse1 > cons, [13] and [15], by (Copy) 13] reverse1*(X, x, y) >= y because [14], by (Select) 14] y >= y by (Var) 15] reverse1*(X, x, y) >= _|_ by (Bot) 16] reverse1*(X, x, y) >= x because [17], by (Select) 17] x >= x by (Var) 18] reverse1*(X) >= _|_ by (Bot) 19] reverse1*(X) >= X because [20], by (Select) 20] X >= X by (Meta) We can thus remove the following rules: reverse1(X) => foldl(/\x./\y.app(cons(y, nil), x), nil, 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]): app(nil, X) >? X foldl(F, X, nil) >? X We use a recursive path ordering as defined in [Kop12, Chapter 5]. We choose Lex = {} and Mul = {app, foldl, nil}, and the following precedence: foldl > nil > app With these choices, we have: 1] app(nil, X) > X because [2], by definition 2] app*(nil, X) >= X because [3], by (Select) 3] X >= X by (Meta) 4] foldl(F, X, nil) >= X because [5], by (Star) 5] foldl*(F, X, nil) >= X because [6], by (Select) 6] X >= X by (Meta) We can thus remove the following rules: app(nil, X) => 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]): foldl(F, X, nil) >? X We use a recursive path ordering as defined in [Kop12, Chapter 5]. We choose Lex = {} and Mul = {foldl, nil}, and the following precedence: nil > foldl With these choices, we have: 1] foldl(F, X, nil) > X because [2], by definition 2] foldl*(F, X, nil) >= X because [3], by (Select) 3] X >= X by (Meta) We can thus remove the following rules: foldl(F, X, nil) => X 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.