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 observe that the rules contain a first-order subset: if(true, X, Y) => X if(false, X, Y) => Y Moreover, the system is orthogonal. 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 terminating when seen as a many-sorted first-order TRS. According to the external first-order termination prover, this system is indeed 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(true, %X, %Y) -> %X || if(false, %X, %Y) -> %Y || || Q is empty. || || ---------------------------------------- || || (1) QTRSRRRProof (EQUIVALENT) || Used ordering: || Polynomial interpretation [POLO]: || || POL(false) = 2 || POL(if(x_1, x_2, x_3)) = 2 + 2*x_1 + x_2 + x_3 || POL(true) = 2 || With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly: || || if(true, %X, %Y) -> %X || if(false, %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] h#(F, G, s(X)) =#> G(h(F, G, if(F X, X, 0))) 1] h#(F, G, s(X)) =#> h#(F, G, if(F X, X, 0)) 2] h#(F, G, s(X)) =#> if#(F X, X, 0) 3] h#(F, G, s(X)) =#> F(X) 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, 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 * 1 : 0, 1, 2, 3 * 2 : * 3 : 0, 1, 2, 3 This graph has the following strongly connected components: P_1: h#(F, G, s(X)) =#> G(h(F, G, if(F X, X, 0))) h#(F, G, s(X)) =#> h#(F, G, if(F X, X, 0)) h#(F, G, s(X)) =#> F(X) 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 ::= 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, 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: h#(F, G, s(X)) >? G(h(F, G, if(F X, X, 0))) h#(F, G, s(X)) >? h#(F, G, if(F X, X, 0)) h#(F, G, s(X)) >? F(X) 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]] = _|_ [[if(x_1, x_2, x_3)]] = if(x_2, x_3) We choose Lex = {} and Mul = {@_{o -> o}, false, h, h#, if, s, true}, and the following precedence: false > h = h# > @_{o -> o} > s > if > true 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)) > @_{o -> o}(G, h(F, G, if(X, _|_))) h#(F, G, s(X)) >= h#(F, G, if(X, _|_)) h#(F, G, s(X)) >= @_{o -> o}(F, 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)) > @_{o -> o}(G, h(F, G, if(X, _|_))) because [2], by definition 2] h#*(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) because h# > @_{o -> o}, [3] and [5], by (Copy) 3] h#*(F, G, s(X)) >= G because [4], by (Select) 4] G >= G by (Meta) 5] h#*(F, G, s(X)) >= h(F, G, if(X, _|_)) because h# = h, h# in Mul, [6], [7] and [8], by (Stat) 6] F >= F by (Meta) 7] G >= G by (Meta) 8] s(X) > if(X, _|_) because [9], by definition 9] s*(X) >= if(X, _|_) because s > if, [10] and [12], by (Copy) 10] s*(X) >= X because [11], by (Select) 11] X >= X by (Meta) 12] s*(X) >= _|_ by (Bot) 13] h#(F, G, s(X)) >= h#(F, G, if(X, _|_)) because h# in Mul, [6], [7] and [14], by (Fun) 14] s(X) >= if(X, _|_) because [9], by (Star) 15] h#(F, G, s(X)) >= @_{o -> o}(F, X) because [16], by (Star) 16] h#*(F, G, s(X)) >= @_{o -> o}(F, X) because h# > @_{o -> o}, [17] and [18], by (Copy) 17] h#*(F, G, s(X)) >= F because [6], by (Select) 18] h#*(F, G, s(X)) >= X because [19], by (Select) 19] s(X) >= X because [10], by (Star) 20] if(X, Y) >= X because [21], by (Star) 21] if*(X, Y) >= X because [22], by (Select) 22] X >= X by (Meta) 23] if(X, Y) >= Y because [24], by (Star) 24] if*(X, Y) >= Y because [25], by (Select) 25] Y >= Y by (Meta) 26] h(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) because [27], by (Star) 27] h*(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) because h > @_{o -> o}, [28] and [29], by (Copy) 28] h*(F, G, s(X)) >= G because [7], by (Select) 29] h*(F, G, s(X)) >= h(F, G, if(X, _|_)) because h in Mul, [6], [7] and [8], by (Stat) 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: h#(F, G, s(X)) =#> h#(F, G, if(F X, X, 0)) h#(F, G, s(X)) =#> F(X) 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: h#(F, G, s(X)) >? h#(F, G, if(F X, X, 0)) h#(F, G, s(X)) >? F(X) 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]] = _|_ [[h#(x_1, x_2, x_3)]] = h#(x_1, x_3) [[if(x_1, x_2, x_3)]] = if(x_2, x_3) We choose Lex = {} and Mul = {@_{o -> o}, false, h, h#, if, s, true}, and the following precedence: false > h > @_{o -> o} = h# > s > if > true Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: h#(F, s(X)) > h#(F, if(X, _|_)) h#(F, s(X)) >= @_{o -> o}(F, 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, s(X)) > h#(F, if(X, _|_)) because [2], by definition 2] h#*(F, s(X)) >= h#(F, if(X, _|_)) because h# in Mul, [3] and [4], by (Stat) 3] F >= F by (Meta) 4] s(X) > if(X, _|_) because [5], by definition 5] s*(X) >= if(X, _|_) because s > if, [6] and [8], by (Copy) 6] s*(X) >= X because [7], by (Select) 7] X >= X by (Meta) 8] s*(X) >= _|_ by (Bot) 9] h#(F, s(X)) >= @_{o -> o}(F, X) because h# = @_{o -> o}, h# in Mul, [3] and [10], by (Fun) 10] s(X) >= X because [6], by (Star) 11] if(X, Y) >= X because [12], by (Star) 12] if*(X, Y) >= X because [13], by (Select) 13] X >= X by (Meta) 14] if(X, Y) >= Y because [15], by (Star) 15] if*(X, Y) >= Y because [16], by (Select) 16] Y >= Y by (Meta) 17] h(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) because [18], by (Star) 18] h*(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) because h > @_{o -> o}, [19] and [21], by (Copy) 19] h*(F, G, s(X)) >= G because [20], by (Select) 20] G >= G by (Meta) 21] h*(F, G, s(X)) >= h(F, G, if(X, _|_)) because h in Mul, [3], [22] and [4], by (Stat) 22] G >= G by (Meta) 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: h#(F, G, s(X)) =#> F(X) 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 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: h#(F, G, s(X)) >? F(X) 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]] = _|_ [[if(x_1, x_2, x_3)]] = if(x_2, x_3) We choose Lex = {} and Mul = {@_{o -> o}, false, h, h#, if, s, true}, and the following precedence: false > h# > h > @_{o -> o} > s > if > true 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)) > @_{o -> o}(F, 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)) > @_{o -> o}(F, X) because [2], by definition 2] h#*(F, G, s(X)) >= @_{o -> o}(F, X) because h# > @_{o -> o}, [3] and [5], by (Copy) 3] h#*(F, G, s(X)) >= F because [4], by (Select) 4] F >= F by (Meta) 5] h#*(F, G, s(X)) >= X because [6], by (Select) 6] s(X) >= X because [7], by (Star) 7] s*(X) >= X because [8], by (Select) 8] X >= X by (Meta) 9] if(X, Y) >= X because [10], by (Star) 10] if*(X, Y) >= X because [11], by (Select) 11] X >= X by (Meta) 12] if(X, Y) >= Y because [13], by (Star) 13] if*(X, Y) >= Y because [14], by (Select) 14] Y >= Y by (Meta) 15] h(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) because [16], by (Star) 16] h*(F, G, s(X)) >= @_{o -> o}(G, h(F, G, if(X, _|_))) because h > @_{o -> o}, [17] and [19], by (Copy) 17] h*(F, G, s(X)) >= G because [18], by (Select) 18] G >= G by (Meta) 19] h*(F, G, s(X)) >= h(F, G, if(X, _|_)) because h in Mul, [20], [21] and [22], by (Stat) 20] F >= F by (Meta) 21] G >= G by (Meta) 22] s(X) > if(X, _|_) because [23], by definition 23] s*(X) >= if(X, _|_) because s > if, [24] and [25], by (Copy) 24] s*(X) >= X because [8], by (Select) 25] s*(X) >= _|_ by (Bot) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace a dependency pair problem (P_3, 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.