The rewrite relation of the following TRS is considered.
app(g,app(h,app(g,x))) | → | app(g,x) | (1) |
app(g,app(g,x)) | → | app(g,app(h,app(g,x))) | (2) |
app(h,app(h,x)) | → | app(h,app(app(f,app(h,x)),x)) | (3) |
app(app(map,fun),nil) | → | nil | (4) |
app(app(map,fun),app(app(cons,x),xs)) | → | app(app(cons,app(fun,x)),app(app(map,fun),xs)) | (5) |
app(app(filter,fun),nil) | → | nil | (6) |
app(app(filter,fun),app(app(cons,x),xs)) | → | app(app(app(app(filter2,app(fun,x)),fun),x),xs) | (7) |
app(app(app(app(filter2,true),fun),x),xs) | → | app(app(cons,x),app(app(filter,fun),xs)) | (8) |
app(app(app(app(filter2,false),fun),x),xs) | → | app(app(filter,fun),xs) | (9) |
We uncurry the binary symbol app in combination with the following symbol map which also determines the applicative arities of these symbols.
g | is mapped to | g, | g1(x1) | |||
h | is mapped to | h, | h1(x1) | |||
f | is mapped to | f, | f1(x1), | f2(x1, x2) | ||
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) | ||
filter | is mapped to | filter, | filter1(x1), | filter3(x1, x2) | ||
filter2 | is mapped to | filter2, | filter21(x1), | filter22(x1, x2), | filter23(x1, x2, x3), | filter24(x1,...,x4) |
true | is mapped to | true | ||||
false | is mapped to | false |
g1(h1(g1(x))) | → | g1(x) | (24) |
g1(g1(x)) | → | g1(h1(g1(x))) | (25) |
h1(h1(x)) | → | h1(f2(h1(x),x)) | (26) |
map2(fun,nil) | → | nil | (27) |
map2(fun,cons2(x,xs)) | → | cons2(app(fun,x),map2(fun,xs)) | (28) |
filter3(fun,nil) | → | nil | (29) |
filter3(fun,cons2(x,xs)) | → | filter24(app(fun,x),fun,x,xs) | (30) |
filter24(true,fun,x,xs) | → | cons2(x,filter3(fun,xs)) | (31) |
filter24(false,fun,x,xs) | → | filter3(fun,xs) | (32) |
app(g,y1) | → | g1(y1) | (10) |
app(h,y1) | → | h1(y1) | (11) |
app(f,y1) | → | f1(y1) | (12) |
app(f1(x0),y1) | → | f2(x0,y1) | (13) |
app(map,y1) | → | map1(y1) | (14) |
app(map1(x0),y1) | → | map2(x0,y1) | (15) |
app(cons,y1) | → | cons1(y1) | (16) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (17) |
app(filter,y1) | → | filter1(y1) | (18) |
app(filter1(x0),y1) | → | filter3(x0,y1) | (19) |
app(filter2,y1) | → | filter21(y1) | (20) |
app(filter21(x0),y1) | → | filter22(x0,y1) | (21) |
app(filter22(x0,x1),y1) | → | filter23(x0,x1,y1) | (22) |
app(filter23(x0,x1,x2),y1) | → | filter24(x0,x1,x2,y1) | (23) |
g1#(g1(x)) | → | g1#(h1(g1(x))) | (33) |
g1#(g1(x)) | → | h1#(g1(x)) | (34) |
h1#(h1(x)) | → | h1#(f2(h1(x),x)) | (35) |
map2#(fun,cons2(x,xs)) | → | app#(fun,x) | (36) |
map2#(fun,cons2(x,xs)) | → | map2#(fun,xs) | (37) |
filter3#(fun,cons2(x,xs)) | → | filter24#(app(fun,x),fun,x,xs) | (38) |
filter3#(fun,cons2(x,xs)) | → | app#(fun,x) | (39) |
filter24#(true,fun,x,xs) | → | filter3#(fun,xs) | (40) |
filter24#(false,fun,x,xs) | → | filter3#(fun,xs) | (41) |
app#(g,y1) | → | g1#(y1) | (42) |
app#(h,y1) | → | h1#(y1) | (43) |
app#(map1(x0),y1) | → | map2#(x0,y1) | (44) |
app#(filter1(x0),y1) | → | filter3#(x0,y1) | (45) |
app#(filter23(x0,x1,x2),y1) | → | filter24#(x0,x1,x2,y1) | (46) |
The dependency pairs are split into 2 components.
app#(map1(x0),y1) | → | map2#(x0,y1) | (44) |
map2#(fun,cons2(x,xs)) | → | app#(fun,x) | (36) |
app#(filter1(x0),y1) | → | filter3#(x0,y1) | (45) |
filter3#(fun,cons2(x,xs)) | → | app#(fun,x) | (39) |
app#(filter23(x0,x1,x2),y1) | → | filter24#(x0,x1,x2,y1) | (46) |
filter24#(true,fun,x,xs) | → | filter3#(fun,xs) | (40) |
filter24#(false,fun,x,xs) | → | filter3#(fun,xs) | (41) |
map2#(fun,cons2(x,xs)) | → | map2#(fun,xs) | (37) |
[map1(x1)] | = | 1 · x1 |
[cons2(x1, x2)] | = | 1 · x1 + 1 · x2 |
[filter1(x1)] | = | 1 · x1 |
[filter23(x1, x2, x3)] | = | 1 · x1 + 1 · x2 + 1 · x3 |
[true] | = | 0 |
[false] | = | 0 |
[map2#(x1, x2)] | = | 1 · x1 + 1 · x2 |
[app#(x1, x2)] | = | 1 · x1 + 1 · x2 |
[filter3#(x1, x2)] | = | 1 · x1 + 1 · x2 |
[filter24#(x1,...,x4)] | = | 1 · x1 + 1 · x2 + 1 · x3 + 1 · x4 |
Using size-change termination in combination with the subterm criterion one obtains the following initial size-change graphs.
map2#(fun,cons2(x,xs)) | → | app#(fun,x) | (36) |
1 | ≥ | 1 | |
2 | > | 2 | |
map2#(fun,cons2(x,xs)) | → | map2#(fun,xs) | (37) |
1 | ≥ | 1 | |
2 | > | 2 | |
filter3#(fun,cons2(x,xs)) | → | app#(fun,x) | (39) |
1 | ≥ | 1 | |
2 | > | 2 | |
app#(map1(x0),y1) | → | map2#(x0,y1) | (44) |
1 | > | 1 | |
2 | ≥ | 2 | |
app#(filter1(x0),y1) | → | filter3#(x0,y1) | (45) |
1 | > | 1 | |
2 | ≥ | 2 | |
app#(filter23(x0,x1,x2),y1) | → | filter24#(x0,x1,x2,y1) | (46) |
1 | > | 1 | |
1 | > | 2 | |
1 | > | 3 | |
2 | ≥ | 4 | |
filter24#(true,fun,x,xs) | → | filter3#(fun,xs) | (40) |
2 | ≥ | 1 | |
4 | ≥ | 2 | |
filter24#(false,fun,x,xs) | → | filter3#(fun,xs) | (41) |
2 | ≥ | 1 | |
4 | ≥ | 2 |
As there is no critical graph in the transitive closure, there are no infinite chains.
g1#(g1(x)) | → | g1#(h1(g1(x))) | (33) |
prec(g1) | = | 1 | weight(g1) | = | 1 | ||||
prec(h1) | = | 0 | weight(h1) | = | 1 |
π(g1#) | = | 1 |
π(g1) | = | [] |
π(h1) | = | [] |
h1(h1(x)) | → | h1(f2(h1(x),x)) | (26) |
g1#(g1(x)) | → | g1#(h1(g1(x))) | (33) |
There are no pairs anymore.