Runtime Complexity TRS:
The TRS R consists of the following rules:
rev(nil) → nil
rev(.(x, y)) → ++(rev(y), .(x, nil))
car(.(x, y)) → x
cdr(.(x, y)) → y
null(nil) → true
null(.(x, y)) → false
++(nil, y) → y
++(.(x, y), z) → .(x, ++(y, z))
Renamed function symbols to avoid clashes with predefined symbol.
Runtime Complexity TRS:
The TRS R consists of the following rules:
rev'(nil') → nil'
rev'(.'(x, y)) → ++'(rev'(y), .'(x, nil'))
car'(.'(x, y)) → x
cdr'(.'(x, y)) → y
null'(nil') → true'
null'(.'(x, y)) → false'
++'(nil', y) → y
++'(.'(x, y), z) → .'(x, ++'(y, z))
Infered types.
Rules:
rev'(nil') → nil'
rev'(.'(x, y)) → ++'(rev'(y), .'(x, nil'))
car'(.'(x, y)) → x
cdr'(.'(x, y)) → y
null'(nil') → true'
null'(.'(x, y)) → false'
++'(nil', y) → y
++'(.'(x, y), z) → .'(x, ++'(y, z))
Types:
rev' :: nil':.' → nil':.'
nil' :: nil':.'
.' :: car' → nil':.' → nil':.'
++' :: nil':.' → nil':.' → nil':.'
car' :: nil':.' → car'
cdr' :: nil':.' → nil':.'
null' :: nil':.' → true':false'
true' :: true':false'
false' :: true':false'
_hole_nil':.'1 :: nil':.'
_hole_car'2 :: car'
_hole_true':false'3 :: true':false'
_gen_nil':.'4 :: Nat → nil':.'
Heuristically decided to analyse the following defined symbols:
rev', ++'
They will be analysed ascendingly in the following order:
++' < rev'
Rules:
rev'(nil') → nil'
rev'(.'(x, y)) → ++'(rev'(y), .'(x, nil'))
car'(.'(x, y)) → x
cdr'(.'(x, y)) → y
null'(nil') → true'
null'(.'(x, y)) → false'
++'(nil', y) → y
++'(.'(x, y), z) → .'(x, ++'(y, z))
Types:
rev' :: nil':.' → nil':.'
nil' :: nil':.'
.' :: car' → nil':.' → nil':.'
++' :: nil':.' → nil':.' → nil':.'
car' :: nil':.' → car'
cdr' :: nil':.' → nil':.'
null' :: nil':.' → true':false'
true' :: true':false'
false' :: true':false'
_hole_nil':.'1 :: nil':.'
_hole_car'2 :: car'
_hole_true':false'3 :: true':false'
_gen_nil':.'4 :: Nat → nil':.'
Generator Equations:
_gen_nil':.'4(0) ⇔ nil'
_gen_nil':.'4(+(x, 1)) ⇔ .'(_hole_car'2, _gen_nil':.'4(x))
The following defined symbols remain to be analysed:
++', rev'
They will be analysed ascendingly in the following order:
++' < rev'
Proved the following rewrite lemma:
++'(_gen_nil':.'4(_n6), _gen_nil':.'4(b)) → _gen_nil':.'4(+(_n6, b)), rt ∈ Ω(1 + n6)
Induction Base:
++'(_gen_nil':.'4(0), _gen_nil':.'4(b)) →RΩ(1)
_gen_nil':.'4(b)
Induction Step:
++'(_gen_nil':.'4(+(_$n7, 1)), _gen_nil':.'4(_b147)) →RΩ(1)
.'(_hole_car'2, ++'(_gen_nil':.'4(_$n7), _gen_nil':.'4(_b147))) →IH
.'(_hole_car'2, _gen_nil':.'4(+(_$n7, _b147)))
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
rev'(nil') → nil'
rev'(.'(x, y)) → ++'(rev'(y), .'(x, nil'))
car'(.'(x, y)) → x
cdr'(.'(x, y)) → y
null'(nil') → true'
null'(.'(x, y)) → false'
++'(nil', y) → y
++'(.'(x, y), z) → .'(x, ++'(y, z))
Types:
rev' :: nil':.' → nil':.'
nil' :: nil':.'
.' :: car' → nil':.' → nil':.'
++' :: nil':.' → nil':.' → nil':.'
car' :: nil':.' → car'
cdr' :: nil':.' → nil':.'
null' :: nil':.' → true':false'
true' :: true':false'
false' :: true':false'
_hole_nil':.'1 :: nil':.'
_hole_car'2 :: car'
_hole_true':false'3 :: true':false'
_gen_nil':.'4 :: Nat → nil':.'
Lemmas:
++'(_gen_nil':.'4(_n6), _gen_nil':.'4(b)) → _gen_nil':.'4(+(_n6, b)), rt ∈ Ω(1 + n6)
Generator Equations:
_gen_nil':.'4(0) ⇔ nil'
_gen_nil':.'4(+(x, 1)) ⇔ .'(_hole_car'2, _gen_nil':.'4(x))
The following defined symbols remain to be analysed:
rev'
Proved the following rewrite lemma:
rev'(_gen_nil':.'4(_n597)) → _gen_nil':.'4(_n597), rt ∈ Ω(1 + n597 + n5972)
Induction Base:
rev'(_gen_nil':.'4(0)) →RΩ(1)
nil'
Induction Step:
rev'(_gen_nil':.'4(+(_$n598, 1))) →RΩ(1)
++'(rev'(_gen_nil':.'4(_$n598)), .'(_hole_car'2, nil')) →IH
++'(_gen_nil':.'4(_$n598), .'(_hole_car'2, nil')) →LΩ(1 + $n598)
_gen_nil':.'4(+(_$n598, +(0, 1)))
We have rt ∈ Ω(n2) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n2).
Rules:
rev'(nil') → nil'
rev'(.'(x, y)) → ++'(rev'(y), .'(x, nil'))
car'(.'(x, y)) → x
cdr'(.'(x, y)) → y
null'(nil') → true'
null'(.'(x, y)) → false'
++'(nil', y) → y
++'(.'(x, y), z) → .'(x, ++'(y, z))
Types:
rev' :: nil':.' → nil':.'
nil' :: nil':.'
.' :: car' → nil':.' → nil':.'
++' :: nil':.' → nil':.' → nil':.'
car' :: nil':.' → car'
cdr' :: nil':.' → nil':.'
null' :: nil':.' → true':false'
true' :: true':false'
false' :: true':false'
_hole_nil':.'1 :: nil':.'
_hole_car'2 :: car'
_hole_true':false'3 :: true':false'
_gen_nil':.'4 :: Nat → nil':.'
Lemmas:
++'(_gen_nil':.'4(_n6), _gen_nil':.'4(b)) → _gen_nil':.'4(+(_n6, b)), rt ∈ Ω(1 + n6)
rev'(_gen_nil':.'4(_n597)) → _gen_nil':.'4(_n597), rt ∈ Ω(1 + n597 + n5972)
Generator Equations:
_gen_nil':.'4(0) ⇔ nil'
_gen_nil':.'4(+(x, 1)) ⇔ .'(_hole_car'2, _gen_nil':.'4(x))
No more defined symbols left to analyse.
The lowerbound Ω(n2) was proven with the following lemma:
rev'(_gen_nil':.'4(_n597)) → _gen_nil':.'4(_n597), rt ∈ Ω(1 + n597 + n5972)