Runtime Complexity TRS:
The TRS R consists of the following rules:
nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)
Renamed function symbols to avoid clashes with predefined symbol.
Runtime Complexity TRS:
The TRS R consists of the following rules:
nthtail'(n, l) → cond'(ge'(n, length'(l)), n, l)
cond'(true', n, l) → l
cond'(false', n, l) → tail'(nthtail'(s'(n), l))
tail'(nil') → nil'
tail'(cons'(x, l)) → l
length'(nil') → 0'
length'(cons'(x, l)) → s'(length'(l))
ge'(u, 0') → true'
ge'(0', s'(v)) → false'
ge'(s'(u), s'(v)) → ge'(u, v)
Sliced the following arguments:
cons'/0
Runtime Complexity TRS:
The TRS R consists of the following rules:
nthtail'(n, l) → cond'(ge'(n, length'(l)), n, l)
cond'(true', n, l) → l
cond'(false', n, l) → tail'(nthtail'(s'(n), l))
tail'(nil') → nil'
tail'(cons'(l)) → l
length'(nil') → 0'
length'(cons'(l)) → s'(length'(l))
ge'(u, 0') → true'
ge'(0', s'(v)) → false'
ge'(s'(u), s'(v)) → ge'(u, v)
Infered types.
Rules:
nthtail'(n, l) → cond'(ge'(n, length'(l)), n, l)
cond'(true', n, l) → l
cond'(false', n, l) → tail'(nthtail'(s'(n), l))
tail'(nil') → nil'
tail'(cons'(l)) → l
length'(nil') → 0'
length'(cons'(l)) → s'(length'(l))
ge'(u, 0') → true'
ge'(0', s'(v)) → false'
ge'(s'(u), s'(v)) → ge'(u, v)
Types:
nthtail' :: s':0' → nil':cons' → nil':cons'
cond' :: true':false' → s':0' → nil':cons' → nil':cons'
ge' :: s':0' → s':0' → true':false'
length' :: nil':cons' → s':0'
true' :: true':false'
false' :: true':false'
tail' :: nil':cons' → nil':cons'
s' :: s':0' → s':0'
nil' :: nil':cons'
cons' :: nil':cons' → nil':cons'
0' :: s':0'
_hole_nil':cons'1 :: nil':cons'
_hole_s':0'2 :: s':0'
_hole_true':false'3 :: true':false'
_gen_nil':cons'4 :: Nat → nil':cons'
_gen_s':0'5 :: Nat → s':0'
Heuristically decided to analyse the following defined symbols:
nthtail', ge', length'
They will be analysed ascendingly in the following order:
ge' < nthtail'
length' < nthtail'
Rules:
nthtail'(n, l) → cond'(ge'(n, length'(l)), n, l)
cond'(true', n, l) → l
cond'(false', n, l) → tail'(nthtail'(s'(n), l))
tail'(nil') → nil'
tail'(cons'(l)) → l
length'(nil') → 0'
length'(cons'(l)) → s'(length'(l))
ge'(u, 0') → true'
ge'(0', s'(v)) → false'
ge'(s'(u), s'(v)) → ge'(u, v)
Types:
nthtail' :: s':0' → nil':cons' → nil':cons'
cond' :: true':false' → s':0' → nil':cons' → nil':cons'
ge' :: s':0' → s':0' → true':false'
length' :: nil':cons' → s':0'
true' :: true':false'
false' :: true':false'
tail' :: nil':cons' → nil':cons'
s' :: s':0' → s':0'
nil' :: nil':cons'
cons' :: nil':cons' → nil':cons'
0' :: s':0'
_hole_nil':cons'1 :: nil':cons'
_hole_s':0'2 :: s':0'
_hole_true':false'3 :: true':false'
_gen_nil':cons'4 :: Nat → nil':cons'
_gen_s':0'5 :: Nat → s':0'
Generator Equations:
_gen_nil':cons'4(0) ⇔ nil'
_gen_nil':cons'4(+(x, 1)) ⇔ cons'(_gen_nil':cons'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:
ge', nthtail', length'
They will be analysed ascendingly in the following order:
ge' < nthtail'
length' < nthtail'
Proved the following rewrite lemma:
ge'(_gen_s':0'5(_n7), _gen_s':0'5(_n7)) → true', rt ∈ Ω(1 + n7)
Induction Base:
ge'(_gen_s':0'5(0), _gen_s':0'5(0)) →RΩ(1)
true'
Induction Step:
ge'(_gen_s':0'5(+(_$n8, 1)), _gen_s':0'5(+(_$n8, 1))) →RΩ(1)
ge'(_gen_s':0'5(_$n8), _gen_s':0'5(_$n8)) →IH
true'
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
nthtail'(n, l) → cond'(ge'(n, length'(l)), n, l)
cond'(true', n, l) → l
cond'(false', n, l) → tail'(nthtail'(s'(n), l))
tail'(nil') → nil'
tail'(cons'(l)) → l
length'(nil') → 0'
length'(cons'(l)) → s'(length'(l))
ge'(u, 0') → true'
ge'(0', s'(v)) → false'
ge'(s'(u), s'(v)) → ge'(u, v)
Types:
nthtail' :: s':0' → nil':cons' → nil':cons'
cond' :: true':false' → s':0' → nil':cons' → nil':cons'
ge' :: s':0' → s':0' → true':false'
length' :: nil':cons' → s':0'
true' :: true':false'
false' :: true':false'
tail' :: nil':cons' → nil':cons'
s' :: s':0' → s':0'
nil' :: nil':cons'
cons' :: nil':cons' → nil':cons'
0' :: s':0'
_hole_nil':cons'1 :: nil':cons'
_hole_s':0'2 :: s':0'
_hole_true':false'3 :: true':false'
_gen_nil':cons'4 :: Nat → nil':cons'
_gen_s':0'5 :: Nat → s':0'
Lemmas:
ge'(_gen_s':0'5(_n7), _gen_s':0'5(_n7)) → true', rt ∈ Ω(1 + n7)
Generator Equations:
_gen_nil':cons'4(0) ⇔ nil'
_gen_nil':cons'4(+(x, 1)) ⇔ cons'(_gen_nil':cons'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:
length', nthtail'
They will be analysed ascendingly in the following order:
length' < nthtail'
Proved the following rewrite lemma:
length'(_gen_nil':cons'4(_n446)) → _gen_s':0'5(_n446), rt ∈ Ω(1 + n446)
Induction Base:
length'(_gen_nil':cons'4(0)) →RΩ(1)
0'
Induction Step:
length'(_gen_nil':cons'4(+(_$n447, 1))) →RΩ(1)
s'(length'(_gen_nil':cons'4(_$n447))) →IH
s'(_gen_s':0'5(_$n447))
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
nthtail'(n, l) → cond'(ge'(n, length'(l)), n, l)
cond'(true', n, l) → l
cond'(false', n, l) → tail'(nthtail'(s'(n), l))
tail'(nil') → nil'
tail'(cons'(l)) → l
length'(nil') → 0'
length'(cons'(l)) → s'(length'(l))
ge'(u, 0') → true'
ge'(0', s'(v)) → false'
ge'(s'(u), s'(v)) → ge'(u, v)
Types:
nthtail' :: s':0' → nil':cons' → nil':cons'
cond' :: true':false' → s':0' → nil':cons' → nil':cons'
ge' :: s':0' → s':0' → true':false'
length' :: nil':cons' → s':0'
true' :: true':false'
false' :: true':false'
tail' :: nil':cons' → nil':cons'
s' :: s':0' → s':0'
nil' :: nil':cons'
cons' :: nil':cons' → nil':cons'
0' :: s':0'
_hole_nil':cons'1 :: nil':cons'
_hole_s':0'2 :: s':0'
_hole_true':false'3 :: true':false'
_gen_nil':cons'4 :: Nat → nil':cons'
_gen_s':0'5 :: Nat → s':0'
Lemmas:
ge'(_gen_s':0'5(_n7), _gen_s':0'5(_n7)) → true', rt ∈ Ω(1 + n7)
length'(_gen_nil':cons'4(_n446)) → _gen_s':0'5(_n446), rt ∈ Ω(1 + n446)
Generator Equations:
_gen_nil':cons'4(0) ⇔ nil'
_gen_nil':cons'4(+(x, 1)) ⇔ cons'(_gen_nil':cons'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:
nthtail'
Could not prove a rewrite lemma for the defined symbol nthtail'.
Rules:
nthtail'(n, l) → cond'(ge'(n, length'(l)), n, l)
cond'(true', n, l) → l
cond'(false', n, l) → tail'(nthtail'(s'(n), l))
tail'(nil') → nil'
tail'(cons'(l)) → l
length'(nil') → 0'
length'(cons'(l)) → s'(length'(l))
ge'(u, 0') → true'
ge'(0', s'(v)) → false'
ge'(s'(u), s'(v)) → ge'(u, v)
Types:
nthtail' :: s':0' → nil':cons' → nil':cons'
cond' :: true':false' → s':0' → nil':cons' → nil':cons'
ge' :: s':0' → s':0' → true':false'
length' :: nil':cons' → s':0'
true' :: true':false'
false' :: true':false'
tail' :: nil':cons' → nil':cons'
s' :: s':0' → s':0'
nil' :: nil':cons'
cons' :: nil':cons' → nil':cons'
0' :: s':0'
_hole_nil':cons'1 :: nil':cons'
_hole_s':0'2 :: s':0'
_hole_true':false'3 :: true':false'
_gen_nil':cons'4 :: Nat → nil':cons'
_gen_s':0'5 :: Nat → s':0'
Lemmas:
ge'(_gen_s':0'5(_n7), _gen_s':0'5(_n7)) → true', rt ∈ Ω(1 + n7)
length'(_gen_nil':cons'4(_n446)) → _gen_s':0'5(_n446), rt ∈ Ω(1 + n446)
Generator Equations:
_gen_nil':cons'4(0) ⇔ nil'
_gen_nil':cons'4(+(x, 1)) ⇔ cons'(_gen_nil':cons'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 Ω(n) was proven with the following lemma:
ge'(_gen_s':0'5(_n7), _gen_s':0'5(_n7)) → true', rt ∈ Ω(1 + n7)