The rewrite relation of the following TRS is considered.
app(app(.,1),x) | → | x | (1) |
app(app(.,x),1) | → | x | (2) |
app(app(.,app(i,x)),x) | → | 1 | (3) |
app(app(.,x),app(i,x)) | → | 1 | (4) |
app(app(.,app(i,y)),app(app(.,y),z)) | → | z | (5) |
app(app(.,y),app(app(.,app(i,y)),z)) | → | z | (6) |
app(app(.,app(app(.,x),y)),z) | → | app(app(.,x),app(app(.,y),z)) | (7) |
app(i,1) | → | 1 | (8) |
app(i,app(i,x)) | → | x | (9) |
app(i,app(app(.,x),y)) | → | app(app(.,app(i,y)),app(i,x)) | (10) |
app(app(map,f),nil) | → | nil | (11) |
app(app(map,f),app(app(cons,x),xs)) | → | app(app(cons,app(f,x)),app(app(map,f),xs)) | (12) |
app(app(filter,f),nil) | → | nil | (13) |
app(app(filter,f),app(app(cons,x),xs)) | → | app(app(app(app(filter2,app(f,x)),f),x),xs) | (14) |
app(app(app(app(filter2,true),f),x),xs) | → | app(app(cons,x),app(app(filter,f),xs)) | (15) |
app(app(app(app(filter2,false),f),x),xs) | → | app(app(filter,f),xs) | (16) |
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) | ||
1 | is mapped to | 1 | ||||
i | is mapped to | i, | i1(x1) | |||
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(1,x) | → | x | (30) |
.2(x,1) | → | x | (31) |
.2(i1(x),x) | → | 1 | (32) |
.2(x,i1(x)) | → | 1 | (33) |
.2(i1(y),.2(y,z)) | → | z | (34) |
.2(y,.2(i1(y),z)) | → | z | (35) |
.2(.2(x,y),z) | → | .2(x,.2(y,z)) | (36) |
i1(1) | → | 1 | (37) |
i1(i1(x)) | → | x | (38) |
i1(.2(x,y)) | → | .2(i1(y),i1(x)) | (39) |
map2(f,nil) | → | nil | (40) |
map2(f,cons2(x,xs)) | → | cons2(app(f,x),map2(f,xs)) | (41) |
filter3(f,nil) | → | nil | (42) |
filter3(f,cons2(x,xs)) | → | filter24(app(f,x),f,x,xs) | (43) |
filter24(true,f,x,xs) | → | cons2(x,filter3(f,xs)) | (44) |
filter24(false,f,x,xs) | → | filter3(f,xs) | (45) |
app(.,y1) | → | .1(y1) | (17) |
app(.1(x0),y1) | → | .2(x0,y1) | (18) |
app(i,y1) | → | i1(y1) | (19) |
app(map,y1) | → | map1(y1) | (20) |
app(map1(x0),y1) | → | map2(x0,y1) | (21) |
app(cons,y1) | → | cons1(y1) | (22) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (23) |
app(filter,y1) | → | filter1(y1) | (24) |
app(filter1(x0),y1) | → | filter3(x0,y1) | (25) |
app(filter2,y1) | → | filter21(y1) | (26) |
app(filter21(x0),y1) | → | filter22(x0,y1) | (27) |
app(filter22(x0,x1),y1) | → | filter23(x0,x1,y1) | (28) |
app(filter23(x0,x1,x2),y1) | → | filter24(x0,x1,x2,y1) | (29) |
prec(.2) | = | 1 | stat(.2) | = | lex | |
prec(1) | = | 0 | stat(1) | = | mul | |
prec(i1) | = | 5 | stat(i1) | = | lex | |
prec(map2) | = | 5 | stat(map2) | = | lex | |
prec(nil) | = | 2 | stat(nil) | = | mul | |
prec(cons2) | = | 3 | stat(cons2) | = | mul | |
prec(app) | = | 5 | stat(app) | = | lex | |
prec(filter3) | = | 5 | stat(filter3) | = | lex | |
prec(filter24) | = | 5 | stat(filter24) | = | lex | |
prec(true) | = | 6 | stat(true) | = | mul | |
prec(false) | = | 7 | stat(false) | = | mul | |
prec(.) | = | 8 | stat(.) | = | mul | |
prec(i) | = | 9 | stat(i) | = | mul | |
prec(map) | = | 10 | stat(map) | = | mul | |
prec(map1) | = | 5 | stat(map1) | = | lex | |
prec(cons) | = | 11 | stat(cons) | = | mul | |
prec(filter) | = | 12 | stat(filter) | = | mul | |
prec(filter2) | = | 13 | stat(filter2) | = | mul | |
prec(filter22) | = | 4 | stat(filter22) | = | mul | |
prec(filter23) | = | 5 | stat(filter23) | = | lex |
π(.2) | = | [1,2] |
π(1) | = | [] |
π(i1) | = | [1] |
π(map2) | = | [2,1] |
π(nil) | = | [] |
π(cons2) | = | [1,2] |
π(app) | = | [2,1] |
π(filter3) | = | [2,1] |
π(filter24) | = | [4,2,1,3] |
π(true) | = | [] |
π(false) | = | [] |
π(.) | = | [] |
π(.1) | = | 1 |
π(i) | = | [] |
π(map) | = | [] |
π(map1) | = | [1] |
π(cons) | = | [] |
π(cons1) | = | 1 |
π(filter) | = | [] |
π(filter1) | = | 1 |
π(filter2) | = | [] |
π(filter21) | = | 1 |
π(filter22) | = | [1,2] |
π(filter23) | = | [3,1,2] |
.2(1,x) | → | x | (30) |
.2(x,1) | → | x | (31) |
.2(i1(x),x) | → | 1 | (32) |
.2(x,i1(x)) | → | 1 | (33) |
.2(i1(y),.2(y,z)) | → | z | (34) |
.2(y,.2(i1(y),z)) | → | z | (35) |
.2(.2(x,y),z) | → | .2(x,.2(y,z)) | (36) |
i1(1) | → | 1 | (37) |
i1(i1(x)) | → | x | (38) |
i1(.2(x,y)) | → | .2(i1(y),i1(x)) | (39) |
map2(f,nil) | → | nil | (40) |
map2(f,cons2(x,xs)) | → | cons2(app(f,x),map2(f,xs)) | (41) |
filter3(f,nil) | → | nil | (42) |
filter3(f,cons2(x,xs)) | → | filter24(app(f,x),f,x,xs) | (43) |
filter24(true,f,x,xs) | → | cons2(x,filter3(f,xs)) | (44) |
filter24(false,f,x,xs) | → | filter3(f,xs) | (45) |
app(.,y1) | → | .1(y1) | (17) |
app(.1(x0),y1) | → | .2(x0,y1) | (18) |
app(i,y1) | → | i1(y1) | (19) |
app(map,y1) | → | map1(y1) | (20) |
app(map1(x0),y1) | → | map2(x0,y1) | (21) |
app(cons,y1) | → | cons1(y1) | (22) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (23) |
app(filter,y1) | → | filter1(y1) | (24) |
app(filter2,y1) | → | filter21(y1) | (26) |
app(filter21(x0),y1) | → | filter22(x0,y1) | (27) |
app(filter22(x0,x1),y1) | → | filter23(x0,x1,y1) | (28) |
app(filter23(x0,x1,x2),y1) | → | filter24(x0,x1,x2,y1) | (29) |
prec(filter1) | = | 0 | weight(filter1) | = | 1 | ||||
prec(app) | = | 2 | weight(app) | = | 0 | ||||
prec(filter3) | = | 1 | weight(filter3) | = | 1 |
app(filter1(x0),y1) | → | filter3(x0,y1) | (25) |
There are no rules in the TRS. Hence, it is terminating.