YES We show the termination of the TRS R: filter(cons(X,Y),|0|(),M) -> cons(|0|(),n__filter(activate(Y),M,M)) filter(cons(X,Y),s(N),M) -> cons(X,n__filter(activate(Y),N,M)) sieve(cons(|0|(),Y)) -> cons(|0|(),n__sieve(activate(Y))) sieve(cons(s(N),Y)) -> cons(s(N),n__sieve(filter(activate(Y),N,N))) nats(N) -> cons(N,n__nats(s(N))) zprimes() -> sieve(nats(s(s(|0|())))) filter(X1,X2,X3) -> n__filter(X1,X2,X3) sieve(X) -> n__sieve(X) nats(X) -> n__nats(X) activate(n__filter(X1,X2,X3)) -> filter(X1,X2,X3) activate(n__sieve(X)) -> sieve(X) activate(n__nats(X)) -> nats(X) activate(X) -> X -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: filter#(cons(X,Y),|0|(),M) -> activate#(Y) p2: filter#(cons(X,Y),s(N),M) -> activate#(Y) p3: sieve#(cons(|0|(),Y)) -> activate#(Y) p4: sieve#(cons(s(N),Y)) -> filter#(activate(Y),N,N) p5: sieve#(cons(s(N),Y)) -> activate#(Y) p6: zprimes#() -> sieve#(nats(s(s(|0|())))) p7: zprimes#() -> nats#(s(s(|0|()))) p8: activate#(n__filter(X1,X2,X3)) -> filter#(X1,X2,X3) p9: activate#(n__sieve(X)) -> sieve#(X) p10: activate#(n__nats(X)) -> nats#(X) and R consists of: r1: filter(cons(X,Y),|0|(),M) -> cons(|0|(),n__filter(activate(Y),M,M)) r2: filter(cons(X,Y),s(N),M) -> cons(X,n__filter(activate(Y),N,M)) r3: sieve(cons(|0|(),Y)) -> cons(|0|(),n__sieve(activate(Y))) r4: sieve(cons(s(N),Y)) -> cons(s(N),n__sieve(filter(activate(Y),N,N))) r5: nats(N) -> cons(N,n__nats(s(N))) r6: zprimes() -> sieve(nats(s(s(|0|())))) r7: filter(X1,X2,X3) -> n__filter(X1,X2,X3) r8: sieve(X) -> n__sieve(X) r9: nats(X) -> n__nats(X) r10: activate(n__filter(X1,X2,X3)) -> filter(X1,X2,X3) r11: activate(n__sieve(X)) -> sieve(X) r12: activate(n__nats(X)) -> nats(X) r13: activate(X) -> X The estimated dependency graph contains the following SCCs: {p1, p2, p3, p4, p5, p8, p9} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: filter#(cons(X,Y),|0|(),M) -> activate#(Y) p2: activate#(n__sieve(X)) -> sieve#(X) p3: sieve#(cons(s(N),Y)) -> activate#(Y) p4: activate#(n__filter(X1,X2,X3)) -> filter#(X1,X2,X3) p5: filter#(cons(X,Y),s(N),M) -> activate#(Y) p6: sieve#(cons(s(N),Y)) -> filter#(activate(Y),N,N) p7: sieve#(cons(|0|(),Y)) -> activate#(Y) and R consists of: r1: filter(cons(X,Y),|0|(),M) -> cons(|0|(),n__filter(activate(Y),M,M)) r2: filter(cons(X,Y),s(N),M) -> cons(X,n__filter(activate(Y),N,M)) r3: sieve(cons(|0|(),Y)) -> cons(|0|(),n__sieve(activate(Y))) r4: sieve(cons(s(N),Y)) -> cons(s(N),n__sieve(filter(activate(Y),N,N))) r5: nats(N) -> cons(N,n__nats(s(N))) r6: zprimes() -> sieve(nats(s(s(|0|())))) r7: filter(X1,X2,X3) -> n__filter(X1,X2,X3) r8: sieve(X) -> n__sieve(X) r9: nats(X) -> n__nats(X) r10: activate(n__filter(X1,X2,X3)) -> filter(X1,X2,X3) r11: activate(n__sieve(X)) -> sieve(X) r12: activate(n__nats(X)) -> nats(X) r13: activate(X) -> X The set of usable rules consists of r1, r2, r3, r4, r5, r7, r8, r9, r10, r11, r12, r13 Take the reduction pair: lexicographic combination of reduction pairs: 1. matrix interpretations: carrier: N^1 order: standard order interpretations: filter#_A(x1,x2,x3) = x1 cons_A(x1,x2) = x2 |0|_A() = 1 activate#_A(x1) = x1 n__sieve_A(x1) = x1 + 2 sieve#_A(x1) = x1 + 1 s_A(x1) = 1 n__filter_A(x1,x2,x3) = x1 activate_A(x1) = x1 filter_A(x1,x2,x3) = x1 sieve_A(x1) = x1 + 2 nats_A(x1) = 1 n__nats_A(x1) = 1 2. matrix interpretations: carrier: N^1 order: standard order interpretations: filter#_A(x1,x2,x3) = x1 cons_A(x1,x2) = x2 + 1 |0|_A() = 1 activate#_A(x1) = x1 n__sieve_A(x1) = 3 sieve#_A(x1) = x1 + 2 s_A(x1) = 1 n__filter_A(x1,x2,x3) = x1 + 1 activate_A(x1) = x1 + 3 filter_A(x1,x2,x3) = x1 + 4 sieve_A(x1) = 4 nats_A(x1) = 3 n__nats_A(x1) = 1 The next rules are strictly ordered: p1, p2, p3, p4, p5, p6, p7 We remove them from the problem. Then no dependency pair remains.