Term Rewriting System R: [X, Y, Z] primes -> sieve(from(s(s(0)))) from(X) -> cons(X, from(s(X))) head(cons(X, Y)) -> X tail(cons(X, Y)) -> Y if(true, X, Y) -> X if(false, X, Y) -> Y filter(s(s(X)), cons(Y, Z)) -> if(divides(s(s(X)), Y), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y)))) sieve(cons(X, Y)) -> cons(X, filter(X, sieve(Y))) Termination of R to be shown. This program has no overlaps, so it is sufficient to show innermost termination. R contains the following Dependency Pairs: FROM(X) -> FROM(s(X)) FILTER(s(s(X)), cons(Y, Z)) -> IF(divides(s(s(X)), Y), filter(s(s(X)), Z), cons(Y, filter(X, sieve(Y)))) FILTER(s(s(X)), cons(Y, Z)) -> FILTER(s(s(X)), Z) FILTER(s(s(X)), cons(Y, Z)) -> FILTER(X, sieve(Y)) FILTER(s(s(X)), cons(Y, Z)) -> SIEVE(Y) SIEVE(cons(X, Y)) -> FILTER(X, sieve(Y)) SIEVE(cons(X, Y)) -> SIEVE(Y) PRIMES -> SIEVE(from(s(s(0)))) PRIMES -> FROM(s(s(0))) Furthermore, R contains two SCCs. SCC1: FROM(X) -> FROM(s(X)) Found an infinite P-chain over R: P = FROM(X) -> FROM(s(X)) R = [] s = FROM(X) evaluates to t = FROM(s(X)) Thus, s starts an infinite reduction as s matches t. Non-Termination of R could be shown. Duration: 0.733 seconds.