We consider the system 434. Alphabet: 0 : [] --> nat cons : [nat * natlist] --> natlist foldl : [nat -> nat -> nat * nat * natlist] --> nat nil : [] --> natlist plus : [nat * nat] --> nat sum : [natlist] --> nat Rules: foldl(/\x./\y.X(x, y), Y, nil) => Y foldl(/\x./\y.X(x, y), Y, cons(Z, U)) => foldl(/\z./\u.X(z, u), X(Y, Z), U) sum(X) => foldl(/\x./\y.plus(x, y), 0, X) We use the dependency pair framework as described in [Kop12, Ch. 6/7], with dynamic dependency pairs. We thus obtain the following dependency pair problem (P_0, R_0, minimal, formative): Dependency Pairs P_0: 0] foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> foldl#(/\z./\u.X(z, u), X(Y, Z), U) 1] foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> X(z, u) 2] foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> X(Y, Z) 3] sum#(X) =#> foldl#(/\x./\y.plus(x, y), 0, X) Rules R_0: foldl(/\x./\y.X(x, y), Y, nil) => Y foldl(/\x./\y.X(x, y), Y, cons(Z, U)) => foldl(/\z./\u.X(z, u), X(Y, Z), U) sum(X) => foldl(/\x./\y.plus(x, y), 0, X) Thus, the original system is terminating if (P_0, R_0, minimal, formative) is finite. We consider the dependency pair problem (P_0, R_0, minimal, formative). This combination (P_0, R_0) has no formative rules! We will name the empty set of rules:R_1. By [Kop12, Thm. 7.17], we may replace the dependency pair problem (P_0, R_0, minimal, formative) by (P_0, R_1, minimal, formative). Thus, the original system is terminating if (P_0, R_1, minimal, formative) is finite. We consider the dependency pair problem (P_0, R_1, minimal, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. As the system is abstraction-simple and the formative flag is set, it suffices to find a tagged reduction pair [Kop12, Def. 6.70]. Thus, we must orient: foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) >? foldl#(/\z./\u.X(z, u), X(Y, Z), U) foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) >? X(~c0, ~c1) foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) >? X(Y, Z) sum#(X) >? foldl#(/\x./\y.plus-(x, y), 0, X) plus-(X, Y) >= plus(X, Y) We apply [Kop12, Thm. 6.75] and use the following argument functions: pi( sum#(X) ) = #argfun-sum##(foldl#(/\x./\y.plus-(x, y), 0, X)) Since this representation is not advantageous for the higher-order recursive path ordering, we present the strict requirements in their unextended form, which is not problematic since for any F, s and substituion gamma: (F s)gamma beta-reduces to F(s)gamma.) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ [[foldl#(x_1, x_2, x_3)]] = foldl#(x_3, x_1, x_2) [[sum#(x_1)]] = x_1 [[~c0]] = _|_ [[~c1]] = _|_ We choose Lex = {foldl#} and Mul = {#argfun-sum##, cons, plus, plus-}, and the following precedence: cons > plus = plus- > foldl# > #argfun-sum## Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) > foldl#(/\x./\y.X(x, y), X(Y, Z), U) foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) > X(Y, Z) #argfun-sum##(foldl#(/\x./\y.plus-(x, y), _|_, X)) >= foldl#(/\x./\y.plus-(x, y), _|_, X) plus-(X, Y) >= plus(X, Y) With these choices, we have: 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 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) 3] cons(Z, U) > U because [4], by definition 4] cons*(Z, U) >= U because [5], by (Select) 5] U >= U by (Meta) 6] foldl#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= /\x./\y.X(x, y) because [7], by (Select) 7] /\x./\z.X(x, z) >= /\x./\z.X(x, z) because [8], by (Abs) 8] /\z.X(y, z) >= /\z.X(y, z) because [9], by (Abs) 9] X(y, x) >= X(y, x) because [10] and [11], by (Meta) 10] y >= y by (Var) 11] x >= x by (Var) 12] foldl#*(/\z./\u.X(z, u), Y, cons(Z, U)) >= X(Y, Z) because [13], by (Select) 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) 14] foldl#*(/\z./\u.X(z, u), Y, cons(Z, U)) >= Y because [15], by (Select) 15] Y >= Y by (Meta) 16] foldl#*(/\z./\u.X(z, u), Y, cons(Z, U)) >= Z because [17], by (Select) 17] cons(Z, U) >= Z because [18], by (Star) 18] cons*(Z, U) >= Z because [19], by (Select) 19] Z >= Z by (Meta) 20] foldl#*(/\z./\u.X(z, u), Y, cons(Z, U)) >= U because [21], by (Select) 21] cons(Z, U) >= U because [4], by (Star) 22] foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) because [23], by (Star) 23] foldl#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) because [24], by (Select) 24] X(foldl#*(/\x./\y.X(x, y), Y, cons(Z, U)), foldl#*(/\z./\u.X(z, u), Y, cons(Z, U))) >= X(_|_, _|_) because [25] and [26], by (Meta) 25] foldl#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= _|_ by (Bot) 26] foldl#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= _|_ by (Bot) 27] foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) > X(Y, Z) because [12], by definition 28] #argfun-sum##(foldl#(/\x./\y.plus-(x, y), _|_, X)) >= foldl#(/\x./\y.plus-(x, y), _|_, X) because [29], by (Star) 29] #argfun-sum##*(foldl#(/\x./\y.plus-(x, y), _|_, X)) >= foldl#(/\x./\y.plus-(x, y), _|_, X) because [30], by (Select) 30] foldl#(/\x./\y.plus-(x, y), _|_, X) >= foldl#(/\x./\y.plus-(x, y), _|_, X) because [31], [36] and [37], by (Fun) 31] /\x./\z.plus-(x, z) >= /\x./\z.plus-(x, z) because [32], by (Abs) 32] /\z.plus-(y, z) >= /\z.plus-(y, z) because [33], by (Abs) 33] plus-(y, x) >= plus-(y, x) because plus- in Mul, [34] and [35], by (Fun) 34] y >= y by (Var) 35] x >= x by (Var) 36] _|_ >= _|_ by (Bot) 37] X >= X by (Meta) 38] plus-(X, Y) >= plus(X, Y) because plus- = plus, plus- in Mul, [39] and [40], by (Fun) 39] X >= X by (Meta) 40] Y >= Y by (Meta) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_0, R_1, minimal, formative) by (P_1, R_1, minimal, formative), where P_1 consists of: foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> X(z, u) sum#(X) =#> foldl#(/\x./\y.plus(x, y), 0, X) Thus, the original system is terminating if (P_1, R_1, minimal, formative) is finite. We consider the dependency pair problem (P_1, R_1, minimal, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. As the system is abstraction-simple and the formative flag is set, it suffices to find a tagged reduction pair [Kop12, Def. 6.70]. Thus, we must orient: foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) >? X(~c0, ~c1) sum#(X) >? foldl#(/\x./\y.plus-(x, y), 0, X) plus-(X, Y) >= plus(X, Y) We apply [Kop12, Thm. 6.75] and use the following argument functions: pi( sum#(X) ) = #argfun-sum##(foldl#(/\x./\y.plus-(x, y), 0, X)) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: #argfun-sum## = \y0.3 + y0 0 = 0 cons = \y0y1.3 foldl# = \G0y1y2.3 + y2y2G0(y2,y2) plus = \y0y1.0 plus- = \y0y1.3 + 3y0 + 3y1 sum# = \y0.0 ~c0 = 0 ~c1 = 0 Using this interpretation, the requirements translate to: [[foldl#(/\x./\y._x0(x, y), _x1, cons(_x2, _x3))]] = 3 + 9F0(3,3) > F0(0,0) = [[_x0(~c0, ~c1)]] [[#argfun-sum##(foldl#(/\x./\y.plus-(x, y), 0, _x0))]] = 6 + 3x0x0 + 6x0x0x0 > 3 + 3x0x0 + 6x0x0x0 = [[foldl#(/\x./\y.plus-(x, y), 0, _x0)]] [[plus-(_x0, _x1)]] = 3 + 3x0 + 3x1 >= 0 = [[plus(_x0, _x1)]] By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace a dependency pair problem (P_1, R_1) by ({}, R_1). By the empty set processor [Kop12, Thm. 7.15] this problem may be immediately removed. As all dependency pair problems were succesfully simplified with sound (and complete) processors until nothing remained, we conclude termination. +++ Citations +++ [Kop12] C. Kop. Higher Order Termination. PhD Thesis, 2012.