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