We consider termination of the LCTRS with only rule scheme Calc: Signature: cons :: Int -> o -> o filter :: Int -> o -> o if_1 :: Bool -> Int -> Int -> o -> o if_2 :: Bool -> Int -> Int -> o -> o isdiv :: Int -> Int -> Bool isprime :: Int -> Bool mem :: Int -> o -> Bool nats :: Int -> Int -> o nil :: o primes :: Int -> o sieve :: o -> o Rules: isprime(x) -> mem(x, primes(x)) mem(x, nil) -> false mem(x, cons(y, zs)) -> true | x = y mem(x, cons(y, zs)) -> mem(x, zs) | y > x mem(x, cons(y, zs)) -> mem(x, zs) | x > y primes(x) -> sieve(nats(2, x)) nats(x, y) -> nil | x > y nats(x, y) -> cons(x, nil) | x = y nats(x, y) -> cons(x, nats(x + 1, y)) | y > x sieve(nil) -> nil sieve(cons(x, ys)) -> cons(x, sieve(filter(x, ys))) filter(x, nil) -> nil filter(x, cons(y, zs)) -> if_1(isdiv(x, y), x, y, zs) if_1(true, x, y, zs) -> filter(x, zs) filter(x, cons(y, zs)) -> if_2(isdiv(x, y), x, y, zs) if_2(false, x, y, zs) -> cons(x, filter(x, zs)) isdiv(x, 0) -> true | x > 0 isdiv(x, y) -> false | x > y /\ y > 0 isdiv(x, y) -> isdiv(x, -x + y) | y >= x /\ x > 0 isdiv(x, y) -> isdiv(x, -y) | 0 > y isdiv(x, y) -> isdiv(-x, y) | 0 > x The system is accessible function passing by a sort ordering that equates all sorts. We start by computing the initial DP problem D1 = (P1, R, i, c), where: P1. (1) isprime#(x) => primes#(x) (2) isprime#(x) => mem#(x, primes(x)) (3) mem#(x, cons(y, zs)) => mem#(x, zs) | y > x (4) mem#(x, cons(y, zs)) => mem#(x, zs) | x > y (5) primes#(x) => nats#(2, x) (6) primes#(x) => sieve#(nats(2, x)) (7) nats#(x, y) => nats#(x + 1, y) | y > x (8) sieve#(cons(x, ys)) => filter#(x, ys) (9) sieve#(cons(x, ys)) => sieve#(filter(x, ys)) (10) filter#(x, cons(y, zs)) => isdiv#(x, y) (11) filter#(x, cons(y, zs)) => if_1#(isdiv(x, y), x, y, zs) (12) if_1#(true, x, y, zs) => filter#(x, zs) (13) filter#(x, cons(y, zs)) => isdiv#(x, y) (14) filter#(x, cons(y, zs)) => if_2#(isdiv(x, y), x, y, zs) (15) if_2#(false, x, y, zs) => filter#(x, zs) (16) isdiv#(x, y) => isdiv#(x, -x + y) | y >= x /\ x > 0 (17) isdiv#(x, y) => isdiv#(x, -y) | 0 > y (18) isdiv#(x, y) => isdiv#(-x, y) | 0 > x ***** We apply the Graph Processor on D1 = (P1, R, i, c). We compute a graph approximation with the following edges: 1: 5 6 2: 3 4 3: 3 4 4: 3 4 5: 7 6: 8 9 7: 7 8: 10 11 13 14 9: 8 9 10: 16 17 18 11: 12 12: 10 11 13 14 13: 16 17 18 14: 15 15: 10 11 13 14 16: 16 17: 16 18 18: 16 17 There are 6 SCCs. Processor output: { D2 = (P2, R, i, c) ; D3 = (P3, R, i, c) ; D4 = (P4, R, i, c) ; D5 = (P5, R, i, c) ; D6 = (P6, R, i, c) ; D7 = (P7, R, i, c) }, where: P2. (1) nats#(x, y) => nats#(x + 1, y) | y > x P3. (1) isdiv#(x, y) => isdiv#(x, -x + y) | y >= x /\ x > 0 P4. (1) isdiv#(x, y) => isdiv#(x, -y) | 0 > y (2) isdiv#(x, y) => isdiv#(-x, y) | 0 > x P5. (1) filter#(x, cons(y, zs)) => if_1#(isdiv(x, y), x, y, zs) (2) if_1#(true, x, y, zs) => filter#(x, zs) (3) filter#(x, cons(y, zs)) => if_2#(isdiv(x, y), x, y, zs) (4) if_2#(false, x, y, zs) => filter#(x, zs) P6. (1) sieve#(cons(x, ys)) => sieve#(filter(x, ys)) P7. (1) mem#(x, cons(y, zs)) => mem#(x, zs) | y > x (2) mem#(x, cons(y, zs)) => mem#(x, zs) | x > y ***** We apply the Integer Function Processor on D2 = (P2, R, i, c). We use the following integer mapping: J(nats#) = arg_2 - arg_1 We thus have: (1) y > x |= y - x > y - (x + 1) (and y - x >= 0) All DPs are strictly oriented, and may be removed. Hence, this DP problem is finite. Processor output: { }. ***** We apply the Integer Function Processor on D3 = (P3, R, i, c). We use the following integer mapping: J(isdiv#) = arg_2 We thus have: (1) y >= x /\ x > 0 |= y > -x + y (and y >= 0) All DPs are strictly oriented, and may be removed. Hence, this DP problem is finite. Processor output: { }. ***** We apply the Theory Arguments Processor on D4 = (P4, R, i, c). We use the following theory arguments function: sieve# : [] Processor output: { D8 = (P8, R, i, c) ; D9 = (P9, R, i, c) }, where: P8. (1) isdiv#(x, y) => isdiv#(x, -y) | 0 > y (2) isdiv#(x, y) => isdiv#(-x, y) | 0 > x /\ y = y P9. (1) isdiv#(x, y) => isdiv#(-x, y) | 0 > x ***** We apply the Subterm Criterion Processor on D5 = (P5, R, i, c). We use the following projection function: nu(filter#) = 2 nu(if_1#) = 4 nu(if_2#) = 4 We thus have: (1) cons(y, zs) |>| zs (2) zs |>=| zs (3) cons(y, zs) |>| zs (4) zs |>=| zs We may remove the strictly oriented DPs. Processor output: { D10 = (P10, R, i, c) }, where: P10. (1) if_1#(true, x, y, zs) => filter#(x, zs) (2) if_2#(false, x, y, zs) => filter#(x, zs) ***** We apply the Usable Rules Processor on D6 = (P6, R, i, c). We obtain 10 usable rules (out of 21 rules in the input problem). Processor output: { D11 = (P6, R2, i, c) }, where: R2. (1) filter(x, nil) -> nil (2) filter(x, cons(y, zs)) -> if_1(isdiv(x, y), x, y, zs) (3) filter(x, cons(y, zs)) -> if_2(isdiv(x, y), x, y, zs) (4) if_1(true, x, y, zs) -> filter(x, zs) (5) if_2(false, x, y, zs) -> cons(x, filter(x, zs)) (6) isdiv(x, 0) -> true | x > 0 (7) isdiv(x, y) -> false | x > y /\ y > 0 (8) isdiv(x, y) -> isdiv(x, -x + y) | y >= x /\ x > 0 (9) isdiv(x, y) -> isdiv(x, -y) | 0 > y (10) isdiv(x, y) -> isdiv(-x, y) | 0 > x ***** We apply the Subterm Criterion Processor on D7 = (P7, R, i, c). We use the following projection function: nu(mem#) = 2 We thus have: (1) cons(y, zs) |>| zs (2) cons(y, zs) |>| zs All DPs are strictly oriented, and may be removed. Hence, this DP problem is finite. Processor output: { }. ***** We apply the Integer Function Processor on D8 = (P8, R, i, c). We use the following integer mapping: J(isdiv#) = 0 - arg_2 We thus have: (1) 0 > y |= 0 - y > 0 - -y (and 0 - y >= 0) (2) 0 > x /\ y = y |= 0 - y >= 0 - y We may remove the strictly oriented DPs, which yields: Processor output: { D12 = (P11, R, i, c) }, where: P11. (1) isdiv#(x, y) => isdiv#(-x, y) | 0 > x /\ y = y ***** We apply the Graph Processor on D9 = (P9, R, i, c). We compute a graph approximation with the following edges: 1: As there are no SCCs, this DP problem is removed. Processor output: { }. ***** We apply the Graph Processor on D10 = (P10, R, i, c). We compute a graph approximation with the following edges: 1: 2: As there are no SCCs, this DP problem is removed. Processor output: { }. ***** No progress could be made on DP problem D11 = (P6, R2, i, c).