We consider the system Applicative_05__Ex5Sorting. Alphabet: 0 : [] --> a ascending!fac6220sort : [b] --> b cons : [a * b] --> b descending!fac6220sort : [b] --> b insert : [a -> a -> a * a -> a -> a * b * a] --> b max : [] --> a -> a -> a min : [] --> a -> a -> a nil : [] --> b s : [a] --> a sort : [a -> a -> a * a -> a -> a * b] --> b Rules: max 0 x => x max x 0 => x max s(x) s(y) => max x y min 0 x => 0 min x 0 => 0 min s(x) s(y) => min x y insert(f, g, nil, x) => cons(x, nil) insert(f, g, cons(x, y), z) => cons(f z x, insert(f, g, y, g z x)) sort(f, g, nil) => nil sort(f, g, cons(x, y)) => insert(f, g, sort(f, g, y), x) ascending!fac6220sort(x) => sort(min, max, x) descending!fac6220sort(x) => sort(max, min, x) This AFS is converted to an AFSM simply by replacing all free variables by meta-variables (with arity 0). We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): max 0 X >? X max X 0 >? X max s(X) s(Y) >? max X Y min 0 X >? 0 min X 0 >? 0 min s(X) s(Y) >? min X Y insert(F, G, nil, X) >? cons(X, nil) insert(F, G, cons(X, Y), Z) >? cons(F Z X, insert(F, G, Y, G Z X)) sort(F, G, nil) >? nil sort(F, G, cons(X, Y)) >? insert(F, G, sort(F, G, Y), X) ascending!fac6220sort(X) >? sort(min, max, X) descending!fac6220sort(X) >? sort(max, min, X) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ [[insert(x_1, x_2, x_3, x_4)]] = insert(x_1, x_3, x_4, x_2) [[min]] = _|_ We choose Lex = {insert} and Mul = {@_{o -> o -> o}, @_{o -> o}, ascending!fac6220sort, cons, descending!fac6220sort, max, nil, s, sort}, and the following precedence: descending!fac6220sort > ascending!fac6220sort > s > sort > max > insert > @_{o -> o -> o} > @_{o -> o} > cons > nil Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: @_{o -> o}(@_{o -> o -> o}(max, _|_), X) > X @_{o -> o}(@_{o -> o -> o}(max, X), _|_) >= X @_{o -> o}(@_{o -> o -> o}(max, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(max, X), Y) @_{o -> o}(@_{o -> o -> o}(_|_, _|_), X) >= _|_ @_{o -> o}(@_{o -> o -> o}(_|_, X), _|_) >= _|_ @_{o -> o}(@_{o -> o -> o}(_|_, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(_|_, X), Y) insert(F, G, nil, X) > cons(X, nil) insert(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) sort(F, G, nil) >= nil sort(F, G, cons(X, Y)) > insert(F, G, sort(F, G, Y), X) ascending!fac6220sort(X) > sort(_|_, max, X) descending!fac6220sort(X) >= sort(max, _|_, X) With these choices, we have: 1] @_{o -> o}(@_{o -> o -> o}(max, _|_), X) > X because [2], by definition 2] @_{o -> o}*(@_{o -> o -> o}(max, _|_), X) >= X because [3], by (Select) 3] X >= X by (Meta) 4] @_{o -> o}(@_{o -> o -> o}(max, X), _|_) >= X because [5], by (Star) 5] @_{o -> o}*(@_{o -> o -> o}(max, X), _|_) >= X because [6], by (Select) 6] @_{o -> o -> o}(max, X) @_{o -> o}*(@_{o -> o -> o}(max, X), _|_) >= X because [7] 7] @_{o -> o -> o}*(max, X, @_{o -> o}*(@_{o -> o -> o}(max, X), _|_)) >= X because [8], by (Select) 8] X >= X by (Meta) 9] @_{o -> o}(@_{o -> o -> o}(max, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(max, X), Y) because @_{o -> o} in Mul, [10] and [16], by (Fun) 10] @_{o -> o -> o}(max, s(X)) >= @_{o -> o -> o}(max, X) because [11], by (Star) 11] @_{o -> o -> o}*(max, s(X)) >= @_{o -> o -> o}(max, X) because @_{o -> o -> o} in Mul, [12] and [13], by (Stat) 12] max >= max by (Fun) 13] s(X) > X because [14], by definition 14] s*(X) >= X because [15], by (Select) 15] X >= X by (Meta) 16] s(Y) >= Y because [17], by (Star) 17] s*(Y) >= Y because [18], by (Select) 18] Y >= Y by (Meta) 19] @_{o -> o}(@_{o -> o -> o}(_|_, _|_), X) >= _|_ by (Bot) 20] @_{o -> o}(@_{o -> o -> o}(_|_, X), _|_) >= _|_ by (Bot) 21] @_{o -> o}(@_{o -> o -> o}(_|_, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(_|_, X), Y) because @_{o -> o} in Mul, [22] and [27], by (Fun) 22] @_{o -> o -> o}(_|_, s(X)) >= @_{o -> o -> o}(_|_, X) because @_{o -> o -> o} in Mul, [23] and [24], by (Fun) 23] _|_ >= _|_ by (Bot) 24] s(X) >= X because [25], by (Star) 25] s*(X) >= X because [26], by (Select) 26] X >= X by (Meta) 27] s(Y) >= Y because [28], by (Star) 28] s*(Y) >= Y because [29], by (Select) 29] Y >= Y by (Meta) 30] insert(F, G, nil, X) > cons(X, nil) because [31], by definition 31] insert*(F, G, nil, X) >= cons(X, nil) because insert > cons, [32] and [34], by (Copy) 32] insert*(F, G, nil, X) >= X because [33], by (Select) 33] X >= X by (Meta) 34] insert*(F, G, nil, X) >= nil because insert > nil, by (Copy) 35] insert(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) because [36], by (Star) 36] insert*(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) because insert > cons, [37] and [47], by (Copy) 37] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(F, Z), X) because insert > @_{o -> o}, [38] and [43], by (Copy) 38] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(F, Z) because insert > @_{o -> o -> o}, [39] and [41], by (Copy) 39] insert*(F, G, cons(X, Y), Z) >= F because [40], by (Select) 40] F >= F by (Meta) 41] insert*(F, G, cons(X, Y), Z) >= Z because [42], by (Select) 42] Z >= Z by (Meta) 43] insert*(F, G, cons(X, Y), Z) >= X because [44], by (Select) 44] cons(X, Y) >= X because [45], by (Star) 45] cons*(X, Y) >= X because [46], by (Select) 46] X >= X by (Meta) 47] insert*(F, G, cons(X, Y), Z) >= insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X)) because [48], [49], [39], [52], [54] and [56], by (Stat) 48] F >= F by (Meta) 49] cons(X, Y) > Y because [50], by definition 50] cons*(X, Y) >= Y because [51], by (Select) 51] Y >= Y by (Meta) 52] insert*(F, G, cons(X, Y), Z) >= G because [53], by (Select) 53] G >= G by (Meta) 54] insert*(F, G, cons(X, Y), Z) >= Y because [55], by (Select) 55] cons(X, Y) >= Y because [50], by (Star) 56] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(G, Z), X) because insert > @_{o -> o}, [57] and [43], by (Copy) 57] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(G, Z) because insert > @_{o -> o -> o}, [52] and [41], by (Copy) 58] sort(F, G, nil) >= nil because [59], by (Star) 59] sort*(F, G, nil) >= nil because sort > nil, by (Copy) 60] sort(F, G, cons(X, Y)) > insert(F, G, sort(F, G, Y), X) because [61], by definition 61] sort*(F, G, cons(X, Y)) >= insert(F, G, sort(F, G, Y), X) because sort > insert, [62], [64], [66] and [72], by (Copy) 62] sort*(F, G, cons(X, Y)) >= F because [63], by (Select) 63] F >= F by (Meta) 64] sort*(F, G, cons(X, Y)) >= G because [65], by (Select) 65] G >= G by (Meta) 66] sort*(F, G, cons(X, Y)) >= sort(F, G, Y) because sort in Mul, [67], [68] and [69], by (Stat) 67] F >= F by (Meta) 68] G >= G by (Meta) 69] cons(X, Y) > Y because [70], by definition 70] cons*(X, Y) >= Y because [71], by (Select) 71] Y >= Y by (Meta) 72] sort*(F, G, cons(X, Y)) >= X because [73], by (Select) 73] cons(X, Y) >= X because [74], by (Star) 74] cons*(X, Y) >= X because [75], by (Select) 75] X >= X by (Meta) 76] ascending!fac6220sort(X) > sort(_|_, max, X) because [77], by definition 77] ascending!fac6220sort*(X) >= sort(_|_, max, X) because ascending!fac6220sort > sort, [78], [79] and [80], by (Copy) 78] ascending!fac6220sort*(X) >= _|_ by (Bot) 79] ascending!fac6220sort*(X) >= max because ascending!fac6220sort > max, by (Copy) 80] ascending!fac6220sort*(X) >= X because [81], by (Select) 81] X >= X by (Meta) 82] descending!fac6220sort(X) >= sort(max, _|_, X) because [83], by (Star) 83] descending!fac6220sort*(X) >= sort(max, _|_, X) because descending!fac6220sort > sort, [84], [85] and [86], by (Copy) 84] descending!fac6220sort*(X) >= max because descending!fac6220sort > max, by (Copy) 85] descending!fac6220sort*(X) >= _|_ by (Bot) 86] descending!fac6220sort*(X) >= X because [87], by (Select) 87] X >= X by (Meta) We can thus remove the following rules: max 0 X => X insert(F, G, nil, X) => cons(X, nil) sort(F, G, cons(X, Y)) => insert(F, G, sort(F, G, Y), X) ascending!fac6220sort(X) => sort(min, max, X) We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): max X 0 >? X max s(X) s(Y) >? max X Y min 0 X >? 0 min X 0 >? 0 min s(X) s(Y) >? min X Y insert(F, G, cons(X, Y), Z) >? cons(F Z X, insert(F, G, Y, G Z X)) sort(F, G, nil) >? nil descending!fac6220sort(X) >? sort(max, min, X) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ [[insert(x_1, x_2, x_3, x_4)]] = insert(x_3, x_2, x_1, x_4) We choose Lex = {insert} and Mul = {@_{o -> o -> o}, @_{o -> o}, cons, descending!fac6220sort, max, min, nil, s, sort}, and the following precedence: descending!fac6220sort > sort > insert > @_{o -> o -> o} > cons > nil > s > max > min > @_{o -> o} Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: @_{o -> o}(@_{o -> o -> o}(max, X), _|_) >= X @_{o -> o}(@_{o -> o -> o}(max, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(max, X), Y) @_{o -> o}(@_{o -> o -> o}(min, _|_), X) > _|_ @_{o -> o}(@_{o -> o -> o}(min, X), _|_) >= _|_ @_{o -> o}(@_{o -> o -> o}(min, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(min, X), Y) insert(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) sort(F, G, nil) > nil descending!fac6220sort(X) > sort(max, min, X) With these choices, we have: 1] @_{o -> o}(@_{o -> o -> o}(max, X), _|_) >= X because [2], by (Star) 2] @_{o -> o}*(@_{o -> o -> o}(max, X), _|_) >= X because [3], by (Select) 3] @_{o -> o -> o}(max, X) @_{o -> o}*(@_{o -> o -> o}(max, X), _|_) >= X because [4] 4] @_{o -> o -> o}*(max, X, @_{o -> o}*(@_{o -> o -> o}(max, X), _|_)) >= X because [5], by (Select) 5] X >= X by (Meta) 6] @_{o -> o}(@_{o -> o -> o}(max, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(max, X), Y) because @_{o -> o} in Mul, [7] and [12], by (Fun) 7] @_{o -> o -> o}(max, s(X)) >= @_{o -> o -> o}(max, X) because @_{o -> o -> o} in Mul, [8] and [9], by (Fun) 8] max >= max by (Fun) 9] s(X) >= X because [10], by (Star) 10] s*(X) >= X because [11], by (Select) 11] X >= X by (Meta) 12] s(Y) >= Y because [13], by (Star) 13] s*(Y) >= Y because [14], by (Select) 14] Y >= Y by (Meta) 15] @_{o -> o}(@_{o -> o -> o}(min, _|_), X) > _|_ because [16], by definition 16] @_{o -> o}*(@_{o -> o -> o}(min, _|_), X) >= _|_ by (Bot) 17] @_{o -> o}(@_{o -> o -> o}(min, X), _|_) >= _|_ by (Bot) 18] @_{o -> o}(@_{o -> o -> o}(min, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(min, X), Y) because [19], by (Star) 19] @_{o -> o}*(@_{o -> o -> o}(min, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(min, X), Y) because [20], by (Select) 20] @_{o -> o -> o}(min, s(X)) @_{o -> o}*(@_{o -> o -> o}(min, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(min, X), Y) because [21] 21] @_{o -> o -> o}*(min, s(X), @_{o -> o}*(@_{o -> o -> o}(min, s(X)), s(Y))) >= @_{o -> o}(@_{o -> o -> o}(min, X), Y) because @_{o -> o -> o} > @_{o -> o}, [22] and [27], by (Copy) 22] @_{o -> o -> o}*(min, s(X), @_{o -> o}*(@_{o -> o -> o}(min, s(X)), s(Y))) >= @_{o -> o -> o}(min, X) because @_{o -> o -> o} in Mul, [23] and [24], by (Stat) 23] min >= min by (Fun) 24] s(X) > X because [25], by definition 25] s*(X) >= X because [26], by (Select) 26] X >= X by (Meta) 27] @_{o -> o -> o}*(min, s(X), @_{o -> o}*(@_{o -> o -> o}(min, s(X)), s(Y))) >= Y because [28], by (Select) 28] @_{o -> o}*(@_{o -> o -> o}(min, s(X)), s(Y)) >= Y because [29], by (Select) 29] s(Y) >= Y because [30], by (Star) 30] s*(Y) >= Y because [31], by (Select) 31] Y >= Y by (Meta) 32] insert(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) because [33], by (Star) 33] insert*(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) because insert > cons, [34] and [44], by (Copy) 34] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(F, Z), X) because insert > @_{o -> o}, [35] and [40], by (Copy) 35] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(F, Z) because insert > @_{o -> o -> o}, [36] and [38], by (Copy) 36] insert*(F, G, cons(X, Y), Z) >= F because [37], by (Select) 37] F >= F by (Meta) 38] insert*(F, G, cons(X, Y), Z) >= Z because [39], by (Select) 39] Z >= Z by (Meta) 40] insert*(F, G, cons(X, Y), Z) >= X because [41], by (Select) 41] cons(X, Y) >= X because [42], by (Star) 42] cons*(X, Y) >= X because [43], by (Select) 43] X >= X by (Meta) 44] insert*(F, G, cons(X, Y), Z) >= insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X)) because [45], [36], [48], [50] and [52], by (Stat) 45] cons(X, Y) > Y because [46], by definition 46] cons*(X, Y) >= Y because [47], by (Select) 47] Y >= Y by (Meta) 48] insert*(F, G, cons(X, Y), Z) >= G because [49], by (Select) 49] G >= G by (Meta) 50] insert*(F, G, cons(X, Y), Z) >= Y because [51], by (Select) 51] cons(X, Y) >= Y because [46], by (Star) 52] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(G, Z), X) because insert > @_{o -> o}, [53] and [40], by (Copy) 53] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(G, Z) because insert > @_{o -> o -> o}, [48] and [38], by (Copy) 54] sort(F, G, nil) > nil because [55], by definition 55] sort*(F, G, nil) >= nil because [56], by (Select) 56] nil >= nil by (Fun) 57] descending!fac6220sort(X) > sort(max, min, X) because [58], by definition 58] descending!fac6220sort*(X) >= sort(max, min, X) because descending!fac6220sort > sort, [59], [60] and [61], by (Copy) 59] descending!fac6220sort*(X) >= max because descending!fac6220sort > max, by (Copy) 60] descending!fac6220sort*(X) >= min because descending!fac6220sort > min, by (Copy) 61] descending!fac6220sort*(X) >= X because [62], by (Select) 62] X >= X by (Meta) We can thus remove the following rules: min 0 X => 0 sort(F, G, nil) => nil descending!fac6220sort(X) => sort(max, min, X) We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): max(X, 0) >? X max(s(X), s(Y)) >? max(X, Y) min(X, 0) >? 0 min(s(X), s(Y)) >? min(X, Y) insert(F, G, cons(X, Y), Z) >? cons(F Z X, insert(F, G, Y, G Z X)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ [[insert(x_1, x_2, x_3, x_4)]] = insert(x_3, x_1, x_4, x_2) We choose Lex = {insert} and Mul = {@_{o -> o -> o}, @_{o -> o}, cons, max, min, s}, and the following precedence: insert > cons > @_{o -> o} > s > max > min > @_{o -> o -> o} Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: max(X, _|_) > X max(s(X), s(Y)) >= max(X, Y) min(X, _|_) >= _|_ min(s(X), s(Y)) >= min(X, Y) insert(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) With these choices, we have: 1] max(X, _|_) > X because [2], by definition 2] max*(X, _|_) >= X because [3], by (Select) 3] X >= X by (Meta) 4] max(s(X), s(Y)) >= max(X, Y) because max in Mul, [5] and [8], by (Fun) 5] s(X) >= X because [6], by (Star) 6] s*(X) >= X because [7], by (Select) 7] X >= X by (Meta) 8] s(Y) >= Y because [9], by (Star) 9] s*(Y) >= Y because [10], by (Select) 10] Y >= Y by (Meta) 11] min(X, _|_) >= _|_ by (Bot) 12] min(s(X), s(Y)) >= min(X, Y) because [13], by (Star) 13] min*(s(X), s(Y)) >= min(X, Y) because min in Mul, [14] and [17], by (Stat) 14] s(X) > X because [15], by definition 15] s*(X) >= X because [16], by (Select) 16] X >= X by (Meta) 17] s(Y) >= Y because [18], by (Star) 18] s*(Y) >= Y because [19], by (Select) 19] Y >= Y by (Meta) 20] insert(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) because [21], by (Star) 21] insert*(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) because insert > cons, [22] and [32], by (Copy) 22] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(F, Z), X) because insert > @_{o -> o}, [23] and [28], by (Copy) 23] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(F, Z) because insert > @_{o -> o -> o}, [24] and [26], by (Copy) 24] insert*(F, G, cons(X, Y), Z) >= F because [25], by (Select) 25] F >= F by (Meta) 26] insert*(F, G, cons(X, Y), Z) >= Z because [27], by (Select) 27] Z >= Z by (Meta) 28] insert*(F, G, cons(X, Y), Z) >= X because [29], by (Select) 29] cons(X, Y) >= X because [30], by (Star) 30] cons*(X, Y) >= X because [31], by (Select) 31] X >= X by (Meta) 32] insert*(F, G, cons(X, Y), Z) >= insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X)) because [33], [24], [36], [38] and [40], by (Stat) 33] cons(X, Y) > Y because [34], by definition 34] cons*(X, Y) >= Y because [35], by (Select) 35] Y >= Y by (Meta) 36] insert*(F, G, cons(X, Y), Z) >= G because [37], by (Select) 37] G >= G by (Meta) 38] insert*(F, G, cons(X, Y), Z) >= Y because [39], by (Select) 39] cons(X, Y) >= Y because [34], by (Star) 40] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(G, Z), X) because insert > @_{o -> o}, [41] and [28], by (Copy) 41] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(G, Z) because insert > @_{o -> o -> o}, [36] and [26], by (Copy) We can thus remove the following rules: max(X, 0) => X We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): max(s(X), s(Y)) >? max(X, Y) min(X, 0) >? 0 min(s(X), s(Y)) >? min(X, Y) insert(F, G, cons(X, Y), Z) >? cons(F Z X, insert(F, G, Y, G Z X)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ We choose Lex = {insert} and Mul = {@_{o -> o -> o}, @_{o -> o}, cons, max, min, s}, and the following precedence: min > s > insert > cons > @_{o -> o} > @_{o -> o -> o} > max Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: max(s(X), s(Y)) > max(X, Y) min(X, _|_) >= _|_ min(s(X), s(Y)) >= min(X, Y) insert(F, G, cons(X, Y), Z) > cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) With these choices, we have: 1] max(s(X), s(Y)) > max(X, Y) because [2], by definition 2] max*(s(X), s(Y)) >= max(X, Y) because max in Mul, [3] and [6], by (Stat) 3] s(X) >= X because [4], by (Star) 4] s*(X) >= X because [5], by (Select) 5] X >= X by (Meta) 6] s(Y) > Y because [7], by definition 7] s*(Y) >= Y because [8], by (Select) 8] Y >= Y by (Meta) 9] min(X, _|_) >= _|_ by (Bot) 10] min(s(X), s(Y)) >= min(X, Y) because [11], by (Star) 11] min*(s(X), s(Y)) >= min(X, Y) because min in Mul, [12] and [15], by (Stat) 12] s(X) > X because [13], by definition 13] s*(X) >= X because [14], by (Select) 14] X >= X by (Meta) 15] s(Y) >= Y because [16], by (Star) 16] s*(Y) >= Y because [17], by (Select) 17] Y >= Y by (Meta) 18] insert(F, G, cons(X, Y), Z) > cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) because [19], by definition 19] insert*(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, Z), X), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X))) because insert > cons, [20] and [30], by (Copy) 20] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(F, Z), X) because insert > @_{o -> o}, [21] and [26], by (Copy) 21] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(F, Z) because insert > @_{o -> o -> o}, [22] and [24], by (Copy) 22] insert*(F, G, cons(X, Y), Z) >= F because [23], by (Select) 23] F >= F by (Meta) 24] insert*(F, G, cons(X, Y), Z) >= Z because [25], by (Select) 25] Z >= Z by (Meta) 26] insert*(F, G, cons(X, Y), Z) >= X because [27], by (Select) 27] cons(X, Y) >= X because [28], by (Star) 28] cons*(X, Y) >= X because [29], by (Select) 29] X >= X by (Meta) 30] insert*(F, G, cons(X, Y), Z) >= insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, Z), X)) because [31], [32], [33], [22], [36], [37] and [39], by (Stat) 31] F >= F by (Meta) 32] G >= G by (Meta) 33] cons(X, Y) > Y because [34], by definition 34] cons*(X, Y) >= Y because [35], by (Select) 35] Y >= Y by (Meta) 36] insert*(F, G, cons(X, Y), Z) >= G because [32], by (Select) 37] insert*(F, G, cons(X, Y), Z) >= Y because [38], by (Select) 38] cons(X, Y) >= Y because [34], by (Star) 39] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(G, Z), X) because insert > @_{o -> o}, [40] and [26], by (Copy) 40] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(G, Z) because insert > @_{o -> o -> o}, [36] and [24], by (Copy) We can thus remove the following rules: max(s(X), s(Y)) => max(X, Y) insert(F, G, cons(X, Y), Z) => cons(F Z X, insert(F, G, Y, G Z X)) We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): min(X, 0) >? 0 min(s(X), s(Y)) >? min(X, Y) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[0]] = _|_ We choose Lex = {} and Mul = {min, s}, and the following precedence: min > s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: min(X, _|_) > _|_ min(s(X), s(Y)) >= min(X, Y) With these choices, we have: 1] min(X, _|_) > _|_ because [2], by definition 2] min*(X, _|_) >= _|_ by (Bot) 3] min(s(X), s(Y)) >= min(X, Y) because [4], by (Star) 4] min*(s(X), s(Y)) >= min(X, Y) because min in Mul, [5] and [8], by (Stat) 5] s(X) > X because [6], by definition 6] s*(X) >= X because [7], by (Select) 7] X >= X by (Meta) 8] s(Y) >= Y because [9], by (Star) 9] s*(Y) >= Y because [10], by (Select) 10] Y >= Y by (Meta) We can thus remove the following rules: min(X, 0) => 0 We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): min(s(X), s(Y)) >? min(X, Y) We use a recursive path ordering as defined in [Kop12, Chapter 5]. We choose Lex = {} and Mul = {min, s}, and the following precedence: min > s With these choices, we have: 1] min(s(X), s(Y)) > min(X, Y) because [2], by definition 2] min*(s(X), s(Y)) >= min(X, Y) because min in Mul, [3] and [6], by (Stat) 3] s(X) >= X because [4], by (Star) 4] s*(X) >= X because [5], by (Select) 5] X >= X by (Meta) 6] s(Y) > Y because [7], by definition 7] s*(Y) >= Y because [8], by (Select) 8] Y >= Y by (Meta) We can thus remove the following rules: min(s(X), s(Y)) => min(X, Y) All rules were succesfully removed. Thus, termination of the original system has been reduced to termination of the beta-rule, which is well-known to hold. +++ Citations +++ [Kop12] C. Kop. Higher Order Termination. PhD Thesis, 2012.