We consider the system Applicative_first_order_05__12. Alphabet: and : [a * a] --> a cons : [c * d] --> d false : [] --> b filter : [c -> b * d] --> d filter2 : [b * c -> b * c * d] --> d map : [c -> c * d] --> d nil : [] --> d not : [a] --> a or : [a * a] --> a true : [] --> b Rules: not(not(x)) => x not(or(x, y)) => and(not(x), not(y)) not(and(x, y)) => or(not(x), not(y)) and(x, or(y, z)) => or(and(x, y), and(x, z)) and(or(x, y), z) => or(and(z, x), and(z, y)) map(f, nil) => nil map(f, cons(x, y)) => cons(f x, map(f, y)) filter(f, nil) => nil filter(f, cons(x, y)) => filter2(f x, f, x, y) filter2(true, f, x, y) => cons(x, filter(f, y)) filter2(false, f, x, y) => filter(f, y) 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]): not(not(X)) >? X not(or(X, Y)) >? and(not(X), not(Y)) not(and(X, Y)) >? or(not(X), not(Y)) and(X, or(Y, Z)) >? or(and(X, Y), and(X, Z)) and(or(X, Y), Z) >? or(and(Z, X), and(Z, Y)) map(F, nil) >? nil map(F, cons(X, Y)) >? cons(F X, map(F, Y)) filter(F, nil) >? nil filter(F, cons(X, Y)) >? filter2(F X, F, X, Y) filter2(true, F, X, Y) >? cons(X, filter(F, Y)) filter2(false, F, X, Y) >? filter(F, Y) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[filter2(x_1, x_2, x_3, x_4)]] = filter2(x_2, x_4, x_3, x_1) [[map(x_1, x_2)]] = map(x_2, x_1) [[nil]] = _|_ [[or(x_1, x_2)]] = or(x_2, x_1) We choose Lex = {cons, filter, filter2, map, not, or} and Mul = {@_{o -> o}, and, false, true}, and the following precedence: not > and > map > or > true > filter = filter2 > @_{o -> o} > cons > false Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: not(not(X)) >= X not(or(X, Y)) >= and(not(X), not(Y)) not(and(X, Y)) >= or(not(X), not(Y)) and(X, or(Y, Z)) >= or(and(X, Y), and(X, Z)) and(or(X, Y), Z) >= or(and(Z, X), and(Z, Y)) map(F, _|_) >= _|_ map(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) filter(F, _|_) > _|_ filter(F, cons(X, Y)) > filter2(@_{o -> o}(F, X), F, X, Y) filter2(true, F, X, Y) >= cons(X, filter(F, Y)) filter2(false, F, X, Y) >= filter(F, Y) With these choices, we have: 1] not(not(X)) >= X because [2], by (Star) 2] not*(not(X)) >= X because [3], by (Select) 3] not(X) >= X because [4], by (Star) 4] not*(X) >= X because [5], by (Select) 5] X >= X by (Meta) 6] not(or(X, Y)) >= and(not(X), not(Y)) because [7], by (Star) 7] not*(or(X, Y)) >= and(not(X), not(Y)) because not > and, [8] and [14], by (Copy) 8] not*(or(X, Y)) >= not(X) because [9], [12] and [9], by (Stat) 9] or(X, Y) > X because [10], by definition 10] or*(X, Y) >= X because [11], by (Select) 11] X >= X by (Meta) 12] not*(or(X, Y)) >= X because [13], by (Select) 13] or(X, Y) >= X because [10], by (Star) 14] not*(or(X, Y)) >= not(Y) because [15], [18] and [15], by (Stat) 15] or(X, Y) > Y because [16], by definition 16] or*(X, Y) >= Y because [17], by (Select) 17] Y >= Y by (Meta) 18] not*(or(X, Y)) >= Y because [19], by (Select) 19] or(X, Y) >= Y because [16], by (Star) 20] not(and(X, Y)) >= or(not(X), not(Y)) because [21], by (Star) 21] not*(and(X, Y)) >= or(not(X), not(Y)) because not > or, [22] and [28], by (Copy) 22] not*(and(X, Y)) >= not(X) because [23], [26] and [23], by (Stat) 23] and(X, Y) > X because [24], by definition 24] and*(X, Y) >= X because [25], by (Select) 25] X >= X by (Meta) 26] not*(and(X, Y)) >= X because [27], by (Select) 27] and(X, Y) >= X because [24], by (Star) 28] not*(and(X, Y)) >= not(Y) because [29], [32] and [29], by (Stat) 29] and(X, Y) > Y because [30], by definition 30] and*(X, Y) >= Y because [31], by (Select) 31] Y >= Y by (Meta) 32] not*(and(X, Y)) >= Y because [33], by (Select) 33] and(X, Y) >= Y because [30], by (Star) 34] and(X, or(Y, Z)) >= or(and(X, Y), and(X, Z)) because [35], by (Star) 35] and*(X, or(Y, Z)) >= or(and(X, Y), and(X, Z)) because and > or, [36] and [41], by (Copy) 36] and*(X, or(Y, Z)) >= and(X, Y) because and in Mul, [37] and [38], by (Stat) 37] X >= X by (Meta) 38] or(Y, Z) > Y because [39], by definition 39] or*(Y, Z) >= Y because [40], by (Select) 40] Y >= Y by (Meta) 41] and*(X, or(Y, Z)) >= and(X, Z) because and in Mul, [37] and [42], by (Stat) 42] or(Y, Z) > Z because [43], by definition 43] or*(Y, Z) >= Z because [44], by (Select) 44] Z >= Z by (Meta) 45] and(or(X, Y), Z) >= or(and(Z, X), and(Z, Y)) because [46], by (Star) 46] and*(or(X, Y), Z) >= or(and(Z, X), and(Z, Y)) because and > or, [47] and [52], by (Copy) 47] and*(or(X, Y), Z) >= and(Z, X) because and in Mul, [48] and [51], by (Stat) 48] or(X, Y) > X because [49], by definition 49] or*(X, Y) >= X because [50], by (Select) 50] X >= X by (Meta) 51] Z >= Z by (Meta) 52] and*(or(X, Y), Z) >= and(Z, Y) because and in Mul, [53] and [51], by (Stat) 53] or(X, Y) > Y because [54], by definition 54] or*(X, Y) >= Y because [55], by (Select) 55] Y >= Y by (Meta) 56] map(F, _|_) >= _|_ by (Bot) 57] map(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) because [58], by (Star) 58] map*(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) because map > cons, [59] and [66], by (Copy) 59] map*(F, cons(X, Y)) >= @_{o -> o}(F, X) because map > @_{o -> o}, [60] and [62], by (Copy) 60] map*(F, cons(X, Y)) >= F because [61], by (Select) 61] F >= F by (Meta) 62] map*(F, cons(X, Y)) >= X because [63], by (Select) 63] cons(X, Y) >= X because [64], by (Star) 64] cons*(X, Y) >= X because [65], by (Select) 65] X >= X by (Meta) 66] map*(F, cons(X, Y)) >= map(F, Y) because [67], [60], [70], [72] and [67], by (Stat) 67] cons(X, Y) > Y because [68], by definition 68] cons*(X, Y) >= Y because [69], by (Select) 69] Y >= Y by (Meta) 70] map*(F, cons(X, Y)) >= Y because [71], by (Select) 71] cons(X, Y) >= Y because [68], by (Star) 72] F >= F by (Meta) 73] filter(F, _|_) > _|_ because [74], by definition 74] filter*(F, _|_) >= _|_ by (Bot) 75] filter(F, cons(X, Y)) > filter2(@_{o -> o}(F, X), F, X, Y) because [76], by definition 76] filter*(F, cons(X, Y)) >= filter2(@_{o -> o}(F, X), F, X, Y) because filter = filter2, [77], [78], [81], [82], [83] and [87], by (Stat) 77] F >= F by (Meta) 78] cons(X, Y) > Y because [79], by definition 79] cons*(X, Y) >= Y because [80], by (Select) 80] Y >= Y by (Meta) 81] filter*(F, cons(X, Y)) >= @_{o -> o}(F, X) because filter > @_{o -> o}, [82] and [83], by (Copy) 82] filter*(F, cons(X, Y)) >= F because [77], by (Select) 83] filter*(F, cons(X, Y)) >= X because [84], by (Select) 84] cons(X, Y) >= X because [85], by (Star) 85] cons*(X, Y) >= X because [86], by (Select) 86] X >= X by (Meta) 87] filter*(F, cons(X, Y)) >= Y because [88], by (Select) 88] cons(X, Y) >= Y because [79], by (Star) 89] filter2(true, F, X, Y) >= cons(X, filter(F, Y)) because [90], by (Star) 90] filter2*(true, F, X, Y) >= cons(X, filter(F, Y)) because filter2 > cons, [91] and [93], by (Copy) 91] filter2*(true, F, X, Y) >= X because [92], by (Select) 92] X >= X by (Meta) 93] filter2*(true, F, X, Y) >= filter(F, Y) because filter2 = filter, [94], [95], [96], [97], [94] and [95], by (Stat) 94] F >= F by (Meta) 95] Y >= Y by (Meta) 96] filter2*(true, F, X, Y) >= F because [94], by (Select) 97] filter2*(true, F, X, Y) >= Y because [95], by (Select) 98] filter2(false, F, X, Y) >= filter(F, Y) because [99], by (Star) 99] filter2*(false, F, X, Y) >= filter(F, Y) because filter2 = filter, [100], [101], [102], [103], [100] and [101], by (Stat) 100] F >= F by (Meta) 101] Y >= Y by (Meta) 102] filter2*(false, F, X, Y) >= F because [100], by (Select) 103] filter2*(false, F, X, Y) >= Y because [101], by (Select) We can thus remove the following rules: filter(F, nil) => nil filter(F, cons(X, Y)) => filter2(F X, F, 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]): not(not(X)) >? X not(or(X, Y)) >? and(not(X), not(Y)) not(and(X, Y)) >? or(not(X), not(Y)) and(X, or(Y, Z)) >? or(and(X, Y), and(X, Z)) and(or(X, Y), Z) >? or(and(Z, X), and(Z, Y)) map(F, nil) >? nil map(F, cons(X, Y)) >? cons(F X, map(F, Y)) filter2(true, F, X, Y) >? cons(X, filter(F, Y)) filter2(false, F, X, Y) >? filter(F, Y) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[@_{o -> o}(x_1, x_2)]] = @_{o -> o}(x_2, x_1) [[cons(x_1, x_2)]] = cons(x_2, x_1) [[filter2(x_1, x_2, x_3, x_4)]] = filter2(x_1, x_3, x_4, x_2) [[map(x_1, x_2)]] = map(x_2, x_1) [[or(x_1, x_2)]] = or(x_2, x_1) We choose Lex = {@_{o -> o}, cons, filter2, map, or} and Mul = {and, false, filter, nil, not, true}, and the following precedence: @_{o -> o} = filter2 = map > false > filter > cons > nil > not > and > or > true Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: not(not(X)) >= X not(or(X, Y)) > and(not(X), not(Y)) not(and(X, Y)) >= or(not(X), not(Y)) and(X, or(Y, Z)) > or(and(X, Y), and(X, Z)) and(or(X, Y), Z) > or(and(Z, X), and(Z, Y)) map(F, nil) >= nil map(F, cons(X, Y)) > cons(@_{o -> o}(F, X), map(F, Y)) filter2(true, F, X, Y) > cons(X, filter(F, Y)) filter2(false, F, X, Y) > filter(F, Y) With these choices, we have: 1] not(not(X)) >= X because [2], by (Star) 2] not*(not(X)) >= X because [3], by (Select) 3] not(X) >= X because [4], by (Star) 4] not*(X) >= X because [5], by (Select) 5] X >= X by (Meta) 6] not(or(X, Y)) > and(not(X), not(Y)) because [7], by definition 7] not*(or(X, Y)) >= and(not(X), not(Y)) because not > and, [8] and [12], by (Copy) 8] not*(or(X, Y)) >= not(X) because not in Mul and [9], by (Stat) 9] or(X, Y) > X because [10], by definition 10] or*(X, Y) >= X because [11], by (Select) 11] X >= X by (Meta) 12] not*(or(X, Y)) >= not(Y) because not in Mul and [13], by (Stat) 13] or(X, Y) > Y because [14], by definition 14] or*(X, Y) >= Y because [15], by (Select) 15] Y >= Y by (Meta) 16] not(and(X, Y)) >= or(not(X), not(Y)) because [17], by (Star) 17] not*(and(X, Y)) >= or(not(X), not(Y)) because not > or, [18] and [22], by (Copy) 18] not*(and(X, Y)) >= not(X) because not in Mul and [19], by (Stat) 19] and(X, Y) > X because [20], by definition 20] and*(X, Y) >= X because [21], by (Select) 21] X >= X by (Meta) 22] not*(and(X, Y)) >= not(Y) because not in Mul and [23], by (Stat) 23] and(X, Y) > Y because [24], by definition 24] and*(X, Y) >= Y because [25], by (Select) 25] Y >= Y by (Meta) 26] and(X, or(Y, Z)) > or(and(X, Y), and(X, Z)) because [27], by definition 27] and*(X, or(Y, Z)) >= or(and(X, Y), and(X, Z)) because and > or, [28] and [33], by (Copy) 28] and*(X, or(Y, Z)) >= and(X, Y) because and in Mul, [29] and [30], by (Stat) 29] X >= X by (Meta) 30] or(Y, Z) > Y because [31], by definition 31] or*(Y, Z) >= Y because [32], by (Select) 32] Y >= Y by (Meta) 33] and*(X, or(Y, Z)) >= and(X, Z) because and in Mul, [29] and [34], by (Stat) 34] or(Y, Z) > Z because [35], by definition 35] or*(Y, Z) >= Z because [36], by (Select) 36] Z >= Z by (Meta) 37] and(or(X, Y), Z) > or(and(Z, X), and(Z, Y)) because [38], by definition 38] and*(or(X, Y), Z) >= or(and(Z, X), and(Z, Y)) because and > or, [39] and [44], by (Copy) 39] and*(or(X, Y), Z) >= and(Z, X) because and in Mul, [40] and [43], by (Stat) 40] or(X, Y) > X because [41], by definition 41] or*(X, Y) >= X because [42], by (Select) 42] X >= X by (Meta) 43] Z >= Z by (Meta) 44] and*(or(X, Y), Z) >= and(Z, Y) because and in Mul, [45] and [43], by (Stat) 45] or(X, Y) > Y because [46], by definition 46] or*(X, Y) >= Y because [47], by (Select) 47] Y >= Y by (Meta) 48] map(F, nil) >= nil because [49], by (Star) 49] map*(F, nil) >= nil because map > nil, by (Copy) 50] map(F, cons(X, Y)) > cons(@_{o -> o}(F, X), map(F, Y)) because [51], by definition 51] map*(F, cons(X, Y)) >= cons(@_{o -> o}(F, X), map(F, Y)) because map > cons, [52] and [61], by (Copy) 52] map*(F, cons(X, Y)) >= @_{o -> o}(F, X) because map = @_{o -> o}, [53], [56], [58], [60] and [53], by (Stat) 53] cons(X, Y) > X because [54], by definition 54] cons*(X, Y) >= X because [55], by (Select) 55] X >= X by (Meta) 56] map*(F, cons(X, Y)) >= F because [57], by (Select) 57] F >= F by (Meta) 58] map*(F, cons(X, Y)) >= X because [59], by (Select) 59] cons(X, Y) >= X because [54], by (Star) 60] F >= F by (Meta) 61] map*(F, cons(X, Y)) >= map(F, Y) because [62], [56], [65], [60] and [62], by (Stat) 62] cons(X, Y) > Y because [63], by definition 63] cons*(X, Y) >= Y because [64], by (Select) 64] Y >= Y by (Meta) 65] map*(F, cons(X, Y)) >= Y because [66], by (Select) 66] cons(X, Y) >= Y because [63], by (Star) 67] filter2(true, F, X, Y) > cons(X, filter(F, Y)) because [68], by definition 68] filter2*(true, F, X, Y) >= cons(X, filter(F, Y)) because filter2 > cons, [69] and [71], by (Copy) 69] filter2*(true, F, X, Y) >= X because [70], by (Select) 70] X >= X by (Meta) 71] filter2*(true, F, X, Y) >= filter(F, Y) because filter2 > filter, [72] and [74], by (Copy) 72] filter2*(true, F, X, Y) >= F because [73], by (Select) 73] F >= F by (Meta) 74] filter2*(true, F, X, Y) >= Y because [75], by (Select) 75] Y >= Y by (Meta) 76] filter2(false, F, X, Y) > filter(F, Y) because [77], by definition 77] filter2*(false, F, X, Y) >= filter(F, Y) because filter2 > filter, [78] and [80], by (Copy) 78] filter2*(false, F, X, Y) >= F because [79], by (Select) 79] F >= F by (Meta) 80] filter2*(false, F, X, Y) >= Y because [81], by (Select) 81] Y >= Y by (Meta) We can thus remove the following rules: not(or(X, Y)) => and(not(X), not(Y)) and(X, or(Y, Z)) => or(and(X, Y), and(X, Z)) and(or(X, Y), Z) => or(and(Z, X), and(Z, Y)) map(F, cons(X, Y)) => cons(F X, map(F, Y)) filter2(true, F, X, Y) => cons(X, filter(F, Y)) filter2(false, F, X, Y) => filter(F, 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]): not(not(X)) >? X not(and(X, Y)) >? or(not(X), not(Y)) map(F, nil) >? nil We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: and = Lam[y0;y1].3 + 3*y0 + 3*y1 map = Lam[G0;y1].3 + 3*y1 + G0(0) nil = 2 not = Lam[y0].3*y0 or = Lam[y0;y1].y0 + y1 Using this interpretation, the requirements translate to: [[not(not(_x0))]] = 9*x0 >= x0 = [[_x0]] [[not(and(_x0, _x1))]] = 9 + 9*x0 + 9*x1 > 3*x0 + 3*x1 = [[or(not(_x0), not(_x1))]] [[map(_F0, nil)]] = 9 + F0(0) > 2 = [[nil]] We can thus remove the following rules: not(and(X, Y)) => or(not(X), not(Y)) map(F, nil) => nil We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): not(not(X)) >? X We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: not = Lam[y0].3 + 2*y0 Using this interpretation, the requirements translate to: [[not(not(_x0))]] = 9 + 4*x0 > x0 = [[_x0]] We can thus remove the following rules: not(not(X)) => X 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.