YES We show the termination of the relative TRS R/S: R: 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)) S: rand(x) -> x rand(x) -> rand(s(x)) -- SCC decomposition. Consider the non-minimal dependency pair problem (P, R), where P consists of p1: tests#(s(x)) -> test#(rands(rand(|0|()),nil())) p2: tests#(s(x)) -> rands#(rand(|0|()),nil()) p3: test#(done(y)) -> eq#(f(y),g(y)) p4: rands#(s(x),y) -> rands#(x,|::|(rand(|0|()),y)) and R consists of: r1: tests(|0|()) -> true() r2: tests(s(x)) -> and(test(rands(rand(|0|()),nil())),x) r3: test(done(y)) -> eq(f(y),g(y)) r4: eq(x,x) -> true() r5: rands(|0|(),y) -> done(y) r6: rands(s(x),y) -> rands(x,|::|(rand(|0|()),y)) r7: rand(x) -> x r8: rand(x) -> rand(s(x)) The estimated dependency graph contains the following SCCs: {p4} -- Reduction pair. Consider the non-minimal dependency pair problem (P, R), where P consists of p1: rands#(s(x),y) -> rands#(x,|::|(rand(|0|()),y)) and R consists of: r1: tests(|0|()) -> true() r2: tests(s(x)) -> and(test(rands(rand(|0|()),nil())),x) r3: test(done(y)) -> eq(f(y),g(y)) r4: eq(x,x) -> true() r5: rands(|0|(),y) -> done(y) r6: rands(s(x),y) -> rands(x,|::|(rand(|0|()),y)) r7: rand(x) -> x r8: rand(x) -> rand(s(x)) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8 Take the reduction pair: lexicographic combination of reduction pairs: 1. matrix interpretations: carrier: N^1 order: standard order interpretations: rands#_A(x1,x2) = x1 + x2 s_A(x1) = x1 |::|_A(x1,x2) = x2 rand_A(x1) = x1 + 1 |0|_A() = 1 tests_A(x1) = 4 true_A() = 0 and_A(x1,x2) = x1 test_A(x1) = 3 rands_A(x1,x2) = x1 + 1 nil_A() = 1 done_A(x1) = 1 eq_A(x1,x2) = x1 + 1 f_A(x1) = 1 g_A(x1) = x1 + 1 2. lexicographic path order with precedence: precedence: g > done > f > true > eq > s > nil > rands# > |0| > rand > |::| > rands > test > and > tests argument filter: pi(rands#) = [1, 2] pi(s) = [1] pi(|::|) = [] pi(rand) = [] pi(|0|) = [] pi(tests) = [] pi(true) = [] pi(and) = 1 pi(test) = [] pi(rands) = [] pi(nil) = [] pi(done) = [] pi(eq) = [1] pi(f) = [] pi(g) = 1 The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.