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