(0) Obligation:

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

flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Rewrite Strategy: INNERMOST

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

Converted CpxTRS to CDT

(2) Obligation:

Complexity Dependency Tuples Problem
Rules:

flatten(nil) → nil
flatten(unit(z0)) → flatten(z0)
flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
flatten(flatten(z0)) → flatten(z0)
rev(nil) → nil
rev(unit(z0)) → unit(z0)
rev(++(z0, z1)) → ++(rev(z1), rev(z0))
rev(rev(z0)) → z0
++(z0, nil) → z0
++(nil, z0) → z0
++(++(z0, z1), z2) → ++(z0, ++(z1, z2))
Tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
REV(++(z0, z1)) → c7(++'(rev(z1), rev(z0)), REV(z1), REV(z0))
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
S tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
REV(++(z0, z1)) → c7(++'(rev(z1), rev(z0)), REV(z1), REV(z0))
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
K tuples:none
Defined Rule Symbols:

flatten, rev, ++

Defined Pair Symbols:

FLATTEN, REV, ++'

Compound Symbols:

c1, c2, c3, c4, c7, c11

(3) CdtUnreachableProof (EQUIVALENT transformation)

The following tuples could be removed as they are not reachable from basic start terms:

REV(++(z0, z1)) → c7(++'(rev(z1), rev(z0)), REV(z1), REV(z0))

(4) Obligation:

Complexity Dependency Tuples Problem
Rules:

flatten(nil) → nil
flatten(unit(z0)) → flatten(z0)
flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
flatten(flatten(z0)) → flatten(z0)
rev(nil) → nil
rev(unit(z0)) → unit(z0)
rev(++(z0, z1)) → ++(rev(z1), rev(z0))
rev(rev(z0)) → z0
++(z0, nil) → z0
++(nil, z0) → z0
++(++(z0, z1), z2) → ++(z0, ++(z1, z2))
Tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
S tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
K tuples:none
Defined Rule Symbols:

flatten, rev, ++

Defined Pair Symbols:

FLATTEN, ++'

Compound Symbols:

c1, c2, c3, c4, c11

(5) 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.

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
We considered the (Usable) Rules:

++(z0, nil) → z0
++(++(z0, z1), z2) → ++(z0, ++(z1, z2))
++(nil, z0) → z0
flatten(nil) → nil
flatten(unit(z0)) → flatten(z0)
flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
flatten(flatten(z0)) → flatten(z0)
And the Tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(++(x1, x2)) = [5] + [4]x1 + x2   
POL(++'(x1, x2)) = 0   
POL(FLATTEN(x1)) = [4]x1   
POL(c1(x1)) = x1   
POL(c11(x1, x2)) = x1 + x2   
POL(c2(x1, x2, x3)) = x1 + x2 + x3   
POL(c3(x1, x2, x3)) = x1 + x2 + x3   
POL(c4(x1)) = x1   
POL(flatten(x1)) = [1] + x1   
POL(nil) = [3]   
POL(unit(x1)) = [4] + x1   

(6) Obligation:

Complexity Dependency Tuples Problem
Rules:

flatten(nil) → nil
flatten(unit(z0)) → flatten(z0)
flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
flatten(flatten(z0)) → flatten(z0)
rev(nil) → nil
rev(unit(z0)) → unit(z0)
rev(++(z0, z1)) → ++(rev(z1), rev(z0))
rev(rev(z0)) → z0
++(z0, nil) → z0
++(nil, z0) → z0
++(++(z0, z1), z2) → ++(z0, ++(z1, z2))
Tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
S tuples:

++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
K tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
Defined Rule Symbols:

flatten, rev, ++

Defined Pair Symbols:

FLATTEN, ++'

Compound Symbols:

c1, c2, c3, c4, c11

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

++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
We considered the (Usable) Rules:

++(z0, nil) → z0
++(++(z0, z1), z2) → ++(z0, ++(z1, z2))
++(nil, z0) → z0
flatten(nil) → nil
flatten(unit(z0)) → flatten(z0)
flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
flatten(flatten(z0)) → flatten(z0)
And the Tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(++(x1, x2)) = [4] + [4]x1 + x2   
POL(++'(x1, x2)) = [4] + [4]x1   
POL(FLATTEN(x1)) = [4] + [2]x1   
POL(c1(x1)) = x1   
POL(c11(x1, x2)) = x1 + x2   
POL(c2(x1, x2, x3)) = x1 + x2 + x3   
POL(c3(x1, x2, x3)) = x1 + x2 + x3   
POL(c4(x1)) = x1   
POL(flatten(x1)) = x1   
POL(nil) = [5]   
POL(unit(x1)) = [3] + x1   

(8) Obligation:

Complexity Dependency Tuples Problem
Rules:

flatten(nil) → nil
flatten(unit(z0)) → flatten(z0)
flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
flatten(flatten(z0)) → flatten(z0)
rev(nil) → nil
rev(unit(z0)) → unit(z0)
rev(++(z0, z1)) → ++(rev(z1), rev(z0))
rev(rev(z0)) → z0
++(z0, nil) → z0
++(nil, z0) → z0
++(++(z0, z1), z2) → ++(z0, ++(z1, z2))
Tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
S tuples:none
K tuples:

FLATTEN(unit(z0)) → c1(FLATTEN(z0))
FLATTEN(++(z0, z1)) → c2(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(++(unit(z0), z1)) → c3(++'(flatten(z0), flatten(z1)), FLATTEN(z0), FLATTEN(z1))
FLATTEN(flatten(z0)) → c4(FLATTEN(z0))
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
Defined Rule Symbols:

flatten, rev, ++

Defined Pair Symbols:

FLATTEN, ++'

Compound Symbols:

c1, c2, c3, c4, c11

(9) SIsEmptyProof (EQUIVALENT transformation)

The set S is empty

(10) BOUNDS(O(1), O(1))