We consider the system h51. Alphabet: cons : [] --> a -> alist -> alist foldl : [] --> (a -> a -> a) -> a -> alist -> a nil : [] --> alist Rules: foldl (/\x./\y.f x y) z nil => z foldl (/\x./\y.f x y) z (cons u v) => foldl (/\w./\x'.f w x') (f z u) 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 * alist] --> alist foldl : [a -> a -> a * a * alist] --> a nil : [] --> alist ~AP1 : [a -> a -> a * a] --> a -> a Rules: foldl(/\x./\y.~AP1(F, x) y, X, nil) => X foldl(/\x./\y.~AP1(F, x) y, X, cons(Y, Z)) => foldl(/\z./\u.~AP1(F, z) u, ~AP1(F, X) Y, 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. This gives: Alphabet: cons : [a * alist] --> alist foldl : [a -> a -> a * a * alist] --> a nil : [] --> alist 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) 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) 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) 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) 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: [[foldl#(x_1, x_2, x_3)]] = foldl#(x_1, x_3, x_2) [[~c0]] = _|_ [[~c1]] = _|_ We choose Lex = {foldl#} and Mul = {cons}, and the following precedence: foldl# > cons 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) 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], [8], [11], [12] and [20], 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] cons(Z, U) > U because [9], by definition 9] cons*(Z, U) >= U because [10], by (Select) 10] U >= U by (Meta) 11] foldl#*(/\z./\u.X(z, u), Y, cons(Z, U)) >= /\z./\u.X(z, u) because [3], by (Select) 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 [9], by (Star) 22] foldl#(/\x./\y.X(x, y), Y, cons(Z, U)) > X(_|_, _|_) because [23], by definition 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 By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace a dependency pair problem (P_0, 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 +++ [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.