We consider the system plode. Alphabet: cons : [nat * list] --> list explode : [list * nat -> nat * nat] --> nat implode : [list * nat -> nat * nat] --> nat nil : [] --> list op : [nat -> nat * nat -> nat] --> nat -> nat Rules: op(f, g) x => f (g x) implode(nil, f, x) => x implode(cons(x, y), f, z) => implode(y, f, f z) explode(nil, f, x) => x explode(cons(x, y), f, z) => explode(y, op(f, f), f z) This AFS is converted to an AFSM simply by replacing all free variables by meta-variables (with arity 0). We use the dependency pair framework as described in [Kop12, Ch. 6/7], with dynamic dependency pairs. After applying [Kop12, Thm. 7.22] to denote collapsing dependency pairs in an extended form, we thus obtain the following dependency pair problem (P_0, R_0, minimal, formative): Dependency Pairs P_0: 0] op(F, G) X =#> F(G X) 1] op(F, G) X =#> G(X) 2] implode#(cons(X, Y), F, Z) =#> implode#(Y, F, F Z) 3] implode#(cons(X, Y), F, Z) =#> F(Z) 4] explode#(cons(X, Y), F, Z) =#> explode#(Y, op(F, F), F Z) 5] explode#(cons(X, Y), F, Z) =#> op#(F, F) 6] explode#(cons(X, Y), F, Z) =#> F(Z) Rules R_0: op(F, G) X => F (G X) implode(nil, F, X) => X implode(cons(X, Y), F, Z) => implode(Y, F, F Z) explode(nil, F, X) => X explode(cons(X, Y), F, Z) => explode(Y, op(F, F), F Z) 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 place the elements of P in a dependency graph approximation G (see e.g. [Kop12, Thm. 7.27, 7.29], as follows: * 0 : 0, 1, 2, 3, 4, 5, 6 * 1 : 0, 1, 2, 3, 4, 5, 6 * 2 : 2, 3 * 3 : 0, 1, 2, 3, 4, 5, 6 * 4 : 4, 5, 6 * 5 : * 6 : 0, 1, 2, 3, 4, 5, 6 This graph has the following strongly connected components: P_1: op(F, G) X =#> F(G X) op(F, G) X =#> G(X) implode#(cons(X, Y), F, Z) =#> implode#(Y, F, F Z) implode#(cons(X, Y), F, Z) =#> F(Z) explode#(cons(X, Y), F, Z) =#> explode#(Y, op(F, F), F Z) explode#(cons(X, Y), F, Z) =#> F(Z) By [Kop12, Thm. 7.31], we may replace any dependency pair problem (P_0, R_0, m, f) by (P_1, R_0, m, f). 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). This combination (P_1, 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_1, R_0, minimal, formative) by (P_1, R_1, minimal, formative). 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: op(F, G) X >? F(G X) op(F, G) X >? G(X) implode#(cons(X, Y), F, Z) >? implode#(Y, F, F Z) implode#(cons(X, Y), F, Z) >? F(Z) explode#(cons(X, Y), F, Z) >? explode#(Y, op(F, F), F Z) explode#(cons(X, Y), F, Z) >? F(Z) We apply [Kop12, Thm. 6.75] and use the following argument functions: pi( op(F, G) ) = #argfun-op#(/\x.F (G x), /\y.G y) 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: [[explode#(x_1, x_2, x_3)]] = explode#(x_1, x_3, x_2) [[implode#(x_1, x_2, x_3)]] = implode#(x_2, x_1, x_3) We choose Lex = {explode#, implode#} and Mul = {#argfun-op#, @_{o -> o}, cons, op}, and the following precedence: explode# > #argfun-op# > implode# > cons > @_{o -> o} > op Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: @_{o -> o}(#argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y)), X) >= @_{o -> o}(F, @_{o -> o}(G, X)) @_{o -> o}(#argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y)), X) >= @_{o -> o}(G, X) implode#(cons(X, Y), F, Z) > implode#(Y, F, @_{o -> o}(F, Z)) implode#(cons(X, Y), F, Z) >= @_{o -> o}(F, Z) explode#(cons(X, Y), F, Z) > explode#(Y, #argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(F, x)), /\y.@_{o -> o}(F, y)), @_{o -> o}(F, Z)) explode#(cons(X, Y), F, Z) > @_{o -> o}(F, Z) With these choices, we have: 1] @_{o -> o}(#argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y)), X) >= @_{o -> o}(F, @_{o -> o}(G, X)) because [2], by (Star) 2] @_{o -> o}*(#argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y)), X) >= @_{o -> o}(F, @_{o -> o}(G, X)) because [3], by (Select) 3] #argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y)) @_{o -> o}*(#argfun-op#(/\z.@_{o -> o}(F, @_{o -> o}(G, z)), /\u.@_{o -> o}(G, u)), X) >= @_{o -> o}(F, @_{o -> o}(G, X)) because [4] 4] #argfun-op#*(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y), @_{o -> o}*(#argfun-op#(/\z.@_{o -> o}(F, @_{o -> o}(G, z)), /\u.@_{o -> o}(G, u)), X)) >= @_{o -> o}(F, @_{o -> o}(G, X)) because [5], by (Select) 5] @_{o -> o}(F, @_{o -> o}(G, #argfun-op#*(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y), @_{o -> o}*(#argfun-op#(/\z.@_{o -> o}(F, @_{o -> o}(G, z)), /\u.@_{o -> o}(G, u)), X)))) >= @_{o -> o}(F, @_{o -> o}(G, X)) because @_{o -> o} in Mul, [6] and [7], by (Fun) 6] F >= F by (Meta) 7] @_{o -> o}(G, #argfun-op#*(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y), @_{o -> o}*(#argfun-op#(/\z.@_{o -> o}(F, @_{o -> o}(G, z)), /\u.@_{o -> o}(G, u)), X))) >= @_{o -> o}(G, X) because [8], by (Star) 8] @_{o -> o}*(G, #argfun-op#*(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y), @_{o -> o}*(#argfun-op#(/\z.@_{o -> o}(F, @_{o -> o}(G, z)), /\u.@_{o -> o}(G, u)), X))) >= @_{o -> o}(G, X) because [9], by (Select) 9] #argfun-op#*(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y), @_{o -> o}*(#argfun-op#(/\z.@_{o -> o}(F, @_{o -> o}(G, z)), /\u.@_{o -> o}(G, u)), X)) >= @_{o -> o}(G, X) because [10], by (Select) 10] @_{o -> o}*(#argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y)), X) >= @_{o -> o}(G, X) because @_{o -> o} in Mul, [11] and [15], by (Stat) 11] #argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y)) > G because [12], by definition 12] #argfun-op#*(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y)) >= G because [13], by (Select) 13] /\x.@_{o -> o}(G, x) >= G because [14], by (Eta)[Kop13:2] 14] G >= G by (Meta) 15] X >= X by (Meta) 16] @_{o -> o}(#argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(G, x)), /\y.@_{o -> o}(G, y)), X) >= @_{o -> o}(G, X) because [10], by (Star) 17] implode#(cons(X, Y), F, Z) > implode#(Y, F, @_{o -> o}(F, Z)) because [18], by definition 18] implode#*(cons(X, Y), F, Z) >= implode#(Y, F, @_{o -> o}(F, Z)) because [19], [22], [23], [25] and [26], by (Stat) 19] cons(X, Y) > Y because [20], by definition 20] cons*(X, Y) >= Y because [21], by (Select) 21] Y >= Y by (Meta) 22] F >= F by (Meta) 23] implode#*(cons(X, Y), F, Z) >= Y because [24], by (Select) 24] cons(X, Y) >= Y because [20], by (Star) 25] implode#*(cons(X, Y), F, Z) >= F because [22], by (Select) 26] implode#*(cons(X, Y), F, Z) >= @_{o -> o}(F, Z) because implode# > @_{o -> o}, [25] and [27], by (Copy) 27] implode#*(cons(X, Y), F, Z) >= Z because [28], by (Select) 28] Z >= Z by (Meta) 29] implode#(cons(X, Y), F, Z) >= @_{o -> o}(F, Z) because [26], by (Star) 30] explode#(cons(X, Y), F, Z) > explode#(Y, #argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(F, x)), /\y.@_{o -> o}(F, y)), @_{o -> o}(F, Z)) because [31], by definition 31] explode#*(cons(X, Y), F, Z) >= explode#(Y, #argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(F, x)), /\y.@_{o -> o}(F, y)), @_{o -> o}(F, Z)) because [32], [35], [37] and [50], by (Stat) 32] cons(X, Y) > Y because [33], by definition 33] cons*(X, Y) >= Y because [34], by (Select) 34] Y >= Y by (Meta) 35] explode#*(cons(X, Y), F, Z) >= Y because [36], by (Select) 36] cons(X, Y) >= Y because [33], by (Star) 37] explode#*(cons(X, Y), F, Z) >= #argfun-op#(/\x.@_{o -> o}(F, @_{o -> o}(F, x)), /\y.@_{o -> o}(F, y)) because explode# > #argfun-op#, [38] and [45], by (Copy) 38] explode#*(cons(X, Y), F, Z) >= /\y.@_{o -> o}(F, @_{o -> o}(F, y)) because [39], by (F-Abs) 39] explode#*(cons(X, Y), F, Z, x) >= @_{o -> o}(F, @_{o -> o}(F, x)) because explode# > @_{o -> o}, [40] and [42], by (Copy) 40] explode#*(cons(X, Y), F, Z, x) >= F because [41], by (Select) 41] F >= F by (Meta) 42] explode#*(cons(X, Y), F, Z, x) >= @_{o -> o}(F, x) because explode# > @_{o -> o}, [40] and [43], by (Copy) 43] explode#*(cons(X, Y), F, Z, x) >= x because [44], by (Select) 44] x >= x by (Var) 45] explode#*(cons(X, Y), F, Z) >= /\z.@_{o -> o}(F, z) because [46], by (F-Abs) 46] explode#*(cons(X, Y), F, Z, y) >= @_{o -> o}(F, y) because explode# > @_{o -> o}, [47] and [48], by (Copy) 47] explode#*(cons(X, Y), F, Z, y) >= F because [41], by (Select) 48] explode#*(cons(X, Y), F, Z, y) >= y because [49], by (Select) 49] y >= y by (Var) 50] explode#*(cons(X, Y), F, Z) >= @_{o -> o}(F, Z) because explode# > @_{o -> o}, [51] and [52], by (Copy) 51] explode#*(cons(X, Y), F, Z) >= F because [41], by (Select) 52] explode#*(cons(X, Y), F, Z) >= Z because [53], by (Select) 53] Z >= Z by (Meta) 54] explode#(cons(X, Y), F, Z) > @_{o -> o}(F, Z) because [50], by definition By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_1, R_1, minimal, formative) by (P_2, R_1, minimal, formative), where P_2 consists of: op(F, G) X =#> F(G X) op(F, G) X =#> G(X) implode#(cons(X, Y), F, Z) =#> F(Z) Thus, the original system is terminating if (P_2, R_1, minimal, formative) is finite. We consider the dependency pair problem (P_2, 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: op(F, G, X) >? F(G X) op(F, G, X) >? G(X) implode#(cons(X, Y), F, Z) >? F(Z) We apply [Kop12, Thm. 6.75] and use the following argument functions: pi( op(F, G, X) ) = #argfun-op#(F (G X), G X) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: #argfun-op# = \y0y1.3 + max(y0, y1) cons = \y0y1.3 implode# = \y0G1y2.3 + G1(y2) op = \G0G1y2.0 Using this interpretation, the requirements translate to: [[#argfun-op#(_F0 (_F1 _x2), _F1 _x2)]] = 3 + max(x2, F0(max(x2, F1(x2))), F1(x2)) > F0(max(x2, F1(x2))) = [[_F0(_F1 _x2)]] [[#argfun-op#(_F0 (_F1 _x2), _F1 _x2)]] = 3 + max(x2, F0(max(x2, F1(x2))), F1(x2)) > F1(x2) = [[_F1(_x2)]] [[implode#(cons(_x0, _x1), _F2, _x3)]] = 3 + F2(x3) > F2(x3) = [[_F2(_x3)]] By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace a dependency pair problem (P_2, 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. [Kop13:2] C. Kop. StarHorpo with an Eta-Rule. Unpublished manuscript, http://cl-informatik.uibk.ac.at/users/kop/etahorpo.pdf, 2013.