The rewrite relation of the following TRS is considered.
app(app(app(if,true),x),y) | → | x | (1) |
app(app(app(if,true),x),y) | → | y | (2) |
app(app(takeWhile,p),nil) | → | nil | (3) |
app(app(takeWhile,p),app(app(cons,x),xs)) | → | app(app(app(if,app(p,x)),app(app(cons,x),app(app(takeWhile,p),xs))),nil) | (4) |
app(app(dropWhile,p),nil) | → | nil | (5) |
app(app(dropWhile,p),app(app(cons,x),xs)) | → | app(app(app(if,app(p,x)),app(app(dropWhile,p),xs)),app(app(cons,x),xs)) | (6) |
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 | |||
takeWhile | is mapped to | takeWhile, | takeWhile1(x1), | takeWhile2(x1, x2) | |
nil | is mapped to | nil | |||
cons | is mapped to | cons, | cons1(x1), | cons2(x1, x2) | |
dropWhile | is mapped to | dropWhile, | dropWhile1(x1), | dropWhile2(x1, x2) |
if3(true,x,y) | → | x | (16) |
if3(true,x,y) | → | y | (17) |
takeWhile2(p,nil) | → | nil | (18) |
takeWhile2(p,cons2(x,xs)) | → | if3(app(p,x),cons2(x,takeWhile2(p,xs)),nil) | (19) |
dropWhile2(p,nil) | → | nil | (20) |
dropWhile2(p,cons2(x,xs)) | → | if3(app(p,x),dropWhile2(p,xs),cons2(x,xs)) | (21) |
app(if,y1) | → | if1(y1) | (7) |
app(if1(x0),y1) | → | if2(x0,y1) | (8) |
app(if2(x0,x1),y1) | → | if3(x0,x1,y1) | (9) |
app(takeWhile,y1) | → | takeWhile1(y1) | (10) |
app(takeWhile1(x0),y1) | → | takeWhile2(x0,y1) | (11) |
app(cons,y1) | → | cons1(y1) | (12) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (13) |
app(dropWhile,y1) | → | dropWhile1(y1) | (14) |
app(dropWhile1(x0),y1) | → | dropWhile2(x0,y1) | (15) |
prec(if3) | = | 0 | stat(if3) | = | mul | |
prec(true) | = | 1 | stat(true) | = | mul | |
prec(takeWhile2) | = | 3 | stat(takeWhile2) | = | mul | |
prec(nil) | = | 3 | stat(nil) | = | mul | |
prec(cons2) | = | 0 | stat(cons2) | = | mul | |
prec(app) | = | 3 | stat(app) | = | mul | |
prec(dropWhile2) | = | 3 | stat(dropWhile2) | = | mul | |
prec(if) | = | 4 | stat(if) | = | mul | |
prec(if2) | = | 2 | stat(if2) | = | mul | |
prec(takeWhile) | = | 5 | stat(takeWhile) | = | mul | |
prec(cons) | = | 6 | stat(cons) | = | mul | |
prec(dropWhile) | = | 7 | stat(dropWhile) | = | mul |
π(if3) | = | [1,2,3] |
π(true) | = | [] |
π(takeWhile2) | = | [1,2] |
π(nil) | = | [] |
π(cons2) | = | [1,2] |
π(app) | = | [1,2] |
π(dropWhile2) | = | [1,2] |
π(if) | = | [] |
π(if1) | = | 1 |
π(if2) | = | [1,2] |
π(takeWhile) | = | [] |
π(takeWhile1) | = | 1 |
π(cons) | = | [] |
π(cons1) | = | 1 |
π(dropWhile) | = | [] |
π(dropWhile1) | = | 1 |
if3(true,x,y) | → | x | (16) |
if3(true,x,y) | → | y | (17) |
takeWhile2(p,nil) | → | nil | (18) |
takeWhile2(p,cons2(x,xs)) | → | if3(app(p,x),cons2(x,takeWhile2(p,xs)),nil) | (19) |
dropWhile2(p,nil) | → | nil | (20) |
dropWhile2(p,cons2(x,xs)) | → | if3(app(p,x),dropWhile2(p,xs),cons2(x,xs)) | (21) |
app(if,y1) | → | if1(y1) | (7) |
app(if1(x0),y1) | → | if2(x0,y1) | (8) |
app(if2(x0,x1),y1) | → | if3(x0,x1,y1) | (9) |
app(takeWhile,y1) | → | takeWhile1(y1) | (10) |
app(cons,y1) | → | cons1(y1) | (12) |
app(cons1(x0),y1) | → | cons2(x0,y1) | (13) |
app(dropWhile,y1) | → | dropWhile1(y1) | (14) |
prec(takeWhile1) | = | 4 | weight(takeWhile1) | = | 1 | ||||
prec(dropWhile1) | = | 1 | weight(dropWhile1) | = | 1 | ||||
prec(app) | = | 2 | weight(app) | = | 0 | ||||
prec(takeWhile2) | = | 0 | weight(takeWhile2) | = | 1 | ||||
prec(dropWhile2) | = | 3 | weight(dropWhile2) | = | 0 |
app(takeWhile1(x0),y1) | → | takeWhile2(x0,y1) | (11) |
app(dropWhile1(x0),y1) | → | dropWhile2(x0,y1) | (15) |
There are no rules in the TRS. Hence, it is terminating.