The rewrite relation of the following TRS is considered.
isEmpty(cons(x,xs)) |
→ |
false |
(1) |
isEmpty(nil) |
→ |
true |
(2) |
isZero(0) |
→ |
true |
(3) |
isZero(s(x)) |
→ |
false |
(4) |
head(cons(x,xs)) |
→ |
x |
(5) |
tail(cons(x,xs)) |
→ |
xs |
(6) |
tail(nil) |
→ |
nil |
(7) |
append(nil,x) |
→ |
cons(x,nil) |
(8) |
append(cons(y,ys),x) |
→ |
cons(y,append(ys,x)) |
(9) |
p(s(s(x))) |
→ |
s(p(s(x))) |
(10) |
p(s(0)) |
→ |
0 |
(11) |
p(0) |
→ |
0 |
(12) |
inc(s(x)) |
→ |
s(inc(x)) |
(13) |
inc(0) |
→ |
s(0) |
(14) |
addLists(xs,ys,zs) |
→ |
if(isEmpty(xs),isEmpty(ys),isZero(head(xs)),tail(xs),tail(ys),cons(p(head(xs)),tail(xs)),cons(inc(head(ys)),tail(ys)),zs,append(zs,head(ys))) |
(15) |
if(true,true,b,xs,ys,xs2,ys2,zs,zs2) |
→ |
zs |
(16) |
if(true,false,b,xs,ys,xs2,ys2,zs,zs2) |
→ |
differentLengthError |
(17) |
if(false,true,b,xs,ys,xs2,ys2,zs,zs2) |
→ |
differentLengthError |
(18) |
if(false,false,false,xs,ys,xs2,ys2,zs,zs2) |
→ |
addLists(xs2,ys2,zs) |
(19) |
if(false,false,true,xs,ys,xs2,ys2,zs,zs2) |
→ |
addLists(xs,ys,zs2) |
(20) |
addList(xs,ys) |
→ |
addLists(xs,ys,nil) |
(21) |
Hence, it suffices to show innermost termination in the following.
append#(cons(y,ys),x) |
→ |
append#(ys,x) |
(22) |
p#(s(s(x))) |
→ |
p#(s(x)) |
(23) |
inc#(s(x)) |
→ |
inc#(x) |
(24) |
addLists#(xs,ys,zs) |
→ |
if#(isEmpty(xs),isEmpty(ys),isZero(head(xs)),tail(xs),tail(ys),cons(p(head(xs)),tail(xs)),cons(inc(head(ys)),tail(ys)),zs,append(zs,head(ys))) |
(25) |
addLists#(xs,ys,zs) |
→ |
isEmpty#(xs) |
(26) |
addLists#(xs,ys,zs) |
→ |
isEmpty#(ys) |
(27) |
addLists#(xs,ys,zs) |
→ |
isZero#(head(xs)) |
(28) |
addLists#(xs,ys,zs) |
→ |
head#(xs) |
(29) |
addLists#(xs,ys,zs) |
→ |
tail#(xs) |
(30) |
addLists#(xs,ys,zs) |
→ |
tail#(ys) |
(31) |
addLists#(xs,ys,zs) |
→ |
p#(head(xs)) |
(32) |
addLists#(xs,ys,zs) |
→ |
inc#(head(ys)) |
(33) |
addLists#(xs,ys,zs) |
→ |
head#(ys) |
(34) |
addLists#(xs,ys,zs) |
→ |
append#(zs,head(ys)) |
(35) |
if#(false,false,false,xs,ys,xs2,ys2,zs,zs2) |
→ |
addLists#(xs2,ys2,zs) |
(36) |
if#(false,false,true,xs,ys,xs2,ys2,zs,zs2) |
→ |
addLists#(xs,ys,zs2) |
(37) |
addList#(xs,ys) |
→ |
addLists#(xs,ys,nil) |
(38) |
The dependency pairs are split into 4
components.
-
The
1st
component contains the
pair
addLists#(xs,ys,zs) |
→ |
if#(isEmpty(xs),isEmpty(ys),isZero(head(xs)),tail(xs),tail(ys),cons(p(head(xs)),tail(xs)),cons(inc(head(ys)),tail(ys)),zs,append(zs,head(ys))) |
(25) |
if#(false,false,false,xs,ys,xs2,ys2,zs,zs2) |
→ |
addLists#(xs2,ys2,zs) |
(36) |
if#(false,false,true,xs,ys,xs2,ys2,zs,zs2) |
→ |
addLists#(xs,ys,zs2) |
(37) |
1.1.1.1 Usable Rules Processor
We restrict the rewrite rules to the following usable rules of the DP problem.
isEmpty(cons(x,xs)) |
→ |
false |
(1) |
isEmpty(nil) |
→ |
true |
(2) |
head(cons(x,xs)) |
→ |
x |
(5) |
isZero(0) |
→ |
true |
(3) |
isZero(s(x)) |
→ |
false |
(4) |
tail(cons(x,xs)) |
→ |
xs |
(6) |
tail(nil) |
→ |
nil |
(7) |
p(s(s(x))) |
→ |
s(p(s(x))) |
(10) |
p(s(0)) |
→ |
0 |
(11) |
p(0) |
→ |
0 |
(12) |
inc(s(x)) |
→ |
s(inc(x)) |
(13) |
inc(0) |
→ |
s(0) |
(14) |
append(nil,x) |
→ |
cons(x,nil) |
(8) |
append(cons(y,ys),x) |
→ |
cons(y,append(ys,x)) |
(9) |
1.1.1.1.1 Innermost Lhss Removal Processor
We restrict the innermost strategy to the following left hand sides.
isEmpty(cons(x0,x1)) |
isEmpty(nil) |
isZero(0) |
isZero(s(x0)) |
head(cons(x0,x1)) |
tail(cons(x0,x1)) |
tail(nil) |
append(nil,x0) |
append(cons(x0,x1),x2) |
p(s(s(x0))) |
p(s(0)) |
p(0) |
inc(s(x0)) |
inc(0) |
1.1.1.1.1.1 Narrowing Processor
We consider all narrowings of the pair
below position
1
to get the following set of pairs
addLists#(cons(x0,x1),y1,y2) |
→ |
if#(false,isEmpty(y1),isZero(head(cons(x0,x1))),tail(cons(x0,x1)),tail(y1),cons(p(head(cons(x0,x1))),tail(cons(x0,x1))),cons(inc(head(y1)),tail(y1)),y2,append(y2,head(y1))) |
(39) |
addLists#(nil,y1,y2) |
→ |
if#(true,isEmpty(y1),isZero(head(nil)),tail(nil),tail(y1),cons(p(head(nil)),tail(nil)),cons(inc(head(y1)),tail(y1)),y2,append(y2,head(y1))) |
(40) |
1.1.1.1.1.1.1 Dependency Graph Processor
The dependency pairs are split into 1
component.
-
The
2nd
component contains the
pair
append#(cons(y,ys),x) |
→ |
append#(ys,x) |
(22) |
1.1.1.2 Usable Rules Processor
We restrict the rewrite rules to the following usable rules of the DP problem.
There are no rules.
1.1.1.2.1 Innermost Lhss Removal Processor
We restrict the innermost strategy to the following left hand sides.
There are no lhss.
1.1.1.2.1.1 Size-Change Termination
Using size-change termination in combination with
the subterm criterion
one obtains the following initial size-change graphs.
append#(cons(y,ys),x) |
→ |
append#(ys,x) |
(22) |
|
1 |
> |
1 |
2 |
≥ |
2 |
As there is no critical graph in the transitive closure, there are no infinite chains.
-
The
3rd
component contains the
pair
p#(s(s(x))) |
→ |
p#(s(x)) |
(23) |
1.1.1.3 Usable Rules Processor
We restrict the rewrite rules to the following usable rules of the DP problem.
There are no rules.
1.1.1.3.1 Innermost Lhss Removal Processor
We restrict the innermost strategy to the following left hand sides.
There are no lhss.
1.1.1.3.1.1 Size-Change Termination
Using size-change termination in combination with
the subterm criterion
one obtains the following initial size-change graphs.
p#(s(s(x))) |
→ |
p#(s(x)) |
(23) |
|
1 |
> |
1 |
As there is no critical graph in the transitive closure, there are no infinite chains.
-
The
4th
component contains the
pair
inc#(s(x)) |
→ |
inc#(x) |
(24) |
1.1.1.4 Usable Rules Processor
We restrict the rewrite rules to the following usable rules of the DP problem.
There are no rules.
1.1.1.4.1 Innermost Lhss Removal Processor
We restrict the innermost strategy to the following left hand sides.
There are no lhss.
1.1.1.4.1.1 Size-Change Termination
Using size-change termination in combination with
the subterm criterion
one obtains the following initial size-change graphs.
inc#(s(x)) |
→ |
inc#(x) |
(24) |
|
1 |
> |
1 |
As there is no critical graph in the transitive closure, there are no infinite chains.