YES We show the termination of the relative TRS R/S: R: +(|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)) 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: +#(s(x),y) -> +#(x,y) p2: sum1#(cons(x,y)) -> +#(x,sum1(y)) p3: sum1#(cons(x,y)) -> sum1#(y) p4: sum2#(cons(x,y),z) -> sum2#(y,+(x,z)) p5: sum2#(cons(x,y),z) -> +#(x,z) p6: tests#(s(x)) -> test#(rands(rand(|0|()),nil())) p7: tests#(s(x)) -> rands#(rand(|0|()),nil()) p8: test#(done(y)) -> eq#(f(y),g(y)) p9: rands#(s(x),y) -> rands#(x,|::|(rand(|0|()),y)) and R consists of: r1: +(|0|(),y) -> y r2: +(s(x),y) -> s(+(x,y)) r3: sum1(nil()) -> |0|() r4: sum1(cons(x,y)) -> +(x,sum1(y)) r5: sum2(nil(),z) -> z r6: sum2(cons(x,y),z) -> sum2(y,+(x,z)) r7: tests(|0|()) -> true() r8: tests(s(x)) -> and(test(rands(rand(|0|()),nil())),x) r9: test(done(y)) -> eq(f(y),g(y)) r10: eq(x,x) -> true() r11: rands(|0|(),y) -> done(y) r12: rands(s(x),y) -> rands(x,|::|(rand(|0|()),y)) r13: rand(x) -> x r14: rand(x) -> rand(s(x)) The estimated dependency graph contains the following SCCs: {p4} {p3} {p1} {p9} -- Reduction pair. Consider the non-minimal dependency pair problem (P, R), where P consists of p1: sum2#(cons(x,y),z) -> sum2#(y,+(x,z)) and R consists of: r1: +(|0|(),y) -> y r2: +(s(x),y) -> s(+(x,y)) r3: sum1(nil()) -> |0|() r4: sum1(cons(x,y)) -> +(x,sum1(y)) r5: sum2(nil(),z) -> z r6: sum2(cons(x,y),z) -> sum2(y,+(x,z)) r7: tests(|0|()) -> true() r8: tests(s(x)) -> and(test(rands(rand(|0|()),nil())),x) r9: test(done(y)) -> eq(f(y),g(y)) r10: eq(x,x) -> true() r11: rands(|0|(),y) -> done(y) r12: rands(s(x),y) -> rands(x,|::|(rand(|0|()),y)) r13: rand(x) -> x r14: rand(x) -> rand(s(x)) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: |::| > test > g > f > eq > rands > done > rand > and > sum2 > sum1 > |0| > true > nil > tests > s > + > sum2# > cons argument filter: pi(sum2#) = [1] pi(cons) = [1, 2] pi(+) = [1, 2] pi(|0|) = [] pi(s) = 1 pi(sum1) = [1] pi(nil) = [] pi(sum2) = [1, 2] pi(tests) = [1] pi(true) = [] pi(and) = 2 pi(test) = [1] pi(rands) = [1] pi(rand) = 1 pi(done) = [] pi(eq) = [2] pi(f) = [1] pi(g) = [] pi(|::|) = [1, 2] 2. lexicographic path order with precedence: precedence: |::| > g > f > true > eq > done > rand > |0| > rands > test > and > sum2# > nil > tests > + > sum2 > sum1 > s > cons argument filter: pi(sum2#) = [1] pi(cons) = 2 pi(+) = [1] pi(|0|) = [] pi(s) = 1 pi(sum1) = [1] pi(nil) = [] pi(sum2) = [1, 2] pi(tests) = [1] pi(true) = [] pi(and) = 2 pi(test) = [1] pi(rands) = [] pi(rand) = 1 pi(done) = [] pi(eq) = [2] pi(f) = 1 pi(g) = [] pi(|::|) = 1 3. lexicographic path order with precedence: precedence: |::| > g > f > true > eq > done > rand > |0| > rands > test > and > nil > tests > + > sum2 > sum1 > s > cons > sum2# argument filter: pi(sum2#) = [] pi(cons) = [2] pi(+) = [1] pi(|0|) = [] pi(s) = 1 pi(sum1) = 1 pi(nil) = [] pi(sum2) = 1 pi(tests) = [1] pi(true) = [] pi(and) = 2 pi(test) = [1] pi(rands) = [] pi(rand) = [1] pi(done) = [] pi(eq) = 2 pi(f) = 1 pi(g) = [] pi(|::|) = [1] 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: sum1#(cons(x,y)) -> sum1#(y) and R consists of: r1: +(|0|(),y) -> y r2: +(s(x),y) -> s(+(x,y)) r3: sum1(nil()) -> |0|() r4: sum1(cons(x,y)) -> +(x,sum1(y)) r5: sum2(nil(),z) -> z r6: sum2(cons(x,y),z) -> sum2(y,+(x,z)) r7: tests(|0|()) -> true() r8: tests(s(x)) -> and(test(rands(rand(|0|()),nil())),x) r9: test(done(y)) -> eq(f(y),g(y)) r10: eq(x,x) -> true() r11: rands(|0|(),y) -> done(y) r12: rands(s(x),y) -> rands(x,|::|(rand(|0|()),y)) r13: rand(x) -> x r14: rand(x) -> rand(s(x)) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: |::| > g > f > test > eq > done > rand > rands > and > sum2 > sum1 > |0| > true > nil > tests > + > s > cons > sum1# argument filter: pi(sum1#) = 1 pi(cons) = 2 pi(+) = 2 pi(|0|) = [] pi(s) = 1 pi(sum1) = [] pi(nil) = [] pi(sum2) = 2 pi(tests) = 1 pi(true) = [] pi(and) = 2 pi(test) = [1] pi(rands) = 2 pi(rand) = 1 pi(done) = 1 pi(eq) = [1, 2] pi(f) = 1 pi(g) = 1 pi(|::|) = 2 2. lexicographic path order with precedence: precedence: |::| > g > f > true > eq > done > rand > |0| > rands > test > and > nil > tests > + > sum2 > sum1 > s > cons > sum1# argument filter: pi(sum1#) = 1 pi(cons) = 2 pi(+) = 2 pi(|0|) = [] pi(s) = 1 pi(sum1) = [] pi(nil) = [] pi(sum2) = [2] pi(tests) = [1] pi(true) = [] pi(and) = 2 pi(test) = [1] pi(rands) = [2] pi(rand) = 1 pi(done) = 1 pi(eq) = [1, 2] pi(f) = 1 pi(g) = [1] pi(|::|) = 2 3. lexicographic path order with precedence: precedence: |::| > g > f > true > eq > done > rand > |0| > rands > test > and > nil > tests > + > sum2 > sum1 > s > cons > sum1# argument filter: pi(sum1#) = [1] pi(cons) = [2] pi(+) = 2 pi(|0|) = [] pi(s) = 1 pi(sum1) = [] pi(nil) = [] pi(sum2) = [] pi(tests) = [1] pi(true) = [] pi(and) = [] pi(test) = [1] pi(rands) = [2] pi(rand) = 1 pi(done) = 1 pi(eq) = [1, 2] pi(f) = 1 pi(g) = 1 pi(|::|) = 2 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: +#(s(x),y) -> +#(x,y) and R consists of: r1: +(|0|(),y) -> y r2: +(s(x),y) -> s(+(x,y)) r3: sum1(nil()) -> |0|() r4: sum1(cons(x,y)) -> +(x,sum1(y)) r5: sum2(nil(),z) -> z r6: sum2(cons(x,y),z) -> sum2(y,+(x,z)) r7: tests(|0|()) -> true() r8: tests(s(x)) -> and(test(rands(rand(|0|()),nil())),x) r9: test(done(y)) -> eq(f(y),g(y)) r10: eq(x,x) -> true() r11: rands(|0|(),y) -> done(y) r12: rands(s(x),y) -> rands(x,|::|(rand(|0|()),y)) r13: rand(x) -> x r14: rand(x) -> rand(s(x)) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: |::| > g > f > sum1 > |0| > tests > test > nil > done > eq > rand > rands > and > true > sum2 > + > cons > s > +# argument filter: pi(+#) = [1, 2] pi(s) = 1 pi(+) = [1, 2] pi(|0|) = [] pi(sum1) = [1] pi(nil) = [] pi(cons) = [1, 2] pi(sum2) = [1, 2] pi(tests) = [] pi(true) = [] pi(and) = 1 pi(test) = [1] pi(rands) = 2 pi(rand) = [1] pi(done) = 1 pi(eq) = [1, 2] pi(f) = 1 pi(g) = 1 pi(|::|) = 2 2. lexicographic path order with precedence: precedence: |::| > g > f > true > eq > done > rand > |0| > rands > test > and > nil > tests > + > sum2 > sum1 > cons > +# > s argument filter: pi(+#) = [1, 2] pi(s) = 1 pi(+) = 1 pi(|0|) = [] pi(sum1) = 1 pi(nil) = [] pi(cons) = [1, 2] pi(sum2) = 1 pi(tests) = [] pi(true) = [] pi(and) = 1 pi(test) = 1 pi(rands) = 2 pi(rand) = [] pi(done) = 1 pi(eq) = [1, 2] pi(f) = 1 pi(g) = 1 pi(|::|) = 2 3. lexicographic path order with precedence: precedence: |::| > g > f > |0| > true > eq > done > rand > rands > tests > test > and > nil > + > sum2 > sum1 > cons > s > +# argument filter: pi(+#) = [1] pi(s) = [1] pi(+) = 1 pi(|0|) = [] pi(sum1) = 1 pi(nil) = [] pi(cons) = [2] pi(sum2) = 1 pi(tests) = [] pi(true) = [] pi(and) = 1 pi(test) = [] pi(rands) = [2] pi(rand) = [] pi(done) = 1 pi(eq) = [1, 2] pi(f) = 1 pi(g) = 1 pi(|::|) = 2 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: rands#(s(x),y) -> rands#(x,|::|(rand(|0|()),y)) and R consists of: r1: +(|0|(),y) -> y r2: +(s(x),y) -> s(+(x,y)) r3: sum1(nil()) -> |0|() r4: sum1(cons(x,y)) -> +(x,sum1(y)) r5: sum2(nil(),z) -> z r6: sum2(cons(x,y),z) -> sum2(y,+(x,z)) r7: tests(|0|()) -> true() r8: tests(s(x)) -> and(test(rands(rand(|0|()),nil())),x) r9: test(done(y)) -> eq(f(y),g(y)) r10: eq(x,x) -> true() r11: rands(|0|(),y) -> done(y) r12: rands(s(x),y) -> rands(x,|::|(rand(|0|()),y)) r13: rand(x) -> x r14: rand(x) -> rand(s(x)) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: g > f > test > eq > rands# > rand > |::| > rands > and > sum1 > |0| > done > true > nil > tests > sum2 > cons > + > s argument filter: pi(rands#) = [1] pi(s) = 1 pi(|::|) = 2 pi(rand) = [1] pi(|0|) = [] pi(+) = [1, 2] pi(sum1) = [1] pi(nil) = [] pi(cons) = [1, 2] pi(sum2) = [1, 2] pi(tests) = 1 pi(true) = [] pi(and) = 2 pi(test) = [1] pi(rands) = 2 pi(done) = 1 pi(eq) = [] pi(f) = [1] pi(g) = 1 2. lexicographic path order with precedence: precedence: g > f > true > eq > rand > |::| > rands > done > |0| > tests > and > s > + > test > nil > sum2 > sum1 > cons > rands# argument filter: pi(rands#) = 1 pi(s) = 1 pi(|::|) = 2 pi(rand) = [] pi(|0|) = [] pi(+) = 1 pi(sum1) = 1 pi(nil) = [] pi(cons) = 1 pi(sum2) = [1, 2] pi(tests) = [] pi(true) = [] pi(and) = [] pi(test) = [1] pi(rands) = [] pi(done) = [] pi(eq) = [] pi(f) = 1 pi(g) = 1 3. lexicographic path order with precedence: precedence: g > f > true > eq > done > |0| > rand > cons > s > |::| > rands > test > and > nil > tests > + > sum2 > sum1 > rands# argument filter: pi(rands#) = 1 pi(s) = [1] pi(|::|) = [] pi(rand) = [] pi(|0|) = [] pi(+) = 1 pi(sum1) = [1] pi(nil) = [] pi(cons) = [1] pi(sum2) = 2 pi(tests) = [] pi(true) = [] pi(and) = [] pi(test) = [1] pi(rands) = [] pi(done) = [] pi(eq) = [] pi(f) = 1 pi(g) = 1 The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.