(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
append(@l1, @l2) → append#1(@l1, @l2)
append#1(::(@x, @xs), @l2) → ::(@x, append(@xs, @l2))
append#1(nil, @l2) → @l2
subtrees(@t) → subtrees#1(@t)
subtrees#1(leaf) → nil
subtrees#1(node(@x, @t1, @t2)) → subtrees#2(subtrees(@t1), @t1, @t2, @x)
subtrees#2(@l1, @t1, @t2, @x) → subtrees#3(subtrees(@t2), @l1, @t1, @t2, @x)
subtrees#3(@l2, @l1, @t1, @t2, @x) → ::(node(@x, @t1, @t2), append(@l1, @l2))
Rewrite Strategy: INNERMOST
(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)
Converted CpxTRS to CDT
(2) Obligation:
Complexity Dependency Tuples Problem
Rules:
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
Tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
S tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
K tuples:none
Defined Rule Symbols:
append, append#1, subtrees, subtrees#1, subtrees#2, subtrees#3
Defined Pair Symbols:
APPEND, APPEND#1, SUBTREES, SUBTREES#1, SUBTREES#2, SUBTREES#3
Compound Symbols:
c, c1, c3, c5, c6, c7
(3) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
We considered the (Usable) Rules:
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
And the Tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(::(x1, x2)) = 0
POL(APPEND(x1, x2)) = 0
POL(APPEND#1(x1, x2)) = 0
POL(SUBTREES(x1)) = [1] + [2]x1
POL(SUBTREES#1(x1)) = [2]x1
POL(SUBTREES#2(x1, x2, x3, x4)) = [1] + [2]x3 + [2]x4
POL(SUBTREES#3(x1, x2, x3, x4, x5)) = x5
POL(append(x1, x2)) = [3] + [2]x2
POL(append#1(x1, x2)) = [3] + x2
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c3(x1)) = x1
POL(c5(x1, x2)) = x1 + x2
POL(c6(x1, x2)) = x1 + x2
POL(c7(x1)) = x1
POL(leaf) = [3]
POL(nil) = [3]
POL(node(x1, x2, x3)) = [2] + x1 + x2 + x3
POL(subtrees(x1)) = [1] + [5]x1
POL(subtrees#1(x1)) = [3] + [2]x1
POL(subtrees#2(x1, x2, x3, x4)) = [2] + [4]x1 + x2 + [3]x3 + [3]x4
POL(subtrees#3(x1, x2, x3, x4, x5)) = [3] + [3]x1 + [5]x2 + [5]x3 + [2]x4 + [3]x5
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
Tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
S tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
K tuples:
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
Defined Rule Symbols:
append, append#1, subtrees, subtrees#1, subtrees#2, subtrees#3
Defined Pair Symbols:
APPEND, APPEND#1, SUBTREES, SUBTREES#1, SUBTREES#2, SUBTREES#3
Compound Symbols:
c, c1, c3, c5, c6, c7
(5) CdtKnowledgeProof (EQUIVALENT transformation)
The following tuples could be moved from S to K by knowledge propagation:
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
SUBTREES(z0) → c3(SUBTREES#1(z0))
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
Tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
S tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
K tuples:
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
Defined Rule Symbols:
append, append#1, subtrees, subtrees#1, subtrees#2, subtrees#3
Defined Pair Symbols:
APPEND, APPEND#1, SUBTREES, SUBTREES#1, SUBTREES#2, SUBTREES#3
Compound Symbols:
c, c1, c3, c5, c6, c7
(7) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^2))) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
We considered the (Usable) Rules:
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
And the Tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(::(x1, x2)) = [1] + x2
POL(APPEND(x1, x2)) = x1
POL(APPEND#1(x1, x2)) = x1
POL(SUBTREES(x1)) = x1 + x12
POL(SUBTREES#1(x1)) = x1 + x12
POL(SUBTREES#2(x1, x2, x3, x4)) = [3] + x1 + x2 + [3]x3 + x32 + [2]x2·x3
POL(SUBTREES#3(x1, x2, x3, x4, x5)) = x2 + [2]x3·x4
POL(append(x1, x2)) = x1 + x2
POL(append#1(x1, x2)) = x1 + x2
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c3(x1)) = x1
POL(c5(x1, x2)) = x1 + x2
POL(c6(x1, x2)) = x1 + x2
POL(c7(x1)) = x1
POL(leaf) = 0
POL(nil) = 0
POL(node(x1, x2, x3)) = [2] + x2 + x3
POL(subtrees(x1)) = [1] + [2]x1
POL(subtrees#1(x1)) = [2]x1
POL(subtrees#2(x1, x2, x3, x4)) = [3] + x1 + [2]x3
POL(subtrees#3(x1, x2, x3, x4, x5)) = [1] + x1 + x2
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:
append(z0, z1) → append#1(z0, z1)
append#1(::(z0, z1), z2) → ::(z0, append(z1, z2))
append#1(nil, z0) → z0
subtrees(z0) → subtrees#1(z0)
subtrees#1(leaf) → nil
subtrees#1(node(z0, z1, z2)) → subtrees#2(subtrees(z1), z1, z2, z0)
subtrees#2(z0, z1, z2, z3) → subtrees#3(subtrees(z2), z0, z1, z2, z3)
subtrees#3(z0, z1, z2, z3, z4) → ::(node(z4, z2, z3), append(z1, z0))
Tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
S tuples:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
K tuples:
SUBTREES(z0) → c3(SUBTREES#1(z0))
SUBTREES#1(node(z0, z1, z2)) → c5(SUBTREES#2(subtrees(z1), z1, z2, z0), SUBTREES(z1))
SUBTREES#2(z0, z1, z2, z3) → c6(SUBTREES#3(subtrees(z2), z0, z1, z2, z3), SUBTREES(z2))
SUBTREES#3(z0, z1, z2, z3, z4) → c7(APPEND(z1, z0))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
Defined Rule Symbols:
append, append#1, subtrees, subtrees#1, subtrees#2, subtrees#3
Defined Pair Symbols:
APPEND, APPEND#1, SUBTREES, SUBTREES#1, SUBTREES#2, SUBTREES#3
Compound Symbols:
c, c1, c3, c5, c6, c7
(9) CdtKnowledgeProof (EQUIVALENT transformation)
The following tuples could be moved from S to K by knowledge propagation:
APPEND(z0, z1) → c(APPEND#1(z0, z1))
APPEND#1(::(z0, z1), z2) → c1(APPEND(z1, z2))
Now S is empty
(10) BOUNDS(O(1), O(1))