(0) Obligation:

Runtime Complexity Relative TRS:
The TRS R consists of the following rules:

#less(@x, @y) → #cklt(#compare(@x, @y))
append(@l1, @l2) → append#1(@l1, @l2)
append#1(::(@x, @xs), @l2) → ::(@x, append(@xs, @l2))
append#1(nil, @l2) → @l2
flatten(@t) → flatten#1(@t)
flatten#1(leaf) → nil
flatten#1(node(@l, @t1, @t2)) → append(@l, append(flatten(@t1), flatten(@t2)))
flattensort(@t) → insertionsort(flatten(@t))
insert(@x, @l) → insert#1(@l, @x)
insert#1(::(@y, @ys), @x) → insert#2(#less(@y, @x), @x, @y, @ys)
insert#1(nil, @x) → ::(@x, nil)
insert#2(#false, @x, @y, @ys) → ::(@x, ::(@y, @ys))
insert#2(#true, @x, @y, @ys) → ::(@y, insert(@x, @ys))
insertionsort(@l) → insertionsort#1(@l)
insertionsort#1(::(@x, @xs)) → insert(@x, insertionsort(@xs))
insertionsort#1(nil) → nil

The (relative) TRS S consists of the following rules:

#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(@y)) → #GT
#compare(#0, #pos(@y)) → #LT
#compare(#0, #s(@y)) → #LT
#compare(#neg(@x), #0) → #LT
#compare(#neg(@x), #neg(@y)) → #compare(@y, @x)
#compare(#neg(@x), #pos(@y)) → #LT
#compare(#pos(@x), #0) → #GT
#compare(#pos(@x), #neg(@y)) → #GT
#compare(#pos(@x), #pos(@y)) → #compare(@x, @y)
#compare(#s(@x), #0) → #GT
#compare(#s(@x), #s(@y)) → #compare(@x, @y)

Rewrite Strategy: INNERMOST

(1) CpxTrsToCdtProof (UPPER BOUND(ID) transformation)

Converted Cpx (relative) TRS to CDT

(2) Obligation:

Complexity Dependency Tuples Problem
Rules:

#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
#less(z0, z1) → #cklt(#compare(z0, z1))
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
flattensort(z0) → insertionsort(flatten(z0))
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
Tuples:

#CKLT(#EQ) → c
#CKLT(#GT) → c1
#CKLT(#LT) → c2
#COMPARE(#0, #0) → c3
#COMPARE(#0, #neg(z0)) → c4
#COMPARE(#0, #pos(z0)) → c5
#COMPARE(#0, #s(z0)) → c6
#COMPARE(#neg(z0), #0) → c7
#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#neg(z0), #pos(z1)) → c9
#COMPARE(#pos(z0), #0) → c10
#COMPARE(#pos(z0), #neg(z1)) → c11
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #0) → c13
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
#LESS(z0, z1) → c15(#CKLT(#compare(z0, z1)), #COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
APPEND#1(nil, z0) → c18
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(leaf) → c20
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c22(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#1(nil, z0) → c25
INSERT#2(#false, z0, z1, z2) → c26
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT#1(nil) → c30
S tuples:

#LESS(z0, z1) → c15(#CKLT(#compare(z0, z1)), #COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
APPEND#1(nil, z0) → c18
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(leaf) → c20
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c22(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#1(nil, z0) → c25
INSERT#2(#false, z0, z1, z2) → c26
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT#1(nil) → c30
K tuples:none
Defined Rule Symbols:

#less, append, append#1, flatten, flatten#1, flattensort, insert, insert#1, insert#2, insertionsort, insertionsort#1, #cklt, #compare

Defined Pair Symbols:

#CKLT, #COMPARE, #LESS, APPEND, APPEND#1, FLATTEN, FLATTEN#1, FLATTENSORT, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1

Compound Symbols:

c, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30

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

Removed 17 trailing nodes:

#CKLT(#LT) → c2
APPEND#1(nil, z0) → c18
#COMPARE(#s(z0), #0) → c13
INSERTIONSORT#1(nil) → c30
#COMPARE(#neg(z0), #0) → c7
#COMPARE(#pos(z0), #0) → c10
#CKLT(#EQ) → c
#COMPARE(#0, #neg(z0)) → c4
#COMPARE(#0, #pos(z0)) → c5
#COMPARE(#0, #0) → c3
INSERT#2(#false, z0, z1, z2) → c26
#COMPARE(#neg(z0), #pos(z1)) → c9
#COMPARE(#pos(z0), #neg(z1)) → c11
FLATTEN#1(leaf) → c20
INSERT#1(nil, z0) → c25
#COMPARE(#0, #s(z0)) → c6
#CKLT(#GT) → c1

(4) Obligation:

Complexity Dependency Tuples Problem
Rules:

#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
#less(z0, z1) → #cklt(#compare(z0, z1))
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
flattensort(z0) → insertionsort(flatten(z0))
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
#LESS(z0, z1) → c15(#CKLT(#compare(z0, z1)), #COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c22(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
S tuples:

#LESS(z0, z1) → c15(#CKLT(#compare(z0, z1)), #COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c22(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
K tuples:none
Defined Rule Symbols:

#less, append, append#1, flatten, flatten#1, flattensort, insert, insert#1, insert#2, insertionsort, insertionsort#1, #cklt, #compare

Defined Pair Symbols:

#COMPARE, #LESS, APPEND, APPEND#1, FLATTEN, FLATTEN#1, FLATTENSORT, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1

Compound Symbols:

c8, c12, c14, c15, c16, c17, c19, c21, c22, c23, c24, c27, c28, c29

(5) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)

Removed 1 trailing tuple parts

(6) Obligation:

Complexity Dependency Tuples Problem
Rules:

#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
#less(z0, z1) → #cklt(#compare(z0, z1))
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
flattensort(z0) → insertionsort(flatten(z0))
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c22(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
S tuples:

APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c22(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
K tuples:none
Defined Rule Symbols:

#less, append, append#1, flatten, flatten#1, flattensort, insert, insert#1, insert#2, insertionsort, insertionsort#1, #cklt, #compare

Defined Pair Symbols:

#COMPARE, APPEND, APPEND#1, FLATTEN, FLATTEN#1, FLATTENSORT, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #LESS

Compound Symbols:

c8, c12, c14, c16, c17, c19, c21, c22, c23, c24, c27, c28, c29, c15

(7) CdtGraphSplitRhsProof (BOTH BOUNDS(ID, ID) transformation)

Split RHS of tuples not part of any SCC

(8) Obligation:

Complexity Dependency Tuples Problem
Rules:

#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
#less(z0, z1) → #cklt(#compare(z0, z1))
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
flattensort(z0) → insertionsort(flatten(z0))
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
FLATTENSORT(z0) → c(FLATTEN(z0))
S tuples:

APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
FLATTENSORT(z0) → c(FLATTEN(z0))
K tuples:none
Defined Rule Symbols:

#less, append, append#1, flatten, flatten#1, flattensort, insert, insert#1, insert#2, insertionsort, insertionsort#1, #cklt, #compare

Defined Pair Symbols:

#COMPARE, APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #LESS, FLATTENSORT

Compound Symbols:

c8, c12, c14, c16, c17, c19, c21, c23, c24, c27, c28, c29, c15, c

(9) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)

Removed 1 leading nodes:

FLATTENSORT(z0) → c(FLATTEN(z0))

(10) Obligation:

Complexity Dependency Tuples Problem
Rules:

#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
#less(z0, z1) → #cklt(#compare(z0, z1))
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
flattensort(z0) → insertionsort(flatten(z0))
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
S tuples:

APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
K tuples:none
Defined Rule Symbols:

#less, append, append#1, flatten, flatten#1, flattensort, insert, insert#1, insert#2, insertionsort, insertionsort#1, #cklt, #compare

Defined Pair Symbols:

#COMPARE, APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #LESS, FLATTENSORT

Compound Symbols:

c8, c12, c14, c16, c17, c19, c21, c23, c24, c27, c28, c29, c15, c

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

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

FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))

(12) Obligation:

Complexity Dependency Tuples Problem
Rules:

#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
#less(z0, z1) → #cklt(#compare(z0, z1))
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
flattensort(z0) → insertionsort(flatten(z0))
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
S tuples:

APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
K tuples:

FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
Defined Rule Symbols:

#less, append, append#1, flatten, flatten#1, flattensort, insert, insert#1, insert#2, insertionsort, insertionsort#1, #cklt, #compare

Defined Pair Symbols:

#COMPARE, APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #LESS, FLATTENSORT

Compound Symbols:

c8, c12, c14, c16, c17, c19, c21, c23, c24, c27, c28, c29, c15, c

(13) CdtUsableRulesProof (EQUIVALENT transformation)

The following rules are not usable and were removed:

flattensort(z0) → insertionsort(flatten(z0))

(14) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
#less(z0, z1) → #cklt(#compare(z0, z1))
#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
S tuples:

APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
K tuples:

FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
Defined Rule Symbols:

append, flatten, flatten#1, append#1, #less, #cklt, #compare, insertionsort, insertionsort#1, insert, insert#1, insert#2

Defined Pair Symbols:

#COMPARE, APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #LESS, FLATTENSORT

Compound Symbols:

c8, c12, c14, c16, c17, c19, c21, c23, c24, c27, c28, c29, c15, c

(15) CdtRuleRemovalProof (UPPER BOUND(ADD(n^1)) transformation)

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

FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
We considered the (Usable) Rules:none
And the Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(#0) = [2]   
POL(#COMPARE(x1, x2)) = 0   
POL(#EQ) = [2]   
POL(#GT) = [2]   
POL(#LESS(x1, x2)) = 0   
POL(#LT) = [2]   
POL(#cklt(x1)) = [5]   
POL(#compare(x1, x2)) = [2] + [4]x1 + [4]x2   
POL(#false) = [4]   
POL(#less(x1, x2)) = [2] + [4]x1 + [2]x2   
POL(#neg(x1)) = x1   
POL(#pos(x1)) = x1   
POL(#s(x1)) = [4] + x1   
POL(#true) = [2]   
POL(::(x1, x2)) = 0   
POL(APPEND(x1, x2)) = 0   
POL(APPEND#1(x1, x2)) = 0   
POL(FLATTEN(x1)) = [4] + [2]x1   
POL(FLATTEN#1(x1)) = [1] + [2]x1   
POL(FLATTENSORT(x1)) = 0   
POL(INSERT(x1, x2)) = 0   
POL(INSERT#1(x1, x2)) = 0   
POL(INSERT#2(x1, x2, x3, x4)) = 0   
POL(INSERTIONSORT(x1)) = 0   
POL(INSERTIONSORT#1(x1)) = 0   
POL(append(x1, x2)) = [2] + x2   
POL(append#1(x1, x2)) = x2   
POL(c(x1)) = x1   
POL(c12(x1)) = x1   
POL(c14(x1)) = x1   
POL(c15(x1)) = x1   
POL(c16(x1)) = x1   
POL(c17(x1)) = x1   
POL(c19(x1)) = x1   
POL(c21(x1, x2, x3, x4)) = x1 + x2 + x3 + x4   
POL(c23(x1)) = x1   
POL(c24(x1, x2)) = x1 + x2   
POL(c27(x1)) = x1   
POL(c28(x1)) = x1   
POL(c29(x1, x2)) = x1 + x2   
POL(c8(x1)) = x1   
POL(flatten(x1)) = 0   
POL(flatten#1(x1)) = [3] + [3]x1   
POL(insert(x1, x2)) = [4] + [2]x1 + x2   
POL(insert#1(x1, x2)) = [4] + [3]x1 + [2]x2   
POL(insert#2(x1, x2, x3, x4)) = [2] + [2]x1 + [2]x2 + [3]x3 + [5]x4   
POL(insertionsort(x1)) = 0   
POL(insertionsort#1(x1)) = [3] + [2]x1   
POL(leaf) = 0   
POL(nil) = 0   
POL(node(x1, x2, x3)) = [4] + x1 + x2 + x3   

(16) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
#less(z0, z1) → #cklt(#compare(z0, z1))
#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
S tuples:

APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
K tuples:

FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
Defined Rule Symbols:

append, flatten, flatten#1, append#1, #less, #cklt, #compare, insertionsort, insertionsort#1, insert, insert#1, insert#2

Defined Pair Symbols:

#COMPARE, APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #LESS, FLATTENSORT

Compound Symbols:

c8, c12, c14, c16, c17, c19, c21, c23, c24, c27, c28, c29, c15, c

(17) CdtRuleRemovalProof (UPPER BOUND(ADD(n^1)) transformation)

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

INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
We considered the (Usable) Rules:

flatten#1(leaf) → nil
flatten(z0) → flatten#1(z0)
append(z0, z1) → append#1(z0, z1)
append#1(nil, z0) → z0
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
And the Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(#0) = [3]   
POL(#COMPARE(x1, x2)) = 0   
POL(#EQ) = [3]   
POL(#GT) = [2]   
POL(#LESS(x1, x2)) = 0   
POL(#LT) = 0   
POL(#cklt(x1)) = [3]   
POL(#compare(x1, x2)) = 0   
POL(#false) = 0   
POL(#less(x1, x2)) = [2]x2   
POL(#neg(x1)) = [2]   
POL(#pos(x1)) = 0   
POL(#s(x1)) = [3]   
POL(#true) = 0   
POL(::(x1, x2)) = [2] + x2   
POL(APPEND(x1, x2)) = 0   
POL(APPEND#1(x1, x2)) = 0   
POL(FLATTEN(x1)) = [1] + [4]x1   
POL(FLATTEN#1(x1)) = [4]x1   
POL(FLATTENSORT(x1)) = [5] + [4]x1   
POL(INSERT(x1, x2)) = 0   
POL(INSERT#1(x1, x2)) = 0   
POL(INSERT#2(x1, x2, x3, x4)) = 0   
POL(INSERTIONSORT(x1)) = [2] + [4]x1   
POL(INSERTIONSORT#1(x1)) = [4]x1   
POL(append(x1, x2)) = x1 + x2   
POL(append#1(x1, x2)) = x1 + x2   
POL(c(x1)) = x1   
POL(c12(x1)) = x1   
POL(c14(x1)) = x1   
POL(c15(x1)) = x1   
POL(c16(x1)) = x1   
POL(c17(x1)) = x1   
POL(c19(x1)) = x1   
POL(c21(x1, x2, x3, x4)) = x1 + x2 + x3 + x4   
POL(c23(x1)) = x1   
POL(c24(x1, x2)) = x1 + x2   
POL(c27(x1)) = x1   
POL(c28(x1)) = x1   
POL(c29(x1, x2)) = x1 + x2   
POL(c8(x1)) = x1   
POL(flatten(x1)) = x1   
POL(flatten#1(x1)) = x1   
POL(insert(x1, x2)) = [2] + [3]x1   
POL(insert#1(x1, x2)) = [4] + [2]x1 + [3]x2   
POL(insert#2(x1, x2, x3, x4)) = [2] + [2]x1 + [5]x2 + [2]x3 + [2]x4   
POL(insertionsort(x1)) = 0   
POL(insertionsort#1(x1)) = [2] + [2]x1   
POL(leaf) = [1]   
POL(nil) = 0   
POL(node(x1, x2, x3)) = [1] + x1 + x2 + x3   

(18) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
#less(z0, z1) → #cklt(#compare(z0, z1))
#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
S tuples:

APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
K tuples:

FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
Defined Rule Symbols:

append, flatten, flatten#1, append#1, #less, #cklt, #compare, insertionsort, insertionsort#1, insert, insert#1, insert#2

Defined Pair Symbols:

#COMPARE, APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #LESS, FLATTENSORT

Compound Symbols:

c8, c12, c14, c16, c17, c19, c21, c23, c24, c27, c28, c29, c15, c

(19) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) transformation)

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

APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
We considered the (Usable) Rules:

flatten#1(leaf) → nil
flatten(z0) → flatten#1(z0)
append(z0, z1) → append#1(z0, z1)
append#1(nil, z0) → z0
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
And the Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(#0) = 0   
POL(#COMPARE(x1, x2)) = 0   
POL(#EQ) = 0   
POL(#GT) = 0   
POL(#LESS(x1, x2)) = 0   
POL(#LT) = 0   
POL(#cklt(x1)) = 0   
POL(#compare(x1, x2)) = 0   
POL(#false) = 0   
POL(#less(x1, x2)) = 0   
POL(#neg(x1)) = 0   
POL(#pos(x1)) = 0   
POL(#s(x1)) = 0   
POL(#true) = 0   
POL(::(x1, x2)) = [1] + x2   
POL(APPEND(x1, x2)) = [1] + [2]x1   
POL(APPEND#1(x1, x2)) = [2]x1   
POL(FLATTEN(x1)) = [2]x12   
POL(FLATTEN#1(x1)) = [2]x12   
POL(FLATTENSORT(x1)) = [2] + x1 + x12   
POL(INSERT(x1, x2)) = 0   
POL(INSERT#1(x1, x2)) = 0   
POL(INSERT#2(x1, x2, x3, x4)) = 0   
POL(INSERTIONSORT(x1)) = 0   
POL(INSERTIONSORT#1(x1)) = 0   
POL(append(x1, x2)) = x1 + x2   
POL(append#1(x1, x2)) = x1 + x2   
POL(c(x1)) = x1   
POL(c12(x1)) = x1   
POL(c14(x1)) = x1   
POL(c15(x1)) = x1   
POL(c16(x1)) = x1   
POL(c17(x1)) = x1   
POL(c19(x1)) = x1   
POL(c21(x1, x2, x3, x4)) = x1 + x2 + x3 + x4   
POL(c23(x1)) = x1   
POL(c24(x1, x2)) = x1 + x2   
POL(c27(x1)) = x1   
POL(c28(x1)) = x1   
POL(c29(x1, x2)) = x1 + x2   
POL(c8(x1)) = x1   
POL(flatten(x1)) = [2]x1   
POL(flatten#1(x1)) = [2]x1   
POL(insert(x1, x2)) = 0   
POL(insert#1(x1, x2)) = 0   
POL(insert#2(x1, x2, x3, x4)) = 0   
POL(insertionsort(x1)) = 0   
POL(insertionsort#1(x1)) = 0   
POL(leaf) = 0   
POL(nil) = 0   
POL(node(x1, x2, x3)) = [1] + x1 + x2 + x3   

(20) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
#less(z0, z1) → #cklt(#compare(z0, z1))
#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
S tuples:

INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
K tuples:

FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
Defined Rule Symbols:

append, flatten, flatten#1, append#1, #less, #cklt, #compare, insertionsort, insertionsort#1, insert, insert#1, insert#2

Defined Pair Symbols:

#COMPARE, APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #LESS, FLATTENSORT

Compound Symbols:

c8, c12, c14, c16, c17, c19, c21, c23, c24, c27, c28, c29, c15, c

(21) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) transformation)

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

INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
We considered the (Usable) Rules:

flatten#1(leaf) → nil
flatten(z0) → flatten#1(z0)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
append(z0, z1) → append#1(z0, z1)
append#1(nil, z0) → z0
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
insertionsort#1(nil) → nil
insert(z0, z1) → insert#1(z1, z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insert#1(nil, z0) → ::(z0, nil)
insertionsort(z0) → insertionsort#1(z0)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
And the Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(#0) = 0   
POL(#COMPARE(x1, x2)) = 0   
POL(#EQ) = 0   
POL(#GT) = 0   
POL(#LESS(x1, x2)) = [1]   
POL(#LT) = 0   
POL(#cklt(x1)) = 0   
POL(#compare(x1, x2)) = 0   
POL(#false) = 0   
POL(#less(x1, x2)) = 0   
POL(#neg(x1)) = 0   
POL(#pos(x1)) = 0   
POL(#s(x1)) = 0   
POL(#true) = 0   
POL(::(x1, x2)) = [1] + x2   
POL(APPEND(x1, x2)) = 0   
POL(APPEND#1(x1, x2)) = 0   
POL(FLATTEN(x1)) = 0   
POL(FLATTEN#1(x1)) = 0   
POL(FLATTENSORT(x1)) = [2] + [3]x1 + x12   
POL(INSERT(x1, x2)) = [2]x2   
POL(INSERT#1(x1, x2)) = [2]x1   
POL(INSERT#2(x1, x2, x3, x4)) = [2]x4   
POL(INSERTIONSORT(x1)) = [1] + x12   
POL(INSERTIONSORT#1(x1)) = [1] + x12   
POL(append(x1, x2)) = x1 + x2   
POL(append#1(x1, x2)) = x1 + x2   
POL(c(x1)) = x1   
POL(c12(x1)) = x1   
POL(c14(x1)) = x1   
POL(c15(x1)) = x1   
POL(c16(x1)) = x1   
POL(c17(x1)) = x1   
POL(c19(x1)) = x1   
POL(c21(x1, x2, x3, x4)) = x1 + x2 + x3 + x4   
POL(c23(x1)) = x1   
POL(c24(x1, x2)) = x1 + x2   
POL(c27(x1)) = x1   
POL(c28(x1)) = x1   
POL(c29(x1, x2)) = x1 + x2   
POL(c8(x1)) = x1   
POL(flatten(x1)) = x1   
POL(flatten#1(x1)) = x1   
POL(insert(x1, x2)) = [1] + x2   
POL(insert#1(x1, x2)) = [1] + x1   
POL(insert#2(x1, x2, x3, x4)) = [2] + x4   
POL(insertionsort(x1)) = x1   
POL(insertionsort#1(x1)) = x1   
POL(leaf) = 0   
POL(nil) = 0   
POL(node(x1, x2, x3)) = x1 + x2 + x3   

(22) Obligation:

Complexity Dependency Tuples Problem
Rules:

append(z0, z1) → append#1(z0, z1)
flatten(z0) → flatten#1(z0)
flatten#1(leaf) → nil
flatten#1(node(z0, z1, z2)) → append(z0, append(flatten(z1), flatten(z2)))
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
#less(z0, z1) → #cklt(#compare(z0, z1))
#cklt(#EQ) → #false
#cklt(#GT) → #false
#cklt(#LT) → #true
#compare(#0, #0) → #EQ
#compare(#0, #neg(z0)) → #GT
#compare(#0, #pos(z0)) → #LT
#compare(#0, #s(z0)) → #LT
#compare(#neg(z0), #0) → #LT
#compare(#neg(z0), #neg(z1)) → #compare(z1, z0)
#compare(#neg(z0), #pos(z1)) → #LT
#compare(#pos(z0), #0) → #GT
#compare(#pos(z0), #neg(z1)) → #GT
#compare(#pos(z0), #pos(z1)) → #compare(z0, z1)
#compare(#s(z0), #0) → #GT
#compare(#s(z0), #s(z1)) → #compare(z0, z1)
insertionsort(z0) → insertionsort#1(z0)
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insertionsort#1(nil) → nil
insert(z0, z1) → insert#1(z1, z0)
insert#1(::(z0, z1), z2) → insert#2(#less(z0, z2), z2, z0, z1)
insert#1(nil, z0) → ::(z0, nil)
insert#2(#false, z0, z1, z2) → ::(z0, ::(z1, z2))
insert#2(#true, z0, z1, z2) → ::(z1, insert(z0, z2))
Tuples:

#COMPARE(#neg(z0), #neg(z1)) → c8(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c12(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c14(#COMPARE(z0, z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
S tuples:

INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
K tuples:

FLATTENSORT(z0) → c(INSERTIONSORT(flatten(z0)))
FLATTEN(z0) → c19(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c21(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERTIONSORT(z0) → c28(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c29(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
APPEND(z0, z1) → c16(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c17(APPEND(z1, z2))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
#LESS(z0, z1) → c15(#COMPARE(z0, z1))
Defined Rule Symbols:

append, flatten, flatten#1, append#1, #less, #cklt, #compare, insertionsort, insertionsort#1, insert, insert#1, insert#2

Defined Pair Symbols:

#COMPARE, APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #LESS, FLATTENSORT

Compound Symbols:

c8, c12, c14, c16, c17, c19, c21, c23, c24, c27, c28, c29, c15, c

(23) CdtKnowledgeProof (EQUIVALENT transformation)

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

INSERT#2(#true, z0, z1, z2) → c27(INSERT(z0, z2))
INSERT(z0, z1) → c23(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c24(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
Now S is empty

(24) BOUNDS(1, 1)