Certification Problem

Input (TPDB Runtime_Complexity_Innermost_Rewriting/Frederiksen_Glenstrup/naiverev)

The rewrite relation of the following TRS is considered.

naiverev(Cons(x,xs)) app(naiverev(xs),Cons(x,Nil)) (1)
app(Cons(x,xs),ys) Cons(x,app(xs,ys)) (2)
notEmpty(Cons(x,xs)) True (3)
notEmpty(Nil) False (4)
naiverev(Nil) Nil (5)
app(Nil,ys) ys (6)
goal(xs) naiverev(xs) (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:
naiverev#(Cons(z0,z1)) c(app#(naiverev(z1),Cons(z0,Nil)),naiverev#(z1)) (9)
originates from
naiverev(Cons(z0,z1)) app(naiverev(z1),Cons(z0,Nil)) (8)
naiverev#(Nil) c1 (10)
originates from
naiverev(Nil) Nil (5)
app#(Cons(z0,z1),z2) c2(app#(z1,z2)) (12)
originates from
app(Cons(z0,z1),z2) Cons(z0,app(z1,z2)) (11)
app#(Nil,z0) c3 (14)
originates from
app(Nil,z0) z0 (13)
notEmpty#(Cons(z0,z1)) c4 (16)
originates from
notEmpty(Cons(z0,z1)) True (15)
notEmpty#(Nil) c5 (17)
originates from
notEmpty(Nil) False (4)
goal#(z0) c6(naiverev#(z0)) (19)
originates from
goal(z0) naiverev(z0) (18)
Moreover, we add the following terms to the innermost strategy.
naiverev#(Cons(z0,z1))
naiverev#(Nil)
app#(Cons(z0,z1),z2)
app#(Nil,z0)
notEmpty#(Cons(z0,z1))
notEmpty#(Nil)
goal#(z0)

1.1 Usable Rules

We remove the following rules since they are not usable.
notEmpty(Cons(z0,z1)) True (15)
notEmpty(Nil) False (4)
goal(z0) naiverev(z0) (18)

1.1.1 Rule Shifting

The rules
goal#(z0) c6(naiverev#(z0)) (19)
are strictly oriented by the following non-linear polynomial interpretation over the naturals
[c(x1, x2)] = 1 · x1 + 0 + 1 · x2
[c1] = 0
[c2(x1)] = 1 · x1 + 0
[c3] = 0
[c4] = 0
[c5] = 0
[c6(x1)] = 1 · x1 + 0
[naiverev(x1)] = 0
[app(x1, x2)] = 1
[naiverev#(x1)] = 0
[app#(x1, x2)] = 0
[notEmpty#(x1)] = 0
[goal#(x1)] = 2 + 1 · x1 + 2 · x1 · x1
[Cons(x1, x2)] = 0
[Nil] = 0
which has the intended complexity. Here, only the following usable rules have been considered:
naiverev#(Cons(z0,z1)) c(app#(naiverev(z1),Cons(z0,Nil)),naiverev#(z1)) (9)
naiverev#(Nil) c1 (10)
app#(Cons(z0,z1),z2) c2(app#(z1,z2)) (12)
app#(Nil,z0) c3 (14)
notEmpty#(Cons(z0,z1)) c4 (16)
notEmpty#(Nil) c5 (17)
goal#(z0) c6(naiverev#(z0)) (19)

1.1.1.1 Rule Shifting

The rules
naiverev#(Nil) c1 (10)
app#(Nil,z0) c3 (14)
notEmpty#(Cons(z0,z1)) c4 (16)
notEmpty#(Nil) c5 (17)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c(x1, x2)] = 1 · x1 + 0 + 1 · x2
[c1] = 0
[c2(x1)] = 1 · x1 + 0
[c3] = 0
[c4] = 0
[c5] = 0
[c6(x1)] = 1 · x1 + 0
[naiverev(x1)] = 1 + 1 · x1
[app(x1, x2)] = 1 · x1 + 0 + 1 · x2
[naiverev#(x1)] = 1 + 1 · x1
[app#(x1, x2)] = 1
[notEmpty#(x1)] = 1 + 1 · x1
[goal#(x1)] = 1 + 1 · x1
[Cons(x1, x2)] = 1 + 1 · x1 + 1 · x2
[Nil] = 0
which has the intended complexity. Here, only the following usable rules have been considered:
naiverev#(Cons(z0,z1)) c(app#(naiverev(z1),Cons(z0,Nil)),naiverev#(z1)) (9)
naiverev#(Nil) c1 (10)
app#(Cons(z0,z1),z2) c2(app#(z1,z2)) (12)
app#(Nil,z0) c3 (14)
notEmpty#(Cons(z0,z1)) c4 (16)
notEmpty#(Nil) c5 (17)
goal#(z0) c6(naiverev#(z0)) (19)

1.1.1.1.1 Rule Shifting

The rules
naiverev#(Cons(z0,z1)) c(app#(naiverev(z1),Cons(z0,Nil)),naiverev#(z1)) (9)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c(x1, x2)] = 1 · x1 + 0 + 1 · x2
[c1] = 0
[c2(x1)] = 1 · x1 + 0
[c3] = 0
[c4] = 0
[c5] = 0
[c6(x1)] = 1 · x1 + 0
[naiverev(x1)] = 3
[app(x1, x2)] = 3
[naiverev#(x1)] = 3 + 1 · x1
[app#(x1, x2)] = 0
[notEmpty#(x1)] = 0
[goal#(x1)] = 3 + 1 · x1
[Cons(x1, x2)] = 2 + 1 · x1 + 1 · x2
[Nil] = 0
which has the intended complexity. Here, only the following usable rules have been considered:
naiverev#(Cons(z0,z1)) c(app#(naiverev(z1),Cons(z0,Nil)),naiverev#(z1)) (9)
naiverev#(Nil) c1 (10)
app#(Cons(z0,z1),z2) c2(app#(z1,z2)) (12)
app#(Nil,z0) c3 (14)
notEmpty#(Cons(z0,z1)) c4 (16)
notEmpty#(Nil) c5 (17)
goal#(z0) c6(naiverev#(z0)) (19)

1.1.1.1.1.1 Rule Shifting

The rules
app#(Cons(z0,z1),z2) c2(app#(z1,z2)) (12)
are strictly oriented by the following non-linear polynomial interpretation over the naturals
[c(x1, x2)] = 1 · x1 + 0 + 1 · x2
[c1] = 0
[c2(x1)] = 1 · x1 + 0
[c3] = 0
[c4] = 0
[c5] = 0
[c6(x1)] = 1 · x1 + 0
[naiverev(x1)] = 1 · x1 + 0
[app(x1, x2)] = 1 · x1 + 0 + 1 · x2
[naiverev#(x1)] = 1 + 1 · x1 + 1 · x1 · x1
[app#(x1, x2)] = 1 · x1 + 0
[notEmpty#(x1)] = 0
[goal#(x1)] = 1 + 1 · x1 + 1 · x1 · x1
[Cons(x1, x2)] = 1 + 1 · x2
[Nil] = 0
which has the intended complexity. Here, only the following usable rules have been considered:
naiverev#(Cons(z0,z1)) c(app#(naiverev(z1),Cons(z0,Nil)),naiverev#(z1)) (9)
naiverev#(Nil) c1 (10)
app#(Cons(z0,z1),z2) c2(app#(z1,z2)) (12)
app#(Nil,z0) c3 (14)
notEmpty#(Cons(z0,z1)) c4 (16)
notEmpty#(Nil) c5 (17)
goal#(z0) c6(naiverev#(z0)) (19)
naiverev(Nil) Nil (5)
naiverev(Cons(z0,z1)) app(naiverev(z1),Cons(z0,Nil)) (8)
app(Nil,z0) z0 (13)
app(Cons(z0,z1),z2) Cons(z0,app(z1,z2)) (11)

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).