The rewrite relation of the following TRS is considered.
app(app(times,x),app(app(plus,y),app(s,z))) | → | app(app(plus,app(app(times,x),app(app(plus,y),app(app(times,app(s,z)),0)))),app(app(times,x),app(s,z))) | (1) |
app(app(times,x),0) | → | 0 | (2) |
app(app(times,x),app(s,y)) | → | app(app(plus,app(app(times,x),y)),x) | (3) |
app(app(plus,x),0) | → | x | (4) |
app(app(plus,x),app(s,y)) | → | app(s,app(app(plus,x),y)) | (5) |
app(app(map,f),nil) | → | nil | (6) |
app(app(map,f),app(app(cons,x),xs)) | → | app(app(cons,app(f,x)),app(app(map,f),xs)) | (7) |
app(app(filter,f),nil) | → | nil | (8) |
app(app(filter,f),app(app(cons,x),xs)) | → | app(app(app(app(filter2,app(f,x)),f),x),xs) | (9) |
app(app(app(app(filter2,true),f),x),xs) | → | app(app(cons,x),app(app(filter,f),xs)) | (10) |
app(app(app(app(filter2,false),f),x),xs) | → | app(app(filter,f),xs) | (11) |
We uncurry the binary symbol app in combination with the following symbol map which also determines the applicative arities of these symbols.
times | is mapped to | times, | times1(x1), | times2(x1, x2) | ||
plus | is mapped to | plus, | plus1(x1), | plus2(x1, x2) | ||
s | is mapped to | s, | s1(x1) | |||
0 | is mapped to | 0 | ||||
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 |
times2(x,plus2(y,s1(z))) | → | plus2(times2(x,plus2(y,times2(s1(z),0))),times2(x,s1(z))) | (27) |
times2(x,0) | → | 0 | (28) |
times2(x,s1(y)) | → | plus2(times2(x,y),x) | (29) |
plus2(x,0) | → | x | (30) |
plus2(x,s1(y)) | → | s1(plus2(x,y)) | (31) |
map2(f,nil) | → | nil | (32) |
map2(f,cons2(x,xs)) | → | cons2(app(f,x),map2(f,xs)) | (33) |
filter3(f,nil) | → | nil | (34) |
filter3(f,cons2(x,xs)) | → | filter24(app(f,x),f,x,xs) | (35) |
filter24(true,f,x,xs) | → | cons2(x,filter3(f,xs)) | (36) |
filter24(false,f,x,xs) | → | filter3(f,xs) | (37) |
app(times,y1) | → | times1(y1) | (12) |
app(times1(x0),y1) | → | times2(x0,y1) | (13) |
app(plus,y1) | → | plus1(y1) | (14) |
app(plus1(x0),y1) | → | plus2(x0,y1) | (15) |
app(s,y1) | → | s1(y1) | (16) |
app(map,y1) | → | map1(y1) | (17) |
app(map1(x0),y1) | → | map2(x0,y1) | (18) |
app(cons,y1) | → | cons1(y1) | (19) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (20) |
app(filter,y1) | → | filter1(y1) | (21) |
app(filter1(x0),y1) | → | filter3(x0,y1) | (22) |
app(filter2,y1) | → | filter21(y1) | (23) |
app(filter21(x0),y1) | → | filter22(x0,y1) | (24) |
app(filter22(x0,x1),y1) | → | filter23(x0,x1,y1) | (25) |
app(filter23(x0,x1,x2),y1) | → | filter24(x0,x1,x2,y1) | (26) |
times2#(x,plus2(y,s1(z))) | → | plus2#(times2(x,plus2(y,times2(s1(z),0))),times2(x,s1(z))) | (38) |
times2#(x,plus2(y,s1(z))) | → | times2#(x,plus2(y,times2(s1(z),0))) | (39) |
times2#(x,plus2(y,s1(z))) | → | plus2#(y,times2(s1(z),0)) | (40) |
times2#(x,plus2(y,s1(z))) | → | times2#(s1(z),0) | (41) |
times2#(x,plus2(y,s1(z))) | → | times2#(x,s1(z)) | (42) |
times2#(x,s1(y)) | → | plus2#(times2(x,y),x) | (43) |
times2#(x,s1(y)) | → | times2#(x,y) | (44) |
plus2#(x,s1(y)) | → | plus2#(x,y) | (45) |
map2#(f,cons2(x,xs)) | → | app#(f,x) | (46) |
map2#(f,cons2(x,xs)) | → | map2#(f,xs) | (47) |
filter3#(f,cons2(x,xs)) | → | filter24#(app(f,x),f,x,xs) | (48) |
filter3#(f,cons2(x,xs)) | → | app#(f,x) | (49) |
filter24#(true,f,x,xs) | → | filter3#(f,xs) | (50) |
filter24#(false,f,x,xs) | → | filter3#(f,xs) | (51) |
app#(times1(x0),y1) | → | times2#(x0,y1) | (52) |
app#(plus1(x0),y1) | → | plus2#(x0,y1) | (53) |
app#(map1(x0),y1) | → | map2#(x0,y1) | (54) |
app#(filter1(x0),y1) | → | filter3#(x0,y1) | (55) |
app#(filter23(x0,x1,x2),y1) | → | filter24#(x0,x1,x2,y1) | (56) |
The dependency pairs are split into 3 components.
app#(map1(x0),y1) | → | map2#(x0,y1) | (54) |
map2#(f,cons2(x,xs)) | → | app#(f,x) | (46) |
app#(filter1(x0),y1) | → | filter3#(x0,y1) | (55) |
filter3#(f,cons2(x,xs)) | → | filter24#(app(f,x),f,x,xs) | (48) |
filter24#(true,f,x,xs) | → | filter3#(f,xs) | (50) |
filter3#(f,cons2(x,xs)) | → | app#(f,x) | (49) |
app#(filter23(x0,x1,x2),y1) | → | filter24#(x0,x1,x2,y1) | (56) |
filter24#(false,f,x,xs) | → | filter3#(f,xs) | (51) |
map2#(f,cons2(x,xs)) | → | map2#(f,xs) | (47) |
Using size-change termination in combination with the subterm criterion one obtains the following initial size-change graphs.
map2#(f,cons2(x,xs)) | → | app#(f,x) | (46) |
1 | ≥ | 1 | |
2 | > | 2 | |
map2#(f,cons2(x,xs)) | → | map2#(f,xs) | (47) |
1 | ≥ | 1 | |
2 | > | 2 | |
filter3#(f,cons2(x,xs)) | → | app#(f,x) | (49) |
1 | ≥ | 1 | |
2 | > | 2 | |
app#(map1(x0),y1) | → | map2#(x0,y1) | (54) |
1 | > | 1 | |
2 | ≥ | 2 | |
filter3#(f,cons2(x,xs)) | → | filter24#(app(f,x),f,x,xs) | (48) |
1 | ≥ | 2 | |
2 | > | 3 | |
2 | > | 4 | |
app#(filter1(x0),y1) | → | filter3#(x0,y1) | (55) |
1 | > | 1 | |
2 | ≥ | 2 | |
app#(filter23(x0,x1,x2),y1) | → | filter24#(x0,x1,x2,y1) | (56) |
1 | > | 1 | |
1 | > | 2 | |
1 | > | 3 | |
2 | ≥ | 4 | |
filter24#(true,f,x,xs) | → | filter3#(f,xs) | (50) |
2 | ≥ | 1 | |
4 | ≥ | 2 | |
filter24#(false,f,x,xs) | → | filter3#(f,xs) | (51) |
2 | ≥ | 1 | |
4 | ≥ | 2 |
As there is no critical graph in the transitive closure, there are no infinite chains.
times2#(x,plus2(y,s1(z))) | → | times2#(x,s1(z)) | (42) |
times2#(x,s1(y)) | → | times2#(x,y) | (44) |
times2#(x,plus2(y,s1(z))) | → | times2#(x,plus2(y,times2(s1(z),0))) | (39) |
[times2(x1, x2)] | = | 1 · x1 + 1 · x2 |
[0] | = | 0 |
[plus2(x1, x2)] | = | 1 · x1 + 1 · x2 |
[s1(x1)] | = | 1 · x1 |
[times2#(x1, x2)] | = | 1 · x1 + 1 · x2 |
times2(x,0) | → | 0 | (28) |
plus2(x,0) | → | x | (30) |
plus2(x,s1(y)) | → | s1(plus2(x,y)) | (31) |
[times2(x1, x2)] | = | 1 · x1 + 2 · x2 |
[0] | = | 0 |
[plus2(x1, x2)] | = | 1 + 2 · x1 + 2 · x2 |
[s1(x1)] | = | 1 · x1 |
[times2#(x1, x2)] | = | 1 · x1 + 2 · x2 |
times2#(x,plus2(y,s1(z))) | → | times2#(x,s1(z)) | (42) |
plus2(x,0) | → | x | (30) |
[times2(x1, x2)] | = | 1 · x1 + 1 · x2 |
[0] | = | 0 |
[plus2(x1, x2)] | = | 2 · x1 + 2 · x2 |
[s1(x1)] | = | 2 + 1 · x1 |
[times2#(x1, x2)] | = | 1 · x1 + 2 · x2 |
times2#(x,s1(y)) | → | times2#(x,y) | (44) |
plus2(x,s1(y)) | → | s1(plus2(x,y)) | (31) |
20
Hence, it suffices to show innermost termination in the following.Using size-change termination in combination with the subterm criterion one obtains the following initial size-change graphs.
times2#(x,plus2(y,s1(z))) | → | times2#(x,plus2(y,times2(s1(z),0))) | (39) |
1 | ≥ | 1 |
As there is no critical graph in the transitive closure, there are no infinite chains.
plus2#(x,s1(y)) | → | plus2#(x,y) | (45) |
[s1(x1)] | = | 1 · x1 |
[plus2#(x1, x2)] | = | 1 · x1 + 1 · x2 |
Using size-change termination in combination with the subterm criterion one obtains the following initial size-change graphs.
plus2#(x,s1(y)) | → | plus2#(x,y) | (45) |
1 | ≥ | 1 | |
2 | > | 2 |
As there is no critical graph in the transitive closure, there are no infinite chains.