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(app(le,0),y) | → | true | (3) |
app(app(le,app(s,x)),0) | → | false | (4) |
app(app(le,app(s,x)),app(s,y)) | → | app(app(le,x),y) | (5) |
app(app(maxlist,x),app(app(cons,y),ys)) | → | app(app(if,app(app(le,x),y)),app(app(maxlist,y),ys)) | (6) |
app(app(maxlist,x),nil) | → | x | (7) |
app(height,app(app(node,x),xs)) | → | app(s,app(app(maxlist,0),app(app(map,height),xs))) | (8) |
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) |
le | is mapped to | le, | le1(x1), | le2(x1, x2) |
0 | is mapped to | 0 | ||
true | is mapped to | true | ||
s | is mapped to | s, | s1(x1) | |
false | is mapped to | false | ||
maxlist | is mapped to | maxlist, | maxlist1(x1), | maxlist2(x1, x2) |
if | is mapped to | if, | if1(x1), | if2(x1, x2) |
height | is mapped to | height, | height1(x1) | |
node | is mapped to | node, | node1(x1), | node2(x1, x2) |
map2(f,nil) | → | nil | (23) |
map2(f,cons2(x,xs)) | → | cons2(app(f,x),map2(f,xs)) | (24) |
le2(0,y) | → | true | (25) |
le2(s1(x),0) | → | false | (26) |
le2(s1(x),s1(y)) | → | le2(x,y) | (27) |
maxlist2(x,cons2(y,ys)) | → | if2(le2(x,y),maxlist2(y,ys)) | (28) |
maxlist2(x,nil) | → | x | (29) |
height1(node2(x,xs)) | → | s1(maxlist2(0,map2(height,xs))) | (30) |
app(map,y1) | → | map1(y1) | (9) |
app(map1(x0),y1) | → | map2(x0,y1) | (10) |
app(cons,y1) | → | cons1(y1) | (11) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (12) |
app(le,y1) | → | le1(y1) | (13) |
app(le1(x0),y1) | → | le2(x0,y1) | (14) |
app(s,y1) | → | s1(y1) | (15) |
app(maxlist,y1) | → | maxlist1(y1) | (16) |
app(maxlist1(x0),y1) | → | maxlist2(x0,y1) | (17) |
app(if,y1) | → | if1(y1) | (18) |
app(if1(x0),y1) | → | if2(x0,y1) | (19) |
app(height,y1) | → | height1(y1) | (20) |
app(node,y1) | → | node1(y1) | (21) |
app(node1(x0),y1) | → | node2(x0,y1) | (22) |
prec(map2) | = | 8 | stat(map2) | = | lex | |
prec(nil) | = | 0 | stat(nil) | = | mul | |
prec(cons2) | = | 2 | stat(cons2) | = | mul | |
prec(app) | = | 8 | stat(app) | = | lex | |
prec(le2) | = | 1 | stat(le2) | = | mul | |
prec(0) | = | 5 | stat(0) | = | mul | |
prec(true) | = | 3 | stat(true) | = | mul | |
prec(false) | = | 5 | stat(false) | = | mul | |
prec(maxlist2) | = | 5 | stat(maxlist2) | = | mul | |
prec(if2) | = | 4 | stat(if2) | = | mul | |
prec(height1) | = | 8 | stat(height1) | = | lex | |
prec(node2) | = | 5 | stat(node2) | = | mul | |
prec(height) | = | 5 | stat(height) | = | mul | |
prec(map) | = | 9 | stat(map) | = | mul | |
prec(map1) | = | 6 | stat(map1) | = | lex | |
prec(cons) | = | 10 | stat(cons) | = | mul | |
prec(cons1) | = | 7 | stat(cons1) | = | lex | |
prec(le) | = | 11 | stat(le) | = | mul | |
prec(s) | = | 12 | stat(s) | = | mul | |
prec(maxlist) | = | 13 | stat(maxlist) | = | mul | |
prec(if) | = | 14 | stat(if) | = | mul | |
prec(node) | = | 15 | stat(node) | = | mul |
π(map2) | = | [2,1] |
π(nil) | = | [] |
π(cons2) | = | [1,2] |
π(app) | = | [2,1] |
π(le2) | = | [1,2] |
π(0) | = | [] |
π(true) | = | [] |
π(s1) | = | 1 |
π(false) | = | [] |
π(maxlist2) | = | [1,2] |
π(if2) | = | [1,2] |
π(height1) | = | [1] |
π(node2) | = | [1,2] |
π(height) | = | [] |
π(map) | = | [] |
π(map1) | = | [1] |
π(cons) | = | [] |
π(cons1) | = | [1] |
π(le) | = | [] |
π(le1) | = | 1 |
π(s) | = | [] |
π(maxlist) | = | [] |
π(maxlist1) | = | 1 |
π(if) | = | [] |
π(if1) | = | 1 |
π(node) | = | [] |
π(node1) | = | 1 |
map2(f,nil) | → | nil | (23) |
map2(f,cons2(x,xs)) | → | cons2(app(f,x),map2(f,xs)) | (24) |
le2(0,y) | → | true | (25) |
le2(s1(x),0) | → | false | (26) |
maxlist2(x,cons2(y,ys)) | → | if2(le2(x,y),maxlist2(y,ys)) | (28) |
maxlist2(x,nil) | → | x | (29) |
height1(node2(x,xs)) | → | s1(maxlist2(0,map2(height,xs))) | (30) |
app(map,y1) | → | map1(y1) | (9) |
app(map1(x0),y1) | → | map2(x0,y1) | (10) |
app(cons,y1) | → | cons1(y1) | (11) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (12) |
app(le,y1) | → | le1(y1) | (13) |
app(le1(x0),y1) | → | le2(x0,y1) | (14) |
app(s,y1) | → | s1(y1) | (15) |
app(maxlist,y1) | → | maxlist1(y1) | (16) |
app(maxlist1(x0),y1) | → | maxlist2(x0,y1) | (17) |
app(if,y1) | → | if1(y1) | (18) |
app(if1(x0),y1) | → | if2(x0,y1) | (19) |
app(height,y1) | → | height1(y1) | (20) |
app(node,y1) | → | node1(y1) | (21) |
app(node1(x0),y1) | → | node2(x0,y1) | (22) |
prec(s1) | = | 1 | weight(s1) | = | 0 | ||||
prec(le2) | = | 0 | weight(le2) | = | 0 |
le2(s1(x),s1(y)) | → | le2(x,y) | (27) |
There are no rules in the TRS. Hence, it is terminating.