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

terms(N) → cons(recip(sqr(N)), n__terms(s(N)))
sqr(0) → 0
sqr(s(X)) → s(add(sqr(X), dbl(X)))
dbl(0) → 0
dbl(s(X)) → s(s(dbl(X)))
add(0, X) → X
add(s(X), Y) → s(add(X, Y))
first(0, X) → nil
first(s(X), cons(Y, Z)) → cons(Y, n__first(X, activate(Z)))
terms(X) → n__terms(X)
first(X1, X2) → n__first(X1, X2)
activate(n__terms(X)) → terms(X)
activate(n__first(X1, X2)) → first(X1, X2)
activate(X) → X

Rewrite Strategy: INNERMOST


Renamed function symbols to avoid clashes with predefined symbol.


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


terms'(N) → cons'(recip'(sqr'(N)), n__terms'(s'(N)))
sqr'(0') → 0'
sqr'(s'(X)) → s'(add'(sqr'(X), dbl'(X)))
dbl'(0') → 0'
dbl'(s'(X)) → s'(s'(dbl'(X)))
add'(0', X) → X
add'(s'(X), Y) → s'(add'(X, Y))
first'(0', X) → nil'
first'(s'(X), cons'(Y, Z)) → cons'(Y, n__first'(X, activate'(Z)))
terms'(X) → n__terms'(X)
first'(X1, X2) → n__first'(X1, X2)
activate'(n__terms'(X)) → terms'(X)
activate'(n__first'(X1, X2)) → first'(X1, X2)
activate'(X) → X

Rewrite Strategy: INNERMOST


Infered types.


Rules:
terms'(N) → cons'(recip'(sqr'(N)), n__terms'(s'(N)))
sqr'(0') → 0'
sqr'(s'(X)) → s'(add'(sqr'(X), dbl'(X)))
dbl'(0') → 0'
dbl'(s'(X)) → s'(s'(dbl'(X)))
add'(0', X) → X
add'(s'(X), Y) → s'(add'(X, Y))
first'(0', X) → nil'
first'(s'(X), cons'(Y, Z)) → cons'(Y, n__first'(X, activate'(Z)))
terms'(X) → n__terms'(X)
first'(X1, X2) → n__first'(X1, X2)
activate'(n__terms'(X)) → terms'(X)
activate'(n__first'(X1, X2)) → first'(X1, X2)
activate'(X) → X

Types:
terms' :: s':0' → n__terms':cons':nil':n__first'
cons' :: recip' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
recip' :: s':0' → recip'
sqr' :: s':0' → s':0'
n__terms' :: s':0' → n__terms':cons':nil':n__first'
s' :: s':0' → s':0'
0' :: s':0'
add' :: s':0' → s':0' → s':0'
dbl' :: s':0' → s':0'
first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
nil' :: n__terms':cons':nil':n__first'
n__first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
activate' :: n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
_hole_n__terms':cons':nil':n__first'1 :: n__terms':cons':nil':n__first'
_hole_s':0'2 :: s':0'
_hole_recip'3 :: recip'
_gen_n__terms':cons':nil':n__first'4 :: Nat → n__terms':cons':nil':n__first'
_gen_s':0'5 :: Nat → s':0'


Heuristically decided to analyse the following defined symbols:
sqr', add', dbl', activate'

They will be analysed ascendingly in the following order:
add' < sqr'
dbl' < sqr'


Rules:
terms'(N) → cons'(recip'(sqr'(N)), n__terms'(s'(N)))
sqr'(0') → 0'
sqr'(s'(X)) → s'(add'(sqr'(X), dbl'(X)))
dbl'(0') → 0'
dbl'(s'(X)) → s'(s'(dbl'(X)))
add'(0', X) → X
add'(s'(X), Y) → s'(add'(X, Y))
first'(0', X) → nil'
first'(s'(X), cons'(Y, Z)) → cons'(Y, n__first'(X, activate'(Z)))
terms'(X) → n__terms'(X)
first'(X1, X2) → n__first'(X1, X2)
activate'(n__terms'(X)) → terms'(X)
activate'(n__first'(X1, X2)) → first'(X1, X2)
activate'(X) → X

Types:
terms' :: s':0' → n__terms':cons':nil':n__first'
cons' :: recip' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
recip' :: s':0' → recip'
sqr' :: s':0' → s':0'
n__terms' :: s':0' → n__terms':cons':nil':n__first'
s' :: s':0' → s':0'
0' :: s':0'
add' :: s':0' → s':0' → s':0'
dbl' :: s':0' → s':0'
first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
nil' :: n__terms':cons':nil':n__first'
n__first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
activate' :: n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
_hole_n__terms':cons':nil':n__first'1 :: n__terms':cons':nil':n__first'
_hole_s':0'2 :: s':0'
_hole_recip'3 :: recip'
_gen_n__terms':cons':nil':n__first'4 :: Nat → n__terms':cons':nil':n__first'
_gen_s':0'5 :: Nat → s':0'

Generator Equations:
_gen_n__terms':cons':nil':n__first'4(0) ⇔ n__terms'(0')
_gen_n__terms':cons':nil':n__first'4(+(x, 1)) ⇔ cons'(recip'(0'), _gen_n__terms':cons':nil':n__first'4(x))
_gen_s':0'5(0) ⇔ 0'
_gen_s':0'5(+(x, 1)) ⇔ s'(_gen_s':0'5(x))

The following defined symbols remain to be analysed:
add', sqr', dbl', activate'

They will be analysed ascendingly in the following order:
add' < sqr'
dbl' < sqr'


Proved the following rewrite lemma:
add'(_gen_s':0'5(_n7), _gen_s':0'5(b)) → _gen_s':0'5(+(_n7, b)), rt ∈ Ω(1 + n7)

Induction Base:
add'(_gen_s':0'5(0), _gen_s':0'5(b)) →RΩ(1)
_gen_s':0'5(b)

Induction Step:
add'(_gen_s':0'5(+(_$n8, 1)), _gen_s':0'5(_b230)) →RΩ(1)
s'(add'(_gen_s':0'5(_$n8), _gen_s':0'5(_b230))) →IH
s'(_gen_s':0'5(+(_$n8, _b230)))

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


Rules:
terms'(N) → cons'(recip'(sqr'(N)), n__terms'(s'(N)))
sqr'(0') → 0'
sqr'(s'(X)) → s'(add'(sqr'(X), dbl'(X)))
dbl'(0') → 0'
dbl'(s'(X)) → s'(s'(dbl'(X)))
add'(0', X) → X
add'(s'(X), Y) → s'(add'(X, Y))
first'(0', X) → nil'
first'(s'(X), cons'(Y, Z)) → cons'(Y, n__first'(X, activate'(Z)))
terms'(X) → n__terms'(X)
first'(X1, X2) → n__first'(X1, X2)
activate'(n__terms'(X)) → terms'(X)
activate'(n__first'(X1, X2)) → first'(X1, X2)
activate'(X) → X

Types:
terms' :: s':0' → n__terms':cons':nil':n__first'
cons' :: recip' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
recip' :: s':0' → recip'
sqr' :: s':0' → s':0'
n__terms' :: s':0' → n__terms':cons':nil':n__first'
s' :: s':0' → s':0'
0' :: s':0'
add' :: s':0' → s':0' → s':0'
dbl' :: s':0' → s':0'
first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
nil' :: n__terms':cons':nil':n__first'
n__first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
activate' :: n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
_hole_n__terms':cons':nil':n__first'1 :: n__terms':cons':nil':n__first'
_hole_s':0'2 :: s':0'
_hole_recip'3 :: recip'
_gen_n__terms':cons':nil':n__first'4 :: Nat → n__terms':cons':nil':n__first'
_gen_s':0'5 :: Nat → s':0'

Lemmas:
add'(_gen_s':0'5(_n7), _gen_s':0'5(b)) → _gen_s':0'5(+(_n7, b)), rt ∈ Ω(1 + n7)

Generator Equations:
_gen_n__terms':cons':nil':n__first'4(0) ⇔ n__terms'(0')
_gen_n__terms':cons':nil':n__first'4(+(x, 1)) ⇔ cons'(recip'(0'), _gen_n__terms':cons':nil':n__first'4(x))
_gen_s':0'5(0) ⇔ 0'
_gen_s':0'5(+(x, 1)) ⇔ s'(_gen_s':0'5(x))

The following defined symbols remain to be analysed:
dbl', sqr', activate'

They will be analysed ascendingly in the following order:
dbl' < sqr'


Proved the following rewrite lemma:
dbl'(_gen_s':0'5(_n862)) → _gen_s':0'5(*(2, _n862)), rt ∈ Ω(1 + n862)

Induction Base:
dbl'(_gen_s':0'5(0)) →RΩ(1)
0'

Induction Step:
dbl'(_gen_s':0'5(+(_$n863, 1))) →RΩ(1)
s'(s'(dbl'(_gen_s':0'5(_$n863)))) →IH
s'(s'(_gen_s':0'5(*(2, _$n863))))

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


Rules:
terms'(N) → cons'(recip'(sqr'(N)), n__terms'(s'(N)))
sqr'(0') → 0'
sqr'(s'(X)) → s'(add'(sqr'(X), dbl'(X)))
dbl'(0') → 0'
dbl'(s'(X)) → s'(s'(dbl'(X)))
add'(0', X) → X
add'(s'(X), Y) → s'(add'(X, Y))
first'(0', X) → nil'
first'(s'(X), cons'(Y, Z)) → cons'(Y, n__first'(X, activate'(Z)))
terms'(X) → n__terms'(X)
first'(X1, X2) → n__first'(X1, X2)
activate'(n__terms'(X)) → terms'(X)
activate'(n__first'(X1, X2)) → first'(X1, X2)
activate'(X) → X

Types:
terms' :: s':0' → n__terms':cons':nil':n__first'
cons' :: recip' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
recip' :: s':0' → recip'
sqr' :: s':0' → s':0'
n__terms' :: s':0' → n__terms':cons':nil':n__first'
s' :: s':0' → s':0'
0' :: s':0'
add' :: s':0' → s':0' → s':0'
dbl' :: s':0' → s':0'
first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
nil' :: n__terms':cons':nil':n__first'
n__first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
activate' :: n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
_hole_n__terms':cons':nil':n__first'1 :: n__terms':cons':nil':n__first'
_hole_s':0'2 :: s':0'
_hole_recip'3 :: recip'
_gen_n__terms':cons':nil':n__first'4 :: Nat → n__terms':cons':nil':n__first'
_gen_s':0'5 :: Nat → s':0'

Lemmas:
add'(_gen_s':0'5(_n7), _gen_s':0'5(b)) → _gen_s':0'5(+(_n7, b)), rt ∈ Ω(1 + n7)
dbl'(_gen_s':0'5(_n862)) → _gen_s':0'5(*(2, _n862)), rt ∈ Ω(1 + n862)

Generator Equations:
_gen_n__terms':cons':nil':n__first'4(0) ⇔ n__terms'(0')
_gen_n__terms':cons':nil':n__first'4(+(x, 1)) ⇔ cons'(recip'(0'), _gen_n__terms':cons':nil':n__first'4(x))
_gen_s':0'5(0) ⇔ 0'
_gen_s':0'5(+(x, 1)) ⇔ s'(_gen_s':0'5(x))

The following defined symbols remain to be analysed:
sqr', activate'


Proved the following rewrite lemma:
sqr'(_gen_s':0'5(_n1414)) → _gen_s':0'5(*(_n1414, _n1414)), rt ∈ Ω(1 + n1414 + n14142 + n14143)

Induction Base:
sqr'(_gen_s':0'5(0)) →RΩ(1)
0'

Induction Step:
sqr'(_gen_s':0'5(+(_$n1415, 1))) →RΩ(1)
s'(add'(sqr'(_gen_s':0'5(_$n1415)), dbl'(_gen_s':0'5(_$n1415)))) →IH
s'(add'(_gen_s':0'5(*(_$n1415, _$n1415)), dbl'(_gen_s':0'5(_$n1415)))) →LΩ(1 + $n1415)
s'(add'(_gen_s':0'5(*(_$n1415, _$n1415)), _gen_s':0'5(*(2, _$n1415)))) →LΩ(1 + $n14152)
s'(_gen_s':0'5(+(*(_$n1415, _$n1415), *(2, _$n1415))))

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


Rules:
terms'(N) → cons'(recip'(sqr'(N)), n__terms'(s'(N)))
sqr'(0') → 0'
sqr'(s'(X)) → s'(add'(sqr'(X), dbl'(X)))
dbl'(0') → 0'
dbl'(s'(X)) → s'(s'(dbl'(X)))
add'(0', X) → X
add'(s'(X), Y) → s'(add'(X, Y))
first'(0', X) → nil'
first'(s'(X), cons'(Y, Z)) → cons'(Y, n__first'(X, activate'(Z)))
terms'(X) → n__terms'(X)
first'(X1, X2) → n__first'(X1, X2)
activate'(n__terms'(X)) → terms'(X)
activate'(n__first'(X1, X2)) → first'(X1, X2)
activate'(X) → X

Types:
terms' :: s':0' → n__terms':cons':nil':n__first'
cons' :: recip' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
recip' :: s':0' → recip'
sqr' :: s':0' → s':0'
n__terms' :: s':0' → n__terms':cons':nil':n__first'
s' :: s':0' → s':0'
0' :: s':0'
add' :: s':0' → s':0' → s':0'
dbl' :: s':0' → s':0'
first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
nil' :: n__terms':cons':nil':n__first'
n__first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
activate' :: n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
_hole_n__terms':cons':nil':n__first'1 :: n__terms':cons':nil':n__first'
_hole_s':0'2 :: s':0'
_hole_recip'3 :: recip'
_gen_n__terms':cons':nil':n__first'4 :: Nat → n__terms':cons':nil':n__first'
_gen_s':0'5 :: Nat → s':0'

Lemmas:
add'(_gen_s':0'5(_n7), _gen_s':0'5(b)) → _gen_s':0'5(+(_n7, b)), rt ∈ Ω(1 + n7)
dbl'(_gen_s':0'5(_n862)) → _gen_s':0'5(*(2, _n862)), rt ∈ Ω(1 + n862)
sqr'(_gen_s':0'5(_n1414)) → _gen_s':0'5(*(_n1414, _n1414)), rt ∈ Ω(1 + n1414 + n14142 + n14143)

Generator Equations:
_gen_n__terms':cons':nil':n__first'4(0) ⇔ n__terms'(0')
_gen_n__terms':cons':nil':n__first'4(+(x, 1)) ⇔ cons'(recip'(0'), _gen_n__terms':cons':nil':n__first'4(x))
_gen_s':0'5(0) ⇔ 0'
_gen_s':0'5(+(x, 1)) ⇔ s'(_gen_s':0'5(x))

The following defined symbols remain to be analysed:
activate'


Could not prove a rewrite lemma for the defined symbol activate'.


Rules:
terms'(N) → cons'(recip'(sqr'(N)), n__terms'(s'(N)))
sqr'(0') → 0'
sqr'(s'(X)) → s'(add'(sqr'(X), dbl'(X)))
dbl'(0') → 0'
dbl'(s'(X)) → s'(s'(dbl'(X)))
add'(0', X) → X
add'(s'(X), Y) → s'(add'(X, Y))
first'(0', X) → nil'
first'(s'(X), cons'(Y, Z)) → cons'(Y, n__first'(X, activate'(Z)))
terms'(X) → n__terms'(X)
first'(X1, X2) → n__first'(X1, X2)
activate'(n__terms'(X)) → terms'(X)
activate'(n__first'(X1, X2)) → first'(X1, X2)
activate'(X) → X

Types:
terms' :: s':0' → n__terms':cons':nil':n__first'
cons' :: recip' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
recip' :: s':0' → recip'
sqr' :: s':0' → s':0'
n__terms' :: s':0' → n__terms':cons':nil':n__first'
s' :: s':0' → s':0'
0' :: s':0'
add' :: s':0' → s':0' → s':0'
dbl' :: s':0' → s':0'
first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
nil' :: n__terms':cons':nil':n__first'
n__first' :: s':0' → n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
activate' :: n__terms':cons':nil':n__first' → n__terms':cons':nil':n__first'
_hole_n__terms':cons':nil':n__first'1 :: n__terms':cons':nil':n__first'
_hole_s':0'2 :: s':0'
_hole_recip'3 :: recip'
_gen_n__terms':cons':nil':n__first'4 :: Nat → n__terms':cons':nil':n__first'
_gen_s':0'5 :: Nat → s':0'

Lemmas:
add'(_gen_s':0'5(_n7), _gen_s':0'5(b)) → _gen_s':0'5(+(_n7, b)), rt ∈ Ω(1 + n7)
dbl'(_gen_s':0'5(_n862)) → _gen_s':0'5(*(2, _n862)), rt ∈ Ω(1 + n862)
sqr'(_gen_s':0'5(_n1414)) → _gen_s':0'5(*(_n1414, _n1414)), rt ∈ Ω(1 + n1414 + n14142 + n14143)

Generator Equations:
_gen_n__terms':cons':nil':n__first'4(0) ⇔ n__terms'(0')
_gen_n__terms':cons':nil':n__first'4(+(x, 1)) ⇔ cons'(recip'(0'), _gen_n__terms':cons':nil':n__first'4(x))
_gen_s':0'5(0) ⇔ 0'
_gen_s':0'5(+(x, 1)) ⇔ s'(_gen_s':0'5(x))

No more defined symbols left to analyse.


The lowerbound Ω(n3) was proven with the following lemma:
sqr'(_gen_s':0'5(_n1414)) → _gen_s':0'5(*(_n1414, _n1414)), rt ∈ Ω(1 + n1414 + n14142 + n14143)