Certification Problem

Input (TPDB Runtime_Complexity_Innermost_Rewriting/SK90/2.29)

The rewrite relation of the following TRS is considered.

prime(0) false (1)
prime(s(0)) false (2)
prime(s(s(x))) prime1(s(s(x)),s(x)) (3)
prime1(x,0) false (4)
prime1(x,s(0)) true (5)
prime1(x,s(s(y))) and(not(divp(s(s(y)),x)),prime1(x,s(y))) (6)
divp(x,y) =(rem(x,y),0) (7)
The evaluation strategy is innermost.

Property / Task

Determine bounds on the runtime complexity.

Answer / Result

An upperbound for the complexity is O(n2).

Proof (by AProVE @ termCOMP 2023)

1 Dependency Tuples

We get the following set of dependency tuples:
prime#(0) c (8)
originates from
prime(0) false (1)
prime#(s(0)) c1 (9)
originates from
prime(s(0)) false (2)
prime#(s(s(z0))) c2(prime1#(s(s(z0)),s(z0))) (11)
originates from
prime(s(s(z0))) prime1(s(s(z0)),s(z0)) (10)
prime1#(z0,0) c3 (13)
originates from
prime1(z0,0) false (12)
prime1#(z0,s(0)) c4 (15)
originates from
prime1(z0,s(0)) true (14)
prime1#(z0,s(s(z1))) c5(divp#(s(s(z1)),z0),prime1#(z0,s(z1))) (17)
originates from
prime1(z0,s(s(z1))) and(not(divp(s(s(z1)),z0)),prime1(z0,s(z1))) (16)
divp#(z0,z1) c6 (19)
originates from
divp(z0,z1) =(rem(z0,z1),0) (18)
Moreover, we add the following terms to the innermost strategy.
prime#(0)
prime#(s(0))
prime#(s(s(z0)))
prime1#(z0,0)
prime1#(z0,s(0))
prime1#(z0,s(s(z1)))
divp#(z0,z1)

1.1 Usable Rules

We remove the following rules since they are not usable.
prime(0) false (1)
prime(s(0)) false (2)
prime(s(s(z0))) prime1(s(s(z0)),s(z0)) (10)
prime1(z0,0) false (12)
prime1(z0,s(0)) true (14)
prime1(z0,s(s(z1))) and(not(divp(s(s(z1)),z0)),prime1(z0,s(z1))) (16)
divp(z0,z1) =(rem(z0,z1),0) (18)

1.1.1 Rule Shifting

The rules
prime#(0) c (8)
prime#(s(0)) c1 (9)
prime#(s(s(z0))) c2(prime1#(s(s(z0)),s(z0))) (11)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c] = 0
[c1] = 0
[c2(x1)] = 1 · x1 + 0
[c3] = 0
[c4] = 0
[c5(x1, x2)] = 1 · x1 + 0 + 1 · x2
[c6] = 0
[prime#(x1)] = 1
[prime1#(x1, x2)] = 0
[divp#(x1, x2)] = 0
[0] = 0
[s(x1)] = 0
which has the intended complexity. Here, only the following usable rules have been considered:
prime#(0) c (8)
prime#(s(0)) c1 (9)
prime#(s(s(z0))) c2(prime1#(s(s(z0)),s(z0))) (11)
prime1#(z0,0) c3 (13)
prime1#(z0,s(0)) c4 (15)
prime1#(z0,s(s(z1))) c5(divp#(s(s(z1)),z0),prime1#(z0,s(z1))) (17)
divp#(z0,z1) c6 (19)

1.1.1.1 Rule Shifting

The rules
prime1#(z0,s(0)) c4 (15)
prime1#(z0,s(s(z1))) c5(divp#(s(s(z1)),z0),prime1#(z0,s(z1))) (17)
are strictly oriented by the following non-linear polynomial interpretation over the naturals
[c] = 0
[c1] = 0
[c2(x1)] = 1 · x1 + 0
[c3] = 0
[c4] = 0
[c5(x1, x2)] = 1 · x1 + 0 + 1 · x2
[c6] = 0
[prime#(x1)] = 2 · x1 · x1 + 0
[prime1#(x1, x2)] = 1 · x1 + 0 + 1 · x2 + 2 · x2 · x2
[divp#(x1, x2)] = 1 · x1 + 0
[0] = 0
[s(x1)] = 2 + 1 · x1
which has the intended complexity. Here, only the following usable rules have been considered:
prime#(0) c (8)
prime#(s(0)) c1 (9)
prime#(s(s(z0))) c2(prime1#(s(s(z0)),s(z0))) (11)
prime1#(z0,0) c3 (13)
prime1#(z0,s(0)) c4 (15)
prime1#(z0,s(s(z1))) c5(divp#(s(s(z1)),z0),prime1#(z0,s(z1))) (17)
divp#(z0,z1) c6 (19)

1.1.1.1.1 Rule Shifting

The rules
prime1#(z0,0) c3 (13)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c] = 0
[c1] = 0
[c2(x1)] = 1 · x1 + 0
[c3] = 0
[c4] = 0
[c5(x1, x2)] = 1 · x1 + 0 + 1 · x2
[c6] = 0
[prime#(x1)] = 1 + 1 · x1
[prime1#(x1, x2)] = 1 · x1 + 0 + 1 · x2
[divp#(x1, x2)] = 0
[0] = 1
[s(x1)] = 1
which has the intended complexity. Here, only the following usable rules have been considered:
prime#(0) c (8)
prime#(s(0)) c1 (9)
prime#(s(s(z0))) c2(prime1#(s(s(z0)),s(z0))) (11)
prime1#(z0,0) c3 (13)
prime1#(z0,s(0)) c4 (15)
prime1#(z0,s(s(z1))) c5(divp#(s(s(z1)),z0),prime1#(z0,s(z1))) (17)
divp#(z0,z1) c6 (19)

1.1.1.1.1.1 Rule Shifting

The rules
divp#(z0,z1) c6 (19)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c] = 0
[c1] = 0
[c2(x1)] = 1 · x1 + 0
[c3] = 0
[c4] = 0
[c5(x1, x2)] = 1 · x1 + 0 + 1 · x2
[c6] = 0
[prime#(x1)] = 2 + 3 · x1
[prime1#(x1, x2)] = 1 · x2 + 0
[divp#(x1, x2)] = 1
[0] = 0
[s(x1)] = 2 + 1 · x1
which has the intended complexity. Here, only the following usable rules have been considered:
prime#(0) c (8)
prime#(s(0)) c1 (9)
prime#(s(s(z0))) c2(prime1#(s(s(z0)),s(z0))) (11)
prime1#(z0,0) c3 (13)
prime1#(z0,s(0)) c4 (15)
prime1#(z0,s(s(z1))) c5(divp#(s(s(z1)),z0),prime1#(z0,s(z1))) (17)
divp#(z0,z1) c6 (19)

1.1.1.1.1.1.1 R is empty

There are no rules in the TRS R. Hence, R/S has complexity O(1).