YES We show the termination of the relative TRS R/S: R: rev(nil()) -> nil() rev(cons(x,l)) -> cons(rev1(x,l),rev2(x,l)) rev1(|0|(),nil()) -> |0|() rev1(s(x),nil()) -> s(x) rev1(x,cons(y,l)) -> rev1(y,l) rev2(x,nil()) -> nil() rev2(x,cons(y,l)) -> rev(cons(x,rev2(y,l))) 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: rev#(cons(x,l)) -> rev1#(x,l) p2: rev#(cons(x,l)) -> rev2#(x,l) p3: rev1#(x,cons(y,l)) -> rev1#(y,l) p4: rev2#(x,cons(y,l)) -> rev#(cons(x,rev2(y,l))) p5: rev2#(x,cons(y,l)) -> rev2#(y,l) and R consists of: r1: rev(nil()) -> nil() r2: rev(cons(x,l)) -> cons(rev1(x,l),rev2(x,l)) r3: rev1(|0|(),nil()) -> |0|() r4: rev1(s(x),nil()) -> s(x) r5: rev1(x,cons(y,l)) -> rev1(y,l) r6: rev2(x,nil()) -> nil() r7: rev2(x,cons(y,l)) -> rev(cons(x,rev2(y,l))) r8: rand(x) -> x r9: rand(x) -> rand(s(x)) The estimated dependency graph contains the following SCCs: {p2, p4, p5} {p3} -- Reduction pair. Consider the non-minimal dependency pair problem (P, R), where P consists of p1: rev2#(x,cons(y,l)) -> rev#(cons(x,rev2(y,l))) p2: rev#(cons(x,l)) -> rev2#(x,l) p3: rev2#(x,cons(y,l)) -> rev2#(y,l) and R consists of: r1: rev(nil()) -> nil() r2: rev(cons(x,l)) -> cons(rev1(x,l),rev2(x,l)) r3: rev1(|0|(),nil()) -> |0|() r4: rev1(s(x),nil()) -> s(x) r5: rev1(x,cons(y,l)) -> rev1(y,l) r6: rev2(x,nil()) -> nil() r7: rev2(x,cons(y,l)) -> rev(cons(x,rev2(y,l))) r8: rand(x) -> x r9: rand(x) -> rand(s(x)) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: rev2#_A(x1,x2) = x2 + 6 cons_A(x1,x2) = max{8, x2 + 7} rev#_A(x1) = max{9, x1 + 6} rev2_A(x1,x2) = x2 rev_A(x1) = max{1, x1} nil_A = 3 rev1_A(x1,x2) = max{5, x2 + 2} |0|_A = 0 s_A(x1) = 0 rand_A(x1) = x1 + 7 precedence: rev2# = rev2 > cons = nil > rev > rev# = rev1 = |0| = s = rand partial status: pi(rev2#) = [2] pi(cons) = [] pi(rev#) = [1] pi(rev2) = [] pi(rev) = [1] pi(nil) = [] pi(rev1) = [2] pi(|0|) = [] pi(s) = [] pi(rand) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: rev2#_A(x1,x2) = 8 cons_A(x1,x2) = 11 rev#_A(x1) = x1 + 11 rev2_A(x1,x2) = 13 rev_A(x1) = max{8, x1 + 2} nil_A = 15 rev1_A(x1,x2) = 25 |0|_A = 26 s_A(x1) = 11 rand_A(x1) = 0 precedence: rev2 = nil > rev > rev2# = cons = rev# = rev1 = |0| = s > rand partial status: pi(rev2#) = [] pi(cons) = [] pi(rev#) = [1] pi(rev2) = [] pi(rev) = [] pi(nil) = [] pi(rev1) = [] pi(|0|) = [] pi(s) = [] pi(rand) = [] The next rules are strictly ordered: p1 We remove them from the problem. -- SCC decomposition. Consider the non-minimal dependency pair problem (P, R), where P consists of p1: rev#(cons(x,l)) -> rev2#(x,l) p2: rev2#(x,cons(y,l)) -> rev2#(y,l) and R consists of: r1: rev(nil()) -> nil() r2: rev(cons(x,l)) -> cons(rev1(x,l),rev2(x,l)) r3: rev1(|0|(),nil()) -> |0|() r4: rev1(s(x),nil()) -> s(x) r5: rev1(x,cons(y,l)) -> rev1(y,l) r6: rev2(x,nil()) -> nil() r7: rev2(x,cons(y,l)) -> rev(cons(x,rev2(y,l))) r8: rand(x) -> x r9: rand(x) -> rand(s(x)) The estimated dependency graph contains the following SCCs: {p2} -- Reduction pair. Consider the non-minimal dependency pair problem (P, R), where P consists of p1: rev2#(x,cons(y,l)) -> rev2#(y,l) and R consists of: r1: rev(nil()) -> nil() r2: rev(cons(x,l)) -> cons(rev1(x,l),rev2(x,l)) r3: rev1(|0|(),nil()) -> |0|() r4: rev1(s(x),nil()) -> s(x) r5: rev1(x,cons(y,l)) -> rev1(y,l) r6: rev2(x,nil()) -> nil() r7: rev2(x,cons(y,l)) -> rev(cons(x,rev2(y,l))) r8: rand(x) -> x r9: rand(x) -> rand(s(x)) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: rev2#_A(x1,x2) = max{0, x2 - 1} cons_A(x1,x2) = max{3, x2 + 2} rev_A(x1) = max{3, x1} nil_A = 4 rev1_A(x1,x2) = max{6, x2 - 3} rev2_A(x1,x2) = x2 |0|_A = 5 s_A(x1) = 0 rand_A(x1) = x1 precedence: rev1 = rev2 > rev = nil > cons > rand > rev2# = |0| = s partial status: pi(rev2#) = [] pi(cons) = [] pi(rev) = [1] pi(nil) = [] pi(rev1) = [] pi(rev2) = [] pi(|0|) = [] pi(s) = [] pi(rand) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: rev2#_A(x1,x2) = 24 cons_A(x1,x2) = 26 rev_A(x1) = x1 + 27 nil_A = 11 rev1_A(x1,x2) = 26 rev2_A(x1,x2) = 9 |0|_A = 25 s_A(x1) = 25 rand_A(x1) = 0 precedence: rev2# = cons = rev = nil = rev1 = rev2 = |0| = s > rand partial status: pi(rev2#) = [] pi(cons) = [] pi(rev) = [1] pi(nil) = [] pi(rev1) = [] pi(rev2) = [] pi(|0|) = [] pi(s) = [] pi(rand) = [] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains. -- Reduction pair. Consider the non-minimal dependency pair problem (P, R), where P consists of p1: rev1#(x,cons(y,l)) -> rev1#(y,l) and R consists of: r1: rev(nil()) -> nil() r2: rev(cons(x,l)) -> cons(rev1(x,l),rev2(x,l)) r3: rev1(|0|(),nil()) -> |0|() r4: rev1(s(x),nil()) -> s(x) r5: rev1(x,cons(y,l)) -> rev1(y,l) r6: rev2(x,nil()) -> nil() r7: rev2(x,cons(y,l)) -> rev(cons(x,rev2(y,l))) r8: rand(x) -> x r9: rand(x) -> rand(s(x)) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: rev1#_A(x1,x2) = max{3, x2} cons_A(x1,x2) = x2 + 3 rev_A(x1) = max{1, x1} nil_A = 5 rev1_A(x1,x2) = max{7, x2 - 4} rev2_A(x1,x2) = x2 |0|_A = 6 s_A(x1) = 0 rand_A(x1) = x1 precedence: rev2 > rev1 > |0| > rev = nil > cons > rev1# > s = rand partial status: pi(rev1#) = [2] pi(cons) = [] pi(rev) = [1] pi(nil) = [] pi(rev1) = [] pi(rev2) = [] pi(|0|) = [] pi(s) = [] pi(rand) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: rev1#_A(x1,x2) = max{24, x2 - 1} cons_A(x1,x2) = 26 rev_A(x1) = x1 + 27 nil_A = 11 rev1_A(x1,x2) = 26 rev2_A(x1,x2) = 9 |0|_A = 25 s_A(x1) = 25 rand_A(x1) = 0 precedence: rev1# = cons = rev = nil = rev1 = rev2 = |0| = s > rand partial status: pi(rev1#) = [] pi(cons) = [] pi(rev) = [1] pi(nil) = [] pi(rev1) = [] pi(rev2) = [] pi(|0|) = [] pi(s) = [] pi(rand) = [] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.