(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 CpxTRS 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(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

(3) CdtPolyRedPairProof (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:

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)
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   

(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:

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

(5) CdtPolyRedPairProof (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:

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)
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   

(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), 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

(7) CdtKnowledgeProof (EQUIVALENT 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))

(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:

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

(9) CdtPolyRedPairProof (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:

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)
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   

(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: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

(11) SIsEmptyProof (EQUIVALENT transformation)

The set S is empty

(12) BOUNDS(O(1), O(1))