YES We show the termination of R/S, where R is f(0) -> true f(1) -> false f(s(x)) -> f(x) if(true,s(x),s(y)) -> s(x) if(false,s(x),s(y)) -> s(y) g(x,c(y)) -> c(g(x,y)) g(x,c(y)) -> g(x,if(f(x),c(g(s(x),y)),c(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 f#(s(x)) -> f#(x) g#(x,c(y)) -> g#(x,y) g#(x,c(y)) -> g#(x,if(f(x),c(g(s(x),y)),c(y))) g#(x,c(y)) -> if#(f(x),c(g(s(x),y)),c(y)) g#(x,c(y)) -> f#(x) g#(x,c(y)) -> g#(s(x),y) and Q consists of the rules: f(0) -> true f(1) -> false f(s(x)) -> f(x) if(true,s(x),s(y)) -> s(x) if(false,s(x),s(y)) -> s(y) g(x,c(y)) -> c(g(x,y)) g(x,c(y)) -> g(x,if(f(x),c(g(s(x),y)),c(y))) rand(x) -> x rand(x) -> rand(s(x)) The weakly monotone algebra (N^3, >_lex) with f#_A((x1,y1,z1)) = (0, 0, 0) s_A((x1,y1,z1)) = (x1, y1 + 1, z1 + 1) g#_A((x1,y1,z1),(x2,y2,z2)) = (x1 + 2, 1, 1) c_A((x1,y1,z1)) = (1, 2, 2) if_A((x1,y1,z1),(x2,y2,z2),(x3,y3,z3)) = (x2 + x3 + 1, 3, 1) f_A((x1,y1,z1)) = (x1 + 1, y1 + 1, z1 + 1) g_A((x1,y1,z1),(x2,y2,z2)) = (x1 + 2, 1, 1) if#_A((x1,y1,z1),(x2,y2,z2),(x3,y3,z3)) = (x1, 2, 0) 0_A = (1, 1, 1) true_A = (1, 3, 3) 1_A = (1, 1, 1) false_A = (1, 3, 3) rand_A((x1,y1,z1)) = (x1 + 1, 1, 0) strictly orients the following dependency pairs: g#(x,c(y)) -> if#(f(x),c(g(s(x),y)),c(y)) g#(x,c(y)) -> f#(x) We remove them from the set of dependency pairs. The weakly monotone algebra (N^3, >_lex) with f#_A((x1,y1,z1)) = (x1, y1, z1) s_A((x1,y1,z1)) = (x1, y1 + 1, z1 + 1) g#_A((x1,y1,z1),(x2,y2,z2)) = (0, 0, 0) c_A((x1,y1,z1)) = (1, 2, 2) if_A((x1,y1,z1),(x2,y2,z2),(x3,y3,z3)) = (x2 + x3 + 1, 0, 0) f_A((x1,y1,z1)) = (x1 + 1, y1 + 1, z1 + 1) g_A((x1,y1,z1),(x2,y2,z2)) = (x1 + 2, 1, 1) 0_A = (1, 1, 1) true_A = (1, 3, 3) 1_A = (1, 1, 1) false_A = (1, 3, 3) rand_A((x1,y1,z1)) = (x1 + 1, 1, 0) strictly orients the following dependency pairs: f#(s(x)) -> f#(x) We remove them from the set of dependency pairs. The weakly monotone algebra (N^3, >_lex) with g#_A((x1,y1,z1),(x2,y2,z2)) = (x2, y2, 0) c_A((x1,y1,z1)) = (x1 + 2, 2, 1) if_A((x1,y1,z1),(x2,y2,z2),(x3,y3,z3)) = (1, 2, 0) f_A((x1,y1,z1)) = (2, 2, 1) g_A((x1,y1,z1),(x2,y2,z2)) = (x2 + 1, 3, 1) s_A((x1,y1,z1)) = (0, 1, 1) 0_A = (1, 1, 1) true_A = (1, 1, 2) 1_A = (1, 1, 1) false_A = (1, 1, 1) rand_A((x1,y1,z1)) = (x1 + 1, 1, 0) strictly orients the following dependency pairs: g#(x,c(y)) -> g#(x,y) g#(x,c(y)) -> g#(x,if(f(x),c(g(s(x),y)),c(y))) g#(x,c(y)) -> g#(s(x),y) We remove them from the set of dependency pairs. No dependency pair remains.