We consider the system sort. Alphabet: 0 : [] --> nat ascending!6220sort : [list] --> list cons : [nat * list] --> list descending!6220sort : [list] --> list insert : [nat * list * nat -> nat -> nat * nat -> nat -> nat] --> list max : [nat * nat] --> nat min : [nat * nat] --> nat nil : [] --> list s : [nat] --> nat sort : [list * nat -> nat -> nat * nat -> nat -> nat] --> list Rules: max(0, x) => x max(x, 0) => x max(s(x), s(y)) => s(max(x, y)) min(0, x) => 0 min(x, 0) => 0 min(s(x), s(y)) => s(min(x, y)) insert(x, nil, f, g) => cons(x, nil) insert(x, cons(y, z), f, g) => cons(f x y, insert(g x y, z, f, g)) sort(nil, f, g) => nil sort(cons(x, y), f, g) => insert(x, sort(y, f, g), f, g) ascending!6220sort(x) => sort(x, /\y./\z.min(y, z), /\u./\v.max(u, v)) descending!6220sort(x) => sort(x, /\y./\z.max(y, z), /\u./\v.min(u, v)) 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: max(0, X) => X max(X, 0) => X max(s(X), s(Y)) => s(max(X, Y)) min(0, X) => 0 min(X, 0) => 0 min(s(X), s(Y)) => s(min(X, 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) QTRSRRRProof [EQUIVALENT] || (4) QTRS || (5) RisEmptyProof [EQUIVALENT] || (6) YES || || || ---------------------------------------- || || (0) || Obligation: || Q restricted rewrite system: || The TRS R consists of the following rules: || || max(0, %X) -> %X || max(%X, 0) -> %X || max(s(%X), s(%Y)) -> s(max(%X, %Y)) || min(0, %X) -> 0 || min(%X, 0) -> 0 || min(s(%X), s(%Y)) -> s(min(%X, %Y)) || ~PAIR(%X, %Y) -> %X || ~PAIR(%X, %Y) -> %Y || || Q is empty. || || ---------------------------------------- || || (1) QTRSRRRProof (EQUIVALENT) || Used ordering: || Polynomial interpretation [POLO]: || || POL(0) = 0 || POL(max(x_1, x_2)) = 2*x_1 + 2*x_2 || POL(min(x_1, x_2)) = 1 + 2*x_1 + 2*x_2 || POL(s(x_1)) = 2 + 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: || || max(s(%X), s(%Y)) -> s(max(%X, %Y)) || min(0, %X) -> 0 || min(%X, 0) -> 0 || min(s(%X), s(%Y)) -> s(min(%X, %Y)) || ~PAIR(%X, %Y) -> %X || ~PAIR(%X, %Y) -> %Y || || || || || ---------------------------------------- || || (2) || Obligation: || Q restricted rewrite system: || The TRS R consists of the following rules: || || max(0, %X) -> %X || max(%X, 0) -> %X || || Q is empty. || || ---------------------------------------- || || (3) QTRSRRRProof (EQUIVALENT) || Used ordering: || Quasi precedence: || trivial || || || Status: || max_2: multiset status || 0: multiset status || || With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly: || || max(0, %X) -> %X || max(%X, 0) -> %X || || || || || ---------------------------------------- || || (4) || Obligation: || Q restricted rewrite system: || R is empty. || Q is empty. || || ---------------------------------------- || || (5) RisEmptyProof (EQUIVALENT) || The TRS R is empty. Hence, termination is trivially proven. || ---------------------------------------- || || (6) || 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] insert#(X, cons(Y, Z), F, G) =#> F(X, Y) 1] insert#(X, cons(Y, Z), F, G) =#> insert#(G X Y, Z, F, G) 2] insert#(X, cons(Y, Z), F, G) =#> G(X, Y) 3] sort#(cons(X, Y), F, G) =#> insert#(X, sort(Y, F, G), F, G) 4] sort#(cons(X, Y), F, G) =#> sort#(Y, F, G) 5] ascending!6220sort#(X) =#> sort#(X, /\x./\y.min(x, y), /\z./\u.max(z, u)) 6] ascending!6220sort#(X) =#> min#(x, y) 7] ascending!6220sort#(X) =#> max#(x, y) 8] descending!6220sort#(X) =#> sort#(X, /\x./\y.max(x, y), /\z./\u.min(z, u)) 9] descending!6220sort#(X) =#> max#(x, y) 10] descending!6220sort#(X) =#> min#(x, y) Rules R_0: max(0, X) => X max(X, 0) => X max(s(X), s(Y)) => s(max(X, Y)) min(0, X) => 0 min(X, 0) => 0 min(s(X), s(Y)) => s(min(X, Y)) insert(X, nil, F, G) => cons(X, nil) insert(X, cons(Y, Z), F, G) => cons(F X Y, insert(G X Y, Z, F, G)) sort(nil, F, G) => nil sort(cons(X, Y), F, G) => insert(X, sort(Y, F, G), F, G) ascending!6220sort(X) => sort(X, /\x./\y.min(x, y), /\z./\u.max(z, u)) descending!6220sort(X) => sort(X, /\x./\y.max(x, y), /\z./\u.min(z, u)) 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, 7, 8, 9, 10 * 1 : 0, 1, 2 * 2 : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 * 3 : 0, 1, 2 * 4 : 3, 4 * 5 : 3, 4 * 6 : * 7 : * 8 : 3, 4 * 9 : * 10 : This graph has the following strongly connected components: P_1: insert#(X, cons(Y, Z), F, G) =#> F(X, Y) insert#(X, cons(Y, Z), F, G) =#> insert#(G X Y, Z, F, G) insert#(X, cons(Y, Z), F, G) =#> G(X, Y) sort#(cons(X, Y), F, G) =#> insert#(X, sort(Y, F, G), F, G) sort#(cons(X, Y), F, G) =#> sort#(Y, F, G) ascending!6220sort#(X) =#> sort#(X, /\x./\y.min(x, y), /\z./\u.max(z, u)) descending!6220sort#(X) =#> sort#(X, /\x./\y.max(x, y), /\z./\u.min(z, u)) 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 ::= insert(X, nil, F, G) => cons(X, nil) insert(X, cons(Y, Z), F, G) => cons(F X Y, insert(G X Y, Z, F, G)) sort(nil, F, G) => nil sort(cons(X, Y), F, G) => insert(X, sort(Y, F, G), F, G) ascending!6220sort(X) => sort(X, /\x./\y.min(x, y), /\z./\u.max(z, u)) descending!6220sort(X) => sort(X, /\x./\y.max(x, y), /\z./\u.min(z, u)) 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: insert#(X, cons(Y, Z), F, G) >? F(X, Y) insert#(X, cons(Y, Z), F, G) >? insert#(G X Y, Z, F, G) insert#(X, cons(Y, Z), F, G) >? G(X, Y) sort#(cons(X, Y), F, G) >? insert#(X, sort(Y, F, G), F, G) sort#(cons(X, Y), F, G) >? sort#(Y, F, G) ascending!6220sort#(X) >? sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) descending!6220sort#(X) >? sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) insert(X, nil, F, G) >= cons(X, nil) insert(X, cons(Y, Z), F, G) >= cons(F X Y, insert(G X Y, Z, F, G)) sort(nil, F, G) >= nil sort(cons(X, Y), F, G) >= insert(X, sort(Y, F, G), F, G) ascending!6220sort(X) >= sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) descending!6220sort(X) >= sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) max-(X, Y) >= max(X, Y) min-(X, Y) >= min(X, Y) We apply [Kop12, Thm. 6.75] and use the following argument functions: pi( ascending!6220sort(X) ) = #argfun-ascending!6220sort#(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) pi( ascending!6220sort#(X) ) = #argfun-ascending!6220sort##(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) pi( descending!6220sort(X) ) = #argfun-descending!6220sort#(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) pi( descending!6220sort#(X) ) = #argfun-descending!6220sort##(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) 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: [[ascending!6220sort(x_1)]] = x_1 [[ascending!6220sort#(x_1)]] = x_1 [[descending!6220sort(x_1)]] = x_1 [[descending!6220sort#(x_1)]] = x_1 [[insert(x_1, x_2, x_3, x_4)]] = insert(x_2, x_3, x_4, x_1) [[insert#(x_1, x_2, x_3, x_4)]] = insert#(x_2, x_3, x_4, x_1) [[min(x_1, x_2)]] = x_1 [[nil]] = _|_ We choose Lex = {insert, insert#} and Mul = {#argfun-ascending!6220sort#, #argfun-ascending!6220sort##, #argfun-descending!6220sort#, #argfun-descending!6220sort##, @_{o -> o -> o}, @_{o -> o}, cons, max, max-, min-, sort, sort#}, and the following precedence: #argfun-descending!6220sort# > #argfun-descending!6220sort## > #argfun-ascending!6220sort# > #argfun-ascending!6220sort## > min- > sort# > insert# > sort > insert > @_{o -> o -> o} > cons > @_{o -> o} > max = max- Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: insert#(X, cons(Y, Z), F, G) > @_{o -> o}(@_{o -> o -> o}(F, X), Y) insert#(X, cons(Y, Z), F, G) >= insert#(@_{o -> o}(@_{o -> o -> o}(G, X), Y), Z, F, G) insert#(X, cons(Y, Z), F, G) > @_{o -> o}(@_{o -> o -> o}(G, X), Y) sort#(cons(X, Y), F, G) >= insert#(X, sort(Y, F, G), F, G) sort#(cons(X, Y), F, G) >= sort#(Y, F, G) #argfun-ascending!6220sort##(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) #argfun-descending!6220sort##(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) insert(X, _|_, F, G) >= cons(X, _|_) insert(X, cons(Y, Z), F, G) >= cons(@_{o -> o}(@_{o -> o -> o}(F, X), Y), insert(@_{o -> o}(@_{o -> o -> o}(G, X), Y), Z, F, G)) sort(_|_, F, G) >= _|_ sort(cons(X, Y), F, G) >= insert(X, sort(Y, F, G), F, G) #argfun-ascending!6220sort#(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) #argfun-descending!6220sort#(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) max-(X, Y) >= max(X, Y) min-(X, Y) >= X With these choices, we have: 1] insert#(X, cons(Y, Z), F, G) > @_{o -> o}(@_{o -> o -> o}(F, X), Y) because [2], by definition 2] insert#*(X, cons(Y, Z), F, G) >= @_{o -> o}(@_{o -> o -> o}(F, X), Y) because insert# > @_{o -> o}, [3] and [8], by (Copy) 3] insert#*(X, cons(Y, Z), F, G) >= @_{o -> o -> o}(F, X) because insert# > @_{o -> o -> o}, [4] and [6], by (Copy) 4] insert#*(X, cons(Y, Z), F, G) >= F because [5], by (Select) 5] F >= F by (Meta) 6] insert#*(X, cons(Y, Z), F, G) >= X because [7], by (Select) 7] X >= X by (Meta) 8] insert#*(X, cons(Y, Z), F, G) >= Y because [9], by (Select) 9] cons(Y, Z) >= Y because [10], by (Star) 10] cons*(Y, Z) >= Y because [11], by (Select) 11] Y >= Y by (Meta) 12] insert#(X, cons(Y, Z), F, G) >= insert#(@_{o -> o}(@_{o -> o -> o}(G, X), Y), Z, F, G) because [13], by (Star) 13] insert#*(X, cons(Y, Z), F, G) >= insert#(@_{o -> o}(@_{o -> o -> o}(G, X), Y), Z, F, G) because [14], [17], [21], [4] and [19], by (Stat) 14] cons(Y, Z) > Z because [15], by definition 15] cons*(Y, Z) >= Z because [16], by (Select) 16] Z >= Z by (Meta) 17] insert#*(X, cons(Y, Z), F, G) >= @_{o -> o}(@_{o -> o -> o}(G, X), Y) because insert# > @_{o -> o}, [18] and [8], by (Copy) 18] insert#*(X, cons(Y, Z), F, G) >= @_{o -> o -> o}(G, X) because insert# > @_{o -> o -> o}, [19] and [6], by (Copy) 19] insert#*(X, cons(Y, Z), F, G) >= G because [20], by (Select) 20] G >= G by (Meta) 21] insert#*(X, cons(Y, Z), F, G) >= Z because [22], by (Select) 22] cons(Y, Z) >= Z because [15], by (Star) 23] insert#(X, cons(Y, Z), F, G) > @_{o -> o}(@_{o -> o -> o}(G, X), Y) because [24], by definition 24] insert#*(X, cons(Y, Z), F, G) >= @_{o -> o}(@_{o -> o -> o}(G, X), Y) because insert# > @_{o -> o}, [18] and [8], by (Copy) 25] sort#(cons(X, Y), F, G) >= insert#(X, sort(Y, F, G), F, G) because [26], by (Star) 26] sort#*(cons(X, Y), F, G) >= insert#(X, sort(Y, F, G), F, G) because sort# > insert#, [27], [31], [36] and [38], by (Copy) 27] sort#*(cons(X, Y), F, G) >= X because [28], by (Select) 28] cons(X, Y) >= X because [29], by (Star) 29] cons*(X, Y) >= X because [30], by (Select) 30] X >= X by (Meta) 31] sort#*(cons(X, Y), F, G) >= sort(Y, F, G) because sort# > sort, [32], [36] and [38], by (Copy) 32] sort#*(cons(X, Y), F, G) >= Y because [33], by (Select) 33] cons(X, Y) >= Y because [34], by (Star) 34] cons*(X, Y) >= Y because [35], by (Select) 35] Y >= Y by (Meta) 36] sort#*(cons(X, Y), F, G) >= F because [37], by (Select) 37] F >= F by (Meta) 38] sort#*(cons(X, Y), F, G) >= G because [39], by (Select) 39] G >= G by (Meta) 40] sort#(cons(X, Y), F, G) >= sort#(Y, F, G) because sort# in Mul, [41], [42] and [43], by (Fun) 41] cons(X, Y) >= Y because [34], by (Star) 42] F >= F by (Meta) 43] G >= G by (Meta) 44] #argfun-ascending!6220sort##(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) because [45], by (Star) 45] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) because #argfun-ascending!6220sort## > sort#, [46], [50] and [57], by (Copy) 46] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= X because [47], by (Select) 47] sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) >= X because [48], by (Star) 48] sort#*(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) >= X because [49], by (Select) 49] X >= X by (Meta) 50] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= /\x./\y.min-(x, y) because [51], by (F-Abs) 51] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), v) >= /\x.min-(v, x) because [52], by (F-Abs) 52] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), v, w) >= min-(v, w) because #argfun-ascending!6220sort## > min-, [53] and [55], by (Copy) 53] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), v, w) >= v because [54], by (Select) 54] v >= v by (Var) 55] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), v, w) >= w because [56], by (Select) 56] w >= w by (Var) 57] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= /\x./\y.max-(x, y) because [58], by (F-Abs) 58] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), x') >= /\x.max-(x', x) because [59], by (F-Abs) 59] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), x', y') >= max-(x', y') because #argfun-ascending!6220sort## > max-, [60] and [62], by (Copy) 60] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), x', y') >= x' because [61], by (Select) 61] x' >= x' by (Var) 62] #argfun-ascending!6220sort##*(sort#(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), x', y') >= y' because [63], by (Select) 63] y' >= y' by (Var) 64] #argfun-descending!6220sort##(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) because [65], by (Star) 65] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) because #argfun-descending!6220sort## > sort#, [66], [70] and [77], by (Copy) 66] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= X because [67], by (Select) 67] sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) >= X because [68], by (Star) 68] sort#*(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) >= X because [69], by (Select) 69] X >= X by (Meta) 70] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= /\x./\y.max-(x, y) because [71], by (F-Abs) 71] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), v) >= /\x.max-(v, x) because [72], by (F-Abs) 72] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), v, w) >= max-(v, w) because #argfun-descending!6220sort## > max-, [73] and [75], by (Copy) 73] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), v, w) >= v because [74], by (Select) 74] v >= v by (Var) 75] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), v, w) >= w because [76], by (Select) 76] w >= w by (Var) 77] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= /\x./\y.min-(x, y) because [78], by (F-Abs) 78] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), x') >= /\x.min-(x', x) because [79], by (F-Abs) 79] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), x', y') >= min-(x', y') because #argfun-descending!6220sort## > min-, [80] and [82], by (Copy) 80] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), x', y') >= x' because [81], by (Select) 81] x' >= x' by (Var) 82] #argfun-descending!6220sort##*(sort#(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), x', y') >= y' because [83], by (Select) 83] y' >= y' by (Var) 84] insert(X, _|_, F, G) >= cons(X, _|_) because [85], by (Star) 85] insert*(X, _|_, F, G) >= cons(X, _|_) because insert > cons, [86] and [88], by (Copy) 86] insert*(X, _|_, F, G) >= X because [87], by (Select) 87] X >= X by (Meta) 88] insert*(X, _|_, F, G) >= _|_ by (Bot) 89] insert(X, cons(Y, Z), F, G) >= cons(@_{o -> o}(@_{o -> o -> o}(F, X), Y), insert(@_{o -> o}(@_{o -> o -> o}(G, X), Y), Z, F, G)) because [90], by (Star) 90] insert*(X, cons(Y, Z), F, G) >= cons(@_{o -> o}(@_{o -> o -> o}(F, X), Y), insert(@_{o -> o}(@_{o -> o -> o}(G, X), Y), Z, F, G)) because insert > cons, [91] and [96], by (Copy) 91] insert*(X, cons(Y, Z), F, G) >= @_{o -> o}(@_{o -> o -> o}(F, X), Y) because insert > @_{o -> o}, [92] and [95], by (Copy) 92] insert*(X, cons(Y, Z), F, G) >= @_{o -> o -> o}(F, X) because insert > @_{o -> o -> o}, [93] and [94], by (Copy) 93] insert*(X, cons(Y, Z), F, G) >= F because [5], by (Select) 94] insert*(X, cons(Y, Z), F, G) >= X because [7], by (Select) 95] insert*(X, cons(Y, Z), F, G) >= Y because [9], by (Select) 96] insert*(X, cons(Y, Z), F, G) >= insert(@_{o -> o}(@_{o -> o -> o}(G, X), Y), Z, F, G) because [14], [97], [100], [93] and [99], by (Stat) 97] insert*(X, cons(Y, Z), F, G) >= @_{o -> o}(@_{o -> o -> o}(G, X), Y) because insert > @_{o -> o}, [98] and [95], by (Copy) 98] insert*(X, cons(Y, Z), F, G) >= @_{o -> o -> o}(G, X) because insert > @_{o -> o -> o}, [99] and [94], by (Copy) 99] insert*(X, cons(Y, Z), F, G) >= G because [20], by (Select) 100] insert*(X, cons(Y, Z), F, G) >= Z because [22], by (Select) 101] sort(_|_, F, G) >= _|_ by (Bot) 102] sort(cons(X, Y), F, G) >= insert(X, sort(Y, F, G), F, G) because [103], by (Star) 103] sort*(cons(X, Y), F, G) >= insert(X, sort(Y, F, G), F, G) because sort > insert, [104], [105], [108] and [109], by (Copy) 104] sort*(cons(X, Y), F, G) >= X because [28], by (Select) 105] sort*(cons(X, Y), F, G) >= sort(Y, F, G) because sort in Mul, [106], [42] and [43], by (Stat) 106] cons(X, Y) > Y because [107], by definition 107] cons*(X, Y) >= Y because [35], by (Select) 108] sort*(cons(X, Y), F, G) >= F because [42], by (Select) 109] sort*(cons(X, Y), F, G) >= G because [43], by (Select) 110] #argfun-ascending!6220sort#(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) because [111], by (Star) 111] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) because #argfun-ascending!6220sort# > sort, [112], [115] and [122], by (Copy) 112] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= X because [113], by (Select) 113] sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) >= X because [114], by (Star) 114] sort*(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)) >= X because [49], by (Select) 115] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= /\x./\y.min-(x, y) because [116], by (F-Abs) 116] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), v) >= /\x.min-(v, x) because [117], by (F-Abs) 117] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), v, w) >= min-(v, w) because #argfun-ascending!6220sort# > min-, [118] and [120], by (Copy) 118] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), v, w) >= v because [119], by (Select) 119] v >= v by (Var) 120] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), v, w) >= w because [121], by (Select) 121] w >= w by (Var) 122] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u))) >= /\x./\y.max-(x, y) because [123], by (F-Abs) 123] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), x') >= /\x.max-(x', x) because [124], by (F-Abs) 124] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), x', y') >= max-(x', y') because #argfun-ascending!6220sort# > max-, [125] and [127], by (Copy) 125] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), x', y') >= x' because [126], by (Select) 126] x' >= x' by (Var) 127] #argfun-ascending!6220sort#*(sort(X, /\x./\y.min-(x, y), /\z./\u.max-(z, u)), x', y') >= y' because [128], by (Select) 128] y' >= y' by (Var) 129] #argfun-descending!6220sort#(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) because [130], by (Star) 130] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) because #argfun-descending!6220sort# > sort, [131], [134] and [141], by (Copy) 131] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= X because [132], by (Select) 132] sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) >= X because [133], by (Star) 133] sort*(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)) >= X because [69], by (Select) 134] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= /\x./\y.max-(x, y) because [135], by (F-Abs) 135] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), v) >= /\x.max-(v, x) because [136], by (F-Abs) 136] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), v, w) >= max-(v, w) because #argfun-descending!6220sort# > max-, [137] and [139], by (Copy) 137] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), v, w) >= v because [138], by (Select) 138] v >= v by (Var) 139] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), v, w) >= w because [140], by (Select) 140] w >= w by (Var) 141] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u))) >= /\x./\y.min-(x, y) because [142], by (F-Abs) 142] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), x') >= /\x.min-(x', x) because [143], by (F-Abs) 143] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), x', y') >= min-(x', y') because #argfun-descending!6220sort# > min-, [144] and [146], by (Copy) 144] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), x', y') >= x' because [145], by (Select) 145] x' >= x' by (Var) 146] #argfun-descending!6220sort#*(sort(X, /\x./\y.max-(x, y), /\z./\u.min-(z, u)), x', y') >= y' because [147], by (Select) 147] y' >= y' by (Var) 148] max-(X, Y) >= max(X, Y) because max- = max, max- in Mul, [149] and [150], by (Fun) 149] X >= X by (Meta) 150] Y >= Y by (Meta) 151] min-(X, Y) >= X because [152], by (Star) 152] min-*(X, Y) >= X because [153], by (Select) 153] X >= X 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_1, minimal, formative) by (P_2, R_1, minimal, formative), where P_2 consists of: insert#(X, cons(Y, Z), F, G) =#> insert#(G X Y, Z, F, G) sort#(cons(X, Y), F, G) =#> insert#(X, sort(Y, F, G), F, G) sort#(cons(X, Y), F, G) =#> sort#(Y, F, G) ascending!6220sort#(X) =#> sort#(X, /\x./\y.min(x, y), /\z./\u.max(z, u)) descending!6220sort#(X) =#> sort#(X, /\x./\y.max(x, y), /\z./\u.min(z, u)) 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 * 2 : 1, 2 * 3 : 1, 2 * 4 : 1, 2 This graph has the following strongly connected components: P_3: insert#(X, cons(Y, Z), F, G) =#> insert#(G X Y, Z, F, G) P_4: sort#(cons(X, Y), F, G) =#> sort#(Y, F, G) 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) and (P_4, R_1, m, f). Thus, the original system is terminating if each of (P_3, R_1, minimal, formative) and (P_4, R_1, minimal, formative) is finite. We consider the dependency pair problem (P_4, R_1, minimal, formative). We apply the subterm criterion with the following projection function: nu(sort#) = 1 Thus, we can orient the dependency pairs as follows: nu(sort#(cons(X, Y), F, G)) = cons(X, Y) |> Y = nu(sort#(Y, F, G)) By [FuhKop19, Thm. 61], we may replace a dependency pair problem (P_4, 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_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(insert#) = 2 Thus, we can orient the dependency pairs as follows: nu(insert#(X, cons(Y, Z), F, G)) = cons(Y, Z) |> Z = nu(insert#(G X Y, Z, F, G)) 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.