(0) Obligation:

Runtime Complexity TRS:
The TRS R consists of the following 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)

Rewrite Strategy: INNERMOST

(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)

Converted Cpx (relative) TRS to CDT

(2) Obligation:

Complexity Dependency Tuples Problem
Rules:

sort(nil) → nil
sort(cons(z0, z1)) → insert(z0, sort(z1))
insert(z0, nil) → cons(z0, nil)
insert(z0, cons(z1, z2)) → choose(z0, cons(z1, z2), z0, z1)
choose(z0, cons(z1, z2), z3, 0) → cons(z0, cons(z1, z2))
choose(z0, cons(z1, z2), 0, s(z3)) → cons(z1, insert(z0, z2))
choose(z0, cons(z1, z2), s(z3), s(z4)) → choose(z0, cons(z1, z2), z3, z4)
Tuples:

SORT(nil) → c
SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, nil) → c2
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), z3, 0) → c4
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
S tuples:

SORT(nil) → c
SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, nil) → c2
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), z3, 0) → c4
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
K tuples:none
Defined Rule Symbols:

sort, insert, choose

Defined Pair Symbols:

SORT, INSERT, CHOOSE

Compound Symbols:

c, c1, c2, c3, c4, c5, c6

(3) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 3 trailing nodes:

SORT(nil) → c
CHOOSE(z0, cons(z1, z2), z3, 0) → c4
INSERT(z0, nil) → c2

(4) Obligation:

Complexity Dependency Tuples Problem
Rules:

sort(nil) → nil
sort(cons(z0, z1)) → insert(z0, sort(z1))
insert(z0, nil) → cons(z0, nil)
insert(z0, cons(z1, z2)) → choose(z0, cons(z1, z2), z0, z1)
choose(z0, cons(z1, z2), z3, 0) → cons(z0, cons(z1, z2))
choose(z0, cons(z1, z2), 0, s(z3)) → cons(z1, insert(z0, z2))
choose(z0, cons(z1, z2), s(z3), s(z4)) → choose(z0, cons(z1, z2), z3, z4)
Tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
S tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
K tuples:none
Defined Rule Symbols:

sort, insert, choose

Defined Pair Symbols:

SORT, INSERT, CHOOSE

Compound Symbols:

c1, c3, c5, c6

(5) CdtRuleRemovalProof (UPPER BOUND (ADD(O(n^1))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
We considered the (Usable) Rules:none
And the Tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = [4]
POL(CHOOSE(x1, x2, x3, x4)) = 0
POL(INSERT(x1, x2)) = 0
POL(SORT(x1)) = x1
POL(c1(x1, x2)) = x1 + x2
POL(c3(x1)) = x1
POL(c5(x1)) = x1
POL(c6(x1)) = x1
POL(choose(x1, x2, x3, x4)) = [2] + [4]x1 + [2]x4
POL(cons(x1, x2)) = [4] + x2
POL(insert(x1, x2)) = [3] + [3]x1
POL(nil) = [3]
POL(s(x1)) = [1]
POL(sort(x1)) = [2] + [3]x1

(6) Obligation:

Complexity Dependency Tuples Problem
Rules:

sort(nil) → nil
sort(cons(z0, z1)) → insert(z0, sort(z1))
insert(z0, nil) → cons(z0, nil)
insert(z0, cons(z1, z2)) → choose(z0, cons(z1, z2), z0, z1)
choose(z0, cons(z1, z2), z3, 0) → cons(z0, cons(z1, z2))
choose(z0, cons(z1, z2), 0, s(z3)) → cons(z1, insert(z0, z2))
choose(z0, cons(z1, z2), s(z3), s(z4)) → choose(z0, cons(z1, z2), z3, z4)
Tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
S tuples:

INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
K tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
Defined Rule Symbols:

sort, insert, choose

Defined Pair Symbols:

SORT, INSERT, CHOOSE

Compound Symbols:

c1, c3, c5, c6

(7) CdtRuleRemovalProof (UPPER BOUND (ADD(O(n^2))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
We considered the (Usable) Rules:

choose(z0, cons(z1, z2), z3, 0) → cons(z0, cons(z1, z2))
insert(z0, cons(z1, z2)) → choose(z0, cons(z1, z2), z0, z1)
choose(z0, cons(z1, z2), s(z3), s(z4)) → choose(z0, cons(z1, z2), z3, z4)
insert(z0, nil) → cons(z0, nil)
choose(z0, cons(z1, z2), 0, s(z3)) → cons(z1, insert(z0, z2))
sort(cons(z0, z1)) → insert(z0, sort(z1))
sort(nil) → nil
And the Tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = 0
POL(CHOOSE(x1, x2, x3, x4)) = [2]x2
POL(INSERT(x1, x2)) = [2]x2
POL(SORT(x1)) = [2]x12
POL(c1(x1, x2)) = x1 + x2
POL(c3(x1)) = x1
POL(c5(x1)) = x1
POL(c6(x1)) = x1
POL(choose(x1, x2, x3, x4)) = [2] + x2
POL(cons(x1, x2)) = [2] + x2
POL(insert(x1, x2)) = [2] + x2
POL(nil) = 0
POL(s(x1)) = 0
POL(sort(x1)) = x1

(8) Obligation:

Complexity Dependency Tuples Problem
Rules:

sort(nil) → nil
sort(cons(z0, z1)) → insert(z0, sort(z1))
insert(z0, nil) → cons(z0, nil)
insert(z0, cons(z1, z2)) → choose(z0, cons(z1, z2), z0, z1)
choose(z0, cons(z1, z2), z3, 0) → cons(z0, cons(z1, z2))
choose(z0, cons(z1, z2), 0, s(z3)) → cons(z1, insert(z0, z2))
choose(z0, cons(z1, z2), s(z3), s(z4)) → choose(z0, cons(z1, z2), z3, z4)
Tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
S tuples:

INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
K tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
Defined Rule Symbols:

sort, insert, choose

Defined Pair Symbols:

SORT, INSERT, CHOOSE

Compound Symbols:

c1, c3, c5, c6

(9) CdtKnowledgeProof (BOTH BOUNDS(ID, ID) transformation)

The following tuples could be moved from S to K by knowledge propagation:

INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))

(10) Obligation:

Complexity Dependency Tuples Problem
Rules:

sort(nil) → nil
sort(cons(z0, z1)) → insert(z0, sort(z1))
insert(z0, nil) → cons(z0, nil)
insert(z0, cons(z1, z2)) → choose(z0, cons(z1, z2), z0, z1)
choose(z0, cons(z1, z2), z3, 0) → cons(z0, cons(z1, z2))
choose(z0, cons(z1, z2), 0, s(z3)) → cons(z1, insert(z0, z2))
choose(z0, cons(z1, z2), s(z3), s(z4)) → choose(z0, cons(z1, z2), z3, z4)
Tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
S tuples:

CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
K tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
Defined Rule Symbols:

sort, insert, choose

Defined Pair Symbols:

SORT, INSERT, CHOOSE

Compound Symbols:

c1, c3, c5, c6

(11) CdtRuleRemovalProof (UPPER BOUND (ADD(O(n^2))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
We considered the (Usable) Rules:

choose(z0, cons(z1, z2), z3, 0) → cons(z0, cons(z1, z2))
insert(z0, cons(z1, z2)) → choose(z0, cons(z1, z2), z0, z1)
choose(z0, cons(z1, z2), s(z3), s(z4)) → choose(z0, cons(z1, z2), z3, z4)
insert(z0, nil) → cons(z0, nil)
choose(z0, cons(z1, z2), 0, s(z3)) → cons(z1, insert(z0, z2))
sort(cons(z0, z1)) → insert(z0, sort(z1))
sort(nil) → nil
And the Tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = 0
POL(CHOOSE(x1, x2, x3, x4)) = [1] + x3 + [2]x1·x2
POL(INSERT(x1, x2)) = [1] + x1 + [2]x1·x2
POL(SORT(x1)) = x12
POL(c1(x1, x2)) = x1 + x2
POL(c3(x1)) = x1
POL(c5(x1)) = x1
POL(c6(x1)) = x1
POL(choose(x1, x2, x3, x4)) = [1] + x1 + x2
POL(cons(x1, x2)) = [1] + x1 + x2
POL(insert(x1, x2)) = [1] + x1 + x2
POL(nil) = 0
POL(s(x1)) = [1] + x1
POL(sort(x1)) = x1

(12) Obligation:

Complexity Dependency Tuples Problem
Rules:

sort(nil) → nil
sort(cons(z0, z1)) → insert(z0, sort(z1))
insert(z0, nil) → cons(z0, nil)
insert(z0, cons(z1, z2)) → choose(z0, cons(z1, z2), z0, z1)
choose(z0, cons(z1, z2), z3, 0) → cons(z0, cons(z1, z2))
choose(z0, cons(z1, z2), 0, s(z3)) → cons(z1, insert(z0, z2))
choose(z0, cons(z1, z2), s(z3), s(z4)) → choose(z0, cons(z1, z2), z3, z4)
Tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
S tuples:none
K tuples:

SORT(cons(z0, z1)) → c1(INSERT(z0, sort(z1)), SORT(z1))
CHOOSE(z0, cons(z1, z2), 0, s(z3)) → c5(INSERT(z0, z2))
INSERT(z0, cons(z1, z2)) → c3(CHOOSE(z0, cons(z1, z2), z0, z1))
CHOOSE(z0, cons(z1, z2), s(z3), s(z4)) → c6(CHOOSE(z0, cons(z1, z2), z3, z4))
Defined Rule Symbols:

sort, insert, choose

Defined Pair Symbols:

SORT, INSERT, CHOOSE

Compound Symbols:

c1, c3, c5, c6

(13) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)

The set S is empty