We consider the system if. Alphabet: 0 : [] --> nat false : [] --> bool h : [nat -> bool * nat -> nat * nat] --> nat if : [bool * nat * nat] --> nat s : [nat] --> nat true : [] --> bool Rules: if(true, x, y) => x if(false, x, y) => y h(f, g, 0) => 0 h(f, g, s(x)) => g h(f, g, if(f x, x, 0)) 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 static dependency pairs (see [KusIsoSakBla09] and the adaptation for AFSMs and accessible arguments in [FuhKop19]). We thus obtain the following dependency pair problem (P_0, R_0, computable, formative): Dependency Pairs P_0: 0] h#(F, G, s(X)) =#> h#(F, G, if(F X, X, 0)) 1] h#(F, G, s(X)) =#> if#(F X, X, 0) Rules R_0: if(true, X, Y) => X if(false, X, Y) => Y h(F, G, 0) => 0 h(F, G, s(X)) => G h(F, G, if(F X, X, 0)) Thus, the original system is terminating if (P_0, R_0, computable, formative) is finite. We consider the dependency pair problem (P_0, R_0, computable, 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 : This graph has the following strongly connected components: P_1: h#(F, G, s(X)) =#> h#(F, G, if(F X, X, 0)) 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, computable, formative) is finite. We consider the dependency pair problem (P_1, R_0, computable, formative). The formative rules of (P_1, R_0) are R_1 ::= if(true, X, Y) => X if(false, X, Y) => Y h(F, G, s(X)) => G h(F, G, if(F X, X, 0)) By [Kop12, Thm. 7.17], we may replace the dependency pair problem (P_1, R_0, computable, formative) by (P_1, R_1, computable, formative). Thus, the original system is terminating if (P_1, R_1, computable, formative) is finite. We consider the dependency pair problem (P_1, R_1, computable, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. It suffices to find a standard reduction pair [Kop12, Def. 6.69]. Thus, we must orient: h#(F, G, s(X)) >? h#(F, G, if(F X, X, 0)) if(true, X, Y) >= X if(false, X, Y) >= Y h(F, G, s(X)) >= G h(F, G, if(F X, X, 0)) 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: [[0]] = _|_ [[@_{o -> o}(x_1, x_2)]] = @_{o -> o}(x_2, x_1) [[h(x_1, x_2, x_3)]] = h(x_2, x_3) [[h#(x_1, x_2, x_3)]] = h#(x_3, x_1) [[if(x_1, x_2, x_3)]] = if(x_2, x_3) We choose Lex = {@_{o -> o}, h, h#, s} and Mul = {false, if, true}, and the following precedence: h# > true > h > @_{o -> o} = s > if > false Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: h#(F, G, s(X)) > h#(F, G, if(X, _|_)) if(X, Y) >= X if(X, Y) >= Y h(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) With these choices, we have: 1] h#(F, G, s(X)) > h#(F, G, if(X, _|_)) because [2], by definition 2] h#*(F, G, s(X)) >= h#(F, G, if(X, _|_)) because [3], [8] and [10], by (Stat) 3] s(X) > if(X, _|_) because [4], by definition 4] s*(X) >= if(X, _|_) because s > if, [5] and [7], by (Copy) 5] s*(X) >= X because [6], by (Select) 6] X >= X by (Meta) 7] s*(X) >= _|_ by (Bot) 8] h#*(F, G, s(X)) >= F because [9], by (Select) 9] F >= F by (Meta) 10] h#*(F, G, s(X)) >= if(X, _|_) because [11], by (Select) 11] s(X) >= if(X, _|_) because [4], by (Star) 12] if(X, Y) >= X because [13], by (Star) 13] if*(X, Y) >= X because [14], by (Select) 14] X >= X by (Meta) 15] if(X, Y) >= Y because [16], by (Star) 16] if*(X, Y) >= Y because [17], by (Select) 17] Y >= Y by (Meta) 18] h(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) because [19], by (Star) 19] h*(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) because h > @_{o -> o}, [20] and [22], by (Copy) 20] h*(F, G, s(X)) >= G because [21], by (Select) 21] G >= G by (Meta) 22] h*(F, G, s(X)) >= h(F, G, if(X, _|_)) because [23], [3], [20] and [24], by (Stat) 23] G >= G by (Meta) 24] h*(F, G, s(X)) >= if(X, _|_) because [11], by (Select) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace a dependency pair problem (P_1, 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. [KusIsoSakBla09] K. Kusakari, Y. Isogai, M. Sakai, and F. Blanqui. Static Dependency Pair Method Based On Strong Computability for Higher-Order Rewrite Systems. In volume 92(10) of IEICE Transactions on Information and Systems. 2007--2015, 2009.