The rewrite relation of the following TRS is considered.
p(0) | → | 0 | (1) |
p(s(x)) | → | x | (2) |
plus(x,0) | → | x | (3) |
plus(0,y) | → | y | (4) |
plus(s(x),y) | → | s(plus(x,y)) | (5) |
plus(s(x),y) | → | s(plus(p(s(x)),y)) | (6) |
plus(x,s(y)) | → | s(plus(x,p(s(y)))) | (7) |
times(0,y) | → | 0 | (8) |
times(s(0),y) | → | y | (9) |
times(s(x),y) | → | plus(y,times(x,y)) | (10) |
div(0,y) | → | 0 | (11) |
div(x,y) | → | quot(x,y,y) | (12) |
quot(zero(y),s(y),z) | → | 0 | (13) |
quot(s(x),s(y),z) | → | quot(x,y,z) | (14) |
quot(x,0,s(z)) | → | s(div(x,s(z))) | (15) |
div(div(x,y),z) | → | div(x,times(zero(y),z)) | (16) |
eq(0,0) | → | true | (17) |
eq(s(x),0) | → | false | (18) |
eq(0,s(y)) | → | false | (19) |
eq(s(x),s(y)) | → | eq(x,y) | (20) |
divides(y,x) | → | eq(x,times(div(x,y),y)) | (21) |
prime(s(s(x))) | → | pr(s(s(x)),s(x)) | (22) |
pr(x,s(0)) | → | true | (23) |
pr(x,s(s(y))) | → | if(divides(s(s(y)),x),x,s(y)) | (24) |
if(true,x,y) | → | false | (25) |
if(false,x,y) | → | pr(x,y) | (26) |
zero(div(x,x)) | → | x | (27) |
zero(divides(x,x)) | → | x | (28) |
zero(times(x,x)) | → | x | (29) |
zero(quot(x,x,x)) | → | x | (30) |
zero(s(x)) | → | if(eq(x,s(0)),plus(zero(0),0),s(plus(0,zero(0)))) | (31) |
plus#(s(x),y) | → | plus#(x,y) | (32) |
plus#(s(x),y) | → | plus#(p(s(x)),y) | (33) |
plus#(s(x),y) | → | p#(s(x)) | (34) |
plus#(x,s(y)) | → | plus#(x,p(s(y))) | (35) |
plus#(x,s(y)) | → | p#(s(y)) | (36) |
times#(s(x),y) | → | plus#(y,times(x,y)) | (37) |
times#(s(x),y) | → | times#(x,y) | (38) |
div#(x,y) | → | quot#(x,y,y) | (39) |
quot#(s(x),s(y),z) | → | quot#(x,y,z) | (40) |
quot#(x,0,s(z)) | → | div#(x,s(z)) | (41) |
div#(div(x,y),z) | → | div#(x,times(zero(y),z)) | (42) |
div#(div(x,y),z) | → | times#(zero(y),z) | (43) |
div#(div(x,y),z) | → | zero#(y) | (44) |
eq#(s(x),s(y)) | → | eq#(x,y) | (45) |
divides#(y,x) | → | eq#(x,times(div(x,y),y)) | (46) |
divides#(y,x) | → | times#(div(x,y),y) | (47) |
divides#(y,x) | → | div#(x,y) | (48) |
prime#(s(s(x))) | → | pr#(s(s(x)),s(x)) | (49) |
pr#(x,s(s(y))) | → | if#(divides(s(s(y)),x),x,s(y)) | (50) |
pr#(x,s(s(y))) | → | divides#(s(s(y)),x) | (51) |
if#(false,x,y) | → | pr#(x,y) | (52) |
zero#(s(x)) | → | if#(eq(x,s(0)),plus(zero(0),0),s(plus(0,zero(0)))) | (53) |
zero#(s(x)) | → | eq#(x,s(0)) | (54) |
zero#(s(x)) | → | plus#(zero(0),0) | (55) |
zero#(s(x)) | → | zero#(0) | (56) |
zero#(s(x)) | → | plus#(0,zero(0)) | (57) |
The dependency pairs are split into 4 components.
div#(x,y) | → | quot#(x,y,y) | (39) |
quot#(s(x),s(y),z) | → | quot#(x,y,z) | (40) |
quot#(x,0,s(z)) | → | div#(x,s(z)) | (41) |
div#(div(x,y),z) | → | div#(x,times(zero(y),z)) | (42) |
div#(div(x,y),z) | → | zero#(y) | (44) |
zero#(s(x)) | → | if#(eq(x,s(0)),plus(zero(0),0),s(plus(0,zero(0)))) | (53) |
if#(false,x,y) | → | pr#(x,y) | (52) |
pr#(x,s(s(y))) | → | if#(divides(s(s(y)),x),x,s(y)) | (50) |
pr#(x,s(s(y))) | → | divides#(s(s(y)),x) | (51) |
divides#(y,x) | → | div#(x,y) | (48) |
[div#(x1, x2)] | = | x1 |
[times(x1, x2)] | = | -2 |
[if#(x1, x2, x3)] | = | -1 + x1 + x2 |
[div(x1, x2)] | = | 2 + x1 |
[zero(x1)] | = | 2 |
[divides(x1, x2)] | = | 1 |
[quot(x1, x2, x3)] | = | 2 + x1 |
[s(x1)] | = | x1 |
[if(x1, x2, x3)] | = | -1 + 2 · x1 |
[eq(x1, x2)] | = | 1 |
[0] | = | 0 |
[plus(x1, x2)] | = | x1 |
[false] | = | 1 |
[true] | = | 1 |
[pr(x1, x2)] | = | 1 |
[p(x1)] | = | -2 |
[quot#(x1, x2, x3)] | = | x1 |
[zero#(x1)] | = | 2 |
[pr#(x1, x2)] | = | x1 |
[divides#(x1, x2)] | = | x2 |
zero(s(x)) | → | if(eq(x,s(0)),plus(zero(0),0),s(plus(0,zero(0)))) | (31) |
eq(0,s(y)) | → | false | (19) |
eq(s(x),s(y)) | → | eq(x,y) | (20) |
plus(x,0) | → | x | (3) |
divides(y,x) | → | eq(x,times(div(x,y),y)) | (21) |
if(true,x,y) | → | false | (25) |
pr(x,s(s(y))) | → | if(divides(s(s(y)),x),x,s(y)) | (24) |
if(false,x,y) | → | pr(x,y) | (26) |
pr(x,s(0)) | → | true | (23) |
div(0,y) | → | 0 | (11) |
eq(0,0) | → | true | (17) |
eq(s(x),0) | → | false | (18) |
div(x,y) | → | quot(x,y,y) | (12) |
quot(zero(y),s(y),z) | → | 0 | (13) |
quot(s(x),s(y),z) | → | quot(x,y,z) | (14) |
quot(x,0,s(z)) | → | s(div(x,s(z))) | (15) |
div(div(x,y),z) | → | div(x,times(zero(y),z)) | (16) |
div#(div(x,y),z) | → | div#(x,times(zero(y),z)) | (42) |
[if#(x1, x2, x3)] | = | 2 · x2 + x3 |
[eq(x1, x2)] | = | 2 + 2 · x2 |
[0] | = | 0 |
[s(x1)] | = | 2 + 2 · x1 |
[false] | = | 0 |
[div(x1, x2)] | = | 2 + x2 |
[if(x1, x2, x3)] | = | x3 |
[plus(x1, x2)] | = | x1 + 2 · x2 |
[divides(x1, x2)] | = | -2 + x2 |
[times(x1, x2)] | = | 2 + 2 · x1 + 2 · x2 |
[zero(x1)] | = | -2 + 2 · x1 |
[true] | = | 1 |
[pr(x1, x2)] | = | 1 + 2 · x1 |
[quot(x1, x2, x3)] | = | x2 + 2 · x3 |
[p(x1)] | = | -2 |
[div#(x1, x2)] | = | 2 · x1 |
[quot#(x1, x2, x3)] | = | 2 · x1 |
[zero#(x1)] | = | 2 · x1 |
[pr#(x1, x2)] | = | 2 · x1 + x2 |
[divides#(x1, x2)] | = | x1 + 2 · x2 |
plus(x,0) | → | x | (3) |
plus(0,y) | → | y | (4) |
quot#(s(x),s(y),z) | → | quot#(x,y,z) | (40) |
div#(div(x,y),z) | → | zero#(y) | (44) |
zero#(s(x)) | → | if#(eq(x,s(0)),plus(zero(0),0),s(plus(0,zero(0)))) | (53) |
pr#(x,s(s(y))) | → | if#(divides(s(s(y)),x),x,s(y)) | (50) |
The dependency pairs are split into 1 component.
quot#(x,0,s(z)) | → | div#(x,s(z)) | (41) |
div#(x,y) | → | quot#(x,y,y) | (39) |
prec(0) | = | 1 | weight(0) | = | 2 | ||||
prec(s) | = | 0 | weight(s) | = | 1 |
π(quot#) | = | 2 |
π(0) | = | [] |
π(div#) | = | 2 |
π(s) | = | [] |
quot#(x,0,s(z)) | → | div#(x,s(z)) | (41) |
Using size-change termination in combination with the subterm criterion one obtains the following initial size-change graphs.
div#(x,y) | → | quot#(x,y,y) | (39) |
1 | ≥ | 1 | |
2 | ≥ | 2 | |
2 | ≥ | 3 |
As there is no critical graph in the transitive closure, there are no infinite chains.
times#(s(x),y) | → | times#(x,y) | (38) |
[s(x1)] | = | 1 · x1 |
[times#(x1, x2)] | = | 1 · x1 + 1 · x2 |
Using size-change termination in combination with the subterm criterion one obtains the following initial size-change graphs.
times#(s(x),y) | → | times#(x,y) | (38) |
1 | > | 1 | |
2 | ≥ | 2 |
As there is no critical graph in the transitive closure, there are no infinite chains.
plus#(s(x),y) | → | plus#(p(s(x)),y) | (33) |
plus#(s(x),y) | → | plus#(x,y) | (32) |
plus#(x,s(y)) | → | plus#(x,p(s(y))) | (35) |
[p(x1)] | = | 1 · x1 |
[s(x1)] | = | 1 · x1 |
[plus#(x1, x2)] | = | 1 · x1 + 1 · x2 |
p(s(x)) | → | x | (2) |
20
Hence, it suffices to show innermost termination in the following.[p(x1)] | = | 1 · x1 |
[s(x1)] | = | 1 + 2 · x1 |
[plus#(x1, x2)] | = | 1 · x1 + 1 · x2 |
plus#(s(x),y) | → | plus#(x,y) | (32) |
p(s(x)) | → | x | (2) |
The dependency pairs are split into 0 components.
eq#(s(x),s(y)) | → | eq#(x,y) | (45) |
[s(x1)] | = | 1 · x1 |
[eq#(x1, x2)] | = | 1 · x1 + 1 · x2 |
Using size-change termination in combination with the subterm criterion one obtains the following initial size-change graphs.
eq#(s(x),s(y)) | → | eq#(x,y) | (45) |
1 | > | 1 | |
2 | > | 2 |
As there is no critical graph in the transitive closure, there are no infinite chains.