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) |
|
originates from |
|
||||||||
|
originates from |
|
||||||||
|
originates from |
|
gcd#(z0,0) |
gcd#(0,z0) |
gcd#(s(z0),s(z1)) |
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) |
gcd#(z0,0) | → | c | (5) |
gcd#(0,z0) | → | c1 | (7) |
[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 |
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) |
gcd#(s(z0),s(z1)) | → | c2(gcd#(s(z0),-(z1,z0)),gcd#(-(z0,z1),s(z1))) | (9) |
[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 |
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) |
There are no rules in the TRS R. Hence, R/S has complexity O(1).