YES We show the termination of the TRS R: a__filter(cons(X,Y),|0|(),M) -> cons(|0|(),filter(Y,M,M)) a__filter(cons(X,Y),s(N),M) -> cons(mark(X),filter(Y,N,M)) a__sieve(cons(|0|(),Y)) -> cons(|0|(),sieve(Y)) a__sieve(cons(s(N),Y)) -> cons(s(mark(N)),sieve(filter(Y,N,N))) a__nats(N) -> cons(mark(N),nats(s(N))) a__zprimes() -> a__sieve(a__nats(s(s(|0|())))) mark(filter(X1,X2,X3)) -> a__filter(mark(X1),mark(X2),mark(X3)) mark(sieve(X)) -> a__sieve(mark(X)) mark(nats(X)) -> a__nats(mark(X)) mark(zprimes()) -> a__zprimes() mark(cons(X1,X2)) -> cons(mark(X1),X2) mark(|0|()) -> |0|() mark(s(X)) -> s(mark(X)) a__filter(X1,X2,X3) -> filter(X1,X2,X3) a__sieve(X) -> sieve(X) a__nats(X) -> nats(X) a__zprimes() -> zprimes() -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: a__filter#(cons(X,Y),s(N),M) -> mark#(X) p2: a__sieve#(cons(s(N),Y)) -> mark#(N) p3: a__nats#(N) -> mark#(N) p4: a__zprimes#() -> a__sieve#(a__nats(s(s(|0|())))) p5: a__zprimes#() -> a__nats#(s(s(|0|()))) p6: mark#(filter(X1,X2,X3)) -> a__filter#(mark(X1),mark(X2),mark(X3)) p7: mark#(filter(X1,X2,X3)) -> mark#(X1) p8: mark#(filter(X1,X2,X3)) -> mark#(X2) p9: mark#(filter(X1,X2,X3)) -> mark#(X3) p10: mark#(sieve(X)) -> a__sieve#(mark(X)) p11: mark#(sieve(X)) -> mark#(X) p12: mark#(nats(X)) -> a__nats#(mark(X)) p13: mark#(nats(X)) -> mark#(X) p14: mark#(zprimes()) -> a__zprimes#() p15: mark#(cons(X1,X2)) -> mark#(X1) p16: mark#(s(X)) -> mark#(X) and R consists of: r1: a__filter(cons(X,Y),|0|(),M) -> cons(|0|(),filter(Y,M,M)) r2: a__filter(cons(X,Y),s(N),M) -> cons(mark(X),filter(Y,N,M)) r3: a__sieve(cons(|0|(),Y)) -> cons(|0|(),sieve(Y)) r4: a__sieve(cons(s(N),Y)) -> cons(s(mark(N)),sieve(filter(Y,N,N))) r5: a__nats(N) -> cons(mark(N),nats(s(N))) r6: a__zprimes() -> a__sieve(a__nats(s(s(|0|())))) r7: mark(filter(X1,X2,X3)) -> a__filter(mark(X1),mark(X2),mark(X3)) r8: mark(sieve(X)) -> a__sieve(mark(X)) r9: mark(nats(X)) -> a__nats(mark(X)) r10: mark(zprimes()) -> a__zprimes() r11: mark(cons(X1,X2)) -> cons(mark(X1),X2) r12: mark(|0|()) -> |0|() r13: mark(s(X)) -> s(mark(X)) r14: a__filter(X1,X2,X3) -> filter(X1,X2,X3) r15: a__sieve(X) -> sieve(X) r16: a__nats(X) -> nats(X) r17: a__zprimes() -> zprimes() The estimated dependency graph contains the following SCCs: {p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: a__filter#(cons(X,Y),s(N),M) -> mark#(X) p2: mark#(s(X)) -> mark#(X) p3: mark#(cons(X1,X2)) -> mark#(X1) p4: mark#(zprimes()) -> a__zprimes#() p5: a__zprimes#() -> a__nats#(s(s(|0|()))) p6: a__nats#(N) -> mark#(N) p7: mark#(nats(X)) -> mark#(X) p8: mark#(nats(X)) -> a__nats#(mark(X)) p9: mark#(sieve(X)) -> mark#(X) p10: mark#(sieve(X)) -> a__sieve#(mark(X)) p11: a__sieve#(cons(s(N),Y)) -> mark#(N) p12: mark#(filter(X1,X2,X3)) -> mark#(X3) p13: mark#(filter(X1,X2,X3)) -> mark#(X2) p14: mark#(filter(X1,X2,X3)) -> mark#(X1) p15: mark#(filter(X1,X2,X3)) -> a__filter#(mark(X1),mark(X2),mark(X3)) p16: a__zprimes#() -> a__sieve#(a__nats(s(s(|0|())))) and R consists of: r1: a__filter(cons(X,Y),|0|(),M) -> cons(|0|(),filter(Y,M,M)) r2: a__filter(cons(X,Y),s(N),M) -> cons(mark(X),filter(Y,N,M)) r3: a__sieve(cons(|0|(),Y)) -> cons(|0|(),sieve(Y)) r4: a__sieve(cons(s(N),Y)) -> cons(s(mark(N)),sieve(filter(Y,N,N))) r5: a__nats(N) -> cons(mark(N),nats(s(N))) r6: a__zprimes() -> a__sieve(a__nats(s(s(|0|())))) r7: mark(filter(X1,X2,X3)) -> a__filter(mark(X1),mark(X2),mark(X3)) r8: mark(sieve(X)) -> a__sieve(mark(X)) r9: mark(nats(X)) -> a__nats(mark(X)) r10: mark(zprimes()) -> a__zprimes() r11: mark(cons(X1,X2)) -> cons(mark(X1),X2) r12: mark(|0|()) -> |0|() r13: mark(s(X)) -> s(mark(X)) r14: a__filter(X1,X2,X3) -> filter(X1,X2,X3) r15: a__sieve(X) -> sieve(X) r16: a__nats(X) -> nats(X) r17: a__zprimes() -> zprimes() The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17 Take the reduction pair: matrix interpretations: carrier: N^3 order: lexicographic order interpretations: a__filter#_A(x1,x2,x3) = ((1,0,0),(0,1,0),(0,1,1)) x1 + ((1,0,0),(0,1,0),(1,1,1)) x2 + x3 cons_A(x1,x2) = ((1,0,0),(1,1,0),(0,0,1)) x1 + (1,4,1) s_A(x1) = ((1,0,0),(0,1,0),(1,1,1)) x1 + (8,1,1) mark#_A(x1) = ((1,0,0),(1,1,0),(1,1,1)) x1 + (1,6,16) zprimes_A() = (21,6,1) a__zprimes#_A() = (20,32,45) a__nats#_A(x1) = ((1,0,0),(1,1,0),(0,0,1)) x1 + (2,11,15) |0|_A() = (1,1,0) nats_A(x1) = ((1,0,0),(1,1,0),(1,0,0)) x1 + (2,12,2) mark_A(x1) = ((1,0,0),(1,1,0),(1,1,1)) x1 + (0,10,18) sieve_A(x1) = ((1,0,0),(1,0,0),(1,0,0)) x1 + (1,1,1) a__sieve#_A(x1) = x1 + (0,7,20) filter_A(x1,x2,x3) = ((1,0,0),(1,0,0),(1,1,0)) x1 + ((1,0,0),(1,1,0),(1,0,1)) x2 + ((1,0,0),(1,1,0),(1,0,1)) x3 + (12,1,28) a__nats_A(x1) = ((1,0,0),(1,1,0),(0,0,0)) x1 + (2,14,1) a__filter_A(x1,x2,x3) = ((1,0,0),(1,0,0),(0,1,0)) x1 + ((1,0,0),(1,1,0),(0,0,1)) x2 + ((1,0,0),(1,1,0),(1,0,0)) x3 + (12,2,31) a__sieve_A(x1) = ((1,0,0),(1,0,0),(1,0,0)) x1 + (1,2,22) a__zprimes_A() = (21,20,0) The next rules are strictly ordered: p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16 We remove them from the problem. Then no dependency pair remains.