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. weighted path order base order: max/plus interpretations on natural numbers: rands#_A(x1,x2) = max{x1 + 21, x2 + 19} s_A(x1) = max{6, x1} |::|_A(x1,x2) = x2 rand_A(x1) = max{14, x1 + 7} |0|_A = 10 tests_A(x1) = x1 + 48 true_A = 3 and_A(x1,x2) = max{x1, x2 + 48} test_A(x1) = 5 rands_A(x1,x2) = max{x1 + 21, x2 + 18} nil_A = 0 done_A(x1) = max{0, x1 - 1} eq_A(x1,x2) = max{4, x2} f_A(x1) = x1 + 5 g_A(x1) = 5 precedence: rands# = tests > |0| = true = and = test = g > f > s > nil > eq > rands > |::| = rand = done partial status: pi(rands#) = [1] pi(s) = [1] pi(|::|) = [] pi(rand) = [] pi(|0|) = [] pi(tests) = [1] pi(true) = [] pi(and) = [1, 2] pi(test) = [] pi(rands) = [2] pi(nil) = [] pi(done) = [] pi(eq) = [] pi(f) = [] pi(g) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: rands#_A(x1,x2) = x1 + 18 s_A(x1) = max{28, x1} |::|_A(x1,x2) = 2 rand_A(x1) = 27 |0|_A = 19 tests_A(x1) = x1 + 6 true_A = 24 and_A(x1,x2) = max{x1 + 45, x2 + 7} test_A(x1) = 24 rands_A(x1,x2) = max{22, x2 + 20} nil_A = 7 done_A(x1) = 22 eq_A(x1,x2) = 23 f_A(x1) = 21 g_A(x1) = 19 precedence: rands# = s = |::| = rand = |0| = tests = true = and = test = rands = nil = eq = f > done = g partial status: pi(rands#) = [1] pi(s) = [1] pi(|::|) = [] pi(rand) = [] pi(|0|) = [] pi(tests) = [1] pi(true) = [] pi(and) = [1] pi(test) = [] pi(rands) = [] pi(nil) = [] pi(done) = [] pi(eq) = [] pi(f) = [] pi(g) = [] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.