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

sqr(0) → 0
sqr(s(x)) → +(sqr(x), s(double(x)))
double(0) → 0
double(s(x)) → s(s(double(x)))
+(x, 0) → x
+(x, s(y)) → s(+(x, y))
sqr(s(x)) → s(+(sqr(x), double(x)))

Rewrite Strategy: INNERMOST


Renamed function symbols to avoid clashes with predefined symbol.


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


sqr'(0') → 0'
sqr'(s'(x)) → +'(sqr'(x), s'(double'(x)))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
sqr'(s'(x)) → s'(+'(sqr'(x), double'(x)))

Rewrite Strategy: INNERMOST


Infered types.


Rules:
sqr'(0') → 0'
sqr'(s'(x)) → +'(sqr'(x), s'(double'(x)))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
sqr'(s'(x)) → s'(+'(sqr'(x), double'(x)))

Types:
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
+' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_gen_0':s'2 :: Nat → 0':s'


Heuristically decided to analyse the following defined symbols:
sqr', +', double'

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


Rules:
sqr'(0') → 0'
sqr'(s'(x)) → +'(sqr'(x), s'(double'(x)))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
sqr'(s'(x)) → s'(+'(sqr'(x), double'(x)))

Types:
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
+' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_gen_0':s'2 :: Nat → 0':s'

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

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

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


Proved the following rewrite lemma:
+'(_gen_0':s'2(a), _gen_0':s'2(_n4)) → _gen_0':s'2(+(_n4, a)), rt ∈ Ω(1 + n4)

Induction Base:
+'(_gen_0':s'2(a), _gen_0':s'2(0)) →RΩ(1)
_gen_0':s'2(a)

Induction Step:
+'(_gen_0':s'2(_a137), _gen_0':s'2(+(_$n5, 1))) →RΩ(1)
s'(+'(_gen_0':s'2(_a137), _gen_0':s'2(_$n5))) →IH
s'(_gen_0':s'2(+(_$n5, _a137)))

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


Rules:
sqr'(0') → 0'
sqr'(s'(x)) → +'(sqr'(x), s'(double'(x)))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
sqr'(s'(x)) → s'(+'(sqr'(x), double'(x)))

Types:
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
+' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_gen_0':s'2 :: Nat → 0':s'

Lemmas:
+'(_gen_0':s'2(a), _gen_0':s'2(_n4)) → _gen_0':s'2(+(_n4, a)), rt ∈ Ω(1 + n4)

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

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

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


Proved the following rewrite lemma:
double'(_gen_0':s'2(_n436)) → _gen_0':s'2(*(2, _n436)), rt ∈ Ω(1 + n436)

Induction Base:
double'(_gen_0':s'2(0)) →RΩ(1)
0'

Induction Step:
double'(_gen_0':s'2(+(_$n437, 1))) →RΩ(1)
s'(s'(double'(_gen_0':s'2(_$n437)))) →IH
s'(s'(_gen_0':s'2(*(2, _$n437))))

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


Rules:
sqr'(0') → 0'
sqr'(s'(x)) → +'(sqr'(x), s'(double'(x)))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
sqr'(s'(x)) → s'(+'(sqr'(x), double'(x)))

Types:
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
+' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_gen_0':s'2 :: Nat → 0':s'

Lemmas:
+'(_gen_0':s'2(a), _gen_0':s'2(_n4)) → _gen_0':s'2(+(_n4, a)), rt ∈ Ω(1 + n4)
double'(_gen_0':s'2(_n436)) → _gen_0':s'2(*(2, _n436)), rt ∈ Ω(1 + n436)

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

The following defined symbols remain to be analysed:
sqr'


Proved the following rewrite lemma:
sqr'(_gen_0':s'2(_n736)) → _gen_0':s'2(*(_n736, _n736)), rt ∈ Ω(1 + n736 + n7362)

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

Induction Step:
sqr'(_gen_0':s'2(+(_$n737, 1))) →RΩ(1)
+'(sqr'(_gen_0':s'2(_$n737)), s'(double'(_gen_0':s'2(_$n737)))) →IH
+'(_gen_0':s'2(*(_$n737, _$n737)), s'(double'(_gen_0':s'2(_$n737)))) →LΩ(1 + $n737)
+'(_gen_0':s'2(*(_$n737, _$n737)), s'(_gen_0':s'2(*(2, _$n737)))) →LΩ(2 + 2·$n737)
_gen_0':s'2(+(+(*(2, _$n737), 1), *(_$n737, _$n737)))

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


Rules:
sqr'(0') → 0'
sqr'(s'(x)) → +'(sqr'(x), s'(double'(x)))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
+'(x, 0') → x
+'(x, s'(y)) → s'(+'(x, y))
sqr'(s'(x)) → s'(+'(sqr'(x), double'(x)))

Types:
sqr' :: 0':s' → 0':s'
0' :: 0':s'
s' :: 0':s' → 0':s'
+' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
_hole_0':s'1 :: 0':s'
_gen_0':s'2 :: Nat → 0':s'

Lemmas:
+'(_gen_0':s'2(a), _gen_0':s'2(_n4)) → _gen_0':s'2(+(_n4, a)), rt ∈ Ω(1 + n4)
double'(_gen_0':s'2(_n436)) → _gen_0':s'2(*(2, _n436)), rt ∈ Ω(1 + n436)
sqr'(_gen_0':s'2(_n736)) → _gen_0':s'2(*(_n736, _n736)), rt ∈ Ω(1 + n736 + n7362)

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

No more defined symbols left to analyse.


The lowerbound Ω(n2) was proven with the following lemma:
sqr'(_gen_0':s'2(_n736)) → _gen_0':s'2(*(_n736, _n736)), rt ∈ Ω(1 + n736 + n7362)