(0) Obligation:
The Runtime Complexity (innermost) of the given
CpxRelTRS could be proven to be
BOUNDS(1, n^2).
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) RelTrsToTrsProof (UPPER BOUND(ID) transformation)
transformed relative TRS to TRS
(2) Obligation:
The Runtime Complexity (innermost) of the given
CpxTRS could be proven to be
BOUNDS(1, n^2).
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
#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
(3) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)
Converted Cpx (relative) TRS to CDT
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
#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
#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)
Tuples:
#LESS(z0, z1) → c(#CKLT(#compare(z0, z1)), #COMPARE(z0, z1))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
APPEND#1(nil, z0) → c3
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(leaf) → c5
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c7(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#1(nil, z0) → c10
INSERT#2(#false, z0, z1, z2) → c11
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT#1(nil) → c15
#CKLT(#EQ) → c16
#CKLT(#GT) → c17
#CKLT(#LT) → c18
#COMPARE(#0, #0) → c19
#COMPARE(#0, #neg(z0)) → c20
#COMPARE(#0, #pos(z0)) → c21
#COMPARE(#0, #s(z0)) → c22
#COMPARE(#neg(z0), #0) → c23
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#neg(z0), #pos(z1)) → c25
#COMPARE(#pos(z0), #0) → c26
#COMPARE(#pos(z0), #neg(z1)) → c27
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #0) → c29
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
S tuples:
#LESS(z0, z1) → c(#CKLT(#compare(z0, z1)), #COMPARE(z0, z1))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
APPEND#1(nil, z0) → c3
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(leaf) → c5
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c7(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#1(nil, z0) → c10
INSERT#2(#false, z0, z1, z2) → c11
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT#1(nil) → c15
#CKLT(#EQ) → c16
#CKLT(#GT) → c17
#CKLT(#LT) → c18
#COMPARE(#0, #0) → c19
#COMPARE(#0, #neg(z0)) → c20
#COMPARE(#0, #pos(z0)) → c21
#COMPARE(#0, #s(z0)) → c22
#COMPARE(#neg(z0), #0) → c23
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#neg(z0), #pos(z1)) → c25
#COMPARE(#pos(z0), #0) → c26
#COMPARE(#pos(z0), #neg(z1)) → c27
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #0) → c29
#COMPARE(#s(z0), #s(z1)) → c30(#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:
#LESS, APPEND, APPEND#1, FLATTEN, FLATTEN#1, FLATTENSORT, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #CKLT, #COMPARE
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
(5) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)
Removed 17 trailing nodes:
INSERT#1(nil, z0) → c10
FLATTEN#1(leaf) → c5
#COMPARE(#0, #neg(z0)) → c20
INSERTIONSORT#1(nil) → c15
#CKLT(#LT) → c18
#COMPARE(#pos(z0), #0) → c26
#CKLT(#GT) → c17
#COMPARE(#0, #0) → c19
#COMPARE(#neg(z0), #pos(z1)) → c25
#COMPARE(#neg(z0), #0) → c23
#CKLT(#EQ) → c16
#COMPARE(#0, #s(z0)) → c22
INSERT#2(#false, z0, z1, z2) → c11
#COMPARE(#pos(z0), #neg(z1)) → c27
APPEND#1(nil, z0) → c3
#COMPARE(#0, #pos(z0)) → c21
#COMPARE(#s(z0), #0) → c29
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:
#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
#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)
Tuples:
#LESS(z0, z1) → c(#CKLT(#compare(z0, z1)), #COMPARE(z0, z1))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c7(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
S tuples:
#LESS(z0, z1) → c(#CKLT(#compare(z0, z1)), #COMPARE(z0, z1))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c7(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#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:
#LESS, APPEND, APPEND#1, FLATTEN, FLATTEN#1, FLATTENSORT, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE
Compound Symbols:
c, c1, c2, c4, c6, c7, c8, c9, c12, c13, c14, c24, c28, c30
(7) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)
Removed 1 trailing tuple parts
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:
#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
#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)
Tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c7(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
S tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTENSORT(z0) → c7(INSERTIONSORT(flatten(z0)), FLATTEN(z0))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, FLATTENSORT, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS
Compound Symbols:
c1, c2, c4, c6, c7, c8, c9, c12, c13, c14, c24, c28, c30, c
(9) CdtGraphSplitRhsProof (BOTH BOUNDS(ID, ID) transformation)
Split RHS of tuples not part of any SCC
(10) Obligation:
Complexity Dependency Tuples Problem
Rules:
#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
#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)
Tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
FLATTENSORT(z0) → c3(FLATTEN(z0))
S tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
FLATTENSORT(z0) → c3(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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(11) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)
Removed 1 leading nodes:
FLATTENSORT(z0) → c3(FLATTEN(z0))
(12) Obligation:
Complexity Dependency Tuples Problem
Rules:
#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
#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)
Tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(13) CdtKnowledgeProof (BOTH BOUNDS(ID, ID) transformation)
The following tuples could be moved from S to K by knowledge propagation:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
(14) Obligation:
Complexity Dependency Tuples Problem
Rules:
#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
#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)
Tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(15) CdtUsableRulesProof (EQUIVALENT transformation)
The following rules are not usable and were removed:
flattensort(z0) → insertionsort(flatten(z0))
(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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(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#1(::(z0, z1)) → c14(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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(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)) = 0
POL(APPEND#1(x1, x2)) = 0
POL(FLATTEN(x1)) = 0
POL(FLATTEN#1(x1)) = 0
POL(FLATTENSORT(x1)) = x1
POL(INSERT(x1, x2)) = 0
POL(INSERT#1(x1, x2)) = 0
POL(INSERT#2(x1, x2, x3, x4)) = 0
POL(INSERTIONSORT(x1)) = x1
POL(INSERTIONSORT#1(x1)) = x1
POL(append(x1, x2)) = x1 + x2
POL(append#1(x1, x2)) = x1 + x2
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c12(x1)) = x1
POL(c13(x1)) = x1
POL(c14(x1, x2)) = x1 + x2
POL(c2(x1)) = x1
POL(c24(x1)) = x1
POL(c28(x1)) = x1
POL(c3(x1)) = x1
POL(c30(x1)) = x1
POL(c4(x1)) = x1
POL(c6(x1, x2, x3, x4)) = x1 + x2 + x3 + x4
POL(c8(x1)) = x1
POL(c9(x1, x2)) = x1 + x2
POL(flatten(x1)) = x1
POL(flatten#1(x1)) = 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) = [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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(19) CdtKnowledgeProof (BOTH BOUNDS(ID, ID) transformation)
The following tuples could be moved from S to K by knowledge propagation:
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
(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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
Defined Rule Symbols:
append, flatten, flatten#1, append#1, #less, #cklt, #compare, insertionsort, insertionsort#1, insert, insert#1, insert#2
Defined Pair Symbols:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(21) 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#1(node(z0, z1, z2)) → c6(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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(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) = [1]
POL(#GT) = 0
POL(#LESS(x1, x2)) = 0
POL(#LT) = [1]
POL(#cklt(x1)) = x1
POL(#compare(x1, x2)) = 0
POL(#false) = 0
POL(#less(x1, x2)) = [1]
POL(#neg(x1)) = 0
POL(#pos(x1)) = 0
POL(#s(x1)) = 0
POL(#true) = 0
POL(::(x1, x2)) = 0
POL(APPEND(x1, x2)) = 0
POL(APPEND#1(x1, x2)) = 0
POL(FLATTEN(x1)) = x1
POL(FLATTEN#1(x1)) = x1
POL(FLATTENSORT(x1)) = [1]
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)) = 0
POL(append#1(x1, x2)) = 0
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c12(x1)) = x1
POL(c13(x1)) = x1
POL(c14(x1, x2)) = x1 + x2
POL(c2(x1)) = x1
POL(c24(x1)) = x1
POL(c28(x1)) = x1
POL(c3(x1)) = x1
POL(c30(x1)) = x1
POL(c4(x1)) = x1
POL(c6(x1, x2, x3, x4)) = x1 + x2 + x3 + x4
POL(c8(x1)) = x1
POL(c9(x1, x2)) = x1 + x2
POL(flatten(x1)) = 0
POL(flatten#1(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(leaf) = 0
POL(nil) = 0
POL(node(x1, x2, x3)) = [1] + 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(23) CdtKnowledgeProof (BOTH BOUNDS(ID, ID) transformation)
The following tuples could be moved from S to K by knowledge propagation:
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
(24) 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
Defined Rule Symbols:
append, flatten, flatten#1, append#1, #less, #cklt, #compare, insertionsort, insertionsort#1, insert, insert#1, insert#2
Defined Pair Symbols:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(25) 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) → c1(APPEND#1(z0, 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(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) = [2]
POL(#GT) = [1]
POL(#LESS(x1, x2)) = 0
POL(#LT) = 0
POL(#cklt(x1)) = 0
POL(#compare(x1, x2)) = 0
POL(#false) = [2]
POL(#less(x1, x2)) = 0
POL(#neg(x1)) = 0
POL(#pos(x1)) = 0
POL(#s(x1)) = [1]
POL(#true) = 0
POL(::(x1, x2)) = [2] + x2
POL(APPEND(x1, x2)) = [2] + x1
POL(APPEND#1(x1, x2)) = x1
POL(FLATTEN(x1)) = x12
POL(FLATTEN#1(x1)) = x12
POL(FLATTENSORT(x1)) = [2] + [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)) = [2]x1
POL(INSERTIONSORT#1(x1)) = [2]x1
POL(append(x1, x2)) = x1 + x2
POL(append#1(x1, x2)) = x1 + x2
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c12(x1)) = x1
POL(c13(x1)) = x1
POL(c14(x1, x2)) = x1 + x2
POL(c2(x1)) = x1
POL(c24(x1)) = x1
POL(c28(x1)) = x1
POL(c3(x1)) = x1
POL(c30(x1)) = x1
POL(c4(x1)) = x1
POL(c6(x1, x2, x3, x4)) = x1 + x2 + x3 + x4
POL(c8(x1)) = x1
POL(c9(x1, x2)) = x1 + x2
POL(flatten(x1)) = x1
POL(flatten#1(x1)) = x1
POL(insert(x1, x2)) = [2] + [2]x2 + [2]x12
POL(insert#1(x1, x2)) = [1] + x1 + [2]x2 + [2]x12
POL(insert#2(x1, x2, x3, x4)) = [1] + x42 + [2]x3·x4 + [2]x2·x4 + x1·x4 + [2]x12 + [2]x1·x2 + [2]x1·x3 + [2]x32 + [2]x22
POL(insertionsort(x1)) = 0
POL(insertionsort#1(x1)) = [1]
POL(leaf) = [1]
POL(nil) = 0
POL(node(x1, x2, x3)) = [2] + x1 + x2 + x3
(26) 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
APPEND(z0, z1) → c1(APPEND#1(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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(27) CdtKnowledgeProof (BOTH BOUNDS(ID, ID) transformation)
The following tuples could be moved from S to K by knowledge propagation:
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
(28) 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(29) 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#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#LESS(z0, z1) → c(#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))
#cklt(#GT) → #false
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)
#cklt(#EQ) → #false
insertionsort#1(::(z0, z1)) → insert(z0, insertionsort(z1))
insert#1(nil, z0) → ::(z0, nil)
insertionsort(z0) → insertionsort#1(z0)
#less(z0, z1) → #cklt(#compare(z0, z1))
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
#cklt(#LT) → #true
And the Tuples:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(#0) = [1]
POL(#COMPARE(x1, x2)) = 0
POL(#EQ) = 0
POL(#GT) = 0
POL(#LESS(x1, x2)) = [2]
POL(#LT) = 0
POL(#cklt(x1)) = [2]
POL(#compare(x1, x2)) = 0
POL(#false) = [2]
POL(#less(x1, x2)) = [2]
POL(#neg(x1)) = 0
POL(#pos(x1)) = 0
POL(#s(x1)) = [2]
POL(#true) = [2]
POL(::(x1, x2)) = [2] + 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] + [2]x1 + x12
POL(INSERT(x1, x2)) = [2]x2
POL(INSERT#1(x1, x2)) = [2]x1
POL(INSERT#2(x1, x2, x3, x4)) = [2] + [2]x4
POL(INSERTIONSORT(x1)) = x12
POL(INSERTIONSORT#1(x1)) = x12
POL(append(x1, x2)) = x1 + x2
POL(append#1(x1, x2)) = x1 + x2
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c12(x1)) = x1
POL(c13(x1)) = x1
POL(c14(x1, x2)) = x1 + x2
POL(c2(x1)) = x1
POL(c24(x1)) = x1
POL(c28(x1)) = x1
POL(c3(x1)) = x1
POL(c30(x1)) = x1
POL(c4(x1)) = x1
POL(c6(x1, x2, x3, x4)) = x1 + x2 + x3 + x4
POL(c8(x1)) = x1
POL(c9(x1, x2)) = x1 + x2
POL(flatten(x1)) = x1
POL(flatten#1(x1)) = x1
POL(insert(x1, x2)) = [2] + x2
POL(insert#1(x1, x2)) = [2] + x1
POL(insert#2(x1, x2, x3, x4)) = x4 + x12
POL(insertionsort(x1)) = [2]x1
POL(insertionsort#1(x1)) = [2]x1
POL(leaf) = 0
POL(nil) = 0
POL(node(x1, x2, x3)) = x1 + x2 + x3
(30) 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#LESS(z0, z1) → c(#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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(31) CdtKnowledgeProof (BOTH BOUNDS(ID, ID) transformation)
The following tuples could be moved from S to K by knowledge propagation:
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
(32) 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
Defined Rule Symbols:
append, flatten, flatten#1, append#1, #less, #cklt, #compare, insertionsort, insertionsort#1, insert, insert#1, insert#2
Defined Pair Symbols:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(33) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
#COMPARE(#pos(z0), #pos(z1)) → c28(#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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(#0) = 0
POL(#COMPARE(x1, x2)) = x1·x2
POL(#EQ) = 0
POL(#GT) = [1]
POL(#LESS(x1, x2)) = x1·x2
POL(#LT) = 0
POL(#cklt(x1)) = [2]
POL(#compare(x1, x2)) = 0
POL(#false) = 0
POL(#less(x1, x2)) = 0
POL(#neg(x1)) = x1
POL(#pos(x1)) = [2] + x1
POL(#s(x1)) = x1
POL(#true) = 0
POL(::(x1, x2)) = x1 + 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] + [2]x1 + [2]x12
POL(INSERT(x1, x2)) = [2]x1·x2
POL(INSERT#1(x1, x2)) = [2]x1·x2
POL(INSERT#2(x1, x2, x3, x4)) = [2]x2·x4
POL(INSERTIONSORT(x1)) = [2]x12
POL(INSERTIONSORT#1(x1)) = [2]x12
POL(append(x1, x2)) = x1 + x2
POL(append#1(x1, x2)) = x1 + x2
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c12(x1)) = x1
POL(c13(x1)) = x1
POL(c14(x1, x2)) = x1 + x2
POL(c2(x1)) = x1
POL(c24(x1)) = x1
POL(c28(x1)) = x1
POL(c3(x1)) = x1
POL(c30(x1)) = x1
POL(c4(x1)) = x1
POL(c6(x1, x2, x3, x4)) = x1 + x2 + x3 + x4
POL(c8(x1)) = x1
POL(c9(x1, x2)) = x1 + x2
POL(flatten(x1)) = x1
POL(flatten#1(x1)) = x1
POL(insert(x1, x2)) = x1 + x2
POL(insert#1(x1, x2)) = x1 + x2
POL(insert#2(x1, x2, x3, x4)) = x2 + x3 + x4
POL(insertionsort(x1)) = x1
POL(insertionsort#1(x1)) = x1
POL(leaf) = [2]
POL(nil) = 0
POL(node(x1, x2, x3)) = x1 + x2 + x3
(34) 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
#COMPARE(#pos(z0), #pos(z1)) → c28(#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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(35) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(#0) = 0
POL(#COMPARE(x1, x2)) = [2]x1·x2
POL(#EQ) = [2]
POL(#GT) = 0
POL(#LESS(x1, x2)) = [2]x1·x2
POL(#LT) = 0
POL(#cklt(x1)) = [1]
POL(#compare(x1, x2)) = 0
POL(#false) = 0
POL(#less(x1, x2)) = [2]x1 + x12
POL(#neg(x1)) = [2] + x1
POL(#pos(x1)) = [1] + x1
POL(#s(x1)) = x1
POL(#true) = [2]
POL(::(x1, x2)) = x1 + 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]x1 + [2]x12
POL(INSERT(x1, x2)) = [2]x1·x2
POL(INSERT#1(x1, x2)) = [2]x1·x2
POL(INSERT#2(x1, x2, x3, x4)) = [2]x2·x4
POL(INSERTIONSORT(x1)) = x12
POL(INSERTIONSORT#1(x1)) = x12
POL(append(x1, x2)) = x1 + x2
POL(append#1(x1, x2)) = x1 + x2
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c12(x1)) = x1
POL(c13(x1)) = x1
POL(c14(x1, x2)) = x1 + x2
POL(c2(x1)) = x1
POL(c24(x1)) = x1
POL(c28(x1)) = x1
POL(c3(x1)) = x1
POL(c30(x1)) = x1
POL(c4(x1)) = x1
POL(c6(x1, x2, x3, x4)) = x1 + x2 + x3 + x4
POL(c8(x1)) = x1
POL(c9(x1, x2)) = x1 + x2
POL(flatten(x1)) = x1
POL(flatten#1(x1)) = x1
POL(insert(x1, x2)) = x1 + x2
POL(insert#1(x1, x2)) = x1 + x2
POL(insert#2(x1, x2, x3, x4)) = x2 + x3 + x4
POL(insertionsort(x1)) = x1
POL(insertionsort#1(x1)) = x1
POL(leaf) = 0
POL(nil) = 0
POL(node(x1, x2, x3)) = x1 + x2 + x3
(36) 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
Defined Rule Symbols:
append, flatten, flatten#1, append#1, #less, #cklt, #compare, insertionsort, insertionsort#1, insert, insert#1, insert#2
Defined Pair Symbols:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(37) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
#COMPARE(#s(z0), #s(z1)) → c30(#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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(#0) = [1]
POL(#COMPARE(x1, x2)) = [2]x1·x2
POL(#EQ) = [1]
POL(#GT) = 0
POL(#LESS(x1, x2)) = [2]x1·x2
POL(#LT) = 0
POL(#cklt(x1)) = [1]
POL(#compare(x1, x2)) = x2 + [2]x22 + [2]x1·x2
POL(#false) = 0
POL(#less(x1, x2)) = x1·x2
POL(#neg(x1)) = x1
POL(#pos(x1)) = x1
POL(#s(x1)) = [1] + x1
POL(#true) = [1]
POL(::(x1, x2)) = [1] + x1 + x2
POL(APPEND(x1, x2)) = 0
POL(APPEND#1(x1, x2)) = 0
POL(FLATTEN(x1)) = 0
POL(FLATTEN#1(x1)) = 0
POL(FLATTENSORT(x1)) = x1 + [2]x12
POL(INSERT(x1, x2)) = [2]x1·x2
POL(INSERT#1(x1, x2)) = [2]x1·x2
POL(INSERT#2(x1, x2, x3, x4)) = [2]x2·x4
POL(INSERTIONSORT(x1)) = x12
POL(INSERTIONSORT#1(x1)) = x12
POL(append(x1, x2)) = x1 + x2
POL(append#1(x1, x2)) = x1 + x2
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c12(x1)) = x1
POL(c13(x1)) = x1
POL(c14(x1, x2)) = x1 + x2
POL(c2(x1)) = x1
POL(c24(x1)) = x1
POL(c28(x1)) = x1
POL(c3(x1)) = x1
POL(c30(x1)) = x1
POL(c4(x1)) = x1
POL(c6(x1, x2, x3, x4)) = x1 + x2 + x3 + x4
POL(c8(x1)) = x1
POL(c9(x1, x2)) = x1 + x2
POL(flatten(x1)) = x1
POL(flatten#1(x1)) = x1
POL(insert(x1, x2)) = [1] + x1 + x2
POL(insert#1(x1, x2)) = [1] + x1 + x2
POL(insert#2(x1, x2, x3, x4)) = [2] + x2 + x3 + x4
POL(insertionsort(x1)) = x1
POL(insertionsort#1(x1)) = x1
POL(leaf) = 0
POL(nil) = 0
POL(node(x1, x2, x3)) = x1 + x2 + x3
(38) 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:
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#s(z0), #s(z1)) → c30(#COMPARE(z0, z1))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
S tuples:none
K tuples:
FLATTENSORT(z0) → c3(INSERTIONSORT(flatten(z0)))
INSERTIONSORT#1(::(z0, z1)) → c14(INSERT(z0, insertionsort(z1)), INSERTIONSORT(z1))
INSERTIONSORT(z0) → c13(INSERTIONSORT#1(z0))
FLATTEN#1(node(z0, z1, z2)) → c6(APPEND(z0, append(flatten(z1), flatten(z2))), APPEND(flatten(z1), flatten(z2)), FLATTEN(z1), FLATTEN(z2))
FLATTEN(z0) → c4(FLATTEN#1(z0))
APPEND(z0, z1) → c1(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c2(APPEND(z1, z2))
INSERT#2(#true, z0, z1, z2) → c12(INSERT(z0, z2))
#LESS(z0, z1) → c(#COMPARE(z0, z1))
INSERT(z0, z1) → c8(INSERT#1(z1, z0))
INSERT#1(::(z0, z1), z2) → c9(INSERT#2(#less(z0, z2), z2, z0, z1), #LESS(z0, z2))
#COMPARE(#pos(z0), #pos(z1)) → c28(#COMPARE(z0, z1))
#COMPARE(#neg(z0), #neg(z1)) → c24(#COMPARE(z1, z0))
#COMPARE(#s(z0), #s(z1)) → c30(#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:
APPEND, APPEND#1, FLATTEN, FLATTEN#1, INSERT, INSERT#1, INSERT#2, INSERTIONSORT, INSERTIONSORT#1, #COMPARE, #LESS, FLATTENSORT
Compound Symbols:
c1, c2, c4, c6, c8, c9, c12, c13, c14, c24, c28, c30, c, c3
(39) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)
The set S is empty
(40) BOUNDS(1, 1)