(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) RenamingProof (EQUIVALENT transformation)

Renamed function symbols to avoid clashes with predefined symbol.

(2) Obligation:

Runtime Complexity Relative 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))

S is empty.
Rewrite Strategy: INNERMOST

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

Infered types.

(4) Obligation:

Innermost TRS:
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))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

(5) OrderProof (LOWER BOUND(ID) transformation)

Heuristically decided to analyse the following defined symbols:
flatten, ++, rev

They will be analysed ascendingly in the following order:
++ < flatten
++ < rev

(6) Obligation:

Innermost TRS:
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))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

The following defined symbols remain to be analysed:
++, flatten, rev

They will be analysed ascendingly in the following order:
++ < flatten
++ < rev

(7) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)

Could not prove a rewrite lemma for the defined symbol ++.

(8) Obligation:

Innermost TRS:
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))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

The following defined symbols remain to be analysed:
flatten, rev

(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)

Proved the following rewrite lemma:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

Induction Base:
flatten(gen_nil:unit2_0(0)) →RΩ(1)
nil

Induction Step:
flatten(gen_nil:unit2_0(+(n19_0, 1))) →RΩ(1)
flatten(gen_nil:unit2_0(n19_0)) →IH
gen_nil:unit2_0(0)

We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).

(10) Complex Obligation (BEST)

(11) Obligation:

Innermost TRS:
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))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Lemmas:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

The following defined symbols remain to be analysed:
rev

(12) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)

Could not prove a rewrite lemma for the defined symbol rev.

(13) Obligation:

Innermost TRS:
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))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Lemmas:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

No more defined symbols left to analyse.

(14) LowerBoundsProof (EQUIVALENT transformation)

The lowerbound Ω(n1) was proven with the following lemma:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

(15) BOUNDS(n^1, INF)

(16) Obligation:

Innermost TRS:
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))

Types:
flatten :: nil:unit → nil:unit
nil :: nil:unit
unit :: nil:unit → nil:unit
++ :: nil:unit → nil:unit → nil:unit
rev :: nil:unit → nil:unit
hole_nil:unit1_0 :: nil:unit
gen_nil:unit2_0 :: Nat → nil:unit

Lemmas:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

Generator Equations:
gen_nil:unit2_0(0) ⇔ nil
gen_nil:unit2_0(+(x, 1)) ⇔ unit(gen_nil:unit2_0(x))

No more defined symbols left to analyse.

(17) LowerBoundsProof (EQUIVALENT transformation)

The lowerbound Ω(n1) was proven with the following lemma:
flatten(gen_nil:unit2_0(n19_0)) → gen_nil:unit2_0(0), rt ∈ Ω(1 + n190)

(18) BOUNDS(n^1, INF)