Runtime Complexity TRS:
The TRS R consists of the following rules:
gt(0, y) → false
gt(s(x), 0) → true
gt(s(x), s(y)) → gt(x, y)
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
double(0) → 0
double(s(x)) → s(s(double(x)))
average(x, y) → aver(plus(x, y), 0)
aver(sum, z) → if(gt(sum, double(z)), sum, z)
if(true, sum, z) → aver(sum, s(z))
if(false, sum, z) → z
Renamed function symbols to avoid clashes with predefined symbol.
Runtime Complexity TRS:
The TRS R consists of the following rules:
gt'(0', y) → false'
gt'(s'(x), 0') → true'
gt'(s'(x), s'(y)) → gt'(x, y)
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
average'(x, y) → aver'(plus'(x, y), 0')
aver'(sum, z) → if'(gt'(sum, double'(z)), sum, z)
if'(true', sum, z) → aver'(sum, s'(z))
if'(false', sum, z) → z
Infered types.
Rules:
gt'(0', y) → false'
gt'(s'(x), 0') → true'
gt'(s'(x), s'(y)) → gt'(x, y)
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
average'(x, y) → aver'(plus'(x, y), 0')
aver'(sum, z) → if'(gt'(sum, double'(z)), sum, z)
if'(true', sum, z) → aver'(sum, s'(z))
if'(false', sum, z) → z
Types:
gt' :: 0':s' → 0':s' → false':true'
0' :: 0':s'
false' :: false':true'
s' :: 0':s' → 0':s'
true' :: false':true'
plus' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
average' :: 0':s' → 0':s' → 0':s'
aver' :: 0':s' → 0':s' → 0':s'
if' :: false':true' → 0':s' → 0':s' → 0':s'
_hole_false':true'1 :: false':true'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'
Heuristically decided to analyse the following defined symbols:
gt', plus', double', aver'
They will be analysed ascendingly in the following order:
gt' < aver'
double' < aver'
Rules:
gt'(0', y) → false'
gt'(s'(x), 0') → true'
gt'(s'(x), s'(y)) → gt'(x, y)
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
average'(x, y) → aver'(plus'(x, y), 0')
aver'(sum, z) → if'(gt'(sum, double'(z)), sum, z)
if'(true', sum, z) → aver'(sum, s'(z))
if'(false', sum, z) → z
Types:
gt' :: 0':s' → 0':s' → false':true'
0' :: 0':s'
false' :: false':true'
s' :: 0':s' → 0':s'
true' :: false':true'
plus' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
average' :: 0':s' → 0':s' → 0':s'
aver' :: 0':s' → 0':s' → 0':s'
if' :: false':true' → 0':s' → 0':s' → 0':s'
_hole_false':true'1 :: false':true'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'
Generator Equations:
_gen_0':s'3(0) ⇔ 0'
_gen_0':s'3(+(x, 1)) ⇔ s'(_gen_0':s'3(x))
The following defined symbols remain to be analysed:
gt', plus', double', aver'
They will be analysed ascendingly in the following order:
gt' < aver'
double' < aver'
Proved the following rewrite lemma:
gt'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → false', rt ∈ Ω(1 + n5)
Induction Base:
gt'(_gen_0':s'3(0), _gen_0':s'3(0)) →RΩ(1)
false'
Induction Step:
gt'(_gen_0':s'3(+(_$n6, 1)), _gen_0':s'3(+(_$n6, 1))) →RΩ(1)
gt'(_gen_0':s'3(_$n6), _gen_0':s'3(_$n6)) →IH
false'
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
gt'(0', y) → false'
gt'(s'(x), 0') → true'
gt'(s'(x), s'(y)) → gt'(x, y)
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
average'(x, y) → aver'(plus'(x, y), 0')
aver'(sum, z) → if'(gt'(sum, double'(z)), sum, z)
if'(true', sum, z) → aver'(sum, s'(z))
if'(false', sum, z) → z
Types:
gt' :: 0':s' → 0':s' → false':true'
0' :: 0':s'
false' :: false':true'
s' :: 0':s' → 0':s'
true' :: false':true'
plus' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
average' :: 0':s' → 0':s' → 0':s'
aver' :: 0':s' → 0':s' → 0':s'
if' :: false':true' → 0':s' → 0':s' → 0':s'
_hole_false':true'1 :: false':true'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'
Lemmas:
gt'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → false', rt ∈ Ω(1 + n5)
Generator Equations:
_gen_0':s'3(0) ⇔ 0'
_gen_0':s'3(+(x, 1)) ⇔ s'(_gen_0':s'3(x))
The following defined symbols remain to be analysed:
plus', double', aver'
They will be analysed ascendingly in the following order:
double' < aver'
Proved the following rewrite lemma:
plus'(_gen_0':s'3(_n566), _gen_0':s'3(b)) → _gen_0':s'3(+(_n566, b)), rt ∈ Ω(1 + n566)
Induction Base:
plus'(_gen_0':s'3(0), _gen_0':s'3(b)) →RΩ(1)
_gen_0':s'3(b)
Induction Step:
plus'(_gen_0':s'3(+(_$n567, 1)), _gen_0':s'3(_b699)) →RΩ(1)
s'(plus'(_gen_0':s'3(_$n567), _gen_0':s'3(_b699))) →IH
s'(_gen_0':s'3(+(_$n567, _b699)))
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
gt'(0', y) → false'
gt'(s'(x), 0') → true'
gt'(s'(x), s'(y)) → gt'(x, y)
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
average'(x, y) → aver'(plus'(x, y), 0')
aver'(sum, z) → if'(gt'(sum, double'(z)), sum, z)
if'(true', sum, z) → aver'(sum, s'(z))
if'(false', sum, z) → z
Types:
gt' :: 0':s' → 0':s' → false':true'
0' :: 0':s'
false' :: false':true'
s' :: 0':s' → 0':s'
true' :: false':true'
plus' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
average' :: 0':s' → 0':s' → 0':s'
aver' :: 0':s' → 0':s' → 0':s'
if' :: false':true' → 0':s' → 0':s' → 0':s'
_hole_false':true'1 :: false':true'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'
Lemmas:
gt'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → false', rt ∈ Ω(1 + n5)
plus'(_gen_0':s'3(_n566), _gen_0':s'3(b)) → _gen_0':s'3(+(_n566, b)), rt ∈ Ω(1 + n566)
Generator Equations:
_gen_0':s'3(0) ⇔ 0'
_gen_0':s'3(+(x, 1)) ⇔ s'(_gen_0':s'3(x))
The following defined symbols remain to be analysed:
double', aver'
They will be analysed ascendingly in the following order:
double' < aver'
Proved the following rewrite lemma:
double'(_gen_0':s'3(_n1303)) → _gen_0':s'3(*(2, _n1303)), rt ∈ Ω(1 + n1303)
Induction Base:
double'(_gen_0':s'3(0)) →RΩ(1)
0'
Induction Step:
double'(_gen_0':s'3(+(_$n1304, 1))) →RΩ(1)
s'(s'(double'(_gen_0':s'3(_$n1304)))) →IH
s'(s'(_gen_0':s'3(*(2, _$n1304))))
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
gt'(0', y) → false'
gt'(s'(x), 0') → true'
gt'(s'(x), s'(y)) → gt'(x, y)
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
average'(x, y) → aver'(plus'(x, y), 0')
aver'(sum, z) → if'(gt'(sum, double'(z)), sum, z)
if'(true', sum, z) → aver'(sum, s'(z))
if'(false', sum, z) → z
Types:
gt' :: 0':s' → 0':s' → false':true'
0' :: 0':s'
false' :: false':true'
s' :: 0':s' → 0':s'
true' :: false':true'
plus' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
average' :: 0':s' → 0':s' → 0':s'
aver' :: 0':s' → 0':s' → 0':s'
if' :: false':true' → 0':s' → 0':s' → 0':s'
_hole_false':true'1 :: false':true'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'
Lemmas:
gt'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → false', rt ∈ Ω(1 + n5)
plus'(_gen_0':s'3(_n566), _gen_0':s'3(b)) → _gen_0':s'3(+(_n566, b)), rt ∈ Ω(1 + n566)
double'(_gen_0':s'3(_n1303)) → _gen_0':s'3(*(2, _n1303)), rt ∈ Ω(1 + n1303)
Generator Equations:
_gen_0':s'3(0) ⇔ 0'
_gen_0':s'3(+(x, 1)) ⇔ s'(_gen_0':s'3(x))
The following defined symbols remain to be analysed:
aver'
Could not prove a rewrite lemma for the defined symbol aver'.
Rules:
gt'(0', y) → false'
gt'(s'(x), 0') → true'
gt'(s'(x), s'(y)) → gt'(x, y)
plus'(0', y) → y
plus'(s'(x), y) → s'(plus'(x, y))
double'(0') → 0'
double'(s'(x)) → s'(s'(double'(x)))
average'(x, y) → aver'(plus'(x, y), 0')
aver'(sum, z) → if'(gt'(sum, double'(z)), sum, z)
if'(true', sum, z) → aver'(sum, s'(z))
if'(false', sum, z) → z
Types:
gt' :: 0':s' → 0':s' → false':true'
0' :: 0':s'
false' :: false':true'
s' :: 0':s' → 0':s'
true' :: false':true'
plus' :: 0':s' → 0':s' → 0':s'
double' :: 0':s' → 0':s'
average' :: 0':s' → 0':s' → 0':s'
aver' :: 0':s' → 0':s' → 0':s'
if' :: false':true' → 0':s' → 0':s' → 0':s'
_hole_false':true'1 :: false':true'
_hole_0':s'2 :: 0':s'
_gen_0':s'3 :: Nat → 0':s'
Lemmas:
gt'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → false', rt ∈ Ω(1 + n5)
plus'(_gen_0':s'3(_n566), _gen_0':s'3(b)) → _gen_0':s'3(+(_n566, b)), rt ∈ Ω(1 + n566)
double'(_gen_0':s'3(_n1303)) → _gen_0':s'3(*(2, _n1303)), rt ∈ Ω(1 + n1303)
Generator Equations:
_gen_0':s'3(0) ⇔ 0'
_gen_0':s'3(+(x, 1)) ⇔ s'(_gen_0':s'3(x))
No more defined symbols left to analyse.
The lowerbound Ω(n) was proven with the following lemma:
gt'(_gen_0':s'3(_n5), _gen_0':s'3(_n5)) → false', rt ∈ Ω(1 + n5)