(0) Obligation:
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)
Rewrite Strategy: FULL
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative 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)
S is empty.
Rewrite Strategy: FULL
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
TRS:
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)
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 :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
nthtail,
ge,
lengthThey will be analysed ascendingly in the following order:
ge < nthtail
length < nthtail
(6) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
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 :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(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
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
ge(
gen_s:0'6_0(
n8_0),
gen_s:0'6_0(
n8_0)) →
true, rt ∈ Ω(1 + n8
0)
Induction Base:
ge(gen_s:0'6_0(0), gen_s:0'6_0(0)) →RΩ(1)
true
Induction Step:
ge(gen_s:0'6_0(+(n8_0, 1)), gen_s:0'6_0(+(n8_0, 1))) →RΩ(1)
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) →IH
true
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
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 :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
The following defined symbols remain to be analysed:
length, nthtail
They will be analysed ascendingly in the following order:
length < nthtail
(10) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
length(
gen_nil:cons5_0(
n283_0)) →
gen_s:0'6_0(
n283_0), rt ∈ Ω(1 + n283
0)
Induction Base:
length(gen_nil:cons5_0(0)) →RΩ(1)
0'
Induction Step:
length(gen_nil:cons5_0(+(n283_0, 1))) →RΩ(1)
s(length(gen_nil:cons5_0(n283_0))) →IH
s(gen_s:0'6_0(c284_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(11) Complex Obligation (BEST)
(12) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
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 :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
length(gen_nil:cons5_0(n283_0)) → gen_s:0'6_0(n283_0), rt ∈ Ω(1 + n2830)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
The following defined symbols remain to be analysed:
nthtail
(13) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol nthtail.
(14) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
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 :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
length(gen_nil:cons5_0(n283_0)) → gen_s:0'6_0(n283_0), rt ∈ Ω(1 + n2830)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
No more defined symbols left to analyse.
(15) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
(16) BOUNDS(n^1, INF)
(17) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
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 :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
length(gen_nil:cons5_0(n283_0)) → gen_s:0'6_0(n283_0), rt ∈ Ω(1 + n2830)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
No more defined symbols left to analyse.
(18) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
(19) BOUNDS(n^1, INF)
(20) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
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 :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
No more defined symbols left to analyse.
(21) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
(22) BOUNDS(n^1, INF)