We consider the system Applicative_05__TreeMap. Alphabet: cons : [c * b] --> b map : [c -> c * b] --> b nil : [] --> b node : [a * b] --> c treemap : [a -> a] --> c -> c Rules: map(f, nil) => nil map(f, cons(x, y)) => cons(f x, map(f, y)) treemap(f) node(x, y) => node(f x, map(treemap(f), y)) 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] map#(F, cons(X, Y)) =#> F(X) 1] map#(F, cons(X, Y)) =#> map#(F, Y) 2] treemap(F) node(X, Y) =#> F(X) 3] treemap(F) node(X, Y) =#> map#(treemap(F), Y) 4] treemap(F) node(X, Y) =#> treemap#(F) Rules R_0: map(F, nil) => nil map(F, cons(X, Y)) => cons(F X, map(F, Y)) treemap(F) node(X, Y) => node(F X, map(treemap(F), Y)) 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 * 1 : 0, 1 * 2 : 0, 1, 2, 3, 4 * 3 : 0, 1 * 4 : This graph has the following strongly connected components: P_1: map#(F, cons(X, Y)) =#> F(X) map#(F, cons(X, Y)) =#> map#(F, Y) treemap(F) node(X, Y) =#> F(X) treemap(F) node(X, Y) =#> map#(treemap(F), Y) 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). The formative rules of (P_1, R_0) are R_1 ::= map(F, cons(X, Y)) => cons(F X, map(F, Y)) treemap(F) node(X, Y) => node(F X, map(treemap(F), Y)) 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: map#(F, cons(X, Y)) >? F(X) map#(F, cons(X, Y)) >? map#(F, Y) treemap(F) node(X, Y) >? F(X) treemap(F) node(X, Y) >? map#(treemap(F), Y) map(F, cons(X, Y)) >= cons(F X, map(F, Y)) treemap(F) node(X, Y) >= node(F X, map(treemap(F), 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]. We choose Lex = {} and Mul = {@_{o -> o}, cons, map, map#, node, treemap}, and the following precedence: @_{o -> o} = map = map# > cons > node = treemap With these choices, we have: 1] map#(F, cons(X, Y)) > @_{o -> o}(F, X) because [2], by definition 2] map#*(F, cons(X, Y)) >= @_{o -> o}(F, X) because map# = @_{o -> o}, map# in Mul, [3] and [4], by (Stat) 3] F >= F by (Meta) 4] cons(X, Y) > X because [5], by definition 5] cons*(X, Y) >= X because [6], by (Select) 6] X >= X by (Meta) 7] map#(F, cons(X, Y)) >= map#(F, Y) because [8], by (Star) 8] map#*(F, cons(X, Y)) >= map#(F, Y) because map# in Mul, [3] and [9], by (Stat) 9] cons(X, Y) > Y because [10], by definition 10] cons*(X, Y) >= Y because [11], by (Select) 11] Y >= Y by (Meta) 12] @_{o -> o}(treemap(F), node(X, Y)) > @_{o -> o}(F, X) because [13], by definition 13] @_{o -> o}*(treemap(F), node(X, Y)) >= @_{o -> o}(F, X) because @_{o -> o} in Mul, [14] and [17], by (Stat) 14] treemap(F) > F because [15], by definition 15] treemap*(F) >= F because [16], by (Select) 16] F >= F by (Meta) 17] node(X, Y) > X because [18], by definition 18] node*(X, Y) >= X because [19], by (Select) 19] X >= X by (Meta) 20] @_{o -> o}(treemap(F), node(X, Y)) >= map#(treemap(F), Y) because @_{o -> o} = map#, @_{o -> o} in Mul, [21] and [23], by (Fun) 21] treemap(F) >= treemap(F) because treemap in Mul and [22], by (Fun) 22] F >= F by (Meta) 23] node(X, Y) >= Y because [24], by (Star) 24] node*(X, Y) >= Y because [25], by (Select) 25] Y >= Y by (Meta) 26] map(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) because [27], by (Star) 27] map*(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) because map > cons, [28] and [29], by (Copy) 28] map*(F, cons(X, Y)) >= @_{o -> o}(F, X) because map = @_{o -> o}, map in Mul, [3] and [4], by (Stat) 29] map*(F, cons(X, Y)) >= map(F, Y) because map in Mul, [3] and [9], by (Stat) 30] @_{o -> o}(treemap(F), node(X, Y)) >= node(@_{o -> o}(F, X), map(treemap(F), Y)) because [31], by (Star) 31] @_{o -> o}*(treemap(F), node(X, Y)) >= node(@_{o -> o}(F, X), map(treemap(F), Y)) because @_{o -> o} > node, [32] and [36], by (Copy) 32] @_{o -> o}*(treemap(F), node(X, Y)) >= @_{o -> o}(F, X) because [33], by (Select) 33] treemap(F) @_{o -> o}*(treemap(F), node(X, Y)) >= @_{o -> o}(F, X) because [34] 34] treemap*(F, @_{o -> o}*(treemap(F), node(X, Y))) >= @_{o -> o}(F, X) because [35], by (Select) 35] @_{o -> o}*(treemap(F), node(X, Y)) >= @_{o -> o}(F, X) because @_{o -> o} in Mul, [14] and [17], by (Stat) 36] @_{o -> o}*(treemap(F), node(X, Y)) >= map(treemap(F), Y) because @_{o -> o} = map, @_{o -> o} in Mul, [21] and [37], by (Stat) 37] node(X, Y) > Y because [38], by definition 38] node*(X, Y) >= Y because [25], by (Select) 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: map#(F, cons(X, Y)) =#> map#(F, Y) treemap(F) node(X, Y) =#> map#(treemap(F), Y) 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 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 : 0 This graph has the following strongly connected components: P_3: map#(F, cons(X, Y)) =#> map#(F, Y) By [Kop12, Thm. 7.31], we may replace any dependency pair problem (P_2, R_1, m, f) by (P_3, R_1, m, f). 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 apply the subterm criterion with the following projection function: nu(map#) = 2 Thus, we can orient the dependency pairs as follows: nu(map#(F, cons(X, Y))) = cons(X, Y) |> Y = nu(map#(F, Y)) By [FuhKop19, Thm. 61], we may replace a dependency pair problem (P_3, R_1, minimal, f) by ({}, R_1, minimal, f). 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.