Certification Problem
Input (TPDB TRS_Standard/SK90/2.42)
The rewrite relation of the following TRS is considered.
flatten(nil) |
→ |
nil |
(1) |
flatten(unit(x)) |
→ |
flatten(x) |
(2) |
flatten(++(x,y)) |
→ |
++(flatten(x),flatten(y)) |
(3) |
flatten(++(unit(x),y)) |
→ |
++(flatten(x),flatten(y)) |
(4) |
flatten(flatten(x)) |
→ |
flatten(x) |
(5) |
rev(nil) |
→ |
nil |
(6) |
rev(unit(x)) |
→ |
unit(x) |
(7) |
rev(++(x,y)) |
→ |
++(rev(y),rev(x)) |
(8) |
rev(rev(x)) |
→ |
x |
(9) |
++(x,nil) |
→ |
x |
(10) |
++(nil,y) |
→ |
y |
(11) |
++(++(x,y),z) |
→ |
++(x,++(y,z)) |
(12) |
Property / Task
Prove or disprove termination.Answer / Result
Yes.Proof (by AProVE @ termCOMP 2023)
1 Rule Removal
Using the
linear polynomial interpretation over the naturals
[flatten(x1)] |
= |
1 · x1
|
[nil] |
= |
2 |
[unit(x1)] |
= |
1 + 2 · x1
|
[++(x1, x2)] |
= |
1 · x1 + 1 · x2
|
[rev(x1)] |
= |
2 · x1
|
all of the following rules can be deleted.
flatten(unit(x)) |
→ |
flatten(x) |
(2) |
flatten(++(unit(x),y)) |
→ |
++(flatten(x),flatten(y)) |
(4) |
rev(nil) |
→ |
nil |
(6) |
rev(unit(x)) |
→ |
unit(x) |
(7) |
++(x,nil) |
→ |
x |
(10) |
++(nil,y) |
→ |
y |
(11) |
1.1 Rule Removal
Using the
linear polynomial interpretation over the naturals
[flatten(x1)] |
= |
2 · x1
|
[nil] |
= |
2 |
[++(x1, x2)] |
= |
1 + 1 · x1 + 1 · x2
|
[rev(x1)] |
= |
2 · x1
|
all of the following rules can be deleted.
flatten(nil) |
→ |
nil |
(1) |
flatten(++(x,y)) |
→ |
++(flatten(x),flatten(y)) |
(3) |
rev(++(x,y)) |
→ |
++(rev(y),rev(x)) |
(8) |
1.1.1 Rule Removal
Using the
Knuth Bendix order with w0 = 1 and the following precedence and weight functions
prec(flatten) |
= |
2 |
|
weight(flatten) |
= |
0 |
|
|
|
prec(rev) |
= |
0 |
|
weight(rev) |
= |
1 |
|
|
|
prec(++) |
= |
1 |
|
weight(++) |
= |
0 |
|
|
|
all of the following rules can be deleted.
flatten(flatten(x)) |
→ |
flatten(x) |
(5) |
rev(rev(x)) |
→ |
x |
(9) |
++(++(x,y),z) |
→ |
++(x,++(y,z)) |
(12) |
1.1.1.1 R is empty
There are no rules in the TRS. Hence, it is terminating.