The rewrite relation of the following TRS is considered.
app(app(map,f),nil) | → | nil | (1) |
app(app(map,f),app(app(cons,x),xs)) | → | app(app(cons,app(f,x)),app(app(map,f),xs)) | (2) |
app(sum,app(app(cons,x),xs)) | → | app(app(plus,x),app(sum,xs)) | (3) |
app(size,app(app(node,x),xs)) | → | app(s,app(sum,app(app(map,size),xs))) | (4) |
app(app(plus,0),x) | → | 0 | (5) |
app(app(plus,app(s,x)),y) | → | app(s,app(app(plus,x),y)) | (6) |
We uncurry the binary symbol app in combination with the following symbol map which also determines the applicative arities of these symbols.
map | is mapped to | map, | map1(x1), | map2(x1, x2) |
nil | is mapped to | nil | ||
cons | is mapped to | cons, | cons1(x1), | cons2(x1, x2) |
sum | is mapped to | sum, | sum1(x1) | |
plus | is mapped to | plus, | plus1(x1), | plus2(x1, x2) |
size | is mapped to | size, | size1(x1) | |
node | is mapped to | node, | node1(x1), | node2(x1, x2) |
s | is mapped to | s, | s1(x1) | |
0 | is mapped to | 0 |
map2(f,nil) | → | nil | (18) |
map2(f,cons2(x,xs)) | → | cons2(app(f,x),map2(f,xs)) | (19) |
sum1(cons2(x,xs)) | → | plus2(x,sum1(xs)) | (20) |
size1(node2(x,xs)) | → | s1(sum1(map2(size,xs))) | (21) |
plus2(0,x) | → | 0 | (22) |
plus2(s1(x),y) | → | s1(plus2(x,y)) | (23) |
app(map,y1) | → | map1(y1) | (7) |
app(map1(x0),y1) | → | map2(x0,y1) | (8) |
app(cons,y1) | → | cons1(y1) | (9) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (10) |
app(sum,y1) | → | sum1(y1) | (11) |
app(plus,y1) | → | plus1(y1) | (12) |
app(plus1(x0),y1) | → | plus2(x0,y1) | (13) |
app(size,y1) | → | size1(y1) | (14) |
app(node,y1) | → | node1(y1) | (15) |
app(node1(x0),y1) | → | node2(x0,y1) | (16) |
app(s,y1) | → | s1(y1) | (17) |
prec(map2) | = | 7 | stat(map2) | = | lex | |
prec(nil) | = | 0 | stat(nil) | = | mul | |
prec(cons2) | = | 1 | stat(cons2) | = | mul | |
prec(app) | = | 7 | stat(app) | = | lex | |
prec(sum1) | = | 4 | stat(sum1) | = | mul | |
prec(plus2) | = | 3 | stat(plus2) | = | mul | |
prec(size1) | = | 7 | stat(size1) | = | lex | |
prec(node2) | = | 5 | stat(node2) | = | mul | |
prec(size) | = | 6 | stat(size) | = | mul | |
prec(0) | = | 2 | stat(0) | = | mul | |
prec(map) | = | 8 | stat(map) | = | mul | |
prec(map1) | = | 7 | stat(map1) | = | lex | |
prec(cons) | = | 9 | stat(cons) | = | mul | |
prec(cons1) | = | 7 | stat(cons1) | = | lex | |
prec(sum) | = | 10 | stat(sum) | = | mul | |
prec(plus) | = | 11 | stat(plus) | = | mul | |
prec(plus1) | = | 7 | stat(plus1) | = | lex | |
prec(node) | = | 12 | stat(node) | = | mul | |
prec(s) | = | 13 | stat(s) | = | mul |
π(map2) | = | [2,1] |
π(nil) | = | [] |
π(cons2) | = | [1,2] |
π(app) | = | [2,1] |
π(sum1) | = | [1] |
π(plus2) | = | [1,2] |
π(size1) | = | [1] |
π(node2) | = | [1,2] |
π(s1) | = | 1 |
π(size) | = | [] |
π(0) | = | [] |
π(map) | = | [] |
π(map1) | = | [1] |
π(cons) | = | [] |
π(cons1) | = | [1] |
π(sum) | = | [] |
π(plus) | = | [] |
π(plus1) | = | [1] |
π(node) | = | [] |
π(node1) | = | 1 |
π(s) | = | [] |
map2(f,nil) | → | nil | (18) |
map2(f,cons2(x,xs)) | → | cons2(app(f,x),map2(f,xs)) | (19) |
sum1(cons2(x,xs)) | → | plus2(x,sum1(xs)) | (20) |
size1(node2(x,xs)) | → | s1(sum1(map2(size,xs))) | (21) |
plus2(0,x) | → | 0 | (22) |
app(map,y1) | → | map1(y1) | (7) |
app(map1(x0),y1) | → | map2(x0,y1) | (8) |
app(cons,y1) | → | cons1(y1) | (9) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (10) |
app(sum,y1) | → | sum1(y1) | (11) |
app(plus,y1) | → | plus1(y1) | (12) |
app(plus1(x0),y1) | → | plus2(x0,y1) | (13) |
app(size,y1) | → | size1(y1) | (14) |
app(node,y1) | → | node1(y1) | (15) |
app(node1(x0),y1) | → | node2(x0,y1) | (16) |
app(s,y1) | → | s1(y1) | (17) |
prec(s1) | = | 0 | weight(s1) | = | 1 | ||||
prec(plus2) | = | 1 | weight(plus2) | = | 0 |
plus2(s1(x),y) | → | s1(plus2(x,y)) | (23) |
There are no rules in the TRS. Hence, it is terminating.