The rewrite relation of the following TRS is considered.
app(app(*,x),app(app(+,y),z)) | → | app(app(+,app(app(*,x),y)),app(app(*,x),z)) | (1) |
app(app(map,f),nil) | → | nil | (2) |
app(app(map,f),app(app(cons,x),xs)) | → | app(app(cons,app(f,x)),app(app(map,f),xs)) | (3) |
app(app(filter,f),nil) | → | nil | (4) |
app(app(filter,f),app(app(cons,x),xs)) | → | app(app(app(app(filter2,app(f,x)),f),x),xs) | (5) |
app(app(app(app(filter2,true),f),x),xs) | → | app(app(cons,x),app(app(filter,f),xs)) | (6) |
app(app(app(app(filter2,false),f),x),xs) | → | app(app(filter,f),xs) | (7) |
We uncurry the binary symbol app in combination with the following symbol map which also determines the applicative arities of these symbols.
* | is mapped to | *, | *1(x1), | *2(x1, x2) | ||
+ | is mapped to | +, | +1(x1), | +2(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 |
*2(x,+2(y,z)) | → | +2(*2(x,y),*2(x,z)) | (22) |
map2(f,nil) | → | nil | (23) |
map2(f,cons2(x,xs)) | → | cons2(app(f,x),map2(f,xs)) | (24) |
filter3(f,nil) | → | nil | (25) |
filter3(f,cons2(x,xs)) | → | filter24(app(f,x),f,x,xs) | (26) |
filter24(true,f,x,xs) | → | cons2(x,filter3(f,xs)) | (27) |
filter24(false,f,x,xs) | → | filter3(f,xs) | (28) |
app(*,y1) | → | *1(y1) | (8) |
app(*1(x0),y1) | → | *2(x0,y1) | (9) |
app(+,y1) | → | +1(y1) | (10) |
app(+1(x0),y1) | → | +2(x0,y1) | (11) |
app(map,y1) | → | map1(y1) | (12) |
app(map1(x0),y1) | → | map2(x0,y1) | (13) |
app(cons,y1) | → | cons1(y1) | (14) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (15) |
app(filter,y1) | → | filter1(y1) | (16) |
app(filter1(x0),y1) | → | filter3(x0,y1) | (17) |
app(filter2,y1) | → | filter21(y1) | (18) |
app(filter21(x0),y1) | → | filter22(x0,y1) | (19) |
app(filter22(x0,x1),y1) | → | filter23(x0,x1,y1) | (20) |
app(filter23(x0,x1,x2),y1) | → | filter24(x0,x1,x2,y1) | (21) |
prec(*2) | = | 7 | stat(*2) | = | lex | |
prec(+2) | = | 1 | stat(+2) | = | mul | |
prec(map2) | = | 7 | stat(map2) | = | lex | |
prec(nil) | = | 0 | stat(nil) | = | mul | |
prec(cons2) | = | 2 | stat(cons2) | = | mul | |
prec(app) | = | 7 | stat(app) | = | lex | |
prec(filter3) | = | 7 | stat(filter3) | = | lex | |
prec(filter24) | = | 7 | stat(filter24) | = | lex | |
prec(true) | = | 8 | stat(true) | = | mul | |
prec(false) | = | 9 | stat(false) | = | mul | |
prec(*) | = | 10 | stat(*) | = | mul | |
prec(*1) | = | 7 | stat(*1) | = | lex | |
prec(+) | = | 11 | stat(+) | = | mul | |
prec(+1) | = | 7 | stat(+1) | = | lex | |
prec(map) | = | 12 | stat(map) | = | mul | |
prec(map1) | = | 3 | stat(map1) | = | lex | |
prec(cons) | = | 13 | stat(cons) | = | mul | |
prec(filter) | = | 14 | stat(filter) | = | mul | |
prec(filter1) | = | 4 | stat(filter1) | = | lex | |
prec(filter2) | = | 15 | stat(filter2) | = | mul | |
prec(filter21) | = | 5 | stat(filter21) | = | lex | |
prec(filter22) | = | 7 | stat(filter22) | = | lex | |
prec(filter23) | = | 6 | stat(filter23) | = | mul |
π(*2) | = | [2,1] |
π(+2) | = | [1,2] |
π(map2) | = | [2,1] |
π(nil) | = | [] |
π(cons2) | = | [1,2] |
π(app) | = | [2,1] |
π(filter3) | = | [2,1] |
π(filter24) | = | [4,2,1,3] |
π(true) | = | [] |
π(false) | = | [] |
π(*) | = | [] |
π(*1) | = | [1] |
π(+) | = | [] |
π(+1) | = | [1] |
π(map) | = | [] |
π(map1) | = | [1] |
π(cons) | = | [] |
π(cons1) | = | 1 |
π(filter) | = | [] |
π(filter1) | = | [1] |
π(filter2) | = | [] |
π(filter21) | = | [1] |
π(filter22) | = | [2,1] |
π(filter23) | = | [1,2,3] |
*2(x,+2(y,z)) | → | +2(*2(x,y),*2(x,z)) | (22) |
map2(f,nil) | → | nil | (23) |
map2(f,cons2(x,xs)) | → | cons2(app(f,x),map2(f,xs)) | (24) |
filter3(f,nil) | → | nil | (25) |
filter3(f,cons2(x,xs)) | → | filter24(app(f,x),f,x,xs) | (26) |
filter24(true,f,x,xs) | → | cons2(x,filter3(f,xs)) | (27) |
filter24(false,f,x,xs) | → | filter3(f,xs) | (28) |
app(*,y1) | → | *1(y1) | (8) |
app(*1(x0),y1) | → | *2(x0,y1) | (9) |
app(+,y1) | → | +1(y1) | (10) |
app(+1(x0),y1) | → | +2(x0,y1) | (11) |
app(map,y1) | → | map1(y1) | (12) |
app(map1(x0),y1) | → | map2(x0,y1) | (13) |
app(cons,y1) | → | cons1(y1) | (14) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (15) |
app(filter,y1) | → | filter1(y1) | (16) |
app(filter1(x0),y1) | → | filter3(x0,y1) | (17) |
app(filter2,y1) | → | filter21(y1) | (18) |
app(filter21(x0),y1) | → | filter22(x0,y1) | (19) |
app(filter22(x0,x1),y1) | → | filter23(x0,x1,y1) | (20) |
app(filter23(x0,x1,x2),y1) | → | filter24(x0,x1,x2,y1) | (21) |
There are no rules in the TRS. Hence, it is terminating.