### (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 Cpx (relative) TRS 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(nil) → c
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(nil) → c5
REV(unit(z0)) → c6
REV(++(z0, z1)) → c7(++'(rev(z1), rev(z0)), REV(z1), REV(z0))
REV(rev(z0)) → c8
++'(z0, nil) → c9
++'(nil, z0) → c10
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
S tuples:

FLATTEN(nil) → c
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(nil) → c5
REV(unit(z0)) → c6
REV(++(z0, z1)) → c7(++'(rev(z1), rev(z0)), REV(z1), REV(z0))
REV(rev(z0)) → c8
++'(z0, nil) → c9
++'(nil, z0) → c10
++'(++(z0, z1), z2) → c11(++'(z0, ++(z1, z2)), ++'(z1, z2))
K tuples:none
Defined Rule Symbols:

flatten, rev, ++

Defined Pair Symbols:

FLATTEN, REV, ++'

Compound Symbols:

c, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11

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

Removed 6 trailing nodes:

++'(nil, z0) → c10
FLATTEN(nil) → c
REV(nil) → c5
++'(z0, nil) → c9
REV(unit(z0)) → c6
REV(rev(z0)) → c8

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

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

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

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

### (7) CdtUsableRulesProof (EQUIVALENT transformation)

The following rules are not usable and were removed:

rev(nil) → nil
rev(unit(z0)) → unit(z0)
rev(++(z0, z1)) → ++(rev(z1), rev(z0))
rev(rev(z0)) → z0

### (8) Obligation:

Complexity Dependency Tuples Problem
Rules:

flatten(unit(z0)) → flatten(z0)
flatten(flatten(z0)) → flatten(z0)
flatten(nil) → nil
flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
++(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, ++

Defined Pair Symbols:

FLATTEN, ++'

Compound Symbols:

c1, c2, c3, c4, c11

### (9) CdtRuleRemovalProof (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:none
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

### (10) Obligation:

Complexity Dependency Tuples Problem
Rules:

flatten(unit(z0)) → flatten(z0)
flatten(flatten(z0)) → flatten(z0)
flatten(nil) → nil
flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
++(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, ++

Defined Pair Symbols:

FLATTEN, ++'

Compound Symbols:

c1, c2, c3, c4, c11

### (11) CdtRuleRemovalProof (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:

flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(flatten(z0)) → flatten(z0)
++(++(z0, z1), z2) → ++(z0, ++(z1, z2))
flatten(nil) → nil
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
flatten(unit(z0)) → flatten(z0)
++(nil, z0) → z0
++(z0, nil) → 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

### (12) Obligation:

Complexity Dependency Tuples Problem
Rules:

flatten(unit(z0)) → flatten(z0)
flatten(flatten(z0)) → flatten(z0)
flatten(nil) → nil
flatten(++(z0, z1)) → ++(flatten(z0), flatten(z1))
flatten(++(unit(z0), z1)) → ++(flatten(z0), flatten(z1))
++(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, ++

Defined Pair Symbols:

FLATTEN, ++'

Compound Symbols:

c1, c2, c3, c4, c11

### (13) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)

The set S is empty