The rewrite relation of the following TRS is considered.
| app(f,app(s,x)) | → | app(f,x) | (1) |
| app(g,app(app(cons,0),y)) | → | app(g,y) | (2) |
| app(g,app(app(cons,app(s,x)),y)) | → | app(s,x) | (3) |
| app(h,app(app(cons,x),y)) | → | app(h,app(g,app(app(cons,x),y))) | (4) |
| app(app(map,fun),nil) | → | nil | (5) |
| app(app(map,fun),app(app(cons,x),xs)) | → | app(app(cons,app(fun,x)),app(app(map,fun),xs)) | (6) |
| app(app(filter,fun),nil) | → | nil | (7) |
| app(app(filter,fun),app(app(cons,x),xs)) | → | app(app(app(app(filter2,app(fun,x)),fun),x),xs) | (8) |
| app(app(app(app(filter2,true),fun),x),xs) | → | app(app(cons,x),app(app(filter,fun),xs)) | (9) |
| app(app(app(app(filter2,false),fun),x),xs) | → | app(app(filter,fun),xs) | (10) |
We uncurry the binary symbol app in combination with the following symbol map which also determines the applicative arities of these symbols.
| f | is mapped to | f, | f1(x1) | |||
| s | is mapped to | s, | s1(x1) | |||
| g | is mapped to | g, | g1(x1) | |||
| cons | is mapped to | cons, | cons1(x1), | cons2(x1, x2) | ||
| 0 | is mapped to | 0 | ||||
| h | is mapped to | h, | h1(x1) | |||
| map | is mapped to | map, | map1(x1), | map2(x1, x2) | ||
| nil | is mapped to | nil | ||||
| 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 |
| f1(s1(x)) | → | f1(x) | (25) |
| g1(cons2(0,y)) | → | g1(y) | (26) |
| g1(cons2(s1(x),y)) | → | s1(x) | (27) |
| h1(cons2(x,y)) | → | h1(g1(cons2(x,y))) | (28) |
| map2(fun,nil) | → | nil | (29) |
| map2(fun,cons2(x,xs)) | → | cons2(app(fun,x),map2(fun,xs)) | (30) |
| filter3(fun,nil) | → | nil | (31) |
| filter3(fun,cons2(x,xs)) | → | filter24(app(fun,x),fun,x,xs) | (32) |
| filter24(true,fun,x,xs) | → | cons2(x,filter3(fun,xs)) | (33) |
| filter24(false,fun,x,xs) | → | filter3(fun,xs) | (34) |
| app(f,y1) | → | f1(y1) | (11) |
| app(s,y1) | → | s1(y1) | (12) |
| app(g,y1) | → | g1(y1) | (13) |
| app(cons,y1) | → | cons1(y1) | (14) |
| app(cons1(x0),y1) | → | cons2(x0,y1) | (15) |
| app(h,y1) | → | h1(y1) | (16) |
| app(map,y1) | → | map1(y1) | (17) |
| app(map1(x0),y1) | → | map2(x0,y1) | (18) |
| app(filter,y1) | → | filter1(y1) | (19) |
| app(filter1(x0),y1) | → | filter3(x0,y1) | (20) |
| app(filter2,y1) | → | filter21(y1) | (21) |
| app(filter21(x0),y1) | → | filter22(x0,y1) | (22) |
| app(filter22(x0,x1),y1) | → | filter23(x0,x1,y1) | (23) |
| app(filter23(x0,x1,x2),y1) | → | filter24(x0,x1,x2,y1) | (24) |
| prec(f1) | = | 0 | stat(f1) | = | mul | |
| prec(cons2) | = | 1 | stat(cons2) | = | mul | |
| prec(0) | = | 2 | stat(0) | = | mul | |
| prec(map2) | = | 6 | stat(map2) | = | lex | |
| prec(nil) | = | 7 | stat(nil) | = | mul | |
| prec(app) | = | 6 | stat(app) | = | lex | |
| prec(filter3) | = | 6 | stat(filter3) | = | lex | |
| prec(filter24) | = | 6 | stat(filter24) | = | lex | |
| prec(true) | = | 8 | stat(true) | = | mul | |
| prec(false) | = | 9 | stat(false) | = | mul | |
| prec(f) | = | 10 | stat(f) | = | mul | |
| prec(s) | = | 11 | stat(s) | = | mul | |
| prec(g) | = | 12 | stat(g) | = | mul | |
| prec(cons) | = | 13 | stat(cons) | = | mul | |
| prec(cons1) | = | 3 | stat(cons1) | = | mul | |
| prec(h) | = | 14 | stat(h) | = | mul | |
| prec(map) | = | 15 | stat(map) | = | mul | |
| prec(filter) | = | 16 | stat(filter) | = | mul | |
| prec(filter2) | = | 17 | stat(filter2) | = | mul | |
| prec(filter21) | = | 5 | stat(filter21) | = | mul | |
| prec(filter22) | = | 4 | stat(filter22) | = | mul | |
| prec(filter23) | = | 6 | stat(filter23) | = | lex |
| π(f1) | = | [1] |
| π(s1) | = | 1 |
| π(g1) | = | 1 |
| π(cons2) | = | [1,2] |
| π(0) | = | [] |
| π(h1) | = | 1 |
| π(map2) | = | [2,1] |
| π(nil) | = | [] |
| π(app) | = | [2,1] |
| π(filter3) | = | [2,1] |
| π(filter24) | = | [4,2,1,3] |
| π(true) | = | [] |
| π(false) | = | [] |
| π(f) | = | [] |
| π(s) | = | [] |
| π(g) | = | [] |
| π(cons) | = | [] |
| π(cons1) | = | [1] |
| π(h) | = | [] |
| π(map) | = | [] |
| π(map1) | = | 1 |
| π(filter) | = | [] |
| π(filter1) | = | 1 |
| π(filter2) | = | [] |
| π(filter21) | = | [1] |
| π(filter22) | = | [1,2] |
| π(filter23) | = | [3,1,2] |
| g1(cons2(0,y)) | → | g1(y) | (26) |
| g1(cons2(s1(x),y)) | → | s1(x) | (27) |
| map2(fun,nil) | → | nil | (29) |
| map2(fun,cons2(x,xs)) | → | cons2(app(fun,x),map2(fun,xs)) | (30) |
| filter3(fun,nil) | → | nil | (31) |
| filter3(fun,cons2(x,xs)) | → | filter24(app(fun,x),fun,x,xs) | (32) |
| filter24(true,fun,x,xs) | → | cons2(x,filter3(fun,xs)) | (33) |
| filter24(false,fun,x,xs) | → | filter3(fun,xs) | (34) |
| app(f,y1) | → | f1(y1) | (11) |
| app(s,y1) | → | s1(y1) | (12) |
| app(g,y1) | → | g1(y1) | (13) |
| app(cons,y1) | → | cons1(y1) | (14) |
| app(cons1(x0),y1) | → | cons2(x0,y1) | (15) |
| app(h,y1) | → | h1(y1) | (16) |
| app(map,y1) | → | map1(y1) | (17) |
| app(filter,y1) | → | filter1(y1) | (19) |
| app(filter2,y1) | → | filter21(y1) | (21) |
| app(filter21(x0),y1) | → | filter22(x0,y1) | (22) |
| app(filter22(x0,x1),y1) | → | filter23(x0,x1,y1) | (23) |
| app(filter23(x0,x1,x2),y1) | → | filter24(x0,x1,x2,y1) | (24) |
| [f1(x1)] | = | 2 · x1 |
| [s1(x1)] | = | 2 + 2 · x1 |
| [h1(x1)] | = | 2 · x1 |
| [cons2(x1, x2)] | = | 1 · x1 + 1 · x2 |
| [g1(x1)] | = | 1 · x1 |
| [app(x1, x2)] | = | 2 + 1 · x1 + 2 · x2 |
| [map1(x1)] | = | 2 + 2 · x1 |
| [map2(x1, x2)] | = | 2 · x1 + 2 · x2 |
| [filter1(x1)] | = | 2 + 2 · x1 |
| [filter3(x1, x2)] | = | 2 · x1 + 2 · x2 |
| f1(s1(x)) | → | f1(x) | (25) |
| app(map1(x0),y1) | → | map2(x0,y1) | (18) |
| app(filter1(x0),y1) | → | filter3(x0,y1) | (20) |
The TRS is overlay and locally confluent:
10Hence, it suffices to show innermost termination in the following.
| h1#(cons2(x,y)) | → | h1#(g1(cons2(x,y))) | (35) |
We restrict the rewrite rules to the following usable rules of the DP problem.
There are no rules.
We restrict the innermost strategy to the following left hand sides.
There are no lhss.
| prec(cons2) | = | 1 | weight(cons2) | = | 2 | ||||
| prec(g1) | = | 0 | weight(g1) | = | 1 |
| π(h1#) | = | 1 |
| π(cons2) | = | [] |
| π(g1) | = | [] |
| h1#(cons2(x,y)) | → | h1#(g1(cons2(x,y))) | (35) |
There are no pairs anymore.