We consider the system h55. Alphabet: cons : [] --> a -> b -> b foldr : [] --> (a -> b -> b) -> b -> b -> b nil : [] --> b Rules: foldr (/\x./\y.f x y) z nil => z foldr (/\x./\y.f x y) z (cons u v) => f u (foldr (/\w./\x'.f w x') z v) 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: cons : [a * b] --> b foldr : [a -> b -> b * b * b] --> b nil : [] --> b ~AP1 : [a -> b -> b * a] --> b -> b Rules: foldr(/\x./\y.~AP1(F, x) y, X, nil) => X foldr(/\x./\y.~AP1(F, x) y, X, cons(Y, Z)) => ~AP1(F, Y) foldr(/\z./\u.~AP1(F, z) u, X, Z) foldr(/\x./\y.cons(x, y), X, nil) => X foldr(/\x./\y.cons(x, y), X, cons(Y, Z)) => cons(Y, foldr(/\z./\u.cons(z, u), X, Z)) ~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: cons : [a * b] --> b foldr : [a -> b -> b * b * b] --> b nil : [] --> b Rules: foldr(/\x./\y.X(x, y), Y, nil) => Y foldr(/\x./\y.X(x, y), Y, cons(Z, U)) => X(Z, foldr(/\z./\u.X(z, u), Y, U)) 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] foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> X(Z, foldr(/\z./\u.X(z, u), Y, U)) 1] foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> foldr#(/\z./\u.X(z, u), Y, U) {X : 2} 2] foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> X(z, u) {X : 2} Rules R_0: foldr(/\x./\y.X(x, y), Y, nil) => Y foldr(/\x./\y.X(x, y), Y, cons(Z, U)) => X(Z, foldr(/\z./\u.X(z, u), Y, U)) 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). 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: foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >? X(Z, foldr(/\z./\u.X(z, u), Y, U)) foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >? foldr#(/\z./\u.X(z, u), Y, U) foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >? X(~c0, ~c1) foldr(/\x./\y.X(x, y), Y, nil) >= Y foldr(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\z./\u.X(z, u), Y, U)) 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: [[~c0]] = _|_ [[~c1]] = _|_ We choose Lex = {} and Mul = {cons, foldr, foldr#, nil}, and the following precedence: foldr = foldr# > nil > cons Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) > X(Z, foldr(/\x./\y.X(x, y), Y, U)) foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldr#(/\x./\y.X(x, y), Y, U) foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) foldr(/\x./\y.X(x, y), Y, nil) >= Y foldr(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) With these choices, we have: 1] foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) > X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [2], by definition 2] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [3], by (Select) 3] X(foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)), foldr#*(/\z./\u.X(z, u), Y, cons(Z, U))) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [4] and [8], by (Meta) 4] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= Z because [5], by (Select) 5] cons(Z, U) >= Z because [6], by (Star) 6] cons*(Z, U) >= Z because [7], by (Select) 7] Z >= Z by (Meta) 8] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldr(/\x./\y.X(x, y), Y, U) because foldr# = foldr, foldr# in Mul, [9], [14] and [15], by (Stat) 9] /\x./\z.X(x, z) >= /\x./\z.X(x, z) because [10], by (Abs) 10] /\z.X(y, z) >= /\z.X(y, z) because [11], by (Abs) 11] X(y, x) >= X(y, x) because [12] and [13], by (Meta) 12] y >= y by (Var) 13] x >= x by (Var) 14] Y >= Y by (Meta) 15] cons(Z, U) > U because [16], by definition 16] cons*(Z, U) >= U because [17], by (Select) 17] U >= U by (Meta) 18] foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldr#(/\x./\y.X(x, y), Y, U) because foldr# in Mul, [9], [14] and [19], by (Fun) 19] cons(Z, U) >= U because [16], by (Star) 20] foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) because [21], by (Star) 21] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) because [22], by (Select) 22] X(foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)), foldr#*(/\z./\u.X(z, u), Y, cons(Z, U))) >= X(_|_, _|_) because [23] and [24], by (Meta) 23] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= _|_ by (Bot) 24] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= _|_ by (Bot) 25] foldr(/\x./\y.X(x, y), Y, nil) >= Y because [26], by (Star) 26] foldr*(/\x./\y.X(x, y), Y, nil) >= Y because [27], by (Select) 27] Y >= Y by (Meta) 28] foldr(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [29], by (Star) 29] foldr*(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [30], by (Select) 30] X(foldr*(/\x./\y.X(x, y), Y, cons(Z, U)), foldr*(/\z./\u.X(z, u), Y, cons(Z, U))) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [31] and [32], by (Meta) 31] foldr*(/\x./\y.X(x, y), Y, cons(Z, U)) >= Z because [5], by (Select) 32] foldr*(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldr(/\x./\y.X(x, y), Y, U) because foldr in Mul, [9], [14] and [15], by (Stat) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_0, R_0, minimal, formative) by (P_1, R_0, minimal, formative), where P_1 consists of: foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> foldr#(/\z./\u.X(z, u), Y, U) foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> X(z, u) Thus, the original system is terminating if (P_1, R_0, minimal, formative) is finite. We consider the dependency pair problem (P_1, R_0, 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: foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >? foldr#(/\z./\u.X(z, u), Y, U) foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >? X(~c0, ~c1) foldr(/\x./\y.X(x, y), Y, nil) >= Y foldr(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\z./\u.X(z, u), Y, U)) 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: [[~c0]] = _|_ [[~c1]] = _|_ We choose Lex = {} and Mul = {cons, foldr, foldr#, nil}, and the following precedence: cons > foldr > foldr# > nil Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) > foldr#(/\x./\y.X(x, y), Y, U) foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) foldr(/\x./\y.X(x, y), Y, nil) >= Y foldr(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) With these choices, we have: 1] foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) > foldr#(/\x./\y.X(x, y), Y, U) because [2], by definition 2] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldr#(/\x./\y.X(x, y), Y, U) because foldr# in Mul, [3], [8] and [9], by (Stat) 3] /\x./\z.X(x, z) >= /\x./\z.X(x, z) because [4], by (Abs) 4] /\z.X(y, z) >= /\z.X(y, z) because [5], by (Abs) 5] X(y, x) >= X(y, x) because [6] and [7], by (Meta) 6] y >= y by (Var) 7] x >= x by (Var) 8] Y >= Y by (Meta) 9] cons(Z, U) > U because [10], by definition 10] cons*(Z, U) >= U because [11], by (Select) 11] U >= U by (Meta) 12] foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) because [13], by (Star) 13] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) because [14], by (Select) 14] X(foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)), foldr#*(/\z./\u.X(z, u), Y, cons(Z, U))) >= X(_|_, _|_) because [15] and [16], by (Meta) 15] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= _|_ by (Bot) 16] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= _|_ by (Bot) 17] foldr(/\x./\y.X(x, y), Y, nil) >= Y because [18], by (Star) 18] foldr*(/\x./\y.X(x, y), Y, nil) >= Y because [19], by (Select) 19] Y >= Y by (Meta) 20] foldr(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [21], by (Star) 21] foldr*(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [22], by (Select) 22] X(foldr*(/\x./\y.X(x, y), Y, cons(Z, U)), foldr*(/\z./\u.X(z, u), Y, cons(Z, U))) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [23] and [27], by (Meta) 23] foldr*(/\x./\y.X(x, y), Y, cons(Z, U)) >= Z because [24], by (Select) 24] cons(Z, U) >= Z because [25], by (Star) 25] cons*(Z, U) >= Z because [26], by (Select) 26] Z >= Z by (Meta) 27] foldr*(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldr(/\x./\y.X(x, y), Y, U) because foldr in Mul, [3], [8] and [9], by (Stat) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_1, R_0, minimal, formative) by (P_2, R_0, minimal, formative), where P_2 consists of: foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) =#> X(z, u) Thus, the original system is terminating if (P_2, R_0, minimal, formative) is finite. We consider the dependency pair problem (P_2, R_0, 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: foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) >? X(~c0, ~c1) foldr(/\x./\y.X(x, y), Y, nil) >= Y foldr(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\z./\u.X(z, u), Y, U)) 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: [[~c0]] = _|_ [[~c1]] = _|_ We choose Lex = {} and Mul = {cons, foldr, foldr#, nil}, and the following precedence: cons > foldr > foldr# > nil Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) > X(_|_, _|_) foldr(/\x./\y.X(x, y), Y, nil) >= Y foldr(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) With these choices, we have: 1] foldr#(/\x./\y.X(x, y), Y, cons(Z, U)) > X(_|_, _|_) because [2], by definition 2] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(_|_, _|_) because [3], by (Select) 3] X(foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)), foldr#*(/\z./\u.X(z, u), Y, cons(Z, U))) >= X(_|_, _|_) because [4] and [5], by (Meta) 4] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= _|_ by (Bot) 5] foldr#*(/\x./\y.X(x, y), Y, cons(Z, U)) >= _|_ by (Bot) 6] foldr(/\x./\y.X(x, y), Y, nil) >= Y because [7], by (Star) 7] foldr*(/\x./\y.X(x, y), Y, nil) >= Y because [8], by (Select) 8] Y >= Y by (Meta) 9] foldr(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [10], by (Star) 10] foldr*(/\x./\y.X(x, y), Y, cons(Z, U)) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [11], by (Select) 11] X(foldr*(/\x./\y.X(x, y), Y, cons(Z, U)), foldr*(/\z./\u.X(z, u), Y, cons(Z, U))) >= X(Z, foldr(/\x./\y.X(x, y), Y, U)) because [12] and [16], by (Meta) 12] foldr*(/\x./\y.X(x, y), Y, cons(Z, U)) >= Z because [13], by (Select) 13] cons(Z, U) >= Z because [14], by (Star) 14] cons*(Z, U) >= Z because [15], by (Select) 15] Z >= Z by (Meta) 16] foldr*(/\x./\y.X(x, y), Y, cons(Z, U)) >= foldr(/\x./\y.X(x, y), Y, U) because foldr in Mul, [17], [22] and [23], by (Stat) 17] /\x./\z.X(x, z) >= /\x./\z.X(x, z) because [18], by (Abs) 18] /\z.X(y, z) >= /\z.X(y, z) because [19], by (Abs) 19] X(y, x) >= X(y, x) because [20] and [21], by (Meta) 20] y >= y by (Var) 21] x >= x by (Var) 22] Y >= Y by (Meta) 23] cons(Z, U) > U because [24], by definition 24] cons*(Z, U) >= U because [25], by (Select) 25] U >= U by (Meta) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace a dependency pair problem (P_2, R_0) by ({}, R_0). 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 +++ [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.