(0) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
merge(Cons(x, xs), Nil) → Cons(x, xs)
merge(Cons(x', xs'), Cons(x, xs)) → merge[Ite](<=(x', x), Cons(x', xs'), Cons(x, xs))
merge(Nil, ys) → ys
goal(xs, ys) → merge(xs, ys)
The (relative) TRS S consists of the following rules:
<=(S(x), S(y)) → <=(x, y)
<=(0, y) → True
<=(S(x), 0) → False
merge[Ite](False, xs', Cons(x, xs)) → Cons(x, merge(xs', xs))
merge[Ite](True, Cons(x, xs), ys) → Cons(x, merge(xs, ys))
Rewrite Strategy: INNERMOST
(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:
merge(Cons(x, xs), Nil) → Cons(x, xs)
merge(Cons(x', xs'), Cons(x, xs)) → merge[Ite](<=(x', x), Cons(x', xs'), Cons(x, xs))
merge(Nil, ys) → ys
goal(xs, ys) → merge(xs, ys)
The (relative) TRS S consists of the following rules:
<=(S(x), S(y)) → <=(x, y)
<=(0', y) → True
<=(S(x), 0') → False
merge[Ite](False, xs', Cons(x, xs)) → Cons(x, merge(xs', xs))
merge[Ite](True, Cons(x, xs), ys) → Cons(x, merge(xs, ys))
Rewrite Strategy: INNERMOST
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
Innermost TRS:
Rules:
merge(Cons(x, xs), Nil) → Cons(x, xs)
merge(Cons(x', xs'), Cons(x, xs)) → merge[Ite](<=(x', x), Cons(x', xs'), Cons(x, xs))
merge(Nil, ys) → ys
goal(xs, ys) → merge(xs, ys)
<=(S(x), S(y)) → <=(x, y)
<=(0', y) → True
<=(S(x), 0') → False
merge[Ite](False, xs', Cons(x, xs)) → Cons(x, merge(xs', xs))
merge[Ite](True, Cons(x, xs), ys) → Cons(x, merge(xs, ys))
Types:
merge :: Cons:Nil → Cons:Nil → Cons:Nil
Cons :: S:0' → Cons:Nil → Cons:Nil
Nil :: Cons:Nil
merge[Ite] :: True:False → Cons:Nil → Cons:Nil → Cons:Nil
<= :: S:0' → S:0' → True:False
goal :: Cons:Nil → Cons:Nil → Cons:Nil
S :: S:0' → S:0'
0' :: S:0'
True :: True:False
False :: True:False
hole_Cons:Nil1_0 :: Cons:Nil
hole_S:0'2_0 :: S:0'
hole_True:False3_0 :: True:False
gen_Cons:Nil4_0 :: Nat → Cons:Nil
gen_S:0'5_0 :: Nat → S:0'
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
merge,
<=They will be analysed ascendingly in the following order:
<= < merge
(6) Obligation:
Innermost TRS:
Rules:
merge(
Cons(
x,
xs),
Nil) →
Cons(
x,
xs)
merge(
Cons(
x',
xs'),
Cons(
x,
xs)) →
merge[Ite](
<=(
x',
x),
Cons(
x',
xs'),
Cons(
x,
xs))
merge(
Nil,
ys) →
ysgoal(
xs,
ys) →
merge(
xs,
ys)
<=(
S(
x),
S(
y)) →
<=(
x,
y)
<=(
0',
y) →
True<=(
S(
x),
0') →
Falsemerge[Ite](
False,
xs',
Cons(
x,
xs)) →
Cons(
x,
merge(
xs',
xs))
merge[Ite](
True,
Cons(
x,
xs),
ys) →
Cons(
x,
merge(
xs,
ys))
Types:
merge :: Cons:Nil → Cons:Nil → Cons:Nil
Cons :: S:0' → Cons:Nil → Cons:Nil
Nil :: Cons:Nil
merge[Ite] :: True:False → Cons:Nil → Cons:Nil → Cons:Nil
<= :: S:0' → S:0' → True:False
goal :: Cons:Nil → Cons:Nil → Cons:Nil
S :: S:0' → S:0'
0' :: S:0'
True :: True:False
False :: True:False
hole_Cons:Nil1_0 :: Cons:Nil
hole_S:0'2_0 :: S:0'
hole_True:False3_0 :: True:False
gen_Cons:Nil4_0 :: Nat → Cons:Nil
gen_S:0'5_0 :: Nat → S:0'
Generator Equations:
gen_Cons:Nil4_0(0) ⇔ Nil
gen_Cons:Nil4_0(+(x, 1)) ⇔ Cons(0', gen_Cons:Nil4_0(x))
gen_S:0'5_0(0) ⇔ 0'
gen_S:0'5_0(+(x, 1)) ⇔ S(gen_S:0'5_0(x))
The following defined symbols remain to be analysed:
<=, merge
They will be analysed ascendingly in the following order:
<= < merge
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
<=(
gen_S:0'5_0(
n7_0),
gen_S:0'5_0(
n7_0)) →
True, rt ∈ Ω(0)
Induction Base:
<=(gen_S:0'5_0(0), gen_S:0'5_0(0)) →RΩ(0)
True
Induction Step:
<=(gen_S:0'5_0(+(n7_0, 1)), gen_S:0'5_0(+(n7_0, 1))) →RΩ(0)
<=(gen_S:0'5_0(n7_0), gen_S:0'5_0(n7_0)) →IH
True
We have rt ∈ Ω(1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n0).
(8) Complex Obligation (BEST)
(9) Obligation:
Innermost TRS:
Rules:
merge(
Cons(
x,
xs),
Nil) →
Cons(
x,
xs)
merge(
Cons(
x',
xs'),
Cons(
x,
xs)) →
merge[Ite](
<=(
x',
x),
Cons(
x',
xs'),
Cons(
x,
xs))
merge(
Nil,
ys) →
ysgoal(
xs,
ys) →
merge(
xs,
ys)
<=(
S(
x),
S(
y)) →
<=(
x,
y)
<=(
0',
y) →
True<=(
S(
x),
0') →
Falsemerge[Ite](
False,
xs',
Cons(
x,
xs)) →
Cons(
x,
merge(
xs',
xs))
merge[Ite](
True,
Cons(
x,
xs),
ys) →
Cons(
x,
merge(
xs,
ys))
Types:
merge :: Cons:Nil → Cons:Nil → Cons:Nil
Cons :: S:0' → Cons:Nil → Cons:Nil
Nil :: Cons:Nil
merge[Ite] :: True:False → Cons:Nil → Cons:Nil → Cons:Nil
<= :: S:0' → S:0' → True:False
goal :: Cons:Nil → Cons:Nil → Cons:Nil
S :: S:0' → S:0'
0' :: S:0'
True :: True:False
False :: True:False
hole_Cons:Nil1_0 :: Cons:Nil
hole_S:0'2_0 :: S:0'
hole_True:False3_0 :: True:False
gen_Cons:Nil4_0 :: Nat → Cons:Nil
gen_S:0'5_0 :: Nat → S:0'
Lemmas:
<=(gen_S:0'5_0(n7_0), gen_S:0'5_0(n7_0)) → True, rt ∈ Ω(0)
Generator Equations:
gen_Cons:Nil4_0(0) ⇔ Nil
gen_Cons:Nil4_0(+(x, 1)) ⇔ Cons(0', gen_Cons:Nil4_0(x))
gen_S:0'5_0(0) ⇔ 0'
gen_S:0'5_0(+(x, 1)) ⇔ S(gen_S:0'5_0(x))
The following defined symbols remain to be analysed:
merge
(10) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
merge(
gen_Cons:Nil4_0(
n240_0),
gen_Cons:Nil4_0(
1)) →
gen_Cons:Nil4_0(
+(
1,
n240_0)), rt ∈ Ω(1 + n240
0)
Induction Base:
merge(gen_Cons:Nil4_0(0), gen_Cons:Nil4_0(1)) →RΩ(1)
gen_Cons:Nil4_0(1)
Induction Step:
merge(gen_Cons:Nil4_0(+(n240_0, 1)), gen_Cons:Nil4_0(1)) →RΩ(1)
merge[Ite](<=(0', 0'), Cons(0', gen_Cons:Nil4_0(n240_0)), Cons(0', gen_Cons:Nil4_0(0))) →LΩ(0)
merge[Ite](True, Cons(0', gen_Cons:Nil4_0(n240_0)), Cons(0', gen_Cons:Nil4_0(0))) →RΩ(0)
Cons(0', merge(gen_Cons:Nil4_0(n240_0), Cons(0', gen_Cons:Nil4_0(0)))) →IH
Cons(0', gen_Cons:Nil4_0(+(1, c241_0)))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(11) Complex Obligation (BEST)
(12) Obligation:
Innermost TRS:
Rules:
merge(
Cons(
x,
xs),
Nil) →
Cons(
x,
xs)
merge(
Cons(
x',
xs'),
Cons(
x,
xs)) →
merge[Ite](
<=(
x',
x),
Cons(
x',
xs'),
Cons(
x,
xs))
merge(
Nil,
ys) →
ysgoal(
xs,
ys) →
merge(
xs,
ys)
<=(
S(
x),
S(
y)) →
<=(
x,
y)
<=(
0',
y) →
True<=(
S(
x),
0') →
Falsemerge[Ite](
False,
xs',
Cons(
x,
xs)) →
Cons(
x,
merge(
xs',
xs))
merge[Ite](
True,
Cons(
x,
xs),
ys) →
Cons(
x,
merge(
xs,
ys))
Types:
merge :: Cons:Nil → Cons:Nil → Cons:Nil
Cons :: S:0' → Cons:Nil → Cons:Nil
Nil :: Cons:Nil
merge[Ite] :: True:False → Cons:Nil → Cons:Nil → Cons:Nil
<= :: S:0' → S:0' → True:False
goal :: Cons:Nil → Cons:Nil → Cons:Nil
S :: S:0' → S:0'
0' :: S:0'
True :: True:False
False :: True:False
hole_Cons:Nil1_0 :: Cons:Nil
hole_S:0'2_0 :: S:0'
hole_True:False3_0 :: True:False
gen_Cons:Nil4_0 :: Nat → Cons:Nil
gen_S:0'5_0 :: Nat → S:0'
Lemmas:
<=(gen_S:0'5_0(n7_0), gen_S:0'5_0(n7_0)) → True, rt ∈ Ω(0)
merge(gen_Cons:Nil4_0(n240_0), gen_Cons:Nil4_0(1)) → gen_Cons:Nil4_0(+(1, n240_0)), rt ∈ Ω(1 + n2400)
Generator Equations:
gen_Cons:Nil4_0(0) ⇔ Nil
gen_Cons:Nil4_0(+(x, 1)) ⇔ Cons(0', gen_Cons:Nil4_0(x))
gen_S:0'5_0(0) ⇔ 0'
gen_S:0'5_0(+(x, 1)) ⇔ S(gen_S:0'5_0(x))
No more defined symbols left to analyse.
(13) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
merge(gen_Cons:Nil4_0(n240_0), gen_Cons:Nil4_0(1)) → gen_Cons:Nil4_0(+(1, n240_0)), rt ∈ Ω(1 + n2400)
(14) BOUNDS(n^1, INF)
(15) Obligation:
Innermost TRS:
Rules:
merge(
Cons(
x,
xs),
Nil) →
Cons(
x,
xs)
merge(
Cons(
x',
xs'),
Cons(
x,
xs)) →
merge[Ite](
<=(
x',
x),
Cons(
x',
xs'),
Cons(
x,
xs))
merge(
Nil,
ys) →
ysgoal(
xs,
ys) →
merge(
xs,
ys)
<=(
S(
x),
S(
y)) →
<=(
x,
y)
<=(
0',
y) →
True<=(
S(
x),
0') →
Falsemerge[Ite](
False,
xs',
Cons(
x,
xs)) →
Cons(
x,
merge(
xs',
xs))
merge[Ite](
True,
Cons(
x,
xs),
ys) →
Cons(
x,
merge(
xs,
ys))
Types:
merge :: Cons:Nil → Cons:Nil → Cons:Nil
Cons :: S:0' → Cons:Nil → Cons:Nil
Nil :: Cons:Nil
merge[Ite] :: True:False → Cons:Nil → Cons:Nil → Cons:Nil
<= :: S:0' → S:0' → True:False
goal :: Cons:Nil → Cons:Nil → Cons:Nil
S :: S:0' → S:0'
0' :: S:0'
True :: True:False
False :: True:False
hole_Cons:Nil1_0 :: Cons:Nil
hole_S:0'2_0 :: S:0'
hole_True:False3_0 :: True:False
gen_Cons:Nil4_0 :: Nat → Cons:Nil
gen_S:0'5_0 :: Nat → S:0'
Lemmas:
<=(gen_S:0'5_0(n7_0), gen_S:0'5_0(n7_0)) → True, rt ∈ Ω(0)
merge(gen_Cons:Nil4_0(n240_0), gen_Cons:Nil4_0(1)) → gen_Cons:Nil4_0(+(1, n240_0)), rt ∈ Ω(1 + n2400)
Generator Equations:
gen_Cons:Nil4_0(0) ⇔ Nil
gen_Cons:Nil4_0(+(x, 1)) ⇔ Cons(0', gen_Cons:Nil4_0(x))
gen_S:0'5_0(0) ⇔ 0'
gen_S:0'5_0(+(x, 1)) ⇔ S(gen_S:0'5_0(x))
No more defined symbols left to analyse.
(16) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
merge(gen_Cons:Nil4_0(n240_0), gen_Cons:Nil4_0(1)) → gen_Cons:Nil4_0(+(1, n240_0)), rt ∈ Ω(1 + n2400)
(17) BOUNDS(n^1, INF)
(18) Obligation:
Innermost TRS:
Rules:
merge(
Cons(
x,
xs),
Nil) →
Cons(
x,
xs)
merge(
Cons(
x',
xs'),
Cons(
x,
xs)) →
merge[Ite](
<=(
x',
x),
Cons(
x',
xs'),
Cons(
x,
xs))
merge(
Nil,
ys) →
ysgoal(
xs,
ys) →
merge(
xs,
ys)
<=(
S(
x),
S(
y)) →
<=(
x,
y)
<=(
0',
y) →
True<=(
S(
x),
0') →
Falsemerge[Ite](
False,
xs',
Cons(
x,
xs)) →
Cons(
x,
merge(
xs',
xs))
merge[Ite](
True,
Cons(
x,
xs),
ys) →
Cons(
x,
merge(
xs,
ys))
Types:
merge :: Cons:Nil → Cons:Nil → Cons:Nil
Cons :: S:0' → Cons:Nil → Cons:Nil
Nil :: Cons:Nil
merge[Ite] :: True:False → Cons:Nil → Cons:Nil → Cons:Nil
<= :: S:0' → S:0' → True:False
goal :: Cons:Nil → Cons:Nil → Cons:Nil
S :: S:0' → S:0'
0' :: S:0'
True :: True:False
False :: True:False
hole_Cons:Nil1_0 :: Cons:Nil
hole_S:0'2_0 :: S:0'
hole_True:False3_0 :: True:False
gen_Cons:Nil4_0 :: Nat → Cons:Nil
gen_S:0'5_0 :: Nat → S:0'
Lemmas:
<=(gen_S:0'5_0(n7_0), gen_S:0'5_0(n7_0)) → True, rt ∈ Ω(0)
Generator Equations:
gen_Cons:Nil4_0(0) ⇔ Nil
gen_Cons:Nil4_0(+(x, 1)) ⇔ Cons(0', gen_Cons:Nil4_0(x))
gen_S:0'5_0(0) ⇔ 0'
gen_S:0'5_0(+(x, 1)) ⇔ S(gen_S:0'5_0(x))
No more defined symbols left to analyse.
(19) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(1) was proven with the following lemma:
<=(gen_S:0'5_0(n7_0), gen_S:0'5_0(n7_0)) → True, rt ∈ Ω(0)
(20) BOUNDS(1, INF)