0.00/0.42 YES 0.00/0.45 We consider the system theBenchmark. 0.00/0.45 0.00/0.45 Alphabet: 0.00/0.45 0.00/0.45 0 : [] --> nat 0.00/0.45 cons : [] --> nat -> natlist -> natlist 0.00/0.45 foldl : [] --> (nat -> nat -> nat) -> nat -> natlist -> nat 0.00/0.45 nil : [] --> natlist 0.00/0.45 plus : [] --> nat -> nat -> nat 0.00/0.45 sum : [] --> natlist -> nat 0.00/0.45 0.00/0.45 Rules: 0.00/0.45 0.00/0.45 foldl (/\x./\y.f x y) z nil => z 0.00/0.45 foldl (/\x./\y.f x y) z (cons u v) => foldl (/\w./\x'.f w x') (f z u) v 0.00/0.45 sum x => foldl (/\y./\z.plus y z) 0 x 0.00/0.45 0.00/0.45 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. 0.00/0.45 0.00/0.45 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: 0.00/0.45 0.00/0.45 Alphabet: 0.00/0.45 0.00/0.45 0 : [] --> nat 0.00/0.45 cons : [nat * natlist] --> natlist 0.00/0.45 foldl : [nat -> nat -> nat * nat * natlist] --> nat 0.00/0.45 nil : [] --> natlist 0.00/0.45 plus : [] --> nat -> nat -> nat 0.00/0.45 sum : [natlist] --> nat 0.00/0.45 ~AP1 : [nat -> nat -> nat * nat] --> nat -> nat 0.00/0.45 0.00/0.45 Rules: 0.00/0.45 0.00/0.45 foldl(/\x./\y.~AP1(F, x) y, X, nil) => X 0.00/0.45 foldl(/\x./\y.~AP1(F, x) y, X, cons(Y, Z)) => foldl(/\z./\u.~AP1(F, z) u, ~AP1(F, X) Y, Z) 0.00/0.45 sum(X) => foldl(/\x./\y.~AP1(plus, x) y, 0, X) 0.00/0.45 ~AP1(F, X) => F X 0.00/0.45 0.00/0.45 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: 0.00/0.45 0.00/0.45 Alphabet: 0.00/0.45 0.00/0.45 0 : [] --> nat 0.00/0.45 cons : [nat * natlist] --> natlist 0.00/0.45 foldl : [nat -> nat -> nat * nat * natlist] --> nat 0.00/0.45 nil : [] --> natlist 0.00/0.45 plus : [nat * nat] --> nat 0.00/0.45 sum : [natlist] --> nat 0.00/0.45 0.00/0.45 Rules: 0.00/0.45 0.00/0.45 foldl(/\x./\y.X(x, y), Y, nil) => Y 0.00/0.45 foldl(/\x./\y.X(x, y), Y, cons(Z, U)) => foldl(/\z./\u.X(z, u), X(Y, Z), U) 0.00/0.45 sum(X) => foldl(/\x./\y.plus(x, y), 0, X) 0.00/0.45 0.00/0.45 We use rule removal, following [Kop12, Theorem 2.23]. 0.00/0.45 0.00/0.45 This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 0.00/0.45 0.00/0.45 foldl(/\x./\y.X(x, y), Y, nil) >? Y 0.00/0.45 foldl(/\x./\y.X(x, y), Y, cons(Z, U)) >? foldl(/\z./\u.X(z, u), X(Y, Z), U) 0.00/0.45 sum(X) >? foldl(/\x./\y.plus(x, y), 0, X) 0.00/0.45 0.00/0.45 We use a recursive path ordering as defined in [Kop12, Chapter 5]. 0.00/0.45 0.00/0.45 Argument functions: 0.00/0.45 0.00/0.45 [[0]] = _|_ 0.00/0.45 [[foldl(x_1, x_2, x_3)]] = foldl(x_3, x_2, x_1) 0.00/0.45 0.00/0.45 We choose Lex = {foldl} and Mul = {cons, nil, plus, sum}, and the following precedence: cons > nil > sum > foldl > plus 0.00/0.45 0.00/0.45 Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: 0.00/0.45 0.00/0.45 foldl(/\x./\y.X(x, y), Y, nil) > Y 0.00/0.45 foldl(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldl(/\x./\y.X(x, y), X(Y, Z), U) 0.00/0.45 sum(X) >= foldl(/\x./\y.plus(x, y), _|_, X) 0.00/0.45 0.00/0.45 With these choices, we have: 0.00/0.45 0.00/0.45 1] foldl(/\x./\y.X(x, y), Y, nil) > Y because [2], by definition 0.00/0.45 2] foldl*(/\x./\y.X(x, y), Y, nil) >= Y because [3], by (Select) 0.00/0.45 3] Y >= Y by (Meta) 0.00/0.45 0.00/0.45 4] foldl(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldl(/\x./\y.X(x, y), X(Y, Z), U) because [5], by (Star) 0.00/0.45 5] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldl(/\x./\y.X(x, y), X(Y, Z), U) because [6], [9], [15] and [23], by (Stat) 0.00/0.45 6] cons(Z, U) > U because [7], by definition 0.00/0.45 7] cons*(Z, U) >= U because [8], by (Select) 0.00/0.45 8] U >= U by (Meta) 0.00/0.45 9] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= /\x./\y.X(x, y) because [10], by (Select) 0.00/0.45 10] /\x./\z.X(x, z) >= /\x./\z.X(x, z) because [11], by (Abs) 0.00/0.45 11] /\z.X(y, z) >= /\z.X(y, z) because [12], by (Abs) 0.00/0.45 12] X(y, x) >= X(y, x) because [13] and [14], by (Meta) 0.00/0.45 13] y >= y by (Var) 0.00/0.45 14] x >= x by (Var) 0.00/0.45 15] foldl*(/\z./\u.X(z, u), Y, cons(Z, U)) >= X(Y, Z) because [16], by (Select) 0.00/0.45 16] X(foldl*(/\z./\u.X(z, u), Y, cons(Z, U)), foldl*(/\v./\w.X(v, w), Y, cons(Z, U))) >= X(Y, Z) because [17] and [19], by (Meta) 0.00/0.45 17] foldl*(/\z./\u.X(z, u), Y, cons(Z, U)) >= Y because [18], by (Select) 0.00/0.45 18] Y >= Y by (Meta) 0.00/0.45 19] foldl*(/\z./\u.X(z, u), Y, cons(Z, U)) >= Z because [20], by (Select) 0.00/0.45 20] cons(Z, U) >= Z because [21], by (Star) 0.00/0.45 21] cons*(Z, U) >= Z because [22], by (Select) 0.00/0.45 22] Z >= Z by (Meta) 0.00/0.45 23] foldl*(/\z./\u.X(z, u), Y, cons(Z, U)) >= U because [24], by (Select) 0.00/0.45 24] cons(Z, U) >= U because [7], by (Star) 0.00/0.45 0.00/0.45 25] sum(X) >= foldl(/\x./\y.plus(x, y), _|_, X) because [26], by (Star) 0.00/0.45 26] sum*(X) >= foldl(/\x./\y.plus(x, y), _|_, X) because sum > foldl, [27], [34] and [35], by (Copy) 0.00/0.45 27] sum*(X) >= /\y./\z.plus(y, z) because [28], by (F-Abs) 0.00/0.45 28] sum*(X, x) >= /\z.plus(x, z) because [29], by (F-Abs) 0.00/0.45 29] sum*(X, x, y) >= plus(x, y) because sum > plus, [30] and [32], by (Copy) 0.00/0.45 30] sum*(X, x, y) >= x because [31], by (Select) 0.00/0.45 31] x >= x by (Var) 0.00/0.45 32] sum*(X, x, y) >= y because [33], by (Select) 0.00/0.45 33] y >= y by (Var) 0.00/0.45 34] sum*(X) >= _|_ by (Bot) 0.00/0.45 35] sum*(X) >= X because [36], by (Select) 0.00/0.45 36] X >= X by (Meta) 0.00/0.45 0.00/0.45 We can thus remove the following rules: 0.00/0.45 0.00/0.45 foldl(/\x./\y.X(x, y), Y, nil) => Y 0.00/0.45 0.00/0.45 We use rule removal, following [Kop12, Theorem 2.23]. 0.00/0.45 0.00/0.45 This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 0.00/0.45 0.00/0.45 foldl(/\x./\y.X(x, y), Y, cons(Z, U)) >? foldl(/\z./\u.X(z, u), X(Y, Z), U) 0.00/0.45 sum(X) >? foldl(/\x./\y.plus(x, y), 0, X) 0.00/0.45 0.00/0.45 We use a recursive path ordering as defined in [Kop12, Chapter 5]. 0.00/0.45 0.00/0.45 Argument functions: 0.00/0.45 0.00/0.45 [[0]] = _|_ 0.00/0.45 [[foldl(x_1, x_2, x_3)]] = foldl(x_3, x_2, x_1) 0.00/0.45 0.00/0.45 We choose Lex = {foldl} and Mul = {cons, plus, sum}, and the following precedence: cons > sum > foldl > plus 0.00/0.45 0.00/0.45 Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: 0.00/0.45 0.00/0.45 foldl(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldl(/\x./\y.X(x, y), X(Y, Z), U) 0.00/0.45 sum(X) > foldl(/\x./\y.plus(x, y), _|_, X) 0.00/0.45 0.00/0.45 With these choices, we have: 0.00/0.45 0.00/0.45 1] foldl(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldl(/\x./\y.X(x, y), X(Y, Z), U) because [2], by (Star) 0.00/0.45 2] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldl(/\x./\y.X(x, y), X(Y, Z), U) because [3], [6], [12] and [20], by (Stat) 0.00/0.45 3] cons(Z, U) > U because [4], by definition 0.00/0.45 4] cons*(Z, U) >= U because [5], by (Select) 0.00/0.45 5] U >= U by (Meta) 0.00/0.45 6] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= /\x./\y.X(x, y) because [7], by (Select) 0.00/0.45 7] /\x./\z.X(x, z) >= /\x./\z.X(x, z) because [8], by (Abs) 0.00/0.45 8] /\z.X(y, z) >= /\z.X(y, z) because [9], by (Abs) 0.00/0.45 9] X(y, x) >= X(y, x) because [10] and [11], by (Meta) 0.00/0.45 10] y >= y by (Var) 0.00/0.45 11] x >= x by (Var) 0.00/0.45 12] foldl*(/\z./\u.X(z, u), Y, cons(Z, U)) >= X(Y, Z) because [13], by (Select) 0.00/0.45 13] X(foldl*(/\z./\u.X(z, u), Y, cons(Z, U)), foldl*(/\v./\w.X(v, w), Y, cons(Z, U))) >= X(Y, Z) because [14] and [16], by (Meta) 0.00/0.45 14] foldl*(/\z./\u.X(z, u), Y, cons(Z, U)) >= Y because [15], by (Select) 0.00/0.45 15] Y >= Y by (Meta) 0.00/0.45 16] foldl*(/\z./\u.X(z, u), Y, cons(Z, U)) >= Z because [17], by (Select) 0.00/0.45 17] cons(Z, U) >= Z because [18], by (Star) 0.00/0.45 18] cons*(Z, U) >= Z because [19], by (Select) 0.00/0.45 19] Z >= Z by (Meta) 0.00/0.45 20] foldl*(/\z./\u.X(z, u), Y, cons(Z, U)) >= U because [21], by (Select) 0.00/0.45 21] cons(Z, U) >= U because [4], by (Star) 0.00/0.45 0.00/0.45 22] sum(X) > foldl(/\x./\y.plus(x, y), _|_, X) because [23], by definition 0.00/0.45 23] sum*(X) >= foldl(/\x./\y.plus(x, y), _|_, X) because sum > foldl, [24], [31] and [32], by (Copy) 0.00/0.45 24] sum*(X) >= /\y./\z.plus(y, z) because [25], by (F-Abs) 0.00/0.45 25] sum*(X, x) >= /\z.plus(x, z) because [26], by (F-Abs) 0.00/0.45 26] sum*(X, x, y) >= plus(x, y) because sum > plus, [27] and [29], by (Copy) 0.00/0.45 27] sum*(X, x, y) >= x because [28], by (Select) 0.00/0.45 28] x >= x by (Var) 0.00/0.45 29] sum*(X, x, y) >= y because [30], by (Select) 0.00/0.45 30] y >= y by (Var) 0.00/0.45 31] sum*(X) >= _|_ by (Bot) 0.00/0.45 32] sum*(X) >= X because [33], by (Select) 0.00/0.45 33] X >= X by (Meta) 0.00/0.45 0.00/0.45 We can thus remove the following rules: 0.00/0.45 0.00/0.45 sum(X) => foldl(/\x./\y.plus(x, y), 0, X) 0.00/0.45 0.00/0.45 We use rule removal, following [Kop12, Theorem 2.23]. 0.00/0.45 0.00/0.45 This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 0.00/0.45 0.00/0.45 foldl(/\x./\y.X(x, y), Y, cons(Z, U)) >? foldl(/\z./\u.X(z, u), X(Y, Z), U) 0.00/0.45 0.00/0.45 We use a recursive path ordering as defined in [Kop12, Chapter 5]. 0.00/0.45 0.00/0.45 Argument functions: 0.00/0.45 0.00/0.45 [[foldl(x_1, x_2, x_3)]] = foldl(x_3, x_2, x_1) 0.00/0.45 0.00/0.45 We choose Lex = {foldl} and Mul = {cons}, and the following precedence: cons > foldl 0.00/0.45 0.00/0.45 Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: 0.00/0.45 0.00/0.45 foldl(/\x./\y.X(x, y), Y, cons(Z, U)) > foldl(/\x./\y.X(x, y), X(Y, Z), U) 0.00/0.45 0.00/0.45 With these choices, we have: 0.00/0.45 0.00/0.45 1] foldl(/\x./\y.X(x, y), Y, cons(Z, U)) > foldl(/\x./\y.X(x, y), X(Y, Z), U) because [2], by definition 0.00/0.45 2] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldl(/\x./\y.X(x, y), X(Y, Z), U) because [3], [6], [14] and [22], by (Stat) 0.00/0.45 3] cons(Z, U) > U because [4], by definition 0.00/0.45 4] cons*(Z, U) >= U because [5], by (Select) 0.00/0.45 5] U >= U by (Meta) 0.00/0.45 6] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= /\x./\y.X(x, y) because [7], by (F-Abs) 0.00/0.45 7] foldl*(/\x./\y.X(x, y), Y, cons(Z, U), z) >= /\x.X(z, x) because [8], by (F-Abs) 0.00/0.45 8] foldl*(/\x./\y.X(x, y), Y, cons(Z, U), z, u) >= X(z, u) because [9], by (Select) 0.00/0.45 9] X(foldl*(/\x./\y.X(x, y), Y, cons(Z, U), z, u), foldl*(/\v./\w.X(v, w), Y, cons(Z, U), z, u)) >= X(z, u) because [10] and [12], by (Meta) 0.00/0.45 10] foldl*(/\x./\y.X(x, y), Y, cons(Z, U), z, u) >= z because [11], by (Select) 0.00/0.45 11] z >= z by (Var) 0.00/0.45 12] foldl*(/\x./\y.X(x, y), Y, cons(Z, U), z, u) >= u because [13], by (Select) 0.00/0.45 13] u >= u by (Var) 0.00/0.45 14] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Y, Z) because [15], by (Select) 0.00/0.45 15] X(foldl*(/\x./\y.X(x, y), Y, cons(Z, U)), foldl*(/\v./\w.X(v, w), Y, cons(Z, U))) >= X(Y, Z) because [16] and [18], by (Meta) 0.00/0.45 16] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= Y because [17], by (Select) 0.00/0.45 17] Y >= Y by (Meta) 0.00/0.45 18] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= Z because [19], by (Select) 0.00/0.45 19] cons(Z, U) >= Z because [20], by (Star) 0.00/0.45 20] cons*(Z, U) >= Z because [21], by (Select) 0.00/0.45 21] Z >= Z by (Meta) 0.00/0.45 22] foldl*(/\x./\y.X(x, y), Y, cons(Z, U)) >= U because [23], by (Select) 0.00/0.45 23] cons(Z, U) >= U because [4], by (Star) 0.00/0.45 0.00/0.45 We can thus remove the following rules: 0.00/0.45 0.00/0.45 foldl(/\x./\y.X(x, y), Y, cons(Z, U)) => foldl(/\z./\u.X(z, u), X(Y, Z), U) 0.00/0.45 0.00/0.45 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. 0.00/0.45 0.00/0.45 0.00/0.45 +++ Citations +++ 0.00/0.45 0.00/0.45 [Kop11] C. Kop. Simplifying Algebraic Functional Systems. In Proceedings of CAI 2011, volume 6742 of LNCS. 201--215, Springer, 2011. 0.00/0.45 [Kop12] C. Kop. Higher Order Termination. PhD Thesis, 2012. 0.00/0.45 EOF