1.89/1.98 YES 1.97/2.02 We consider the system theBenchmark. 1.97/2.02 1.97/2.02 Alphabet: 1.97/2.02 1.97/2.02 0 : [] --> a 1.97/2.02 asort : [b] --> b 1.97/2.02 cons : [a * b] --> b 1.97/2.02 dsort : [b] --> b 1.97/2.02 insert : [a -> a -> a * a -> a -> a * b * a] --> b 1.97/2.02 max : [] --> a -> a -> a 1.97/2.02 min : [] --> a -> a -> a 1.97/2.02 nil : [] --> b 1.97/2.02 s : [a] --> a 1.97/2.02 sort : [a -> a -> a * a -> a -> a * b] --> b 1.97/2.02 1.97/2.02 Rules: 1.97/2.02 1.97/2.02 sort(f, g, nil) => nil 1.97/2.02 sort(f, g, cons(x, y)) => insert(f, g, sort(f, g, y), x) 1.97/2.02 insert(f, g, nil, x) => cons(x, nil) 1.97/2.02 insert(f, g, cons(x, y), z) => cons(f x z, insert(f, g, y, g x z)) 1.97/2.02 max 0 x => x 1.97/2.02 max x 0 => x 1.97/2.02 max s(x) s(y) => max x y 1.97/2.02 min 0 x => 0 1.97/2.02 min x 0 => 0 1.97/2.02 min s(x) s(y) => min x y 1.97/2.02 asort(x) => sort(min, max, x) 1.97/2.02 dsort(x) => sort(max, min, x) 1.97/2.02 1.97/2.02 This AFS is converted to an AFSM simply by replacing all free variables by meta-variables (with arity 0). 1.97/2.02 1.97/2.02 We use rule removal, following [Kop12, Theorem 2.23]. 1.97/2.02 1.97/2.02 This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 1.97/2.02 1.97/2.02 sort(F, G, nil) >? nil 1.97/2.02 sort(F, G, cons(X, Y)) >? insert(F, G, sort(F, G, Y), X) 1.97/2.02 insert(F, G, nil, X) >? cons(X, nil) 1.97/2.02 insert(F, G, cons(X, Y), Z) >? cons(F X Z, insert(F, G, Y, G X Z)) 1.97/2.02 max 0 X >? X 1.97/2.02 max X 0 >? X 1.97/2.02 max s(X) s(Y) >? max X Y 1.97/2.02 min 0 X >? 0 1.97/2.02 min X 0 >? 0 1.97/2.02 min s(X) s(Y) >? min X Y 1.97/2.02 asort(X) >? sort(min, max, X) 1.97/2.02 dsort(X) >? sort(max, min, X) 1.97/2.02 1.97/2.02 We use a recursive path ordering as defined in [Kop12, Chapter 5]. 1.97/2.02 1.97/2.02 Argument functions: 1.97/2.02 1.97/2.02 [[0]] = _|_ 1.97/2.02 [[insert(x_1, x_2, x_3, x_4)]] = insert(x_2, x_3, x_4, x_1) 1.97/2.02 [[nil]] = _|_ 1.97/2.02 1.97/2.02 We choose Lex = {insert} and Mul = {@_{o -> o -> o}, @_{o -> o}, asort, cons, dsort, max, min, s, sort}, and the following precedence: dsort > asort = max > min > s > sort > insert > @_{o -> o} > cons > @_{o -> o -> o} 1.97/2.02 1.97/2.02 Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: 1.97/2.02 1.97/2.02 sort(F, G, _|_) >= _|_ 1.97/2.02 sort(F, G, cons(X, Y)) >= insert(F, G, sort(F, G, Y), X) 1.97/2.02 insert(F, G, _|_, X) >= cons(X, _|_) 1.97/2.02 insert(F, G, cons(X, Y), Z) > cons(@_{o -> o}(@_{o -> o -> o}(F, X), Z), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, X), Z))) 1.97/2.02 @_{o -> o}(@_{o -> o -> o}(max, _|_), X) > X 1.97/2.02 @_{o -> o}(@_{o -> o -> o}(max, X), _|_) >= X 1.97/2.02 @_{o -> o}(@_{o -> o -> o}(max, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(max, X), Y) 1.97/2.02 @_{o -> o}(@_{o -> o -> o}(min, _|_), X) >= _|_ 1.97/2.02 @_{o -> o}(@_{o -> o -> o}(min, X), _|_) >= _|_ 1.97/2.02 @_{o -> o}(@_{o -> o -> o}(min, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(min, X), Y) 1.97/2.02 asort(X) >= sort(min, max, X) 1.97/2.02 dsort(X) >= sort(max, min, X) 1.97/2.02 1.97/2.02 With these choices, we have: 1.97/2.02 1.97/2.02 1] sort(F, G, _|_) >= _|_ by (Bot) 1.97/2.02 1.97/2.02 2] sort(F, G, cons(X, Y)) >= insert(F, G, sort(F, G, Y), X) because [3], by (Star) 1.97/2.02 3] sort*(F, G, cons(X, Y)) >= insert(F, G, sort(F, G, Y), X) because sort > insert, [4], [6], [8] and [14], by (Copy) 1.97/2.02 4] sort*(F, G, cons(X, Y)) >= F because [5], by (Select) 1.97/2.02 5] F >= F by (Meta) 1.97/2.02 6] sort*(F, G, cons(X, Y)) >= G because [7], by (Select) 1.97/2.02 7] G >= G by (Meta) 1.97/2.02 8] sort*(F, G, cons(X, Y)) >= sort(F, G, Y) because sort in Mul, [9], [10] and [11], by (Stat) 1.97/2.02 9] F >= F by (Meta) 1.97/2.02 10] G >= G by (Meta) 1.97/2.02 11] cons(X, Y) > Y because [12], by definition 1.97/2.02 12] cons*(X, Y) >= Y because [13], by (Select) 1.97/2.02 13] Y >= Y by (Meta) 1.97/2.02 14] sort*(F, G, cons(X, Y)) >= X because [15], by (Select) 1.97/2.02 15] cons(X, Y) >= X because [16], by (Star) 1.97/2.02 16] cons*(X, Y) >= X because [17], by (Select) 1.97/2.02 17] X >= X by (Meta) 1.97/2.02 1.97/2.02 18] insert(F, G, _|_, X) >= cons(X, _|_) because [19], by (Star) 1.97/2.02 19] insert*(F, G, _|_, X) >= cons(X, _|_) because insert > cons, [20] and [22], by (Copy) 1.97/2.02 20] insert*(F, G, _|_, X) >= X because [21], by (Select) 1.97/2.02 21] X >= X by (Meta) 1.97/2.02 22] insert*(F, G, _|_, X) >= _|_ by (Bot) 1.97/2.02 1.97/2.02 23] insert(F, G, cons(X, Y), Z) > cons(@_{o -> o}(@_{o -> o -> o}(F, X), Z), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, X), Z))) because [24], by definition 1.97/2.02 24] insert*(F, G, cons(X, Y), Z) >= cons(@_{o -> o}(@_{o -> o -> o}(F, X), Z), insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, X), Z))) because insert > cons, [25] and [35], by (Copy) 1.97/2.02 25] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(F, X), Z) because insert > @_{o -> o}, [26] and [33], by (Copy) 1.97/2.02 26] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(F, X) because insert > @_{o -> o -> o}, [27] and [29], by (Copy) 1.97/2.02 27] insert*(F, G, cons(X, Y), Z) >= F because [28], by (Select) 1.97/2.02 28] F >= F by (Meta) 1.97/2.02 29] insert*(F, G, cons(X, Y), Z) >= X because [30], by (Select) 1.97/2.02 30] cons(X, Y) >= X because [31], by (Star) 1.97/2.02 31] cons*(X, Y) >= X because [32], by (Select) 1.97/2.02 32] X >= X by (Meta) 1.97/2.02 33] insert*(F, G, cons(X, Y), Z) >= Z because [34], by (Select) 1.97/2.02 34] Z >= Z by (Meta) 1.97/2.02 35] insert*(F, G, cons(X, Y), Z) >= insert(F, G, Y, @_{o -> o}(@_{o -> o -> o}(G, X), Z)) because [36], [37], [27], [40], [41] and [43], by (Stat) 1.97/2.02 36] G >= G by (Meta) 1.97/2.02 37] cons(X, Y) > Y because [38], by definition 1.97/2.02 38] cons*(X, Y) >= Y because [39], by (Select) 1.97/2.02 39] Y >= Y by (Meta) 1.97/2.02 40] insert*(F, G, cons(X, Y), Z) >= G because [36], by (Select) 1.97/2.02 41] insert*(F, G, cons(X, Y), Z) >= Y because [42], by (Select) 1.97/2.02 42] cons(X, Y) >= Y because [38], by (Star) 1.97/2.02 43] insert*(F, G, cons(X, Y), Z) >= @_{o -> o}(@_{o -> o -> o}(G, X), Z) because insert > @_{o -> o}, [44] and [33], by (Copy) 1.97/2.02 44] insert*(F, G, cons(X, Y), Z) >= @_{o -> o -> o}(G, X) because insert > @_{o -> o -> o}, [40] and [29], by (Copy) 1.97/2.02 1.97/2.02 45] @_{o -> o}(@_{o -> o -> o}(max, _|_), X) > X because [46], by definition 1.97/2.02 46] @_{o -> o}*(@_{o -> o -> o}(max, _|_), X) >= X because [47], by (Select) 1.97/2.02 47] X >= X by (Meta) 1.97/2.02 1.97/2.02 48] @_{o -> o}(@_{o -> o -> o}(max, X), _|_) >= X because [49], by (Star) 1.97/2.02 49] @_{o -> o}*(@_{o -> o -> o}(max, X), _|_) >= X because [50], by (Select) 1.97/2.02 50] @_{o -> o -> o}(max, X) @_{o -> o}*(@_{o -> o -> o}(max, X), _|_) >= X because [51] 1.97/2.02 51] @_{o -> o -> o}*(max, X, @_{o -> o}*(@_{o -> o -> o}(max, X), _|_)) >= X because [52], by (Select) 1.97/2.02 52] X >= X by (Meta) 1.97/2.02 1.97/2.02 53] @_{o -> o}(@_{o -> o -> o}(max, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(max, X), Y) because @_{o -> o} in Mul, [54] and [59], by (Fun) 1.97/2.02 54] @_{o -> o -> o}(max, s(X)) >= @_{o -> o -> o}(max, X) because @_{o -> o -> o} in Mul, [55] and [56], by (Fun) 1.97/2.02 55] max >= max by (Fun) 1.97/2.02 56] s(X) >= X because [57], by (Star) 1.97/2.02 57] s*(X) >= X because [58], by (Select) 1.97/2.02 58] X >= X by (Meta) 1.97/2.02 59] s(Y) >= Y because [60], by (Star) 1.97/2.02 60] s*(Y) >= Y because [61], by (Select) 1.97/2.02 61] Y >= Y by (Meta) 1.97/2.02 1.97/2.02 62] @_{o -> o}(@_{o -> o -> o}(min, _|_), X) >= _|_ by (Bot) 1.97/2.02 1.97/2.02 63] @_{o -> o}(@_{o -> o -> o}(min, X), _|_) >= _|_ by (Bot) 1.97/2.02 1.97/2.02 64] @_{o -> o}(@_{o -> o -> o}(min, s(X)), s(Y)) >= @_{o -> o}(@_{o -> o -> o}(min, X), Y) because @_{o -> o} in Mul, [65] and [70], by (Fun) 1.97/2.02 65] @_{o -> o -> o}(min, s(X)) >= @_{o -> o -> o}(min, X) because @_{o -> o -> o} in Mul, [66] and [67], by (Fun) 1.97/2.02 66] min >= min by (Fun) 1.97/2.02 67] s(X) >= X because [68], by (Star) 1.97/2.02 68] s*(X) >= X because [69], by (Select) 1.97/2.02 69] X >= X by (Meta) 1.97/2.02 70] s(Y) >= Y because [71], by (Star) 1.97/2.02 71] s*(Y) >= Y because [72], by (Select) 1.97/2.02 72] Y >= Y by (Meta) 1.97/2.02 1.97/2.02 73] asort(X) >= sort(min, max, X) because [74], by (Star) 1.97/2.02 74] asort*(X) >= sort(min, max, X) because asort > sort, [75], [76] and [77], by (Copy) 1.97/2.02 75] asort*(X) >= min because asort > min, by (Copy) 1.97/2.02 76] asort*(X) >= max because asort = max and asort in Mul, by (Stat) 1.97/2.02 77] asort*(X) >= X because [78], by (Select) 1.97/2.02 78] X >= X by (Meta) 1.97/2.02 1.97/2.02 79] dsort(X) >= sort(max, min, X) because [80], by (Star) 1.97/2.02 80] dsort*(X) >= sort(max, min, X) because dsort > sort, [81], [82] and [83], by (Copy) 1.97/2.02 81] dsort*(X) >= max because dsort > max, by (Copy) 1.97/2.02 82] dsort*(X) >= min because dsort > min, by (Copy) 1.97/2.02 83] dsort*(X) >= X because [84], by (Select) 1.97/2.02 84] X >= X by (Meta) 1.97/2.02 1.97/2.02 We can thus remove the following rules: 1.97/2.02 1.97/2.02 insert(F, G, cons(X, Y), Z) => cons(F X Z, insert(F, G, Y, G X Z)) 1.97/2.02 max 0 X => X 1.97/2.02 1.97/2.02 We use rule removal, following [Kop12, Theorem 2.23]. 1.97/2.02 1.97/2.02 This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 1.97/2.02 1.97/2.02 sort(F, G, nil) >? nil 1.97/2.02 sort(F, G, cons(X, Y)) >? insert(F, G, sort(F, G, Y), X) 1.97/2.02 insert(F, G, nil, X) >? cons(X, nil) 1.97/2.02 max X 0 >? X 1.97/2.02 max s(X) s(Y) >? max X Y 1.97/2.02 min 0 X >? 0 1.97/2.02 min X 0 >? 0 1.97/2.02 min s(X) s(Y) >? min X Y 1.97/2.02 asort(X) >? sort(min, max, X) 1.97/2.02 dsort(X) >? sort(max, min, X) 1.97/2.02 1.97/2.02 We orient these requirements with a polynomial interpretation in the natural numbers. 1.97/2.02 1.97/2.02 The following interpretation satisfies the requirements: 1.97/2.02 1.97/2.02 0 = 3 1.97/2.02 asort = \y0.3 + 3y0 1.97/2.02 cons = \y0y1.3 + y0 + 2y1 1.97/2.02 dsort = \y0.3 + 3y0 1.97/2.02 insert = \G0G1y2y3.3 + y2 + y3 + G0(y3,y3) + G1(y3,y3) 1.97/2.02 max = \y0y1.0 1.97/2.02 min = \y0y1.0 1.97/2.02 nil = 0 1.97/2.02 s = \y0.3 + 3y0 1.97/2.02 sort = \G0G1y2.3y2 + G0(y2,y2) + 2y2y2G1(y2,y2) + 2G1(y2,y2) + y2y2G0(y2,y2) 1.97/2.02 1.97/2.02 Using this interpretation, the requirements translate to: 1.97/2.02 1.97/2.02 [[sort(_F0, _F1, nil)]] = F0(0,0) + 2F1(0,0) >= 0 = [[nil]] 1.97/2.02 [[sort(_F0, _F1, cons(_x2, _x3))]] = 9 + 3x2 + 6x3 + 2x2x2F1(3 + x2 + 2x3,3 + x2 + 2x3) + 4x2x3F0(3 + x2 + 2x3,3 + x2 + 2x3) + 4x3x3F0(3 + x2 + 2x3,3 + x2 + 2x3) + 6x2F0(3 + x2 + 2x3,3 + x2 + 2x3) + 8x2x3F1(3 + x2 + 2x3,3 + x2 + 2x3) + 8x3x3F1(3 + x2 + 2x3,3 + x2 + 2x3) + 10F0(3 + x2 + 2x3,3 + x2 + 2x3) + 12x2F1(3 + x2 + 2x3,3 + x2 + 2x3) + 12x3F0(3 + x2 + 2x3,3 + x2 + 2x3) + 20F1(3 + x2 + 2x3,3 + x2 + 2x3) + 24x3F1(3 + x2 + 2x3,3 + x2 + 2x3) + x2x2F0(3 + x2 + 2x3,3 + x2 + 2x3) > 3 + x2 + 3x3 + F0(x2,x2) + F0(x3,x3) + F1(x2,x2) + 2x3x3F1(x3,x3) + 2F1(x3,x3) + x3x3F0(x3,x3) = [[insert(_F0, _F1, sort(_F0, _F1, _x3), _x2)]] 1.97/2.02 [[insert(_F0, _F1, nil, _x2)]] = 3 + x2 + F0(x2,x2) + F1(x2,x2) >= 3 + x2 = [[cons(_x2, nil)]] 1.97/2.02 [[max _x0 0]] = 3 + x0 > x0 = [[_x0]] 1.97/2.02 [[max s(_x0) s(_x1)]] = 6 + 3x0 + 3x1 > x0 + x1 = [[max _x0 _x1]] 1.97/2.02 [[min 0 _x0]] = 3 + x0 >= 3 = [[0]] 1.97/2.02 [[min _x0 0]] = 3 + x0 >= 3 = [[0]] 1.97/2.02 [[min s(_x0) s(_x1)]] = 6 + 3x0 + 3x1 > x0 + x1 = [[min _x0 _x1]] 1.97/2.02 [[asort(_x0)]] = 3 + 3x0 > 3x0 = [[sort(min, max, _x0)]] 1.97/2.02 [[dsort(_x0)]] = 3 + 3x0 > 3x0 = [[sort(max, min, _x0)]] 1.97/2.02 1.97/2.02 We can thus remove the following rules: 1.97/2.02 1.97/2.02 sort(F, G, cons(X, Y)) => insert(F, G, sort(F, G, Y), X) 1.97/2.02 max X 0 => X 1.97/2.02 max s(X) s(Y) => max X Y 1.97/2.02 min s(X) s(Y) => min X Y 1.97/2.02 asort(X) => sort(min, max, X) 1.97/2.02 dsort(X) => sort(max, min, X) 1.97/2.02 1.97/2.02 We use rule removal, following [Kop12, Theorem 2.23]. 1.97/2.02 1.97/2.02 This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): 1.97/2.02 1.97/2.02 sort(F, G, nil) >? nil 1.97/2.02 insert(F, G, nil, X) >? cons(X, nil) 1.97/2.02 min(0, X) >? 0 1.97/2.02 min(X, 0) >? 0 1.97/2.02 1.97/2.02 We orient these requirements with a polynomial interpretation in the natural numbers. 1.97/2.02 1.97/2.02 The following interpretation satisfies the requirements: 1.97/2.02 1.97/2.02 0 = 0 1.97/2.02 cons = \y0y1.y0 + y1 1.97/2.02 insert = \G0G1y2y3.3 + 3y2 + 3y3 + G0(0,0) + G1(0,0) 1.97/2.02 min = \y0y1.3 + 3y0 + 3y1 1.97/2.02 nil = 0 1.97/2.02 sort = \G0G1y2.3 + 3y2 + G0(0,0) + G1(0,0) 1.97/2.02 1.97/2.02 Using this interpretation, the requirements translate to: 1.97/2.02 1.97/2.02 [[sort(_F0, _F1, nil)]] = 3 + F0(0,0) + F1(0,0) > 0 = [[nil]] 1.97/2.02 [[insert(_F0, _F1, nil, _x2)]] = 3 + 3x2 + F0(0,0) + F1(0,0) > x2 = [[cons(_x2, nil)]] 1.97/2.02 [[min(0, _x0)]] = 3 + 3x0 > 0 = [[0]] 1.97/2.02 [[min(_x0, 0)]] = 3 + 3x0 > 0 = [[0]] 1.97/2.02 1.97/2.02 We can thus remove the following rules: 1.97/2.02 1.97/2.02 sort(F, G, nil) => nil 1.97/2.02 insert(F, G, nil, X) => cons(X, nil) 1.97/2.02 min(0, X) => 0 1.97/2.02 min(X, 0) => 0 1.97/2.02 1.97/2.02 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. 1.97/2.02 1.97/2.02 1.97/2.02 +++ Citations +++ 1.97/2.02 1.97/2.02 [Kop12] C. Kop. Higher Order Termination. PhD Thesis, 2012. 1.97/2.02 EOF