Runtime Complexity TRS:
The TRS R consists of the following rules:
rev(a) → a
rev(b) → b
rev(++(x, y)) → ++(rev(y), rev(x))
rev(++(x, x)) → rev(x)
Renamed function symbols to avoid clashes with predefined symbol.
Runtime Complexity TRS:
The TRS R consists of the following rules:
rev'(a') → a'
rev'(b') → b'
rev'(++'(x, y)) → ++'(rev'(y), rev'(x))
rev'(++'(x, x)) → rev'(x)
Infered types.
Rules:
rev'(a') → a'
rev'(b') → b'
rev'(++'(x, y)) → ++'(rev'(y), rev'(x))
rev'(++'(x, x)) → rev'(x)
Types:
rev' :: a':b':++' → a':b':++'
a' :: a':b':++'
b' :: a':b':++'
++' :: a':b':++' → a':b':++' → a':b':++'
_hole_a':b':++'1 :: a':b':++'
_gen_a':b':++'2 :: Nat → a':b':++'
Heuristically decided to analyse the following defined symbols:
rev'
Rules:
rev'(a') → a'
rev'(b') → b'
rev'(++'(x, y)) → ++'(rev'(y), rev'(x))
rev'(++'(x, x)) → rev'(x)
Types:
rev' :: a':b':++' → a':b':++'
a' :: a':b':++'
b' :: a':b':++'
++' :: a':b':++' → a':b':++' → a':b':++'
_hole_a':b':++'1 :: a':b':++'
_gen_a':b':++'2 :: Nat → a':b':++'
Generator Equations:
_gen_a':b':++'2(0) ⇔ a'
_gen_a':b':++'2(+(x, 1)) ⇔ ++'(a', _gen_a':b':++'2(x))
The following defined symbols remain to be analysed:
rev'
Proved the following rewrite lemma:
rev'(_gen_a':b':++'2(+(1, _n4))) → _*3, rt ∈ Ω(n4)
Induction Base:
rev'(_gen_a':b':++'2(+(1, 0)))
Induction Step:
rev'(_gen_a':b':++'2(+(1, +(_$n5, 1)))) →RΩ(1)
++'(rev'(_gen_a':b':++'2(+(1, _$n5))), rev'(a')) →IH
++'(_*3, rev'(a')) →RΩ(1)
++'(_*3, a')
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
rev'(a') → a'
rev'(b') → b'
rev'(++'(x, y)) → ++'(rev'(y), rev'(x))
rev'(++'(x, x)) → rev'(x)
Types:
rev' :: a':b':++' → a':b':++'
a' :: a':b':++'
b' :: a':b':++'
++' :: a':b':++' → a':b':++' → a':b':++'
_hole_a':b':++'1 :: a':b':++'
_gen_a':b':++'2 :: Nat → a':b':++'
Lemmas:
rev'(_gen_a':b':++'2(+(1, _n4))) → _*3, rt ∈ Ω(n4)
Generator Equations:
_gen_a':b':++'2(0) ⇔ a'
_gen_a':b':++'2(+(x, 1)) ⇔ ++'(a', _gen_a':b':++'2(x))
No more defined symbols left to analyse.
The lowerbound Ω(n) was proven with the following lemma:
rev'(_gen_a':b':++'2(+(1, _n4))) → _*3, rt ∈ Ω(n4)