We consider the system Applicative_05__TreeHeight. Alphabet: 0 : [] --> d cons : [d * c] --> c false : [] --> a height : [] --> d -> d if : [a * d] --> d le : [d * d] --> a map : [d -> d * c] --> c maxlist : [d * c] --> d nil : [] --> c node : [b * c] --> d s : [d] --> d true : [] --> a Rules: map(f, nil) => nil map(f, cons(x, y)) => cons(f x, map(f, y)) le(0, x) => true le(s(x), 0) => false le(s(x), s(y)) => le(x, y) maxlist(x, cons(y, z)) => if(le(x, y), maxlist(y, z)) maxlist(x, nil) => x height node(x, y) => s(maxlist(0, map(height, 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]): map(F, nil) >? nil map(F, cons(X, Y)) >? cons(F X, map(F, Y)) le(0, X) >? true le(s(X), 0) >? false le(s(X), s(Y)) >? le(X, Y) maxlist(X, cons(Y, Z)) >? if(le(X, Y), maxlist(Y, Z)) maxlist(X, nil) >? X height node(X, Y) >? s(maxlist(0, map(height, Y))) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: 0 = 0 cons = Lam[y0;y1].3 + y1 + 3*y0 false = 0 height = Lam[y0].0 if = Lam[y0;y1].y0 + y1 le = Lam[y0;y1].1 + y0 + y1 map = Lam[G0;y1].3 + 3*y1 + 2*y1*G0(y1) + 2*G0(0) + 3*G0(y1) maxlist = Lam[y0;y1].y1 + 2*y0 nil = 0 node = Lam[y0;y1].3 + y0 + 3*y1 s = Lam[y0].y0 true = 0 Using this interpretation, the requirements translate to: [[map(_F0, nil)]] = 3 + 5*F0(0) > 0 = [[nil]] [[map(_F0, cons(_x1, _x2))]] = 12 + 3*x2 + 9*x1 + 2*x2*F0(3 + x2 + 3*x1) + 2*F0(0) + 6*x1*F0(3 + x2 + 3*x1) + 9*F0(3 + x2 + 3*x1) > 6 + 3*x1 + 3*x2 + 2*x2*F0(x2) + 2*F0(0) + 3*F0(x1) + 3*F0(x2) = [[cons(_F0 _x1, map(_F0, _x2))]] [[le(0, _x0)]] = 1 + x0 > 0 = [[true]] [[le(s(_x0), 0)]] = 1 + x0 > 0 = [[false]] [[le(s(_x0), s(_x1))]] = 1 + x0 + x1 >= 1 + x0 + x1 = [[le(_x0, _x1)]] [[maxlist(_x0, cons(_x1, _x2))]] = 3 + x2 + 2*x0 + 3*x1 > 1 + x0 + x2 + 3*x1 = [[if(le(_x0, _x1), maxlist(_x1, _x2))]] [[maxlist(_x0, nil)]] = 2*x0 >= x0 = [[_x0]] [[height node(_x0, _x1)]] = 3 + x0 + 3*x1 >= 3 + 3*x1 = [[s(maxlist(0, map(height, _x1)))]] We can thus remove the following rules: map(F, nil) => nil map(F, cons(X, Y)) => cons(F X, map(F, Y)) le(0, X) => true le(s(X), 0) => false maxlist(X, cons(Y, Z)) => if(le(X, Y), maxlist(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]): le(s(X), s(Y)) >? le(X, Y) maxlist(X, nil) >? X height node(X, Y) >? s(maxlist(0, map(height, Y))) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: 0 = 0 height = Lam[y0].2 + 2*y0 le = Lam[y0;y1].y0 + y1 map = Lam[G0;y1].y1 + G0(0) maxlist = Lam[y0;y1].y0 + y1 nil = 3 node = Lam[y0;y1].3 + y0 + 3*y1 s = Lam[y0].y0 Using this interpretation, the requirements translate to: [[le(s(_x0), s(_x1))]] = x0 + x1 >= x0 + x1 = [[le(_x0, _x1)]] [[maxlist(_x0, nil)]] = 3 + x0 > x0 = [[_x0]] [[height node(_x0, _x1)]] = 11 + 3*x0 + 9*x1 > 2 + x1 = [[s(maxlist(0, map(height, _x1)))]] We can thus remove the following rules: maxlist(X, nil) => X height node(X, Y) => s(maxlist(0, map(height, 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]): le(s(X), s(Y)) >? le(X, Y) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: le = Lam[y0;y1].2*y0 + 2*y1 s = Lam[y0].3 + 3*y0 Using this interpretation, the requirements translate to: [[le(s(_x0), s(_x1))]] = 12 + 6*x0 + 6*x1 > 2*x0 + 2*x1 = [[le(_x0, _x1)]] We can thus remove the following rules: le(s(X), s(Y)) => le(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.