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. matrix interpretations: carrier: N^4 order: lexicographic order interpretations: sum2#_A(x1,x2) = ((1,0,0,0),(1,1,0,0),(1,0,1,0),(1,0,1,1)) x1 + ((1,0,0,0),(0,0,0,0),(0,1,0,0),(0,1,0,0)) x2 cons_A(x1,x2) = ((0,0,0,0),(0,0,0,0),(1,0,0,0),(1,1,0,0)) x1 + ((1,0,0,0),(0,1,0,0),(1,0,1,0),(1,1,1,1)) x2 + (3,1,2,1) +_A(x1,x2) = ((0,0,0,0),(1,0,0,0),(0,0,0,0),(0,1,0,0)) x1 + ((1,0,0,0),(0,0,0,0),(1,0,0,0),(1,0,0,0)) x2 + (2,4,4,0) |0|_A() = (0,0,3,2) s_A(x1) = ((0,0,0,0),(1,0,0,0),(1,0,0,0),(0,1,0,0)) x1 + (0,1,1,1) sum1_A(x1) = ((1,0,0,0),(0,0,0,0),(1,0,0,0),(0,0,0,0)) x1 + (2,1,1,1) nil_A() = (1,1,0,1) sum2_A(x1,x2) = x1 + ((1,0,0,0),(1,0,0,0),(0,0,0,0),(1,0,0,0)) x2 tests_A(x1) = (1,0,0,0) true_A() = (0,1,2,1) and_A(x1,x2) = ((0,0,0,0),(1,0,0,0),(1,1,0,0),(1,1,1,0)) x2 + (0,1,1,1) test_A(x1) = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,1,1)) x1 + (2,3,0,0) rands_A(x1,x2) = (2,2,1,1) rand_A(x1) = x1 + (1,1,1,1) done_A(x1) = ((0,0,0,0),(0,0,0,0),(1,0,0,0),(1,0,0,0)) x1 + (1,1,2,2) eq_A(x1,x2) = x1 + ((0,0,0,0),(1,0,0,0),(0,1,0,0),(0,0,1,0)) x2 + (1,2,2,2) f_A(x1) = ((0,0,0,0),(0,0,0,0),(0,0,0,0),(1,0,0,0)) x1 + (1,1,1,1) g_A(x1) = ((1,0,0,0),(1,1,0,0),(1,1,1,0),(1,1,1,1)) x1 + (1,1,1,1) |::|_A(x1,x2) = ((0,0,0,0),(1,0,0,0),(0,1,0,0),(1,1,1,0)) x2 + (1,1,1,1) 2. lexicographic path order with precedence: precedence: rand > test > f > s > rands > |::| > sum2# > g > cons > + > eq > and > tests > |0| > sum1 > done > sum2 > nil > true argument filter: pi(sum2#) = 1 pi(cons) = [2] pi(+) = [] pi(|0|) = [] pi(s) = [] pi(sum1) = [] pi(nil) = [] pi(sum2) = [] pi(tests) = [] pi(true) = [] pi(and) = [] pi(test) = [] pi(rands) = [] pi(rand) = [] pi(done) = [] pi(eq) = [] pi(f) = [] pi(g) = [1] pi(|::|) = [] 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. matrix interpretations: carrier: N^4 order: lexicographic order interpretations: sum1#_A(x1) = ((1,0,0,0),(0,1,0,0),(0,1,0,0),(1,0,0,0)) x1 cons_A(x1,x2) = ((1,0,0,0),(1,1,0,0),(0,0,1,0),(0,0,0,0)) x1 + ((1,0,0,0),(0,1,0,0),(0,0,1,0),(1,1,0,1)) x2 + (2,4,0,1) +_A(x1,x2) = ((1,0,0,0),(0,1,0,0),(1,0,0,0),(0,1,0,0)) x1 + ((1,0,0,0),(0,1,0,0),(1,1,0,0),(0,1,0,0)) x2 + (1,4,2,3) |0|_A() = (1,1,2,2) s_A(x1) = ((1,0,0,0),(0,1,0,0),(0,0,0,0),(1,0,0,0)) x1 + (0,1,1,4) sum1_A(x1) = ((1,0,0,0),(1,1,0,0),(1,0,0,0),(1,0,0,0)) x1 + (1,1,1,1) nil_A() = (1,1,1,1) sum2_A(x1,x2) = ((1,0,0,0),(0,1,0,0),(0,1,1,0),(0,0,0,1)) x1 + ((1,0,0,0),(1,1,0,0),(1,0,1,0),(0,0,0,0)) x2 tests_A(x1) = x1 + (1,1,1,1) true_A() = (0,0,0,0) and_A(x1,x2) = (0,0,0,0) test_A(x1) = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,1,1,1)) x1 + (2,0,1,0) rands_A(x1,x2) = ((1,0,0,0),(1,1,0,0),(1,0,0,0),(0,1,0,0)) x1 + x2 + (1,0,1,0) rand_A(x1) = x1 + (1,1,1,1) done_A(x1) = ((0,0,0,0),(1,0,0,0),(0,1,0,0),(0,1,1,0)) x1 + (1,4,1,2) eq_A(x1,x2) = ((1,0,0,0),(1,1,0,0),(0,0,0,0),(0,0,0,0)) x1 + (1,1,1,1) f_A(x1) = ((0,0,0,0),(1,0,0,0),(0,0,0,0),(1,1,0,0)) x1 + (1,1,1,1) g_A(x1) = ((1,0,0,0),(0,0,0,0),(0,1,0,0),(1,1,1,0)) x1 + (1,1,1,1) |::|_A(x1,x2) = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(1,1,1,1)) x2 + (0,1,1,1) 2. lexicographic path order with precedence: precedence: test > eq > tests > true > sum1 > + > s > rands > rand > done > |::| > and > g > f > cons > sum2 > nil > |0| > sum1# argument filter: pi(sum1#) = [] pi(cons) = 2 pi(+) = [] pi(|0|) = [] pi(s) = [] pi(sum1) = [] pi(nil) = [] pi(sum2) = [] pi(tests) = [] pi(true) = [] pi(and) = [] pi(test) = [1] pi(rands) = [] pi(rand) = [] pi(done) = [] pi(eq) = [] pi(f) = [] pi(g) = [] 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. matrix interpretations: carrier: N^4 order: lexicographic order interpretations: +#_A(x1,x2) = ((1,0,0,0),(0,1,0,0),(0,0,0,0),(0,0,1,0)) x1 + ((0,0,0,0),(1,0,0,0),(0,1,0,0),(0,1,1,0)) x2 s_A(x1) = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,1,0)) x1 + (0,7,1,2) +_A(x1,x2) = ((1,0,0,0),(0,1,0,0),(1,1,0,0),(1,1,1,0)) x1 + ((1,0,0,0),(0,0,0,0),(0,0,0,0),(1,1,0,0)) x2 + (1,0,4,0) |0|_A() = (1,3,0,1) sum1_A(x1) = x1 + (2,1,2,1) nil_A() = (1,1,1,1) cons_A(x1,x2) = ((1,0,0,0),(1,1,0,0),(0,0,1,0),(0,1,1,1)) x1 + ((1,0,0,0),(1,1,0,0),(1,0,1,0),(0,1,1,1)) x2 + (2,5,0,1) sum2_A(x1,x2) = ((1,0,0,0),(0,0,0,0),(0,1,0,0),(0,0,1,0)) x1 + x2 + (0,1,0,0) tests_A(x1) = ((1,0,0,0),(1,1,0,0),(0,0,1,0),(0,0,0,0)) x1 + (1,0,0,0) true_A() = (0,5,4,1) and_A(x1,x2) = ((0,0,0,0),(1,0,0,0),(1,1,0,0),(1,1,1,0)) x2 + (0,8,2,1) test_A(x1) = x1 rands_A(x1,x2) = ((0,0,0,0),(1,0,0,0),(0,1,0,0),(1,1,0,0)) x1 + ((0,0,0,0),(0,0,0,0),(0,0,0,0),(1,0,0,0)) x2 + (4,0,0,0) rand_A(x1) = x1 + (1,1,1,1) done_A(x1) = ((0,0,0,0),(1,0,0,0),(0,0,0,0),(0,0,0,0)) x1 + (3,2,4,5) eq_A(x1,x2) = ((1,0,0,0),(0,0,0,0),(1,0,0,0),(0,0,0,0)) x1 + ((0,0,0,0),(1,0,0,0),(0,1,0,0),(0,0,1,0)) x2 + (1,0,3,2) f_A(x1) = ((0,0,0,0),(1,0,0,0),(0,1,0,0),(1,1,1,0)) x1 + (1,1,1,1) g_A(x1) = ((1,0,0,0),(1,1,0,0),(1,1,1,0),(1,1,1,1)) x1 + (1,1,1,1) |::|_A(x1,x2) = ((0,0,0,0),(0,0,0,0),(1,0,0,0),(0,1,0,0)) x1 + ((1,0,0,0),(0,1,0,0),(1,1,1,0),(1,1,1,1)) x2 + (1,1,0,0) 2. lexicographic path order with precedence: precedence: test > eq > rand > sum2 > rands > |::| > |0| > done > f > and > true > tests > cons > g > sum1 > nil > + > s > +# argument filter: pi(+#) = [] pi(s) = [] pi(+) = [] pi(|0|) = [] pi(sum1) = [1] pi(nil) = [] pi(cons) = [] pi(sum2) = [] pi(tests) = [] pi(true) = [] pi(and) = [] pi(test) = [1] pi(rands) = [] pi(rand) = [] pi(done) = [] pi(eq) = [] pi(f) = [] pi(g) = [] 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. matrix interpretations: carrier: N^4 order: lexicographic order interpretations: rands#_A(x1,x2) = ((0,0,0,0),(1,0,0,0),(0,1,0,0),(0,0,1,0)) x1 s_A(x1) = x1 + (0,0,1,0) |::|_A(x1,x2) = ((0,0,0,0),(0,0,0,0),(0,0,0,0),(1,0,0,0)) x1 + ((1,0,0,0),(0,1,0,0),(1,0,1,0),(1,1,1,1)) x2 + (1,1,1,0) rand_A(x1) = x1 + (1,0,0,1) |0|_A() = (0,0,0,3) +_A(x1,x2) = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(1,0,0,0)) x1 + ((1,0,0,0),(0,1,0,0),(0,1,1,0),(1,1,0,0)) x2 + (1,1,2,1) sum1_A(x1) = x1 + (1,1,0,1) nil_A() = (1,1,0,1) cons_A(x1,x2) = ((1,0,0,0),(0,0,0,0),(0,0,0,0),(1,0,0,0)) x1 + x2 + (2,0,2,0) sum2_A(x1,x2) = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,1,1)) x1 + ((1,0,0,0),(0,0,0,0),(1,0,0,0),(1,0,0,0)) x2 tests_A(x1) = (1,1,1,1) true_A() = (0,2,0,2) and_A(x1,x2) = (0,0,0,0) test_A(x1) = ((0,0,0,0),(1,0,0,0),(0,1,0,0),(0,1,1,0)) x1 + (3,4,0,0) rands_A(x1,x2) = ((0,0,0,0),(1,0,0,0),(0,1,0,0),(0,0,0,0)) x1 + (2,0,1,2) done_A(x1) = ((0,0,0,0),(1,0,0,0),(1,1,0,0),(0,0,1,0)) x1 + (1,4,2,1) eq_A(x1,x2) = ((1,0,0,0),(1,1,0,0),(1,1,1,0),(1,1,1,1)) x1 + (1,2,0,2) f_A(x1) = ((0,0,0,0),(1,0,0,0),(1,1,0,0),(1,1,1,0)) x1 + (1,1,1,2) g_A(x1) = ((0,0,0,0),(1,0,0,0),(0,0,0,0),(1,1,0,0)) x1 + (1,1,1,1) 2. lexicographic path order with precedence: precedence: test > done > f > eq > true > g > + > sum2 > sum1 > s > tests > rands > and > nil > cons > |::| > rands# > |0| > rand argument filter: pi(rands#) = [] pi(s) = [] pi(|::|) = [] pi(rand) = [] pi(|0|) = [] pi(+) = [] pi(sum1) = [] pi(nil) = [] pi(cons) = [] pi(sum2) = [] pi(tests) = [] pi(true) = [] pi(and) = [] pi(test) = [] pi(rands) = [] 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.