Certification Problem

Input (TPDB Runtime_Complexity_Innermost_Rewriting/AG01/#3.15)

The rewrite relation of the following TRS is considered.

average(s(x),y) average(x,s(y)) (1)
average(x,s(s(s(y)))) s(average(s(x),y)) (2)
average(0,0) 0 (3)
average(0,s(0)) 0 (4)
average(0,s(s(0))) s(0) (5)
The evaluation strategy is innermost.

Property / Task

Determine bounds on the runtime complexity.

Answer / Result

An upperbound for the complexity is O(n).

Proof (by AProVE @ termCOMP 2023)

1 Dependency Tuples

We get the following set of dependency tuples:
average#(s(z0),z1) c(average#(z0,s(z1))) (7)
originates from
average(s(z0),z1) average(z0,s(z1)) (6)
average#(z0,s(s(s(z1)))) c1(average#(s(z0),z1)) (9)
originates from
average(z0,s(s(s(z1)))) s(average(s(z0),z1)) (8)
average#(0,0) c2 (10)
originates from
average(0,0) 0 (3)
average#(0,s(0)) c3 (11)
originates from
average(0,s(0)) 0 (4)
average#(0,s(s(0))) c4 (12)
originates from
average(0,s(s(0))) s(0) (5)
Moreover, we add the following terms to the innermost strategy.
average#(s(z0),z1)
average#(z0,s(s(s(z1))))
average#(0,0)
average#(0,s(0))
average#(0,s(s(0)))

1.1 Usable Rules

We remove the following rules since they are not usable.
average(s(z0),z1) average(z0,s(z1)) (6)
average(z0,s(s(s(z1)))) s(average(s(z0),z1)) (8)
average(0,0) 0 (3)
average(0,s(0)) 0 (4)
average(0,s(s(0))) s(0) (5)

1.1.1 Rule Shifting

The rules
average#(z0,s(s(s(z1)))) c1(average#(s(z0),z1)) (9)
average#(0,0) c2 (10)
average#(0,s(0)) c3 (11)
average#(0,s(s(0))) c4 (12)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c(x1)] = 1 · x1 + 0
[c1(x1)] = 1 · x1 + 0
[c2] = 0
[c3] = 0
[c4] = 0
[average#(x1, x2)] = 1 + 1 · x1 + 1 · x2
[s(x1)] = 1 + 1 · x1
[0] = 0
which has the intended complexity. Here, only the following usable rules have been considered:
average#(s(z0),z1) c(average#(z0,s(z1))) (7)
average#(z0,s(s(s(z1)))) c1(average#(s(z0),z1)) (9)
average#(0,0) c2 (10)
average#(0,s(0)) c3 (11)
average#(0,s(s(0))) c4 (12)

1.1.1.1 Rule Shifting

The rules
average#(s(z0),z1) c(average#(z0,s(z1))) (7)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c(x1)] = 1 · x1 + 0
[c1(x1)] = 1 · x1 + 0
[c2] = 0
[c3] = 0
[c4] = 0
[average#(x1, x2)] = 2 · x1 + 0 + 1 · x2
[s(x1)] = 1 + 1 · x1
[0] = 0
which has the intended complexity. Here, only the following usable rules have been considered:
average#(s(z0),z1) c(average#(z0,s(z1))) (7)
average#(z0,s(s(s(z1)))) c1(average#(s(z0),z1)) (9)
average#(0,0) c2 (10)
average#(0,s(0)) c3 (11)
average#(0,s(s(0))) c4 (12)

1.1.1.1.1 R is empty

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