Certification Problem

Input (TPDB Runtime_Complexity_Innermost_Rewriting/SK90/4.18)

The rewrite relation of the following TRS is considered.

gcd(x,0) x (1)
gcd(0,y) y (2)
gcd(s(x),s(y)) if(<(x,y),gcd(s(x),-(y,x)),gcd(-(x,y),s(y))) (3)
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:
gcd#(z0,0) c (5)
originates from
gcd(z0,0) z0 (4)
gcd#(0,z0) c1 (7)
originates from
gcd(0,z0) z0 (6)
gcd#(s(z0),s(z1)) c2(gcd#(s(z0),-(z1,z0)),gcd#(-(z0,z1),s(z1))) (9)
originates from
gcd(s(z0),s(z1)) if(<(z0,z1),gcd(s(z0),-(z1,z0)),gcd(-(z0,z1),s(z1))) (8)
Moreover, we add the following terms to the innermost strategy.
gcd#(z0,0)
gcd#(0,z0)
gcd#(s(z0),s(z1))

1.1 Usable Rules

We remove the following rules since they are not usable.
gcd(z0,0) z0 (4)
gcd(0,z0) z0 (6)
gcd(s(z0),s(z1)) if(<(z0,z1),gcd(s(z0),-(z1,z0)),gcd(-(z0,z1),s(z1))) (8)

1.1.1 Rule Shifting

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

1.1.1.1 Rule Shifting

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

1.1.1.1.1 R is empty

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