Certification Problem

Input (TPDB Runtime_Complexity_Innermost_Rewriting/Frederiksen_Others/add)

The relative rewrite relation R/S is considered where R is the following TRS

add0(S(x),x2) +(S(0),add0(x2,x)) (1)
add0(0,x2) x2 (2)

and S is the following TRS.

+(x,S(0)) S(x) (3)
+(S(0),y) S(y) (4)
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:
add0#(S(z0),z1) c2(+#(S(0),add0(z1,z0)),add0#(z1,z0)) (6)
originates from
add0(S(z0),z1) +(S(0),add0(z1,z0)) (5)
add0#(0,z0) c3 (8)
originates from
add0(0,z0) z0 (7)
+#(z0,S(0)) c (10)
originates from
+(z0,S(0)) S(z0) (9)
+#(S(0),z0) c1 (12)
originates from
+(S(0),z0) S(z0) (11)
Moreover, we add the following terms to the innermost strategy.
+#(z0,S(0))
+#(S(0),z0)
add0#(S(z0),z1)
add0#(0,z0)

1.1 Rule Shifting

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

1.1.1 Rule Shifting

The rules
add0#(S(z0),z1) c2(+#(S(0),add0(z1,z0)),add0#(z1,z0)) (6)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c] = 0
[c1] = 0
[c2(x1, x2)] = 1 · x1 + 0 + 1 · x2
[c3] = 0
[add0(x1, x2)] = 1 · x1 + 0 + 1 · x2
[+(x1, x2)] = 1 · x1 + 0 + 1 · x2
[+#(x1, x2)] = 0
[add0#(x1, x2)] = 1 · 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:
+#(z0,S(0)) c (10)
+#(S(0),z0) c1 (12)
add0#(S(z0),z1) c2(+#(S(0),add0(z1,z0)),add0#(z1,z0)) (6)
add0#(0,z0) c3 (8)

1.1.1.1 R is empty

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