Runtime Complexity TRS:
The TRS R consists of the following rules:
p(s(x)) → x
p(0) → 0
le(0, y) → true
le(s(x), 0) → false
le(s(x), s(y)) → le(x, y)
average(x, y) → if(le(x, 0), le(y, 0), le(y, s(0)), le(y, s(s(0))), x, y)
if(true, b1, b2, b3, x, y) → if2(b1, b2, b3, x, y)
if(false, b1, b2, b3, x, y) → average(p(x), s(y))
if2(true, b2, b3, x, y) → 0
if2(false, b2, b3, x, y) → if3(b2, b3, x, y)
if3(true, b3, x, y) → 0
if3(false, b3, x, y) → if4(b3, x, y)
if4(true, x, y) → s(0)
if4(false, x, y) → average(s(x), p(p(y)))
Renamed function symbols to avoid clashes with predefined symbol.
Runtime Complexity TRS:
The TRS R consists of the following rules:
p'(s'(x)) → x
p'(0') → 0'
le'(0', y) → true'
le'(s'(x), 0') → false'
le'(s'(x), s'(y)) → le'(x, y)
average'(x, y) → if'(le'(x, 0'), le'(y, 0'), le'(y, s'(0')), le'(y, s'(s'(0'))), x, y)
if'(true', b1, b2, b3, x, y) → if2'(b1, b2, b3, x, y)
if'(false', b1, b2, b3, x, y) → average'(p'(x), s'(y))
if2'(true', b2, b3, x, y) → 0'
if2'(false', b2, b3, x, y) → if3'(b2, b3, x, y)
if3'(true', b3, x, y) → 0'
if3'(false', b3, x, y) → if4'(b3, x, y)
if4'(true', x, y) → s'(0')
if4'(false', x, y) → average'(s'(x), p'(p'(y)))
Infered types.
Rules:
p'(s'(x)) → x
p'(0') → 0'
le'(0', y) → true'
le'(s'(x), 0') → false'
le'(s'(x), s'(y)) → le'(x, y)
average'(x, y) → if'(le'(x, 0'), le'(y, 0'), le'(y, s'(0')), le'(y, s'(s'(0'))), x, y)
if'(true', b1, b2, b3, x, y) → if2'(b1, b2, b3, x, y)
if'(false', b1, b2, b3, x, y) → average'(p'(x), s'(y))
if2'(true', b2, b3, x, y) → 0'
if2'(false', b2, b3, x, y) → if3'(b2, b3, x, y)
if3'(true', b3, x, y) → 0'
if3'(false', b3, x, y) → if4'(b3, x, y)
if4'(true', x, y) → s'(0')
if4'(false', x, y) → average'(s'(x), p'(p'(y)))
Types:
p' :: s':0' → s':0'
s' :: s':0' → s':0'
0' :: s':0'
le' :: s':0' → s':0' → true':false'
true' :: true':false'
false' :: true':false'
average' :: s':0' → s':0' → s':0'
if' :: true':false' → true':false' → true':false' → true':false' → s':0' → s':0' → s':0'
if2' :: true':false' → true':false' → true':false' → s':0' → s':0' → s':0'
if3' :: true':false' → true':false' → s':0' → s':0' → s':0'
if4' :: true':false' → s':0' → s':0' → s':0'
_hole_s':0'1 :: s':0'
_hole_true':false'2 :: true':false'
_gen_s':0'3 :: Nat → s':0'
Heuristically decided to analyse the following defined symbols:
le', average'
They will be analysed ascendingly in the following order:
le' < average'
Rules:
p'(s'(x)) → x
p'(0') → 0'
le'(0', y) → true'
le'(s'(x), 0') → false'
le'(s'(x), s'(y)) → le'(x, y)
average'(x, y) → if'(le'(x, 0'), le'(y, 0'), le'(y, s'(0')), le'(y, s'(s'(0'))), x, y)
if'(true', b1, b2, b3, x, y) → if2'(b1, b2, b3, x, y)
if'(false', b1, b2, b3, x, y) → average'(p'(x), s'(y))
if2'(true', b2, b3, x, y) → 0'
if2'(false', b2, b3, x, y) → if3'(b2, b3, x, y)
if3'(true', b3, x, y) → 0'
if3'(false', b3, x, y) → if4'(b3, x, y)
if4'(true', x, y) → s'(0')
if4'(false', x, y) → average'(s'(x), p'(p'(y)))
Types:
p' :: s':0' → s':0'
s' :: s':0' → s':0'
0' :: s':0'
le' :: s':0' → s':0' → true':false'
true' :: true':false'
false' :: true':false'
average' :: s':0' → s':0' → s':0'
if' :: true':false' → true':false' → true':false' → true':false' → s':0' → s':0' → s':0'
if2' :: true':false' → true':false' → true':false' → s':0' → s':0' → s':0'
if3' :: true':false' → true':false' → s':0' → s':0' → s':0'
if4' :: true':false' → s':0' → s':0' → s':0'
_hole_s':0'1 :: s':0'
_hole_true':false'2 :: true':false'
_gen_s':0'3 :: Nat → s':0'
Generator Equations:
_gen_s':0'3(0) ⇔ 0'
_gen_s':0'3(+(x, 1)) ⇔ s'(_gen_s':0'3(x))
The following defined symbols remain to be analysed:
le', average'
They will be analysed ascendingly in the following order:
le' < average'
Proved the following rewrite lemma:
le'(_gen_s':0'3(_n5), _gen_s':0'3(_n5)) → true', rt ∈ Ω(1 + n5)
Induction Base:
le'(_gen_s':0'3(0), _gen_s':0'3(0)) →RΩ(1)
true'
Induction Step:
le'(_gen_s':0'3(+(_$n6, 1)), _gen_s':0'3(+(_$n6, 1))) →RΩ(1)
le'(_gen_s':0'3(_$n6), _gen_s':0'3(_$n6)) →IH
true'
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
p'(s'(x)) → x
p'(0') → 0'
le'(0', y) → true'
le'(s'(x), 0') → false'
le'(s'(x), s'(y)) → le'(x, y)
average'(x, y) → if'(le'(x, 0'), le'(y, 0'), le'(y, s'(0')), le'(y, s'(s'(0'))), x, y)
if'(true', b1, b2, b3, x, y) → if2'(b1, b2, b3, x, y)
if'(false', b1, b2, b3, x, y) → average'(p'(x), s'(y))
if2'(true', b2, b3, x, y) → 0'
if2'(false', b2, b3, x, y) → if3'(b2, b3, x, y)
if3'(true', b3, x, y) → 0'
if3'(false', b3, x, y) → if4'(b3, x, y)
if4'(true', x, y) → s'(0')
if4'(false', x, y) → average'(s'(x), p'(p'(y)))
Types:
p' :: s':0' → s':0'
s' :: s':0' → s':0'
0' :: s':0'
le' :: s':0' → s':0' → true':false'
true' :: true':false'
false' :: true':false'
average' :: s':0' → s':0' → s':0'
if' :: true':false' → true':false' → true':false' → true':false' → s':0' → s':0' → s':0'
if2' :: true':false' → true':false' → true':false' → s':0' → s':0' → s':0'
if3' :: true':false' → true':false' → s':0' → s':0' → s':0'
if4' :: true':false' → s':0' → s':0' → s':0'
_hole_s':0'1 :: s':0'
_hole_true':false'2 :: true':false'
_gen_s':0'3 :: Nat → s':0'
Lemmas:
le'(_gen_s':0'3(_n5), _gen_s':0'3(_n5)) → true', rt ∈ Ω(1 + n5)
Generator Equations:
_gen_s':0'3(0) ⇔ 0'
_gen_s':0'3(+(x, 1)) ⇔ s'(_gen_s':0'3(x))
The following defined symbols remain to be analysed:
average'
Could not prove a rewrite lemma for the defined symbol average'.
Rules:
p'(s'(x)) → x
p'(0') → 0'
le'(0', y) → true'
le'(s'(x), 0') → false'
le'(s'(x), s'(y)) → le'(x, y)
average'(x, y) → if'(le'(x, 0'), le'(y, 0'), le'(y, s'(0')), le'(y, s'(s'(0'))), x, y)
if'(true', b1, b2, b3, x, y) → if2'(b1, b2, b3, x, y)
if'(false', b1, b2, b3, x, y) → average'(p'(x), s'(y))
if2'(true', b2, b3, x, y) → 0'
if2'(false', b2, b3, x, y) → if3'(b2, b3, x, y)
if3'(true', b3, x, y) → 0'
if3'(false', b3, x, y) → if4'(b3, x, y)
if4'(true', x, y) → s'(0')
if4'(false', x, y) → average'(s'(x), p'(p'(y)))
Types:
p' :: s':0' → s':0'
s' :: s':0' → s':0'
0' :: s':0'
le' :: s':0' → s':0' → true':false'
true' :: true':false'
false' :: true':false'
average' :: s':0' → s':0' → s':0'
if' :: true':false' → true':false' → true':false' → true':false' → s':0' → s':0' → s':0'
if2' :: true':false' → true':false' → true':false' → s':0' → s':0' → s':0'
if3' :: true':false' → true':false' → s':0' → s':0' → s':0'
if4' :: true':false' → s':0' → s':0' → s':0'
_hole_s':0'1 :: s':0'
_hole_true':false'2 :: true':false'
_gen_s':0'3 :: Nat → s':0'
Lemmas:
le'(_gen_s':0'3(_n5), _gen_s':0'3(_n5)) → true', rt ∈ Ω(1 + n5)
Generator Equations:
_gen_s':0'3(0) ⇔ 0'
_gen_s':0'3(+(x, 1)) ⇔ s'(_gen_s':0'3(x))
No more defined symbols left to analyse.
The lowerbound Ω(n) was proven with the following lemma:
le'(_gen_s':0'3(_n5), _gen_s':0'3(_n5)) → true', rt ∈ Ω(1 + n5)