9.22/9.29 YES 9.29/9.33 We consider the system theBenchmark. 9.29/9.33 9.29/9.33 Alphabet: 9.29/9.33 9.29/9.33 0 : [] --> nat 9.29/9.33 cons : [nat * list] --> list 9.29/9.33 foldl : [nat -> nat -> nat * nat * list] --> nat 9.29/9.33 nil : [] --> list 9.29/9.33 plusc : [] --> nat -> nat -> nat 9.29/9.33 s : [nat] --> nat 9.29/9.33 sum : [list] --> nat 9.29/9.33 xap : [nat -> nat -> nat * nat] --> nat -> nat 9.29/9.33 yap : [nat -> nat * nat] --> nat 9.29/9.33 9.29/9.33 Rules: 9.29/9.33 9.29/9.33 foldl(/\x./\y.yap(xap(f, x), y), z, nil) => z 9.29/9.33 foldl(/\x./\y.yap(xap(f, x), y), z, cons(u, v)) => foldl(/\w./\x'.yap(xap(f, w), x'), yap(xap(f, z), u), v) 9.29/9.33 plusc x 0 => x 9.29/9.33 plusc x s(y) => s(plusc x y) 9.29/9.33 sum(x) => foldl(/\y./\z.yap(xap(plusc, y), z), 0, x) 9.29/9.33 xap(f, x) => f x 9.29/9.33 yap(f, x) => f x 9.29/9.33 9.29/9.33 This AFS is converted to an AFSM simply by replacing all free variables by meta-variables (with arity 0). 9.29/9.33 9.29/9.33 Symbol xap 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: 9.29/9.33 9.29/9.33 Alphabet: 9.29/9.33 9.29/9.33 0 : [] --> nat 9.29/9.33 cons : [nat * list] --> list 9.29/9.33 foldl : [nat -> nat -> nat * nat * list] --> nat 9.29/9.33 nil : [] --> list 9.29/9.33 plusc : [nat] --> nat -> nat 9.29/9.33 s : [nat] --> nat 9.29/9.33 sum : [list] --> nat 9.29/9.33 yap : [nat -> nat * nat] --> nat 9.29/9.33 9.29/9.33 Rules: 9.29/9.33 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, nil) => X 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, cons(Y, Z)) => foldl(/\z./\u.yap(F(z), u), yap(F(X), Y), Z) 9.29/9.33 plusc(X) 0 => X 9.29/9.33 plusc(X) s(Y) => s(plusc(X) Y) 9.29/9.33 sum(X) => foldl(/\x./\y.yap(plusc(x), y), 0, X) 9.29/9.33 yap(F, X) => F X 9.29/9.33 9.29/9.33 We use rule removal, following [Kop12, Theorem 2.23]. 9.29/9.33 9.29/9.33 This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 9.29/9.33 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, nil) >? X 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >? foldl(/\z./\u.yap(F(z), u), yap(F(X), Y), Z) 9.29/9.33 plusc(X) 0 >? X 9.29/9.33 plusc(X) s(Y) >? s(plusc(X) Y) 9.29/9.33 sum(X) >? foldl(/\x./\y.yap(plusc(x), y), 0, X) 9.29/9.33 yap(F, X) >? F X 9.29/9.33 9.29/9.33 We use a recursive path ordering as defined in [Kop12, Chapter 5]. 9.29/9.33 9.29/9.33 Argument functions: 9.29/9.33 9.29/9.33 [[0]] = _|_ 9.29/9.33 [[foldl(x_1, x_2, x_3)]] = foldl(x_3, x_1, x_2) 9.29/9.33 [[s(x_1)]] = x_1 9.29/9.33 9.29/9.33 We choose Lex = {foldl} and Mul = {@_{o -> o}, cons, nil, plusc, sum, yap}, and the following precedence: nil > sum > plusc > cons > yap > @_{o -> o} > foldl 9.29/9.33 9.29/9.33 Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: 9.29/9.33 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, nil) >= X 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= foldl(/\x./\y.yap(F(x), y), yap(F(X), Y), Z) 9.29/9.33 @_{o -> o}(plusc(X), _|_) >= X 9.29/9.33 @_{o -> o}(plusc(X), Y) >= @_{o -> o}(plusc(X), Y) 9.29/9.33 sum(X) >= foldl(/\x./\y.yap(plusc(x), y), _|_, X) 9.29/9.33 yap(F, X) > @_{o -> o}(F, X) 9.29/9.33 9.29/9.33 With these choices, we have: 9.29/9.33 9.29/9.33 1] foldl(/\x./\y.yap(F(x), y), X, nil) >= X because [2], by (Star) 9.29/9.33 2] foldl*(/\x./\y.yap(F(x), y), X, nil) >= X because [3], by (Select) 9.29/9.33 3] X >= X by (Meta) 9.29/9.33 9.29/9.33 4] foldl(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= foldl(/\x./\y.yap(F(x), y), yap(F(X), Y), Z) because [5], by (Star) 9.29/9.33 5] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= foldl(/\x./\y.yap(F(x), y), yap(F(X), Y), Z) because [6], [9], [16] and [25], by (Stat) 9.29/9.33 6] cons(Y, Z) > Z because [7], by definition 9.29/9.33 7] cons*(Y, Z) >= Z because [8], by (Select) 9.29/9.33 8] Z >= Z by (Meta) 9.29/9.33 9] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= /\x./\y.yap(F(x), y) because [10], by (Select) 9.29/9.33 10] /\x./\z.yap(F(x), z) >= /\x./\z.yap(F(x), z) because [11], by (Abs) 9.29/9.33 11] /\z.yap(F(y), z) >= /\z.yap(F(y), z) because [12], by (Abs) 9.29/9.33 12] yap(F(y), x) >= yap(F(y), x) because yap in Mul, [13] and [15], by (Fun) 9.29/9.33 13] F(y) >= F(y) because [14], by (Meta) 9.29/9.33 14] y >= y by (Var) 9.29/9.33 15] x >= x by (Var) 9.29/9.33 16] foldl*(/\z./\u.yap(F(z), u), X, cons(Y, Z)) >= yap(F(X), Y) because [17], by (Select) 9.29/9.33 17] yap(F(foldl*(/\z./\u.yap(F(z), u), X, cons(Y, Z))), foldl*(/\v./\w.yap(F(v), w), X, cons(Y, Z))) >= yap(F(X), Y) because yap in Mul, [18] and [21], by (Fun) 9.29/9.33 18] F(foldl*(/\z./\u.yap(F(z), u), X, cons(Y, Z))) >= F(X) because [19], by (Meta) 9.29/9.33 19] foldl*(/\z./\u.yap(F(z), u), X, cons(Y, Z)) >= X because [20], by (Select) 9.29/9.33 20] X >= X by (Meta) 9.29/9.33 21] foldl*(/\z./\u.yap(F(z), u), X, cons(Y, Z)) >= Y because [22], by (Select) 9.29/9.33 22] cons(Y, Z) >= Y because [23], by (Star) 9.29/9.33 23] cons*(Y, Z) >= Y because [24], by (Select) 9.29/9.33 24] Y >= Y by (Meta) 9.29/9.33 25] foldl*(/\z./\u.yap(F(z), u), X, cons(Y, Z)) >= Z because [26], by (Select) 9.29/9.33 26] cons(Y, Z) >= Z because [7], by (Star) 9.29/9.33 9.29/9.33 27] @_{o -> o}(plusc(X), _|_) >= X because [28], by (Star) 9.29/9.33 28] @_{o -> o}*(plusc(X), _|_) >= X because [29], by (Select) 9.29/9.33 29] plusc(X) @_{o -> o}*(plusc(X), _|_) >= X because [30] 9.29/9.33 30] plusc*(X, @_{o -> o}*(plusc(X), _|_)) >= X because [31], by (Select) 9.29/9.33 31] X >= X by (Meta) 9.29/9.33 9.29/9.33 32] @_{o -> o}(plusc(X), Y) >= @_{o -> o}(plusc(X), Y) because @_{o -> o} in Mul, [33] and [35], by (Fun) 9.29/9.33 33] plusc(X) >= plusc(X) because plusc in Mul and [34], by (Fun) 9.29/9.33 34] X >= X by (Meta) 9.29/9.33 35] Y >= Y by (Meta) 9.29/9.33 9.29/9.33 36] sum(X) >= foldl(/\x./\y.yap(plusc(x), y), _|_, X) because [37], by (Star) 9.29/9.33 37] sum*(X) >= foldl(/\x./\y.yap(plusc(x), y), _|_, X) because sum > foldl, [38], [46] and [47], by (Copy) 9.29/9.33 38] sum*(X) >= /\y./\z.yap(plusc(y), z) because [39], by (F-Abs) 9.29/9.33 39] sum*(X, x) >= /\z.yap(plusc(x), z) because [40], by (F-Abs) 9.29/9.33 40] sum*(X, x, y) >= yap(plusc(x), y) because sum > yap, [41] and [44], by (Copy) 9.29/9.33 41] sum*(X, x, y) >= plusc(x) because sum > plusc and [42], by (Copy) 9.29/9.33 42] sum*(X, x, y) >= x because [43], by (Select) 9.29/9.33 43] x >= x by (Var) 9.29/9.33 44] sum*(X, x, y) >= y because [45], by (Select) 9.29/9.33 45] y >= y by (Var) 9.29/9.33 46] sum*(X) >= _|_ by (Bot) 9.29/9.33 47] sum*(X) >= X because [48], by (Select) 9.29/9.33 48] X >= X by (Meta) 9.29/9.33 9.29/9.33 49] yap(F, X) > @_{o -> o}(F, X) because [50], by definition 9.29/9.33 50] yap*(F, X) >= @_{o -> o}(F, X) because yap > @_{o -> o}, [51] and [53], by (Copy) 9.29/9.33 51] yap*(F, X) >= F because [52], by (Select) 9.29/9.33 52] F >= F by (Meta) 9.29/9.33 53] yap*(F, X) >= X because [54], by (Select) 9.29/9.33 54] X >= X by (Meta) 9.29/9.33 9.29/9.33 We can thus remove the following rules: 9.29/9.33 9.29/9.33 yap(F, X) => F X 9.29/9.33 9.29/9.33 We use rule removal, following [Kop12, Theorem 2.23]. 9.29/9.33 9.29/9.33 This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 9.29/9.33 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, nil) >? X 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >? foldl(/\z./\u.yap(F(z), u), yap(F(X), Y), Z) 9.29/9.33 plusc(X) 0 >? X 9.29/9.33 plusc(X) s(Y) >? s(plusc(X) Y) 9.29/9.33 sum(X) >? foldl(/\x./\y.yap(plusc(x), y), 0, X) 9.29/9.33 9.29/9.33 We use a recursive path ordering as defined in [Kop12, Chapter 5]. 9.29/9.33 9.29/9.33 Argument functions: 9.29/9.33 9.29/9.33 [[0]] = _|_ 9.29/9.33 [[foldl(x_1, x_2, x_3)]] = foldl(x_3, x_1, x_2) 9.29/9.33 9.29/9.33 We choose Lex = {foldl} and Mul = {@_{o -> o}, cons, nil, plusc, s, sum, yap}, and the following precedence: nil > sum > plusc > @_{o -> o} > s > foldl > cons > yap 9.29/9.33 9.29/9.33 Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: 9.29/9.33 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, nil) >= X 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, cons(Y, Z)) > foldl(/\x./\y.yap(F(x), y), yap(F(X), Y), Z) 9.29/9.33 @_{o -> o}(plusc(X), _|_) > X 9.29/9.33 @_{o -> o}(plusc(X), s(Y)) > s(@_{o -> o}(plusc(X), Y)) 9.29/9.33 sum(X) > foldl(/\x./\y.yap(plusc(x), y), _|_, X) 9.29/9.33 9.29/9.33 With these choices, we have: 9.29/9.33 9.29/9.33 1] foldl(/\x./\y.yap(F(x), y), X, nil) >= X because [2], by (Star) 9.29/9.33 2] foldl*(/\x./\y.yap(F(x), y), X, nil) >= X because [3], by (Select) 9.29/9.33 3] X >= X by (Meta) 9.29/9.33 9.29/9.33 4] foldl(/\x./\y.yap(F(x), y), X, cons(Y, Z)) > foldl(/\x./\y.yap(F(x), y), yap(F(X), Y), Z) because [5], by definition 9.29/9.33 5] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= foldl(/\x./\y.yap(F(x), y), yap(F(X), Y), Z) because [6], [9], [19] and [29], by (Stat) 9.29/9.33 6] cons(Y, Z) > Z because [7], by definition 9.29/9.33 7] cons*(Y, Z) >= Z because [8], by (Select) 9.29/9.33 8] Z >= Z by (Meta) 9.29/9.33 9] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= /\x./\y.yap(F(x), y) because [10], by (F-Abs) 9.29/9.33 10] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z), z) >= /\x.yap(F(z), x) because [11], by (F-Abs) 9.29/9.33 11] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z), z, u) >= yap(F(z), u) because foldl > yap, [12] and [17], by (Copy) 9.29/9.33 12] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z), z, u) >= F(z) because [13], by (Select) 9.29/9.33 13] /\x.yap(F(foldl*(/\y./\v.yap(F(y), v), X, cons(Y, Z), z, u)), x) >= F(z) because [14], by (Eta)[Kop13:2] 9.29/9.33 14] F(foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z), z, u)) >= F(z) because [15], by (Meta) 9.29/9.33 15] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z), z, u) >= z because [16], by (Select) 9.29/9.33 16] z >= z by (Var) 9.29/9.33 17] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z), z, u) >= u because [18], by (Select) 9.29/9.33 18] u >= u by (Var) 9.29/9.33 19] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= yap(F(X), Y) because foldl > yap, [20] and [25], by (Copy) 9.29/9.33 20] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= F(X) because [21], by (Select) 9.29/9.33 21] /\x.yap(F(foldl*(/\y./\v.yap(F(y), v), X, cons(Y, Z))), x) >= F(X) because [22], by (Eta)[Kop13:2] 9.29/9.33 22] F(foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z))) >= F(X) because [23], by (Meta) 9.29/9.33 23] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= X because [24], by (Select) 9.29/9.33 24] X >= X by (Meta) 9.29/9.33 25] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= Y because [26], by (Select) 9.29/9.33 26] cons(Y, Z) >= Y because [27], by (Star) 9.29/9.33 27] cons*(Y, Z) >= Y because [28], by (Select) 9.29/9.33 28] Y >= Y by (Meta) 9.29/9.33 29] foldl*(/\x./\y.yap(F(x), y), X, cons(Y, Z)) >= Z because [30], by (Select) 9.29/9.33 30] cons(Y, Z) >= Z because [7], by (Star) 9.29/9.33 9.29/9.33 31] @_{o -> o}(plusc(X), _|_) > X because [32], by definition 9.29/9.33 32] @_{o -> o}*(plusc(X), _|_) >= X because [33], by (Select) 9.29/9.33 33] plusc(X) @_{o -> o}*(plusc(X), _|_) >= X because [34] 9.29/9.33 34] plusc*(X, @_{o -> o}*(plusc(X), _|_)) >= X because [35], by (Select) 9.29/9.33 35] X >= X by (Meta) 9.29/9.33 9.29/9.33 36] @_{o -> o}(plusc(X), s(Y)) > s(@_{o -> o}(plusc(X), Y)) because [37], by definition 9.29/9.33 37] @_{o -> o}*(plusc(X), s(Y)) >= s(@_{o -> o}(plusc(X), Y)) because [38], by (Select) 9.29/9.33 38] plusc(X) @_{o -> o}*(plusc(X), s(Y)) >= s(@_{o -> o}(plusc(X), Y)) because [39] 9.29/9.33 39] plusc*(X, @_{o -> o}*(plusc(X), s(Y))) >= s(@_{o -> o}(plusc(X), Y)) because plusc > s and [40], by (Copy) 9.29/9.33 40] plusc*(X, @_{o -> o}*(plusc(X), s(Y))) >= @_{o -> o}(plusc(X), Y) because [41], by (Select) 9.29/9.33 41] @_{o -> o}*(plusc(X), s(Y)) >= @_{o -> o}(plusc(X), Y) because @_{o -> o} in Mul, [42] and [44], by (Stat) 9.29/9.33 42] plusc(X) >= plusc(X) because plusc in Mul and [43], by (Fun) 9.29/9.33 43] X >= X by (Meta) 9.29/9.33 44] s(Y) > Y because [45], by definition 9.29/9.33 45] s*(Y) >= Y because [46], by (Select) 9.29/9.33 46] Y >= Y by (Meta) 9.29/9.33 9.29/9.33 47] sum(X) > foldl(/\x./\y.yap(plusc(x), y), _|_, X) because [48], by definition 9.29/9.33 48] sum*(X) >= foldl(/\x./\y.yap(plusc(x), y), _|_, X) because sum > foldl, [49], [57] and [58], by (Copy) 9.29/9.33 49] sum*(X) >= /\y./\z.yap(plusc(y), z) because [50], by (F-Abs) 9.29/9.33 50] sum*(X, x) >= /\z.yap(plusc(x), z) because [51], by (F-Abs) 9.29/9.33 51] sum*(X, x, y) >= yap(plusc(x), y) because sum > yap, [52] and [55], by (Copy) 9.29/9.33 52] sum*(X, x, y) >= plusc(x) because sum > plusc and [53], by (Copy) 9.29/9.33 53] sum*(X, x, y) >= x because [54], by (Select) 9.29/9.33 54] x >= x by (Var) 9.29/9.33 55] sum*(X, x, y) >= y because [56], by (Select) 9.29/9.33 56] y >= y by (Var) 9.29/9.33 57] sum*(X) >= _|_ by (Bot) 9.29/9.33 58] sum*(X) >= X because [59], by (Select) 9.29/9.33 59] X >= X by (Meta) 9.29/9.33 9.29/9.33 We can thus remove the following rules: 9.29/9.33 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, cons(Y, Z)) => foldl(/\z./\u.yap(F(z), u), yap(F(X), Y), Z) 9.29/9.33 plusc(X) 0 => X 9.29/9.33 plusc(X) s(Y) => s(plusc(X) Y) 9.29/9.33 sum(X) => foldl(/\x./\y.yap(plusc(x), y), 0, X) 9.29/9.33 9.29/9.33 We use rule removal, following [Kop12, Theorem 2.23]. 9.29/9.33 9.29/9.33 This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 9.29/9.33 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, nil) >? X 9.29/9.33 9.29/9.33 We orient these requirements with a polynomial interpretation in the natural numbers. 9.29/9.33 9.29/9.33 The following interpretation satisfies the requirements: 9.29/9.33 9.29/9.33 foldl = \G0y1y2.3 + y1 + y2 + G0(0,0) 9.29/9.33 nil = 3 9.29/9.33 yap = \G0y1.3 + y1 + G0(0) 9.29/9.33 9.29/9.33 Using this interpretation, the requirements translate to: 9.29/9.33 9.29/9.33 [[foldl(/\x./\y.yap(_F0(x), y), _x1, nil)]] = 9 + x1 + F0(0,0) > x1 = [[_x1]] 9.29/9.33 9.29/9.33 We can thus remove the following rules: 9.29/9.33 9.29/9.33 foldl(/\x./\y.yap(F(x), y), X, nil) => X 9.29/9.33 9.29/9.33 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. 9.29/9.33 9.29/9.33 9.29/9.33 +++ Citations +++ 9.29/9.33 9.29/9.33 [Kop12] C. Kop. Higher Order Termination. PhD Thesis, 2012. 9.29/9.33 [Kop13:2] C. Kop. StarHorpo with an Eta-Rule. Unpublished manuscript, http://cl-informatik.uibk.ac.at/users/kop/etahorpo.pdf, 2013. 9.29/9.34 EOF