YES We show the termination of the TRS R: a__terms(N) -> cons(recip(a__sqr(mark(N))),terms(s(N))) a__sqr(|0|()) -> |0|() a__sqr(s(X)) -> s(add(sqr(X),dbl(X))) a__dbl(|0|()) -> |0|() a__dbl(s(X)) -> s(s(dbl(X))) a__add(|0|(),X) -> mark(X) a__add(s(X),Y) -> s(add(X,Y)) a__first(|0|(),X) -> nil() a__first(s(X),cons(Y,Z)) -> cons(mark(Y),first(X,Z)) mark(terms(X)) -> a__terms(mark(X)) mark(sqr(X)) -> a__sqr(mark(X)) mark(add(X1,X2)) -> a__add(mark(X1),mark(X2)) mark(dbl(X)) -> a__dbl(mark(X)) mark(first(X1,X2)) -> a__first(mark(X1),mark(X2)) mark(cons(X1,X2)) -> cons(mark(X1),X2) mark(recip(X)) -> recip(mark(X)) mark(s(X)) -> s(X) mark(|0|()) -> |0|() mark(nil()) -> nil() a__terms(X) -> terms(X) a__sqr(X) -> sqr(X) a__add(X1,X2) -> add(X1,X2) a__dbl(X) -> dbl(X) a__first(X1,X2) -> first(X1,X2) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: a__terms#(N) -> a__sqr#(mark(N)) p2: a__terms#(N) -> mark#(N) p3: a__add#(|0|(),X) -> mark#(X) p4: a__first#(s(X),cons(Y,Z)) -> mark#(Y) p5: mark#(terms(X)) -> a__terms#(mark(X)) p6: mark#(terms(X)) -> mark#(X) p7: mark#(sqr(X)) -> a__sqr#(mark(X)) p8: mark#(sqr(X)) -> mark#(X) p9: mark#(add(X1,X2)) -> a__add#(mark(X1),mark(X2)) p10: mark#(add(X1,X2)) -> mark#(X1) p11: mark#(add(X1,X2)) -> mark#(X2) p12: mark#(dbl(X)) -> a__dbl#(mark(X)) p13: mark#(dbl(X)) -> mark#(X) p14: mark#(first(X1,X2)) -> a__first#(mark(X1),mark(X2)) p15: mark#(first(X1,X2)) -> mark#(X1) p16: mark#(first(X1,X2)) -> mark#(X2) p17: mark#(cons(X1,X2)) -> mark#(X1) p18: mark#(recip(X)) -> mark#(X) and R consists of: r1: a__terms(N) -> cons(recip(a__sqr(mark(N))),terms(s(N))) r2: a__sqr(|0|()) -> |0|() r3: a__sqr(s(X)) -> s(add(sqr(X),dbl(X))) r4: a__dbl(|0|()) -> |0|() r5: a__dbl(s(X)) -> s(s(dbl(X))) r6: a__add(|0|(),X) -> mark(X) r7: a__add(s(X),Y) -> s(add(X,Y)) r8: a__first(|0|(),X) -> nil() r9: a__first(s(X),cons(Y,Z)) -> cons(mark(Y),first(X,Z)) r10: mark(terms(X)) -> a__terms(mark(X)) r11: mark(sqr(X)) -> a__sqr(mark(X)) r12: mark(add(X1,X2)) -> a__add(mark(X1),mark(X2)) r13: mark(dbl(X)) -> a__dbl(mark(X)) r14: mark(first(X1,X2)) -> a__first(mark(X1),mark(X2)) r15: mark(cons(X1,X2)) -> cons(mark(X1),X2) r16: mark(recip(X)) -> recip(mark(X)) r17: mark(s(X)) -> s(X) r18: mark(|0|()) -> |0|() r19: mark(nil()) -> nil() r20: a__terms(X) -> terms(X) r21: a__sqr(X) -> sqr(X) r22: a__add(X1,X2) -> add(X1,X2) r23: a__dbl(X) -> dbl(X) r24: a__first(X1,X2) -> first(X1,X2) The estimated dependency graph contains the following SCCs: {p2, p3, p4, p5, p6, p8, p9, p10, p11, p13, p14, p15, p16, p17, p18} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: a__terms#(N) -> mark#(N) p2: mark#(recip(X)) -> mark#(X) p3: mark#(cons(X1,X2)) -> mark#(X1) p4: mark#(first(X1,X2)) -> mark#(X2) p5: mark#(first(X1,X2)) -> mark#(X1) p6: mark#(first(X1,X2)) -> a__first#(mark(X1),mark(X2)) p7: a__first#(s(X),cons(Y,Z)) -> mark#(Y) p8: mark#(dbl(X)) -> mark#(X) p9: mark#(add(X1,X2)) -> mark#(X2) p10: mark#(add(X1,X2)) -> mark#(X1) p11: mark#(add(X1,X2)) -> a__add#(mark(X1),mark(X2)) p12: a__add#(|0|(),X) -> mark#(X) p13: mark#(sqr(X)) -> mark#(X) p14: mark#(terms(X)) -> mark#(X) p15: mark#(terms(X)) -> a__terms#(mark(X)) and R consists of: r1: a__terms(N) -> cons(recip(a__sqr(mark(N))),terms(s(N))) r2: a__sqr(|0|()) -> |0|() r3: a__sqr(s(X)) -> s(add(sqr(X),dbl(X))) r4: a__dbl(|0|()) -> |0|() r5: a__dbl(s(X)) -> s(s(dbl(X))) r6: a__add(|0|(),X) -> mark(X) r7: a__add(s(X),Y) -> s(add(X,Y)) r8: a__first(|0|(),X) -> nil() r9: a__first(s(X),cons(Y,Z)) -> cons(mark(Y),first(X,Z)) r10: mark(terms(X)) -> a__terms(mark(X)) r11: mark(sqr(X)) -> a__sqr(mark(X)) r12: mark(add(X1,X2)) -> a__add(mark(X1),mark(X2)) r13: mark(dbl(X)) -> a__dbl(mark(X)) r14: mark(first(X1,X2)) -> a__first(mark(X1),mark(X2)) r15: mark(cons(X1,X2)) -> cons(mark(X1),X2) r16: mark(recip(X)) -> recip(mark(X)) r17: mark(s(X)) -> s(X) r18: mark(|0|()) -> |0|() r19: mark(nil()) -> nil() r20: a__terms(X) -> terms(X) r21: a__sqr(X) -> sqr(X) r22: a__add(X1,X2) -> add(X1,X2) r23: a__dbl(X) -> dbl(X) r24: a__first(X1,X2) -> first(X1,X2) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, r22, r23, r24 Take the reduction pair: matrix interpretations: carrier: N^3 order: lexicographic order interpretations: a__terms#_A(x1) = x1 + (1,4,0) mark#_A(x1) = ((1,0,0),(0,1,0),(1,0,0)) x1 + (0,3,3) recip_A(x1) = x1 + (1,0,0) cons_A(x1,x2) = ((1,0,0),(0,1,0),(1,0,1)) x1 + (0,3,2) first_A(x1,x2) = ((1,0,0),(0,0,0),(0,1,0)) x1 + x2 + (2,1,0) a__first#_A(x1,x2) = ((0,0,0),(1,0,0),(1,1,0)) x1 + x2 + (1,0,0) mark_A(x1) = ((1,0,0),(0,1,0),(1,0,1)) x1 + (0,3,1) s_A(x1) = ((0,0,0),(0,0,0),(1,0,0)) x1 + (1,1,0) dbl_A(x1) = x1 + (3,1,0) add_A(x1,x2) = x1 + x2 + (2,2,0) a__add#_A(x1,x2) = x2 + (2,4,4) |0|_A() = (0,0,1) sqr_A(x1) = ((1,0,0),(0,1,0),(1,0,1)) x1 + (2,1,0) terms_A(x1) = ((1,0,0),(1,1,0),(0,0,1)) x1 + (4,5,0) a__terms_A(x1) = ((1,0,0),(1,1,0),(0,0,1)) x1 + (4,5,0) a__sqr_A(x1) = ((1,0,0),(0,1,0),(1,0,1)) x1 + (2,1,1) a__dbl_A(x1) = x1 + (3,1,2) a__add_A(x1,x2) = x1 + ((1,0,0),(0,0,0),(1,0,0)) x2 + (2,4,4) a__first_A(x1,x2) = ((1,0,0),(0,0,0),(0,1,0)) x1 + x2 + (2,2,0) nil_A() = (0,1,1) The next rules are strictly ordered: p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 We remove them from the problem. Then no dependency pair remains.