The rewrite relation of the following TRS is considered.
| app(app(app(rec,f),x),0) | → | x | (1) |
| app(app(app(rec,f),x),app(s,y)) | → | app(app(f,app(s,y)),app(app(app(rec,f),x),y)) | (2) |
We uncurry the binary symbol app in combination with the following symbol map which also determines the applicative arities of these symbols.
| rec | is mapped to | rec, | rec1(x1), | rec2(x1, x2), | rec3(x1, x2, x3) |
| 0 | is mapped to | 0 | |||
| s | is mapped to | s, | s1(x1) |
| rec3(f,x,0) | → | x | (7) |
| rec3(f,x,s1(y)) | → | app(app(f,s1(y)),rec3(f,x,y)) | (8) |
| app(rec,y1) | → | rec1(y1) | (3) |
| app(rec1(x0),y1) | → | rec2(x0,y1) | (4) |
| app(rec2(x0,x1),y1) | → | rec3(x0,x1,y1) | (5) |
| app(s,y1) | → | s1(y1) | (6) |
The TRS is overlay and locally confluent:
10Hence, it suffices to show innermost termination in the following.
| rec3#(f,x,s1(y)) | → | app#(app(f,s1(y)),rec3(f,x,y)) | (9) |
| rec3#(f,x,s1(y)) | → | app#(f,s1(y)) | (10) |
| rec3#(f,x,s1(y)) | → | rec3#(f,x,y) | (11) |
| app#(rec2(x0,x1),y1) | → | rec3#(x0,x1,y1) | (12) |
| [rec3#(x1, x2, x3)] | = |
|
||||||||||||||||
| [s1(x1)] | = |
|
||||||||||||||||
| [app#(x1, x2)] | = |
|
||||||||||||||||
| [app(x1, x2)] | = |
|
||||||||||||||||
| [rec3(x1, x2, x3)] | = |
|
||||||||||||||||
| [rec2(x1, x2)] | = |
|
||||||||||||||||
| [rec] | = |
|
||||||||||||||||
| [rec1(x1)] | = |
|
||||||||||||||||
| [s] | = |
|
||||||||||||||||
| [0] | = |
|
| rec3#(f,x,s1(y)) | → | app#(f,s1(y)) | (10) |
| rec3#(rec,y1,s1(y2)) | → | app#(rec1(s1(y2)),rec3(rec,y1,y2)) | (13) |
| rec3#(rec1(x0),y1,s1(y2)) | → | app#(rec2(x0,s1(y2)),rec3(rec1(x0),y1,y2)) | (14) |
| rec3#(rec2(x0,x1),y1,s1(y2)) | → | app#(rec3(x0,x1,s1(y2)),rec3(rec2(x0,x1),y1,y2)) | (15) |
| rec3#(s,y1,s1(y2)) | → | app#(s1(s1(y2)),rec3(s,y1,y2)) | (16) |
The dependency pairs are split into 1 component.
| rec3#(f,x,s1(y)) | → | rec3#(f,x,y) | (11) |
| rec3#(rec1(x0),y1,s1(y2)) | → | app#(rec2(x0,s1(y2)),rec3(rec1(x0),y1,y2)) | (14) |
| app#(rec2(x0,x1),y1) | → | rec3#(x0,x1,y1) | (12) |
| rec3#(rec2(x0,x1),y1,s1(y2)) | → | app#(rec3(x0,x1,s1(y2)),rec3(rec2(x0,x1),y1,y2)) | (15) |
| → |
| rec3#(x0,x1,s1(s1(y_2))) | → | rec3#(x0,x1,s1(y_2)) | (18) |
| rec3#(rec1(y_0),x1,s1(s1(y_2))) | → | rec3#(rec1(y_0),x1,s1(y_2)) | (19) |
| rec3#(rec2(y_0,y_1),x1,s1(s1(y_3))) | → | rec3#(rec2(y_0,y_1),x1,s1(y_3)) | (20) |
| app#(rec2(rec1(y_0),x1),s1(y_2)) | → | rec3#(rec1(y_0),x1,s1(y_2)) | (21) |
| app#(rec2(rec2(y_0,y_1),x1),s1(y_3)) | → | rec3#(rec2(y_0,y_1),x1,s1(y_3)) | (22) |
| app#(rec2(x0,x1),s1(s1(y_2))) | → | rec3#(x0,x1,s1(s1(y_2))) | (23) |
| app#(rec2(rec1(y_0),x1),s1(s1(y_2))) | → | rec3#(rec1(y_0),x1,s1(s1(y_2))) | (24) |
| app#(rec2(rec2(y_0,y_1),x1),s1(s1(y_3))) | → | rec3#(rec2(y_0,y_1),x1,s1(s1(y_3))) | (25) |
| rec3#(rec1(y0),x1,s1(0)) | → | app#(rec2(y0,s1(0)),x1) | (26) |
| rec3#(rec1(y0),x1,s1(s1(x2))) | → | app#(rec2(y0,s1(s1(x2))),app(app(rec1(y0),s1(x2)),rec3(rec1(y0),x1,x2))) | (27) |
| → |
| → |
| rec3#(rec2(y0,y1),x1,s1(0)) | → | app#(app(app(y0,s1(0)),rec3(y0,y1,0)),x1) | (30) |
| rec3#(rec2(y0,y1),x1,s1(s1(x2))) | → | app#(app(app(y0,s1(s1(x2))),rec3(y0,y1,s1(x2))),app(app(rec2(y0,y1),s1(x2)),rec3(rec2(y0,y1),x1,x2))) | (31) |
| → |
| → |
| → |
| → |
| rec3#(rec1(rec1(y_0)),s1(y_2),s1(0)) | → | app#(rec2(rec1(y_0),s1(0)),s1(y_2)) | (36) |
| rec3#(rec1(rec2(y_0,y_1)),s1(y_3),s1(0)) | → | app#(rec2(rec2(y_0,y_1),s1(0)),s1(y_3)) | (37) |
| rec3#(rec1(x0),s1(s1(y_2)),s1(0)) | → | app#(rec2(x0,s1(0)),s1(s1(y_2))) | (38) |
| rec3#(rec1(rec1(y_0)),s1(s1(y_2)),s1(0)) | → | app#(rec2(rec1(y_0),s1(0)),s1(s1(y_2))) | (39) |
| rec3#(rec1(rec2(y_0,y_1)),s1(s1(y_3)),s1(0)) | → | app#(rec2(rec2(y_0,y_1),s1(0)),s1(s1(y_3))) | (40) |
| [rec3#(x1, x2, x3)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [s1(x1)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec1(x1)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec2(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [app#(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec3(x1, x2, x3)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [0] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [app(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [s] | = |
|
| rec3#(rec1(rec2(y_0,y_1)),s1(y_3),s1(0)) | → | app#(rec2(rec2(y_0,y_1),s1(0)),s1(y_3)) | (37) |
| rec3#(rec1(rec2(y_0,y_1)),s1(s1(y_3)),s1(0)) | → | app#(rec2(rec2(y_0,y_1),s1(0)),s1(s1(y_3))) | (40) |
| [rec3#(x1, x2, x3)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [s1(x1)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec1(x1)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec2(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [app#(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec3(x1, x2, x3)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [0] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [app(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [s] | = |
|
| app#(rec2(rec2(y_0,y_1),x1),s1(y_3)) | → | rec3#(rec2(y_0,y_1),x1,s1(y_3)) | (22) |
| app#(rec2(rec2(y_0,y_1),x1),s1(s1(y_3))) | → | rec3#(rec2(y_0,y_1),x1,s1(s1(y_3))) | (25) |
| [rec3#(x1, x2, x3)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [s1(x1)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec1(x1)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec2(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [app#(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec3(x1, x2, x3)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [0] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [app(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [s] | = |
|
| rec3#(rec2(y0,y1),x1,s1(0)) | → | app#(app(app(y0,s1(0)),y1),x1) | (32) |
| [rec3#(x1, x2, x3)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [s1(x1)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec1(x1)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec2(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [app#(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec3(x1, x2, x3)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [app(x1, x2)] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [0] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [rec] | = |
|
||||||||||||||||||||||||||||||||||||||||||
| [s] | = |
|
| rec3#(rec2(y0,y1),x1,s1(s1(x2))) | → | app#(app(app(y0,s1(s1(x2))),app(app(y0,s1(x2)),rec3(y0,y1,x2))),app(app(app(y0,s1(x2)),rec3(y0,y1,x2)),rec3(rec2(y0,y1),x1,x2))) | (35) |
| prec(rec1) | = | 1 | weight(rec1) | = | 1 |
| π(rec3#) | = | 1 |
| π(rec1) | = | [1] |
| π(rec2) | = | 1 |
| π(app#) | = | 1 |
| rec3#(rec1(y0),x1,s1(s1(x2))) | → | app#(rec2(y0,s1(s1(x2))),rec3(y0,s1(x2),rec3(rec1(y0),x1,x2))) | (29) |
| rec3#(rec1(rec1(y_0)),s1(y_2),s1(0)) | → | app#(rec2(rec1(y_0),s1(0)),s1(y_2)) | (36) |
| rec3#(rec1(x0),s1(s1(y_2)),s1(0)) | → | app#(rec2(x0,s1(0)),s1(s1(y_2))) | (38) |
| rec3#(rec1(rec1(y_0)),s1(s1(y_2)),s1(0)) | → | app#(rec2(rec1(y_0),s1(0)),s1(s1(y_2))) | (39) |
The dependency pairs are split into 1 component.
| rec3#(x0,x1,s1(s1(y_2))) | → | rec3#(x0,x1,s1(y_2)) | (18) |
| rec3#(rec1(y_0),x1,s1(s1(y_2))) | → | rec3#(rec1(y_0),x1,s1(y_2)) | (19) |
| rec3#(rec2(y_0,y_1),x1,s1(s1(y_3))) | → | rec3#(rec2(y_0,y_1),x1,s1(y_3)) | (20) |
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.
Using size-change termination in combination with the subterm criterion one obtains the following initial size-change graphs.
| rec3#(rec2(y_0,y_1),x1,s1(s1(y_3))) | → | rec3#(rec2(y_0,y_1),x1,s1(y_3)) | (20) |
| 1 | ≥ | 1 | |
| 2 | ≥ | 2 | |
| 3 | > | 3 | |
| rec3#(x0,x1,s1(s1(y_2))) | → | rec3#(x0,x1,s1(y_2)) | (18) |
| 1 | ≥ | 1 | |
| 2 | ≥ | 2 | |
| 3 | > | 3 | |
| rec3#(rec1(y_0),x1,s1(s1(y_2))) | → | rec3#(rec1(y_0),x1,s1(y_2)) | (19) |
| 1 | ≥ | 1 | |
| 2 | ≥ | 2 | |
| 3 | > | 3 |
As there is no critical graph in the transitive closure, there are no infinite chains.