We consider the system Applicative_first_order_05__13. Alphabet: !facplus : [a * a] --> a !factimes : [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 true : [] --> b Rules: !factimes(x, !facplus(y, z)) => !facplus(!factimes(x, y), !factimes(x, z)) !factimes(!facplus(x, y), z) => !facplus(!factimes(z, x), !factimes(z, y)) !factimes(!factimes(x, y), z) => !factimes(x, !factimes(y, z)) !facplus(!facplus(x, y), z) => !facplus(x, !facplus(y, z)) 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]): !factimes(X, !facplus(Y, Z)) >? !facplus(!factimes(X, Y), !factimes(X, Z)) !factimes(!facplus(X, Y), Z) >? !facplus(!factimes(Z, X), !factimes(Z, Y)) !factimes(!factimes(X, Y), Z) >? !factimes(X, !factimes(Y, Z)) !facplus(!facplus(X, Y), Z) >? !facplus(X, !facplus(Y, Z)) 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 orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: !facplus = \y0y1.2 + y1 + 2y0 !factimes = \y0y1.y0 + y1 + y0y1 cons = \y0y1.2 + y0 + y1 false = 3 filter = \G0y1.2y1 + G0(0) + y1G0(y1) filter2 = \y0G1y2y3.y0 + y2 + 2y3 + G1(0) + y3G1(y3) map = \G0y1.2 + 3y1 + G0(0) + 2y1G0(y1) nil = 1 true = 3 Using this interpretation, the requirements translate to: [[!factimes(_x0, !facplus(_x1, _x2))]] = 2 + x2 + 2x0x1 + 2x1 + 3x0 + x0x2 >= 2 + x2 + 2x0x1 + 2x1 + 3x0 + x0x2 = [[!facplus(!factimes(_x0, _x1), !factimes(_x0, _x2))]] [[!factimes(!facplus(_x0, _x1), _x2)]] = 2 + x1 + 2x0 + 2x0x2 + 3x2 + x1x2 >= 2 + x1 + 2x0 + 2x0x2 + 3x2 + x1x2 = [[!facplus(!factimes(_x2, _x0), !factimes(_x2, _x1))]] [[!factimes(!factimes(_x0, _x1), _x2)]] = x0 + x1 + x2 + x0x1 + x0x1x2 + x0x2 + x1x2 >= x0 + x1 + x2 + x0x1 + x0x1x2 + x0x2 + x1x2 = [[!factimes(_x0, !factimes(_x1, _x2))]] [[!facplus(!facplus(_x0, _x1), _x2)]] = 6 + x2 + 2x1 + 4x0 > 4 + x2 + 2x0 + 2x1 = [[!facplus(_x0, !facplus(_x1, _x2))]] [[map(_F0, nil)]] = 5 + F0(0) + 2F0(1) > 1 = [[nil]] [[map(_F0, cons(_x1, _x2))]] = 8 + 3x1 + 3x2 + F0(0) + 2x1F0(2 + x1 + x2) + 2x2F0(2 + x1 + x2) + 4F0(2 + x1 + x2) > 4 + x1 + 3x2 + F0(0) + F0(x1) + 2x2F0(x2) = [[cons(_F0 _x1, map(_F0, _x2))]] [[filter(_F0, nil)]] = 2 + F0(0) + F0(1) > 1 = [[nil]] [[filter(_F0, cons(_x1, _x2))]] = 4 + 2x1 + 2x2 + F0(0) + 2F0(2 + x1 + x2) + x1F0(2 + x1 + x2) + x2F0(2 + x1 + x2) > 2x1 + 2x2 + F0(0) + F0(x1) + x2F0(x2) = [[filter2(_F0 _x1, _F0, _x1, _x2)]] [[filter2(true, _F0, _x1, _x2)]] = 3 + x1 + 2x2 + F0(0) + x2F0(x2) > 2 + x1 + 2x2 + F0(0) + x2F0(x2) = [[cons(_x1, filter(_F0, _x2))]] [[filter2(false, _F0, _x1, _x2)]] = 3 + x1 + 2x2 + F0(0) + x2F0(x2) > 2x2 + F0(0) + x2F0(x2) = [[filter(_F0, _x2)]] We can thus remove the following rules: !facplus(!facplus(X, Y), Z) => !facplus(X, !facplus(Y, Z)) 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 rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): !factimes(X, !facplus(Y, Z)) >? !facplus(!factimes(X, Y), !factimes(X, Z)) !factimes(!facplus(X, Y), Z) >? !facplus(!factimes(Z, X), !factimes(Z, Y)) !factimes(!factimes(X, Y), Z) >? !factimes(X, !factimes(Y, Z)) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: !facplus = \y0y1.1 + y0 + y1 !factimes = \y0y1.y1 + 2y0 + 3y0y1 Using this interpretation, the requirements translate to: [[!factimes(_x0, !facplus(_x1, _x2))]] = 1 + x1 + x2 + 3x0x1 + 3x0x2 + 5x0 >= 1 + x1 + x2 + 3x0x1 + 3x0x2 + 4x0 = [[!facplus(!factimes(_x0, _x1), !factimes(_x0, _x2))]] [[!factimes(!facplus(_x0, _x1), _x2)]] = 2 + 2x0 + 2x1 + 3x0x2 + 3x1x2 + 4x2 > 1 + x0 + x1 + 3x0x2 + 3x1x2 + 4x2 = [[!facplus(!factimes(_x2, _x0), !factimes(_x2, _x1))]] [[!factimes(!factimes(_x0, _x1), _x2)]] = x2 + 2x1 + 3x1x2 + 4x0 + 6x0x1 + 6x0x2 + 9x0x1x2 >= x2 + 2x0 + 2x1 + 3x0x2 + 3x1x2 + 6x0x1 + 9x0x1x2 = [[!factimes(_x0, !factimes(_x1, _x2))]] We can thus remove the following rules: !factimes(!facplus(X, Y), Z) => !facplus(!factimes(Z, X), !factimes(Z, 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]): !factimes(X, !facplus(Y, Z)) >? !facplus(!factimes(X, Y), !factimes(X, Z)) !factimes(!factimes(X, Y), Z) >? !factimes(X, !factimes(Y, Z)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. We choose Lex = {!factimes} and Mul = {!facplus}, and the following precedence: !factimes > !facplus With these choices, we have: 1] !factimes(X, !facplus(Y, Z)) >= !facplus(!factimes(X, Y), !factimes(X, Z)) because [2], by (Star) 2] !factimes*(X, !facplus(Y, Z)) >= !facplus(!factimes(X, Y), !factimes(X, Z)) because !factimes > !facplus, [3] and [11], by (Copy) 3] !factimes*(X, !facplus(Y, Z)) >= !factimes(X, Y) because [4], [5], [8] and [9], by (Stat) 4] X >= X by (Meta) 5] !facplus(Y, Z) > Y because [6], by definition 6] !facplus*(Y, Z) >= Y because [7], by (Select) 7] Y >= Y by (Meta) 8] !factimes*(X, !facplus(Y, Z)) >= X because [4], by (Select) 9] !factimes*(X, !facplus(Y, Z)) >= Y because [10], by (Select) 10] !facplus(Y, Z) >= Y because [6], by (Star) 11] !factimes*(X, !facplus(Y, Z)) >= !factimes(X, Z) because [4], [12], [8] and [15], by (Stat) 12] !facplus(Y, Z) > Z because [13], by definition 13] !facplus*(Y, Z) >= Z because [14], by (Select) 14] Z >= Z by (Meta) 15] !factimes*(X, !facplus(Y, Z)) >= Z because [16], by (Select) 16] !facplus(Y, Z) >= Z because [13], by (Star) 17] !factimes(!factimes(X, Y), Z) > !factimes(X, !factimes(Y, Z)) because [18], by definition 18] !factimes*(!factimes(X, Y), Z) >= !factimes(X, !factimes(Y, Z)) because [19], [22] and [24], by (Stat) 19] !factimes(X, Y) > X because [20], by definition 20] !factimes*(X, Y) >= X because [21], by (Select) 21] X >= X by (Meta) 22] !factimes*(!factimes(X, Y), Z) >= X because [23], by (Select) 23] !factimes(X, Y) >= X because [20], by (Star) 24] !factimes*(!factimes(X, Y), Z) >= !factimes(Y, Z) because [25], [28] and [30], by (Stat) 25] !factimes(X, Y) > Y because [26], by definition 26] !factimes*(X, Y) >= Y because [27], by (Select) 27] Y >= Y by (Meta) 28] !factimes*(!factimes(X, Y), Z) >= Y because [29], by (Select) 29] !factimes(X, Y) >= Y because [26], by (Star) 30] !factimes*(!factimes(X, Y), Z) >= Z because [31], by (Select) 31] Z >= Z by (Meta) We can thus remove the following rules: !factimes(!factimes(X, Y), Z) => !factimes(X, !factimes(Y, Z)) We use rule removal, following [Kop12, Theorem 2.23]. This gives the following requirements (possibly using Theorems 2.25 and 2.26 in [Kop12]): !factimes(X, !facplus(Y, Z)) >? !facplus(!factimes(X, Y), !factimes(X, Z)) We use a recursive path ordering as defined in [Kop12, Chapter 5]. We choose Lex = {} and Mul = {!facplus, !factimes}, and the following precedence: !factimes > !facplus With these choices, we have: 1] !factimes(X, !facplus(Y, Z)) > !facplus(!factimes(X, Y), !factimes(X, Z)) because [2], by definition 2] !factimes*(X, !facplus(Y, Z)) >= !facplus(!factimes(X, Y), !factimes(X, Z)) because !factimes > !facplus, [3] and [8], by (Copy) 3] !factimes*(X, !facplus(Y, Z)) >= !factimes(X, Y) because !factimes in Mul, [4] and [5], by (Stat) 4] X >= X by (Meta) 5] !facplus(Y, Z) > Y because [6], by definition 6] !facplus*(Y, Z) >= Y because [7], by (Select) 7] Y >= Y by (Meta) 8] !factimes*(X, !facplus(Y, Z)) >= !factimes(X, Z) because !factimes in Mul, [4] and [9], by (Stat) 9] !facplus(Y, Z) > Z because [10], by definition 10] !facplus*(Y, Z) >= Z because [11], by (Select) 11] Z >= Z by (Meta) We can thus remove the following rules: !factimes(X, !facplus(Y, Z)) => !facplus(!factimes(X, Y), !factimes(X, Z)) 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.