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

terms(N) → cons(recip(sqr(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)) → cons(Y)

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)))
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)) → cons'(Y)

Rewrite Strategy: INNERMOST


Infered types.


Rules:
terms'(N) → cons'(recip'(sqr'(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)) → cons'(Y)

Types:
terms' :: 0':s' → cons':nil'
cons' :: recip' → cons':nil'
recip' :: 0':s' → recip'
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
add' :: 0':s' → 0':s' → 0':s'
dbl' :: 0':s' → 0':s'
first' :: 0':s' → cons':nil' → cons':nil'
nil' :: cons':nil'
_hole_cons':nil'1 :: cons':nil'
_hole_0':s'2 :: 0':s'
_hole_recip'3 :: recip'
_gen_0':s'4 :: Nat → 0':s'


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

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


Rules:
terms'(N) → cons'(recip'(sqr'(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)) → cons'(Y)

Types:
terms' :: 0':s' → cons':nil'
cons' :: recip' → cons':nil'
recip' :: 0':s' → recip'
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
add' :: 0':s' → 0':s' → 0':s'
dbl' :: 0':s' → 0':s'
first' :: 0':s' → cons':nil' → cons':nil'
nil' :: cons':nil'
_hole_cons':nil'1 :: cons':nil'
_hole_0':s'2 :: 0':s'
_hole_recip'3 :: recip'
_gen_0':s'4 :: Nat → 0':s'

Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))

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

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


Proved the following rewrite lemma:
add'(_gen_0':s'4(_n6), _gen_0':s'4(b)) → _gen_0':s'4(+(_n6, b)), rt ∈ Ω(1 + n6)

Induction Base:
add'(_gen_0':s'4(0), _gen_0':s'4(b)) →RΩ(1)
_gen_0':s'4(b)

Induction Step:
add'(_gen_0':s'4(+(_$n7, 1)), _gen_0':s'4(_b139)) →RΩ(1)
s'(add'(_gen_0':s'4(_$n7), _gen_0':s'4(_b139))) →IH
s'(_gen_0':s'4(+(_$n7, _b139)))

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


Rules:
terms'(N) → cons'(recip'(sqr'(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)) → cons'(Y)

Types:
terms' :: 0':s' → cons':nil'
cons' :: recip' → cons':nil'
recip' :: 0':s' → recip'
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
add' :: 0':s' → 0':s' → 0':s'
dbl' :: 0':s' → 0':s'
first' :: 0':s' → cons':nil' → cons':nil'
nil' :: cons':nil'
_hole_cons':nil'1 :: cons':nil'
_hole_0':s'2 :: 0':s'
_hole_recip'3 :: recip'
_gen_0':s'4 :: Nat → 0':s'

Lemmas:
add'(_gen_0':s'4(_n6), _gen_0':s'4(b)) → _gen_0':s'4(+(_n6, b)), rt ∈ Ω(1 + n6)

Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))

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

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


Proved the following rewrite lemma:
dbl'(_gen_0':s'4(_n518)) → _gen_0':s'4(*(2, _n518)), rt ∈ Ω(1 + n518)

Induction Base:
dbl'(_gen_0':s'4(0)) →RΩ(1)
0'

Induction Step:
dbl'(_gen_0':s'4(+(_$n519, 1))) →RΩ(1)
s'(s'(dbl'(_gen_0':s'4(_$n519)))) →IH
s'(s'(_gen_0':s'4(*(2, _$n519))))

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


Rules:
terms'(N) → cons'(recip'(sqr'(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)) → cons'(Y)

Types:
terms' :: 0':s' → cons':nil'
cons' :: recip' → cons':nil'
recip' :: 0':s' → recip'
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
add' :: 0':s' → 0':s' → 0':s'
dbl' :: 0':s' → 0':s'
first' :: 0':s' → cons':nil' → cons':nil'
nil' :: cons':nil'
_hole_cons':nil'1 :: cons':nil'
_hole_0':s'2 :: 0':s'
_hole_recip'3 :: recip'
_gen_0':s'4 :: Nat → 0':s'

Lemmas:
add'(_gen_0':s'4(_n6), _gen_0':s'4(b)) → _gen_0':s'4(+(_n6, b)), rt ∈ Ω(1 + n6)
dbl'(_gen_0':s'4(_n518)) → _gen_0':s'4(*(2, _n518)), rt ∈ Ω(1 + n518)

Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))

The following defined symbols remain to be analysed:
sqr'


Proved the following rewrite lemma:
sqr'(_gen_0':s'4(_n876)) → _gen_0':s'4(*(_n876, _n876)), rt ∈ Ω(1 + n876 + n8762 + n8763)

Induction Base:
sqr'(_gen_0':s'4(0)) →RΩ(1)
0'

Induction Step:
sqr'(_gen_0':s'4(+(_$n877, 1))) →RΩ(1)
s'(add'(sqr'(_gen_0':s'4(_$n877)), dbl'(_gen_0':s'4(_$n877)))) →IH
s'(add'(_gen_0':s'4(*(_$n877, _$n877)), dbl'(_gen_0':s'4(_$n877)))) →LΩ(1 + $n877)
s'(add'(_gen_0':s'4(*(_$n877, _$n877)), _gen_0':s'4(*(2, _$n877)))) →LΩ(1 + $n8772)
s'(_gen_0':s'4(+(*(_$n877, _$n877), *(2, _$n877))))

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


Rules:
terms'(N) → cons'(recip'(sqr'(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)) → cons'(Y)

Types:
terms' :: 0':s' → cons':nil'
cons' :: recip' → cons':nil'
recip' :: 0':s' → recip'
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
add' :: 0':s' → 0':s' → 0':s'
dbl' :: 0':s' → 0':s'
first' :: 0':s' → cons':nil' → cons':nil'
nil' :: cons':nil'
_hole_cons':nil'1 :: cons':nil'
_hole_0':s'2 :: 0':s'
_hole_recip'3 :: recip'
_gen_0':s'4 :: Nat → 0':s'

Lemmas:
add'(_gen_0':s'4(_n6), _gen_0':s'4(b)) → _gen_0':s'4(+(_n6, b)), rt ∈ Ω(1 + n6)
dbl'(_gen_0':s'4(_n518)) → _gen_0':s'4(*(2, _n518)), rt ∈ Ω(1 + n518)
sqr'(_gen_0':s'4(_n876)) → _gen_0':s'4(*(_n876, _n876)), rt ∈ Ω(1 + n876 + n8762 + n8763)

Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))

No more defined symbols left to analyse.


The lowerbound Ω(n3) was proven with the following lemma:
sqr'(_gen_0':s'4(_n876)) → _gen_0':s'4(*(_n876, _n876)), rt ∈ Ω(1 + n876 + n8762 + n8763)