YES We show the termination of R/S, where R is +(0,y) -> y +(s(x),y) -> s(+(x,y)) sum1(nil) -> 0 sum1(cons(x,y)) -> +(x,sum1(y)) sum2(nil,z) -> z sum2(cons(x,y),z) -> sum2(y,+(x,z)) tests(0) -> true tests(s(x)) -> and(test(rands(rand(0),nil)),x) test(done(y)) -> eq(f(y),g(y)) eq(x,x) -> true rands(0,y) -> done(y) rands(s(x),y) -> rands(x,::(rand(0),y)) and S is: rand(x) -> x rand(x) -> rand(s(x)) Since R almost dominates S and S is non-duplicating, it is enough to show finiteness of (P, Q). Here P consists of the dependency pairs +#(s(x),y) -> +#(x,y) sum1#(cons(x,y)) -> +#(x,sum1(y)) sum1#(cons(x,y)) -> sum1#(y) sum2#(cons(x,y),z) -> sum2#(y,+(x,z)) sum2#(cons(x,y),z) -> +#(x,z) tests#(s(x)) -> test#(rands(rand(0),nil)) tests#(s(x)) -> rands#(rand(0),nil) test#(done(y)) -> eq#(f(y),g(y)) rands#(s(x),y) -> rands#(x,::(rand(0),y)) and Q consists of the rules: +(0,y) -> y +(s(x),y) -> s(+(x,y)) sum1(nil) -> 0 sum1(cons(x,y)) -> +(x,sum1(y)) sum2(nil,z) -> z sum2(cons(x,y),z) -> sum2(y,+(x,z)) tests(0) -> true tests(s(x)) -> and(test(rands(rand(0),nil)),x) test(done(y)) -> eq(f(y),g(y)) eq(x,x) -> true rands(0,y) -> done(y) rands(s(x),y) -> rands(x,::(rand(0),y)) rand(x) -> x rand(x) -> rand(s(x)) The weakly monotone algebra (N^3, >_lex) with +#_A((x1,y1,z1),(x2,y2,z2)) = (0, 1, 0) s_A((x1,y1,z1)) = (0, 1, 2) sum1#_A((x1,y1,z1)) = (x1, 0, 1) cons_A((x1,y1,z1),(x2,y2,z2)) = (x1 + x2 + 2, y2 + 1, z2 + 1) sum1_A((x1,y1,z1)) = (x1 + 1, 2, 1) sum2#_A((x1,y1,z1),(x2,y2,z2)) = (x1, 2, 1) +_A((x1,y1,z1),(x2,y2,z2)) = (x2 + 1, 1, 1) tests#_A((x1,y1,z1)) = (x1 + 5, y1 + 1, z1) test#_A((x1,y1,z1)) = (x1 + 1, y1, 1) rands_A((x1,y1,z1),(x2,y2,z2)) = (x2 + 2, 1, 1) rand_A((x1,y1,z1)) = (x1 + 1, 1, 1) 0_A = (1, 3, 2) nil_A = (1, 1, 1) rands#_A((x1,y1,z1),(x2,y2,z2)) = (x2, y2, 0) done_A((x1,y1,z1)) = (1, 2, 2) eq#_A((x1,y1,z1),(x2,y2,z2)) = (x1, 0, 0) f_A((x1,y1,z1)) = (1, 1, 1) g_A((x1,y1,z1)) = (x1 + 1, y1 + 1, z1 + 1) ::_A((x1,y1,z1),(x2,y2,z2)) = (x2, y2, z2) sum2_A((x1,y1,z1),(x2,y2,z2)) = (x1 + x2, 1, 0) tests_A((x1,y1,z1)) = (1, 0, 0) true_A = (0, 1, 1) and_A((x1,y1,z1),(x2,y2,z2)) = (0, 1, 1) test_A((x1,y1,z1)) = (3, 1, 1) eq_A((x1,y1,z1),(x2,y2,z2)) = (x1 + 1, 2, 2) strictly orients the following dependency pairs: sum1#(cons(x,y)) -> +#(x,sum1(y)) sum1#(cons(x,y)) -> sum1#(y) sum2#(cons(x,y),z) -> sum2#(y,+(x,z)) sum2#(cons(x,y),z) -> +#(x,z) tests#(s(x)) -> test#(rands(rand(0),nil)) tests#(s(x)) -> rands#(rand(0),nil) test#(done(y)) -> eq#(f(y),g(y)) We remove them from the set of dependency pairs. The weakly monotone algebra (N^3, >_lex) with +#_A((x1,y1,z1),(x2,y2,z2)) = (x1 + x2, y1 + y2, z1 + z2) s_A((x1,y1,z1)) = (x1, y1 + 1, z1 + 1) rands#_A((x1,y1,z1),(x2,y2,z2)) = (0, 0, 0) ::_A((x1,y1,z1),(x2,y2,z2)) = (x2 + 1, y2 + 1, z2 + 1) rand_A((x1,y1,z1)) = (x1 + 1, 1, 1) 0_A = (1, 3, 3) +_A((x1,y1,z1),(x2,y2,z2)) = (x1 + x2 + 1, y1 + y2 + 2, z1 + 3) sum1_A((x1,y1,z1)) = (x1 + 1, y1 + 1, z1 + 1) nil_A = (1, 1, 1) cons_A((x1,y1,z1),(x2,y2,z2)) = (x1 + x2 + 2, 1, 1) sum2_A((x1,y1,z1),(x2,y2,z2)) = (x1 + x2, 0, 0) tests_A((x1,y1,z1)) = (x1 + 1, 1, 0) true_A = (0, 3, 3) and_A((x1,y1,z1),(x2,y2,z2)) = (0, 0, 0) test_A((x1,y1,z1)) = (3, 1, 1) rands_A((x1,y1,z1),(x2,y2,z2)) = (2, 2, 1) done_A((x1,y1,z1)) = (1, 1, 1) eq_A((x1,y1,z1),(x2,y2,z2)) = (x1 + 1, 2, 2) f_A((x1,y1,z1)) = (1, 1, 1) g_A((x1,y1,z1)) = (1, 1, 1) strictly orients the following dependency pairs: +#(s(x),y) -> +#(x,y) We remove them from the set of dependency pairs. The weakly monotone algebra (N^3, >_lex) with rands#_A((x1,y1,z1),(x2,y2,z2)) = (x1, y1, z1) s_A((x1,y1,z1)) = (x1, y1 + 1, z1 + 1) ::_A((x1,y1,z1),(x2,y2,z2)) = (x2 + 1, 1, 1) rand_A((x1,y1,z1)) = (x1 + 1, 1, 0) 0_A = (1, 2, 0) +_A((x1,y1,z1),(x2,y2,z2)) = (x1 + x2 + 1, y1 + 2, z1) sum1_A((x1,y1,z1)) = (x1 + 1, y1, 1) nil_A = (1, 1, 1) cons_A((x1,y1,z1),(x2,y2,z2)) = (x1 + x2 + 2, y1 + y2 + 1, z1 + z2 + 1) sum2_A((x1,y1,z1),(x2,y2,z2)) = (x1 + x2, 1, 0) tests_A((x1,y1,z1)) = (x1 + 1, y1, 0) true_A = (0, 3, 1) and_A((x1,y1,z1),(x2,y2,z2)) = (0, 2, 1) test_A((x1,y1,z1)) = (3, 5, 1) rands_A((x1,y1,z1),(x2,y2,z2)) = (x1 + 1, y1, 1) done_A((x1,y1,z1)) = (1, 1, 1) eq_A((x1,y1,z1),(x2,y2,z2)) = (x1 + 1, 4, 1) f_A((x1,y1,z1)) = (1, 1, 1) g_A((x1,y1,z1)) = (1, 1, 1) strictly orients the following dependency pairs: rands#(s(x),y) -> rands#(x,::(rand(0),y)) We remove them from the set of dependency pairs. No dependency pair remains.