Runtime Complexity TRS:
The TRS R consists of the following rules:
max(nil) → 0
max(cons(x, nil)) → x
max(cons(x, cons(y, xs))) → if1(ge(x, y), x, y, xs)
if1(true, x, y, xs) → max(cons(x, xs))
if1(false, x, y, xs) → max(cons(y, xs))
del(x, nil) → nil
del(x, cons(y, xs)) → if2(eq(x, y), x, y, xs)
if2(true, x, y, xs) → xs
if2(false, x, y, xs) → cons(y, del(x, xs))
eq(0, 0) → true
eq(0, s(y)) → false
eq(s(x), 0) → false
eq(s(x), s(y)) → eq(x, y)
sort(nil) → nil
sort(cons(x, xs)) → cons(max(cons(x, xs)), sort(del(max(cons(x, xs)), cons(x, xs))))
ge(0, 0) → true
ge(s(x), 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
Renamed function symbols to avoid clashes with predefined symbol.
Runtime Complexity TRS:
The TRS R consists of the following rules:
max'(nil') → 0'
max'(cons'(x, nil')) → x
max'(cons'(x, cons'(y, xs))) → if1'(ge'(x, y), x, y, xs)
if1'(true', x, y, xs) → max'(cons'(x, xs))
if1'(false', x, y, xs) → max'(cons'(y, xs))
del'(x, nil') → nil'
del'(x, cons'(y, xs)) → if2'(eq'(x, y), x, y, xs)
if2'(true', x, y, xs) → xs
if2'(false', x, y, xs) → cons'(y, del'(x, xs))
eq'(0', 0') → true'
eq'(0', s'(y)) → false'
eq'(s'(x), 0') → false'
eq'(s'(x), s'(y)) → eq'(x, y)
sort'(nil') → nil'
sort'(cons'(x, xs)) → cons'(max'(cons'(x, xs)), sort'(del'(max'(cons'(x, xs)), cons'(x, xs))))
ge'(0', 0') → true'
ge'(s'(x), 0') → true'
ge'(0', s'(x)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
Infered types.
Rules:
max'(nil') → 0'
max'(cons'(x, nil')) → x
max'(cons'(x, cons'(y, xs))) → if1'(ge'(x, y), x, y, xs)
if1'(true', x, y, xs) → max'(cons'(x, xs))
if1'(false', x, y, xs) → max'(cons'(y, xs))
del'(x, nil') → nil'
del'(x, cons'(y, xs)) → if2'(eq'(x, y), x, y, xs)
if2'(true', x, y, xs) → xs
if2'(false', x, y, xs) → cons'(y, del'(x, xs))
eq'(0', 0') → true'
eq'(0', s'(y)) → false'
eq'(s'(x), 0') → false'
eq'(s'(x), s'(y)) → eq'(x, y)
sort'(nil') → nil'
sort'(cons'(x, xs)) → cons'(max'(cons'(x, xs)), sort'(del'(max'(cons'(x, xs)), cons'(x, xs))))
ge'(0', 0') → true'
ge'(s'(x), 0') → true'
ge'(0', s'(x)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
Types:
max' :: nil':cons' → 0':s'
nil' :: nil':cons'
0' :: 0':s'
cons' :: 0':s' → nil':cons' → nil':cons'
if1' :: true':false' → 0':s' → 0':s' → nil':cons' → 0':s'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
del' :: 0':s' → nil':cons' → nil':cons'
if2' :: true':false' → 0':s' → 0':s' → nil':cons' → nil':cons'
eq' :: 0':s' → 0':s' → true':false'
s' :: 0':s' → 0':s'
sort' :: nil':cons' → nil':cons'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'
Heuristically decided to analyse the following defined symbols:
max', ge', del', eq', sort'
They will be analysed ascendingly in the following order:
ge' < max'
max' < sort'
eq' < del'
del' < sort'
Rules:
max'(nil') → 0'
max'(cons'(x, nil')) → x
max'(cons'(x, cons'(y, xs))) → if1'(ge'(x, y), x, y, xs)
if1'(true', x, y, xs) → max'(cons'(x, xs))
if1'(false', x, y, xs) → max'(cons'(y, xs))
del'(x, nil') → nil'
del'(x, cons'(y, xs)) → if2'(eq'(x, y), x, y, xs)
if2'(true', x, y, xs) → xs
if2'(false', x, y, xs) → cons'(y, del'(x, xs))
eq'(0', 0') → true'
eq'(0', s'(y)) → false'
eq'(s'(x), 0') → false'
eq'(s'(x), s'(y)) → eq'(x, y)
sort'(nil') → nil'
sort'(cons'(x, xs)) → cons'(max'(cons'(x, xs)), sort'(del'(max'(cons'(x, xs)), cons'(x, xs))))
ge'(0', 0') → true'
ge'(s'(x), 0') → true'
ge'(0', s'(x)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
Types:
max' :: nil':cons' → 0':s'
nil' :: nil':cons'
0' :: 0':s'
cons' :: 0':s' → nil':cons' → nil':cons'
if1' :: true':false' → 0':s' → 0':s' → nil':cons' → 0':s'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
del' :: 0':s' → nil':cons' → nil':cons'
if2' :: true':false' → 0':s' → 0':s' → nil':cons' → nil':cons'
eq' :: 0':s' → 0':s' → true':false'
s' :: 0':s' → 0':s'
sort' :: nil':cons' → nil':cons'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'
Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))
The following defined symbols remain to be analysed:
ge', max', del', eq', sort'
They will be analysed ascendingly in the following order:
ge' < max'
max' < sort'
eq' < del'
del' < sort'
Proved the following rewrite lemma:
ge'(_gen_0':s'4(_n7), _gen_0':s'4(_n7)) → true', rt ∈ Ω(1 + n7)
Induction Base:
ge'(_gen_0':s'4(0), _gen_0':s'4(0)) →RΩ(1)
true'
Induction Step:
ge'(_gen_0':s'4(+(_$n8, 1)), _gen_0':s'4(+(_$n8, 1))) →RΩ(1)
ge'(_gen_0':s'4(_$n8), _gen_0':s'4(_$n8)) →IH
true'
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
max'(nil') → 0'
max'(cons'(x, nil')) → x
max'(cons'(x, cons'(y, xs))) → if1'(ge'(x, y), x, y, xs)
if1'(true', x, y, xs) → max'(cons'(x, xs))
if1'(false', x, y, xs) → max'(cons'(y, xs))
del'(x, nil') → nil'
del'(x, cons'(y, xs)) → if2'(eq'(x, y), x, y, xs)
if2'(true', x, y, xs) → xs
if2'(false', x, y, xs) → cons'(y, del'(x, xs))
eq'(0', 0') → true'
eq'(0', s'(y)) → false'
eq'(s'(x), 0') → false'
eq'(s'(x), s'(y)) → eq'(x, y)
sort'(nil') → nil'
sort'(cons'(x, xs)) → cons'(max'(cons'(x, xs)), sort'(del'(max'(cons'(x, xs)), cons'(x, xs))))
ge'(0', 0') → true'
ge'(s'(x), 0') → true'
ge'(0', s'(x)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
Types:
max' :: nil':cons' → 0':s'
nil' :: nil':cons'
0' :: 0':s'
cons' :: 0':s' → nil':cons' → nil':cons'
if1' :: true':false' → 0':s' → 0':s' → nil':cons' → 0':s'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
del' :: 0':s' → nil':cons' → nil':cons'
if2' :: true':false' → 0':s' → 0':s' → nil':cons' → nil':cons'
eq' :: 0':s' → 0':s' → true':false'
s' :: 0':s' → 0':s'
sort' :: nil':cons' → nil':cons'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'
Lemmas:
ge'(_gen_0':s'4(_n7), _gen_0':s'4(_n7)) → true', rt ∈ Ω(1 + n7)
Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))
The following defined symbols remain to be analysed:
max', del', eq', sort'
They will be analysed ascendingly in the following order:
max' < sort'
eq' < del'
del' < sort'
Proved the following rewrite lemma:
max'(_gen_nil':cons'5(+(1, _n1005))) → _gen_0':s'4(0), rt ∈ Ω(1 + n1005)
Induction Base:
max'(_gen_nil':cons'5(+(1, 0))) →RΩ(1)
0'
Induction Step:
max'(_gen_nil':cons'5(+(1, +(_$n1006, 1)))) →RΩ(1)
if1'(ge'(0', 0'), 0', 0', _gen_nil':cons'5(_$n1006)) →LΩ(1)
if1'(true', 0', 0', _gen_nil':cons'5(_$n1006)) →RΩ(1)
max'(cons'(0', _gen_nil':cons'5(_$n1006))) →IH
_gen_0':s'4(0)
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
max'(nil') → 0'
max'(cons'(x, nil')) → x
max'(cons'(x, cons'(y, xs))) → if1'(ge'(x, y), x, y, xs)
if1'(true', x, y, xs) → max'(cons'(x, xs))
if1'(false', x, y, xs) → max'(cons'(y, xs))
del'(x, nil') → nil'
del'(x, cons'(y, xs)) → if2'(eq'(x, y), x, y, xs)
if2'(true', x, y, xs) → xs
if2'(false', x, y, xs) → cons'(y, del'(x, xs))
eq'(0', 0') → true'
eq'(0', s'(y)) → false'
eq'(s'(x), 0') → false'
eq'(s'(x), s'(y)) → eq'(x, y)
sort'(nil') → nil'
sort'(cons'(x, xs)) → cons'(max'(cons'(x, xs)), sort'(del'(max'(cons'(x, xs)), cons'(x, xs))))
ge'(0', 0') → true'
ge'(s'(x), 0') → true'
ge'(0', s'(x)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
Types:
max' :: nil':cons' → 0':s'
nil' :: nil':cons'
0' :: 0':s'
cons' :: 0':s' → nil':cons' → nil':cons'
if1' :: true':false' → 0':s' → 0':s' → nil':cons' → 0':s'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
del' :: 0':s' → nil':cons' → nil':cons'
if2' :: true':false' → 0':s' → 0':s' → nil':cons' → nil':cons'
eq' :: 0':s' → 0':s' → true':false'
s' :: 0':s' → 0':s'
sort' :: nil':cons' → nil':cons'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'
Lemmas:
ge'(_gen_0':s'4(_n7), _gen_0':s'4(_n7)) → true', rt ∈ Ω(1 + n7)
max'(_gen_nil':cons'5(+(1, _n1005))) → _gen_0':s'4(0), rt ∈ Ω(1 + n1005)
Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))
The following defined symbols remain to be analysed:
eq', del', sort'
They will be analysed ascendingly in the following order:
eq' < del'
del' < sort'
Proved the following rewrite lemma:
eq'(_gen_0':s'4(_n2950), _gen_0':s'4(_n2950)) → true', rt ∈ Ω(1 + n2950)
Induction Base:
eq'(_gen_0':s'4(0), _gen_0':s'4(0)) →RΩ(1)
true'
Induction Step:
eq'(_gen_0':s'4(+(_$n2951, 1)), _gen_0':s'4(+(_$n2951, 1))) →RΩ(1)
eq'(_gen_0':s'4(_$n2951), _gen_0':s'4(_$n2951)) →IH
true'
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
max'(nil') → 0'
max'(cons'(x, nil')) → x
max'(cons'(x, cons'(y, xs))) → if1'(ge'(x, y), x, y, xs)
if1'(true', x, y, xs) → max'(cons'(x, xs))
if1'(false', x, y, xs) → max'(cons'(y, xs))
del'(x, nil') → nil'
del'(x, cons'(y, xs)) → if2'(eq'(x, y), x, y, xs)
if2'(true', x, y, xs) → xs
if2'(false', x, y, xs) → cons'(y, del'(x, xs))
eq'(0', 0') → true'
eq'(0', s'(y)) → false'
eq'(s'(x), 0') → false'
eq'(s'(x), s'(y)) → eq'(x, y)
sort'(nil') → nil'
sort'(cons'(x, xs)) → cons'(max'(cons'(x, xs)), sort'(del'(max'(cons'(x, xs)), cons'(x, xs))))
ge'(0', 0') → true'
ge'(s'(x), 0') → true'
ge'(0', s'(x)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
Types:
max' :: nil':cons' → 0':s'
nil' :: nil':cons'
0' :: 0':s'
cons' :: 0':s' → nil':cons' → nil':cons'
if1' :: true':false' → 0':s' → 0':s' → nil':cons' → 0':s'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
del' :: 0':s' → nil':cons' → nil':cons'
if2' :: true':false' → 0':s' → 0':s' → nil':cons' → nil':cons'
eq' :: 0':s' → 0':s' → true':false'
s' :: 0':s' → 0':s'
sort' :: nil':cons' → nil':cons'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'
Lemmas:
ge'(_gen_0':s'4(_n7), _gen_0':s'4(_n7)) → true', rt ∈ Ω(1 + n7)
max'(_gen_nil':cons'5(+(1, _n1005))) → _gen_0':s'4(0), rt ∈ Ω(1 + n1005)
eq'(_gen_0':s'4(_n2950), _gen_0':s'4(_n2950)) → true', rt ∈ Ω(1 + n2950)
Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))
The following defined symbols remain to be analysed:
del', sort'
They will be analysed ascendingly in the following order:
del' < sort'
Could not prove a rewrite lemma for the defined symbol del'.
Rules:
max'(nil') → 0'
max'(cons'(x, nil')) → x
max'(cons'(x, cons'(y, xs))) → if1'(ge'(x, y), x, y, xs)
if1'(true', x, y, xs) → max'(cons'(x, xs))
if1'(false', x, y, xs) → max'(cons'(y, xs))
del'(x, nil') → nil'
del'(x, cons'(y, xs)) → if2'(eq'(x, y), x, y, xs)
if2'(true', x, y, xs) → xs
if2'(false', x, y, xs) → cons'(y, del'(x, xs))
eq'(0', 0') → true'
eq'(0', s'(y)) → false'
eq'(s'(x), 0') → false'
eq'(s'(x), s'(y)) → eq'(x, y)
sort'(nil') → nil'
sort'(cons'(x, xs)) → cons'(max'(cons'(x, xs)), sort'(del'(max'(cons'(x, xs)), cons'(x, xs))))
ge'(0', 0') → true'
ge'(s'(x), 0') → true'
ge'(0', s'(x)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
Types:
max' :: nil':cons' → 0':s'
nil' :: nil':cons'
0' :: 0':s'
cons' :: 0':s' → nil':cons' → nil':cons'
if1' :: true':false' → 0':s' → 0':s' → nil':cons' → 0':s'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
del' :: 0':s' → nil':cons' → nil':cons'
if2' :: true':false' → 0':s' → 0':s' → nil':cons' → nil':cons'
eq' :: 0':s' → 0':s' → true':false'
s' :: 0':s' → 0':s'
sort' :: nil':cons' → nil':cons'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'
Lemmas:
ge'(_gen_0':s'4(_n7), _gen_0':s'4(_n7)) → true', rt ∈ Ω(1 + n7)
max'(_gen_nil':cons'5(+(1, _n1005))) → _gen_0':s'4(0), rt ∈ Ω(1 + n1005)
eq'(_gen_0':s'4(_n2950), _gen_0':s'4(_n2950)) → true', rt ∈ Ω(1 + n2950)
Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))
The following defined symbols remain to be analysed:
sort'
Proved the following rewrite lemma:
sort'(_gen_nil':cons'5(_n4174)) → _gen_nil':cons'5(_n4174), rt ∈ Ω(1 + n4174 + n41742)
Induction Base:
sort'(_gen_nil':cons'5(0)) →RΩ(1)
nil'
Induction Step:
sort'(_gen_nil':cons'5(+(_$n4175, 1))) →RΩ(1)
cons'(max'(cons'(0', _gen_nil':cons'5(_$n4175))), sort'(del'(max'(cons'(0', _gen_nil':cons'5(_$n4175))), cons'(0', _gen_nil':cons'5(_$n4175))))) →LΩ(1 + $n4175)
cons'(_gen_0':s'4(0), sort'(del'(max'(cons'(0', _gen_nil':cons'5(_$n4175))), cons'(0', _gen_nil':cons'5(_$n4175))))) →LΩ(1 + $n4175)
cons'(_gen_0':s'4(0), sort'(del'(_gen_0':s'4(0), cons'(0', _gen_nil':cons'5(_$n4175))))) →RΩ(1)
cons'(_gen_0':s'4(0), sort'(if2'(eq'(_gen_0':s'4(0), 0'), _gen_0':s'4(0), 0', _gen_nil':cons'5(_$n4175)))) →LΩ(1)
cons'(_gen_0':s'4(0), sort'(if2'(true', _gen_0':s'4(0), 0', _gen_nil':cons'5(_$n4175)))) →RΩ(1)
cons'(_gen_0':s'4(0), sort'(_gen_nil':cons'5(_$n4175))) →IH
cons'(_gen_0':s'4(0), _gen_nil':cons'5(_$n4175))
We have rt ∈ Ω(n2) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n2).
Rules:
max'(nil') → 0'
max'(cons'(x, nil')) → x
max'(cons'(x, cons'(y, xs))) → if1'(ge'(x, y), x, y, xs)
if1'(true', x, y, xs) → max'(cons'(x, xs))
if1'(false', x, y, xs) → max'(cons'(y, xs))
del'(x, nil') → nil'
del'(x, cons'(y, xs)) → if2'(eq'(x, y), x, y, xs)
if2'(true', x, y, xs) → xs
if2'(false', x, y, xs) → cons'(y, del'(x, xs))
eq'(0', 0') → true'
eq'(0', s'(y)) → false'
eq'(s'(x), 0') → false'
eq'(s'(x), s'(y)) → eq'(x, y)
sort'(nil') → nil'
sort'(cons'(x, xs)) → cons'(max'(cons'(x, xs)), sort'(del'(max'(cons'(x, xs)), cons'(x, xs))))
ge'(0', 0') → true'
ge'(s'(x), 0') → true'
ge'(0', s'(x)) → false'
ge'(s'(x), s'(y)) → ge'(x, y)
Types:
max' :: nil':cons' → 0':s'
nil' :: nil':cons'
0' :: 0':s'
cons' :: 0':s' → nil':cons' → nil':cons'
if1' :: true':false' → 0':s' → 0':s' → nil':cons' → 0':s'
ge' :: 0':s' → 0':s' → true':false'
true' :: true':false'
false' :: true':false'
del' :: 0':s' → nil':cons' → nil':cons'
if2' :: true':false' → 0':s' → 0':s' → nil':cons' → nil':cons'
eq' :: 0':s' → 0':s' → true':false'
s' :: 0':s' → 0':s'
sort' :: nil':cons' → nil':cons'
_hole_0':s'1 :: 0':s'
_hole_nil':cons'2 :: nil':cons'
_hole_true':false'3 :: true':false'
_gen_0':s'4 :: Nat → 0':s'
_gen_nil':cons'5 :: Nat → nil':cons'
Lemmas:
ge'(_gen_0':s'4(_n7), _gen_0':s'4(_n7)) → true', rt ∈ Ω(1 + n7)
max'(_gen_nil':cons'5(+(1, _n1005))) → _gen_0':s'4(0), rt ∈ Ω(1 + n1005)
eq'(_gen_0':s'4(_n2950), _gen_0':s'4(_n2950)) → true', rt ∈ Ω(1 + n2950)
sort'(_gen_nil':cons'5(_n4174)) → _gen_nil':cons'5(_n4174), rt ∈ Ω(1 + n4174 + n41742)
Generator Equations:
_gen_0':s'4(0) ⇔ 0'
_gen_0':s'4(+(x, 1)) ⇔ s'(_gen_0':s'4(x))
_gen_nil':cons'5(0) ⇔ nil'
_gen_nil':cons'5(+(x, 1)) ⇔ cons'(0', _gen_nil':cons'5(x))
No more defined symbols left to analyse.
The lowerbound Ω(n2) was proven with the following lemma:
sort'(_gen_nil':cons'5(_n4174)) → _gen_nil':cons'5(_n4174), rt ∈ Ω(1 + n4174 + n41742)