The rewrite relation of the following TRS is considered.
app(app(app(if,true),x),y) | → | x | (1) |
app(app(app(if,false),x),y) | → | y | (2) |
app(app(filter,f),nil) | → | nil | (3) |
app(app(filter,f),app(app(cons,x),xs)) | → | app(app(app(if,app(f,x)),app(app(cons,x),app(app(filter,f),xs))),app(app(filter,f),xs)) | (4) |
We uncurry the binary symbol app in combination with the following symbol map which also determines the applicative arities of these symbols.
if | is mapped to | if, | if1(x1), | if2(x1, x2), | if3(x1, x2, x3) |
true | is mapped to | true | |||
false | is mapped to | false | |||
filter | is mapped to | filter, | filter1(x1), | filter2(x1, x2) | |
nil | is mapped to | nil | |||
cons | is mapped to | cons, | cons1(x1), | cons2(x1, x2) |
if3(true,x,y) | → | x | (12) |
if3(false,x,y) | → | y | (13) |
filter2(f,nil) | → | nil | (14) |
filter2(f,cons2(x,xs)) | → | if3(app(f,x),cons2(x,filter2(f,xs)),filter2(f,xs)) | (15) |
app(if,y1) | → | if1(y1) | (5) |
app(if1(x0),y1) | → | if2(x0,y1) | (6) |
app(if2(x0,x1),y1) | → | if3(x0,x1,y1) | (7) |
app(filter,y1) | → | filter1(y1) | (8) |
app(filter1(x0),y1) | → | filter2(x0,y1) | (9) |
app(cons,y1) | → | cons1(y1) | (10) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (11) |
prec(if3) | = | 0 | stat(if3) | = | mul | |
prec(true) | = | 1 | stat(true) | = | mul | |
prec(false) | = | 2 | stat(false) | = | mul | |
prec(filter2) | = | 7 | stat(filter2) | = | mul | |
prec(nil) | = | 3 | stat(nil) | = | mul | |
prec(cons2) | = | 4 | stat(cons2) | = | mul | |
prec(app) | = | 7 | stat(app) | = | mul | |
prec(if) | = | 8 | stat(if) | = | mul | |
prec(if2) | = | 5 | stat(if2) | = | lex | |
prec(filter) | = | 6 | stat(filter) | = | mul | |
prec(filter1) | = | 6 | stat(filter1) | = | mul | |
prec(cons) | = | 9 | stat(cons) | = | mul | |
prec(cons1) | = | 4 | stat(cons1) | = | mul |
π(if3) | = | [1,2,3] |
π(true) | = | [] |
π(false) | = | [] |
π(filter2) | = | [1,2] |
π(nil) | = | [] |
π(cons2) | = | [1,2] |
π(app) | = | [1,2] |
π(if) | = | [] |
π(if1) | = | 1 |
π(if2) | = | [1,2] |
π(filter) | = | [] |
π(filter1) | = | [1] |
π(cons) | = | [] |
π(cons1) | = | [1] |
if3(true,x,y) | → | x | (12) |
if3(false,x,y) | → | y | (13) |
filter2(f,nil) | → | nil | (14) |
filter2(f,cons2(x,xs)) | → | if3(app(f,x),cons2(x,filter2(f,xs)),filter2(f,xs)) | (15) |
app(if,y1) | → | if1(y1) | (5) |
app(if1(x0),y1) | → | if2(x0,y1) | (6) |
app(if2(x0,x1),y1) | → | if3(x0,x1,y1) | (7) |
app(filter,y1) | → | filter1(y1) | (8) |
app(filter1(x0),y1) | → | filter2(x0,y1) | (9) |
app(cons,y1) | → | cons1(y1) | (10) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (11) |
There are no rules in the TRS. Hence, it is terminating.