(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))
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:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))
S is empty.
Rewrite Strategy: INNERMOST
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
Innermost TRS:
Rules:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
bsort,
last,
bubble,
butlastThey will be analysed ascendingly in the following order:
last < bsort
bubble < bsort
butlast < bsort
(6) Obligation:
Innermost TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
The following defined symbols remain to be analysed:
last, bsort, bubble, butlast
They will be analysed ascendingly in the following order:
last < bsort
bubble < bsort
butlast < bsort
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
last(
gen_nil:.:if:0'3_0(
+(
1,
n5_0))) →
gen_nil:.:if:0'3_0(
0), rt ∈ Ω(1 + n5
0)
Induction Base:
last(gen_nil:.:if:0'3_0(+(1, 0))) →RΩ(1)
nil
Induction Step:
last(gen_nil:.:if:0'3_0(+(1, +(n5_0, 1)))) →RΩ(1)
last(.(nil, gen_nil:.:if:0'3_0(n5_0))) →IH
gen_nil:.:if:0'3_0(0)
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
Innermost TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
The following defined symbols remain to be analysed:
bubble, bsort, butlast
They will be analysed ascendingly in the following order:
bubble < bsort
butlast < bsort
(10) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol bubble.
(11) Obligation:
Innermost TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
The following defined symbols remain to be analysed:
butlast, bsort
They will be analysed ascendingly in the following order:
butlast < bsort
(12) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
butlast(
gen_nil:.:if:0'3_0(
+(
1,
n15924_0))) →
gen_nil:.:if:0'3_0(
n15924_0), rt ∈ Ω(1 + n15924
0)
Induction Base:
butlast(gen_nil:.:if:0'3_0(+(1, 0))) →RΩ(1)
nil
Induction Step:
butlast(gen_nil:.:if:0'3_0(+(1, +(n15924_0, 1)))) →RΩ(1)
.(nil, butlast(.(nil, gen_nil:.:if:0'3_0(n15924_0)))) →IH
.(nil, gen_nil:.:if:0'3_0(c15925_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(13) Complex Obligation (BEST)
(14) Obligation:
Innermost TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
butlast(gen_nil:.:if:0'3_0(+(1, n15924_0))) → gen_nil:.:if:0'3_0(n15924_0), rt ∈ Ω(1 + n159240)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
The following defined symbols remain to be analysed:
bsort
(15) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol bsort.
(16) Obligation:
Innermost TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
butlast(gen_nil:.:if:0'3_0(+(1, n15924_0))) → gen_nil:.:if:0'3_0(n15924_0), rt ∈ Ω(1 + n159240)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
No more defined symbols left to analyse.
(17) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
(18) BOUNDS(n^1, INF)
(19) Obligation:
Innermost TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
butlast(gen_nil:.:if:0'3_0(+(1, n15924_0))) → gen_nil:.:if:0'3_0(n15924_0), rt ∈ Ω(1 + n159240)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
No more defined symbols left to analyse.
(20) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
(21) BOUNDS(n^1, INF)
(22) Obligation:
Innermost TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
No more defined symbols left to analyse.
(23) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
(24) BOUNDS(n^1, INF)