Term Rewriting System R:
[x, y, v, w, z]
sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

Termination of R to be shown.

R
Dependency Pair Analysis

R contains the following Dependency Pairs:

SORT(cons(x, y)) -> INSERT(x, sort(y))
SORT(cons(x, y)) -> SORT(y)
INSERT(x, cons(v, w)) -> CHOOSE(x, cons(v, w), x, v)
CHOOSE(x, cons(v, w), 0, s(z)) -> INSERT(x, w)
CHOOSE(x, cons(v, w), s(y), s(z)) -> CHOOSE(x, cons(v, w), y, z)

Furthermore, R contains two SCCs.

R
DPs
→DP Problem 1
Polynomial Ordering
→DP Problem 2
Polo

Dependency Pairs:

CHOOSE(x, cons(v, w), s(y), s(z)) -> CHOOSE(x, cons(v, w), y, z)
CHOOSE(x, cons(v, w), 0, s(z)) -> INSERT(x, w)
INSERT(x, cons(v, w)) -> CHOOSE(x, cons(v, w), x, v)

Rules:

sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

The following dependency pair can be strictly oriented:

CHOOSE(x, cons(v, w), 0, s(z)) -> INSERT(x, w)

Additionally, the following rules can be oriented:

sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

Used ordering: Polynomial ordering with Polynomial interpretation:
 POL(CHOOSE(x1, x2, x3, x4)) =  x2 POL(0) =  0 POL(cons(x1, x2)) =  1 + x2 POL(INSERT(x1, x2)) =  x2 POL(nil) =  0 POL(s(x1)) =  0 POL(sort(x1)) =  x1 POL(insert(x1, x2)) =  1 + x2 POL(choose(x1, x2, x3, x4)) =  1 + x2

resulting in one new DP problem.

R
DPs
→DP Problem 1
Polo
→DP Problem 3
Dependency Graph
→DP Problem 2
Polo

Dependency Pairs:

CHOOSE(x, cons(v, w), s(y), s(z)) -> CHOOSE(x, cons(v, w), y, z)
INSERT(x, cons(v, w)) -> CHOOSE(x, cons(v, w), x, v)

Rules:

sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

Using the Dependency Graph the DP problem was split into 1 DP problems.

R
DPs
→DP Problem 1
Polo
→DP Problem 3
DGraph
...
→DP Problem 4
Polynomial Ordering
→DP Problem 2
Polo

Dependency Pair:

CHOOSE(x, cons(v, w), s(y), s(z)) -> CHOOSE(x, cons(v, w), y, z)

Rules:

sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

The following dependency pair can be strictly oriented:

CHOOSE(x, cons(v, w), s(y), s(z)) -> CHOOSE(x, cons(v, w), y, z)

Additionally, the following rules can be oriented:

sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

Used ordering: Polynomial ordering with Polynomial interpretation:
 POL(CHOOSE(x1, x2, x3, x4)) =  x3 POL(0) =  0 POL(cons(x1, x2)) =  0 POL(nil) =  0 POL(s(x1)) =  1 + x1 POL(sort(x1)) =  0 POL(insert(x1, x2)) =  0 POL(choose(x1, x2, x3, x4)) =  0

resulting in one new DP problem.

R
DPs
→DP Problem 1
Polo
→DP Problem 3
DGraph
...
→DP Problem 5
Dependency Graph
→DP Problem 2
Polo

Dependency Pair:

Rules:

sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

Using the Dependency Graph resulted in no new DP problems.

R
DPs
→DP Problem 1
Polo
→DP Problem 2
Polynomial Ordering

Dependency Pair:

SORT(cons(x, y)) -> SORT(y)

Rules:

sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

The following dependency pair can be strictly oriented:

SORT(cons(x, y)) -> SORT(y)

Additionally, the following rules can be oriented:

sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

Used ordering: Polynomial ordering with Polynomial interpretation:
 POL(0) =  0 POL(cons(x1, x2)) =  1 + x2 POL(nil) =  0 POL(s(x1)) =  0 POL(sort(x1)) =  x1 POL(insert(x1, x2)) =  1 + x2 POL(choose(x1, x2, x3, x4)) =  1 + x2 POL(SORT(x1)) =  1 + x1

resulting in one new DP problem.

R
DPs
→DP Problem 1
Polo
→DP Problem 2
Polo
→DP Problem 6
Dependency Graph

Dependency Pair:

Rules:

sort(nil) -> nil
sort(cons(x, y)) -> insert(x, sort(y))
insert(x, nil) -> cons(x, nil)
insert(x, cons(v, w)) -> choose(x, cons(v, w), x, v)
choose(x, cons(v, w), y, 0) -> cons(x, cons(v, w))
choose(x, cons(v, w), 0, s(z)) -> cons(v, insert(x, w))
choose(x, cons(v, w), s(y), s(z)) -> choose(x, cons(v, w), y, z)

Using the Dependency Graph resulted in no new DP problems.

Termination of R successfully shown.
Duration:
0:00 minutes