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) We choose Lex = {explode#, implode#} and Mul = {#argfun-op#, @_{o -> o}, cons, op}, and the following precedence: explode# > #argfun-op# > cons > implode# > @_{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 [17], by definition 17] @_{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) 18] implode#(cons(X, Y), F, Z) >= implode#(Y, F, @_{o -> o}(F, Z)) because [19], by (Star) 19] implode#*(cons(X, Y), F, Z) >= implode#(Y, F, @_{o -> o}(F, Z)) because [20], [23], [25] and [27], by (Stat) 20] cons(X, Y) > Y because [21], by definition 21] cons*(X, Y) >= Y because [22], by (Select) 22] Y >= Y by (Meta) 23] implode#*(cons(X, Y), F, Z) >= Y because [24], by (Select) 24] cons(X, Y) >= Y because [21], by (Star) 25] implode#*(cons(X, Y), F, Z) >= F because [26], by (Select) 26] F >= F by (Meta) 27] implode#*(cons(X, Y), F, Z) >= @_{o -> o}(F, Z) because implode# > @_{o -> o}, [25] and [28], by (Copy) 28] implode#*(cons(X, Y), F, Z) >= Z because [29], by (Select) 29] Z >= Z by (Meta) 30] implode#(cons(X, Y), F, Z) >= @_{o -> o}(F, Z) because [27], by (Star) 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], by definition 32] 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 [33], [36], [38] and [51], by (Stat) 33] cons(X, Y) > Y because [34], by definition 34] cons*(X, Y) >= Y because [35], by (Select) 35] Y >= Y by (Meta) 36] explode#*(cons(X, Y), F, Z) >= Y because [37], by (Select) 37] cons(X, Y) >= Y because [34], by (Star) 38] 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#, [39] and [46], by (Copy) 39] explode#*(cons(X, Y), F, Z) >= /\y.@_{o -> o}(F, @_{o -> o}(F, y)) because [40], by (F-Abs) 40] explode#*(cons(X, Y), F, Z, x) >= @_{o -> o}(F, @_{o -> o}(F, x)) because explode# > @_{o -> o}, [41] and [43], by (Copy) 41] explode#*(cons(X, Y), F, Z, x) >= F because [42], by (Select) 42] F >= F by (Meta) 43] explode#*(cons(X, Y), F, Z, x) >= @_{o -> o}(F, x) because explode# > @_{o -> o}, [41] and [44], by (Copy) 44] explode#*(cons(X, Y), F, Z, x) >= x because [45], by (Select) 45] x >= x by (Var) 46] explode#*(cons(X, Y), F, Z) >= /\z.@_{o -> o}(F, z) because [47], by (F-Abs) 47] explode#*(cons(X, Y), F, Z, y) >= @_{o -> o}(F, y) because explode# > @_{o -> o}, [48] and [49], by (Copy) 48] explode#*(cons(X, Y), F, Z, y) >= F because [42], by (Select) 49] explode#*(cons(X, Y), F, Z, y) >= y because [50], by (Select) 50] y >= y by (Var) 51] explode#*(cons(X, Y), F, Z) >= @_{o -> o}(F, Z) because explode# > @_{o -> o}, [52] and [53], by (Copy) 52] explode#*(cons(X, Y), F, Z) >= F because [42], by (Select) 53] explode#*(cons(X, Y), F, Z) >= Z because [54], by (Select) 54] Z >= Z by (Meta) 55] explode#(cons(X, Y), F, Z) > @_{o -> o}(F, Z) because [51], 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) implode#(cons(X, Y), F, Z) =#> implode#(Y, F, F Z) 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) implode#(cons(X, Y), F, Z) >? implode#(Y, F, F Z) 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)) 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: [[implode#(x_1, x_2, x_3)]] = implode#(x_1, x_3, x_2) We choose Lex = {implode#} and Mul = {#argfun-op#, @_{o -> o}, cons, op}, and the following precedence: #argfun-op# > cons > implode# > @_{o -> o} > op Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: #argfun-op#(@_{o -> o}(F, @_{o -> o}(G, X))) >= @_{o -> o}(F, @_{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) With these choices, we have: 1] #argfun-op#(@_{o -> o}(F, @_{o -> o}(G, X))) >= @_{o -> o}(F, @_{o -> o}(G, X)) because [2], by (Star) 2] #argfun-op#*(@_{o -> o}(F, @_{o -> o}(G, X))) >= @_{o -> o}(F, @_{o -> o}(G, X)) because [3], by (Select) 3] @_{o -> o}(F, @_{o -> o}(G, X)) >= @_{o -> o}(F, @_{o -> o}(G, X)) because @_{o -> o} in Mul, [4] and [5], by (Fun) 4] F >= F by (Meta) 5] @_{o -> o}(G, X) >= @_{o -> o}(G, X) because @_{o -> o} in Mul, [6] and [7], by (Fun) 6] G >= G by (Meta) 7] X >= X by (Meta) 8] implode#(cons(X, Y), F, Z) >= implode#(Y, F, @_{o -> o}(F, Z)) because [9], by (Star) 9] implode#*(cons(X, Y), F, Z) >= implode#(Y, F, @_{o -> o}(F, Z)) because [10], [13], [15] and [17], by (Stat) 10] cons(X, Y) > Y because [11], by definition 11] cons*(X, Y) >= Y because [12], by (Select) 12] Y >= Y by (Meta) 13] implode#*(cons(X, Y), F, Z) >= Y because [14], by (Select) 14] cons(X, Y) >= Y because [11], by (Star) 15] implode#*(cons(X, Y), F, Z) >= F because [16], by (Select) 16] F >= F by (Meta) 17] implode#*(cons(X, Y), F, Z) >= @_{o -> o}(F, Z) because implode# > @_{o -> o}, [15] and [18], by (Copy) 18] implode#*(cons(X, Y), F, Z) >= Z because [19], by (Select) 19] Z >= Z by (Meta) 20] implode#(cons(X, Y), F, Z) > @_{o -> o}(F, Z) because [17], by definition By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_2, R_1, minimal, formative) by (P_3, R_1, minimal, formative), where P_3 consists of: op(F, G) X =#> F(G X) implode#(cons(X, Y), F, Z) =#> implode#(Y, F, F Z) Thus, the original system is terminating if (P_3, R_1, minimal, formative) is finite. We consider the dependency pair problem (P_3, R_1, 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 * 1 : 1 This graph has the following strongly connected components: P_4: op(F, G) X =#> F(G X) P_5: implode#(cons(X, Y), F, Z) =#> implode#(Y, F, F Z) By [Kop12, Thm. 7.31], we may replace any dependency pair problem (P_3, R_1, m, f) by (P_4, R_1, m, f) and (P_5, R_1, m, f). Thus, the original system is terminating if each of (P_4, R_1, minimal, formative) and (P_5, R_1, minimal, formative) is finite. We consider the dependency pair problem (P_5, R_1, minimal, formative). We apply the subterm criterion with the following projection function: nu(implode#) = 1 Thus, we can orient the dependency pairs as follows: nu(implode#(cons(X, Y), F, Z)) = cons(X, Y) |> Y = nu(implode#(Y, F, F Z)) By [FuhKop19, Thm. 61], we may replace a dependency pair problem (P_5, R_1, minimal, f) by ({}, R_1, minimal, f). By the empty set processor [Kop12, Thm. 7.15] this problem may be immediately removed. Thus, the original system is terminating if (P_4, R_1, minimal, formative) is finite. We consider the dependency pair problem (P_4, 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) We apply [Kop12, Thm. 6.75] and use the following argument functions: pi( op(F, G, X) ) = #argfun-op#(F (G X)) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: #argfun-op# = \y0.1 + y0 op = \G0G1y2.0 Using this interpretation, the requirements translate to: [[#argfun-op#(_F0 (_F1 _x2))]] = 1 + max(x2, F0(max(x2, F1(x2))), F1(x2)) > F0(max(x2, F1(x2))) = [[_F0(_F1 _x2)]] By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace a dependency pair problem (P_4, 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 +++ [FuhKop19] C. Fuhs, and C. Kop. A static higher-order dependency pair framework. In Proceedings of ESOP 2019, 2019. [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.