We consider the system findzero. Alphabet: 0 : [] --> nat find0 : [nat -> nat * nat * nat] --> nat if : [nat * nat * nat] --> nat min : [nat * nat] --> nat nul : [nat -> nat * nat] --> nat s : [nat] --> nat Rules: min(s(x), s(y)) => min(x, y) min(x, 0) => 0 min(0, x) => 0 min(nul(f, x), y) => nul(f, min(x, y)) nul(f, x) => find0(f, 0, x) find0(f, x, 0) => x find0(f, x, s(y)) => if(f x, find0(f, s(x), y), x) if(s(x), y, z) => y if(0, x, y) => y This AFS is converted to an AFSM simply by replacing all free variables by meta-variables (with arity 0). We observe that the rules contain a first-order subset: if(s(X), Y, Z) => Y if(0, X, Y) => Y Moreover, the system is finitely branching. Thus, by [Kop12, Thm. 7.55], we may omit all first-order dependency pairs from the dependency pair problem (DP(R), R) if this first-order part is Ce-terminating when seen as a many-sorted first-order TRS. According to the external first-order termination prover, this system is indeed Ce-terminating: || proof of resources/system.trs || # AProVE Commit ID: d84c10301d352dfd14de2104819581f4682260f5 fuhs 20130616 || || || Termination w.r.t. Q of the given QTRS could be proven: || || (0) QTRS || (1) QTRSRRRProof [EQUIVALENT] || (2) QTRS || (3) RisEmptyProof [EQUIVALENT] || (4) YES || || || ---------------------------------------- || || (0) || Obligation: || Q restricted rewrite system: || The TRS R consists of the following rules: || || if(s(%X), %Y, %Z) -> %Y || if(0, %X, %Y) -> %Y || ~PAIR(%X, %Y) -> %X || ~PAIR(%X, %Y) -> %Y || || Q is empty. || || ---------------------------------------- || || (1) QTRSRRRProof (EQUIVALENT) || Used ordering: || Polynomial interpretation [POLO]: || || POL(0) = 2 || POL(if(x_1, x_2, x_3)) = 2 + 2*x_1 + x_2 + x_3 || POL(s(x_1)) = 2 + x_1 || POL(~PAIR(x_1, x_2)) = 2 + x_1 + x_2 || With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly: || || if(s(%X), %Y, %Z) -> %Y || if(0, %X, %Y) -> %Y || ~PAIR(%X, %Y) -> %X || ~PAIR(%X, %Y) -> %Y || || || || || ---------------------------------------- || || (2) || Obligation: || Q restricted rewrite system: || R is empty. || Q is empty. || || ---------------------------------------- || || (3) RisEmptyProof (EQUIVALENT) || The TRS R is empty. Hence, termination is trivially proven. || ---------------------------------------- || || (4) || YES || 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] min#(s(X), s(Y)) =#> min#(X, Y) 1] min#(nul(F, X), Y) =#> nul#(F, min(X, Y)) 2] min#(nul(F, X), Y) =#> min#(X, Y) 3] nul#(F, X) =#> find0#(F, 0, X) 4] find0#(F, X, s(Y)) =#> if#(F X, find0(F, s(X), Y), X) 5] find0#(F, X, s(Y)) =#> F(X) 6] find0#(F, X, s(Y)) =#> find0#(F, s(X), Y) Rules R_0: min(s(X), s(Y)) => min(X, Y) min(X, 0) => 0 min(0, X) => 0 min(nul(F, X), Y) => nul(F, min(X, Y)) nul(F, X) => find0(F, 0, X) find0(F, X, 0) => X find0(F, X, s(Y)) => if(F X, find0(F, s(X), Y), X) if(s(X), Y, Z) => Y if(0, X, Y) => 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 * 1 : 3 * 2 : 0, 1, 2 * 3 : 4, 5, 6 * 4 : * 5 : 0, 1, 2, 3, 4, 5, 6 * 6 : 4, 5, 6 This graph has the following strongly connected components: P_1: min#(s(X), s(Y)) =#> min#(X, Y) min#(nul(F, X), Y) =#> nul#(F, min(X, Y)) min#(nul(F, X), Y) =#> min#(X, Y) nul#(F, X) =#> find0#(F, 0, X) find0#(F, X, s(Y)) =#> F(X) find0#(F, X, s(Y)) =#> find0#(F, s(X), 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). 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: min#(s(X), s(Y)) >? min#(X, Y) min#(nul(F, X), Y) >? nul#(F, min(X, Y)) min#(nul(F, X), Y) >? min#(X, Y) nul#(F, X) >? find0#(F, 0, X) find0#(F, X, s(Y)) >? F(X) find0#(F, X, s(Y)) >? find0#(F, s(X), Y) min(s(X), s(Y)) >= min(X, Y) min(X, 0) >= 0 min(0, X) >= 0 min(nul(F, X), Y) >= nul(F, min(X, Y)) nul(F, X) >= find0(F, 0, X) find0(F, X, 0) >= X find0(F, X, s(Y)) >= if(F X, find0(F, s(X), Y), X) if(s(X), Y, Z) >= Y if(0, X, Y) >= Y We apply [Kop12, Thm. 6.75] and use the following argument functions: pi( nul#(F, X) ) = #argfun-nul##(find0#(F, 0, 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: [[0]] = _|_ [[find0(x_1, x_2, x_3)]] = find0(x_1, x_3, x_2) [[find0#(x_1, x_2, x_3)]] = find0#(x_3, x_2, x_1) [[min(x_1, x_2)]] = x_1 We choose Lex = {find0, find0#} and Mul = {#argfun-nul##, @_{o -> o}, if, min#, nul, nul#, s}, and the following precedence: min# > nul > #argfun-nul## > find0 > find0# > @_{o -> o} > if > nul# > s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: min#(s(X), s(Y)) >= min#(X, Y) min#(nul(F, X), Y) >= #argfun-nul##(find0#(F, _|_, X)) min#(nul(F, X), Y) >= min#(X, Y) #argfun-nul##(find0#(F, _|_, X)) >= find0#(F, _|_, X) find0#(F, X, s(Y)) > @_{o -> o}(F, X) find0#(F, X, s(Y)) > find0#(F, s(X), Y) s(X) >= X X >= _|_ _|_ >= _|_ nul(F, X) >= nul(F, X) nul(F, X) >= find0(F, _|_, X) find0(F, X, _|_) >= X find0(F, X, s(Y)) >= if(@_{o -> o}(F, X), find0(F, s(X), Y), X) if(s(X), Y, Z) >= Y if(_|_, X, Y) >= Y With these choices, we have: 1] min#(s(X), s(Y)) >= min#(X, Y) because min# in Mul, [2] and [5], by (Fun) 2] s(X) >= X because [3], by (Star) 3] s*(X) >= X because [4], by (Select) 4] X >= X by (Meta) 5] s(Y) >= Y because [6], by (Star) 6] s*(Y) >= Y because [7], by (Select) 7] Y >= Y by (Meta) 8] min#(nul(F, X), Y) >= #argfun-nul##(find0#(F, _|_, X)) because [9], by (Star) 9] min#*(nul(F, X), Y) >= #argfun-nul##(find0#(F, _|_, X)) because [10], by (Select) 10] nul(F, X) >= #argfun-nul##(find0#(F, _|_, X)) because [11], by (Star) 11] nul*(F, X) >= #argfun-nul##(find0#(F, _|_, X)) because nul > #argfun-nul## and [12], by (Copy) 12] nul*(F, X) >= find0#(F, _|_, X) because nul > find0#, [13], [15] and [16], by (Copy) 13] nul*(F, X) >= F because [14], by (Select) 14] F >= F by (Meta) 15] nul*(F, X) >= _|_ by (Bot) 16] nul*(F, X) >= X because [17], by (Select) 17] X >= X by (Meta) 18] min#(nul(F, X), Y) >= min#(X, Y) because min# in Mul, [19] and [20], by (Fun) 19] nul(F, X) >= X because [16], by (Star) 20] Y >= Y by (Meta) 21] #argfun-nul##(find0#(F, _|_, X)) >= find0#(F, _|_, X) because [22], by (Star) 22] #argfun-nul##*(find0#(F, _|_, X)) >= find0#(F, _|_, X) because [23], by (Select) 23] find0#(F, _|_, X) >= find0#(F, _|_, X) because [24], [25] and [26], by (Fun) 24] F >= F by (Meta) 25] _|_ >= _|_ by (Bot) 26] X >= X by (Meta) 27] find0#(F, X, s(Y)) > @_{o -> o}(F, X) because [28], by definition 28] find0#*(F, X, s(Y)) >= @_{o -> o}(F, X) because find0# > @_{o -> o}, [29] and [31], by (Copy) 29] find0#*(F, X, s(Y)) >= F because [30], by (Select) 30] F >= F by (Meta) 31] find0#*(F, X, s(Y)) >= X because [32], by (Select) 32] X >= X by (Meta) 33] find0#(F, X, s(Y)) > find0#(F, s(X), Y) because [34], by definition 34] find0#*(F, X, s(Y)) >= find0#(F, s(X), Y) because [35], [29], [38] and [39], by (Stat) 35] s(Y) > Y because [36], by definition 36] s*(Y) >= Y because [37], by (Select) 37] Y >= Y by (Meta) 38] find0#*(F, X, s(Y)) >= s(X) because find0# > s and [31], by (Copy) 39] find0#*(F, X, s(Y)) >= Y because [40], by (Select) 40] s(Y) >= Y because [36], by (Star) 41] s(X) >= X because [3], by (Star) 42] X >= _|_ by (Bot) 43] _|_ >= _|_ by (Bot) 44] nul(F, X) >= nul(F, X) because nul in Mul, [45] and [46], by (Fun) 45] F >= F by (Meta) 46] X >= X by (Meta) 47] nul(F, X) >= find0(F, _|_, X) because [48], by (Star) 48] nul*(F, X) >= find0(F, _|_, X) because nul > find0, [49], [50] and [51], by (Copy) 49] nul*(F, X) >= F because [24], by (Select) 50] nul*(F, X) >= _|_ by (Bot) 51] nul*(F, X) >= X because [26], by (Select) 52] find0(F, X, _|_) >= X because [53], by (Star) 53] find0*(F, X, _|_) >= X because [54], by (Select) 54] X >= X by (Meta) 55] find0(F, X, s(Y)) >= if(@_{o -> o}(F, X), find0(F, s(X), Y), X) because [56], by (Star) 56] find0*(F, X, s(Y)) >= if(@_{o -> o}(F, X), find0(F, s(X), Y), X) because find0 > if, [57], [60] and [59], by (Copy) 57] find0*(F, X, s(Y)) >= @_{o -> o}(F, X) because find0 > @_{o -> o}, [58] and [59], by (Copy) 58] find0*(F, X, s(Y)) >= F because [30], by (Select) 59] find0*(F, X, s(Y)) >= X because [32], by (Select) 60] find0*(F, X, s(Y)) >= find0(F, s(X), Y) because [61], [35], [58], [62] and [63], by (Stat) 61] F >= F by (Meta) 62] find0*(F, X, s(Y)) >= s(X) because find0 > s and [59], by (Copy) 63] find0*(F, X, s(Y)) >= Y because [40], by (Select) 64] if(s(X), Y, Z) >= Y because [65], by (Star) 65] if*(s(X), Y, Z) >= Y because [66], by (Select) 66] Y >= Y by (Meta) 67] if(_|_, X, Y) >= Y because [68], by (Star) 68] if*(_|_, X, Y) >= Y because [69], by (Select) 69] Y >= Y by (Meta) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_1, R_0, minimal, formative) by (P_2, R_0, minimal, formative), where P_2 consists of: min#(s(X), s(Y)) =#> min#(X, Y) min#(nul(F, X), Y) =#> nul#(F, min(X, Y)) min#(nul(F, X), Y) =#> min#(X, Y) nul#(F, X) =#> find0#(F, 0, X) Thus, the original system is terminating if (P_2, R_0, minimal, formative) is finite. We consider the dependency pair problem (P_2, 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 * 1 : 3 * 2 : 0, 1, 2 * 3 : This graph has the following strongly connected components: P_3: min#(s(X), s(Y)) =#> min#(X, Y) min#(nul(F, X), Y) =#> min#(X, Y) By [Kop12, Thm. 7.31], we may replace any dependency pair problem (P_2, R_0, m, f) by (P_3, R_0, m, f). Thus, the original system is terminating if (P_3, R_0, minimal, formative) is finite. We consider the dependency pair problem (P_3, R_0, minimal, formative). We apply the subterm criterion with the following projection function: nu(min#) = 1 Thus, we can orient the dependency pairs as follows: nu(min#(s(X), s(Y))) = s(X) |> X = nu(min#(X, Y)) nu(min#(nul(F, X), Y)) = nul(F, X) |> X = nu(min#(X, Y)) By [FuhKop19, Thm. 61], we may replace a dependency pair problem (P_3, R_0, minimal, f) by ({}, R_0, 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.