(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
qsort(nil) → nil
qsort(.(x, y)) → ++(qsort(lowers(x, y)), .(x, qsort(greaters(x, y))))
lowers(x, nil) → nil
lowers(x, .(y, z)) → if(<=(y, x), .(y, lowers(x, z)), lowers(x, z))
greaters(x, nil) → nil
greaters(x, .(y, z)) → if(<=(y, x), greaters(x, z), .(y, greaters(x, z)))
Rewrite Strategy: FULL
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(2n):
The rewrite sequence
lowers(x, .(y, z)) →+ if(<=(y, x), .(y, lowers(x, z)), lowers(x, z))
gives rise to a decreasing loop by considering the right hand sides subterm at position [1,1].
The pumping substitution is [z / .(y, z)].
The result substitution is [ ].
The rewrite sequence
lowers(x, .(y, z)) →+ if(<=(y, x), .(y, lowers(x, z)), lowers(x, z))
gives rise to a decreasing loop by considering the right hand sides subterm at position [2].
The pumping substitution is [z / .(y, z)].
The result substitution is [ ].
(2) BOUNDS(2^n, INF)
(3) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
qsort(nil) → nil
qsort(.(x, y)) → ++(qsort(lowers(x, y)), .(x, qsort(greaters(x, y))))
lowers(x, nil) → nil
lowers(x, .(y, z)) → if(<=(y, x), .(y, lowers(x, z)), lowers(x, z))
greaters(x, nil) → nil
greaters(x, .(y, z)) → if(<=(y, x), greaters(x, z), .(y, greaters(x, z)))
S is empty.
Rewrite Strategy: FULL
(5) SlicingProof (LOWER BOUND(ID) transformation)
Sliced the following arguments:
./0
lowers/0
greaters/0
if/0
<=/0
<=/1
(6) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
qsort(nil) → nil
qsort(.(y)) → ++(qsort(lowers(y)), .(qsort(greaters(y))))
lowers(nil) → nil
lowers(.(z)) → if(.(lowers(z)), lowers(z))
greaters(nil) → nil
greaters(.(z)) → if(greaters(z), .(y, greaters(z)))
S is empty.
Rewrite Strategy: FULL
(7) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(8) Obligation:
TRS:
Rules:
qsort(nil) → nil
qsort(.(y)) → ++(qsort(lowers(y)), .(qsort(greaters(y))))
lowers(nil) → nil
lowers(.(z)) → if(.(lowers(z)), lowers(z))
greaters(nil) → nil
greaters(.(z)) → if(greaters(z), .(y, greaters(z)))
Types:
qsort :: nil:.:++:if:. → nil:.:++:if:.
nil :: nil:.:++:if:.
. :: nil:.:++:if:. → nil:.:++:if:.
++ :: nil:.:++:if:. → nil:.:++:if:. → nil:.:++:if:.
lowers :: nil:.:++:if:. → nil:.:++:if:.
greaters :: nil:.:++:if:. → nil:.:++:if:.
if :: nil:.:++:if:. → nil:.:++:if:. → nil:.:++:if:.
. :: y → nil:.:++:if:. → nil:.:++:if:.
y :: y
hole_nil:.:++:if:.1_0 :: nil:.:++:if:.
hole_y2_0 :: y
gen_nil:.:++:if:.3_0 :: Nat → nil:.:++:if:.
(9) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
qsort,
lowers,
greatersThey will be analysed ascendingly in the following order:
lowers < qsort
greaters < qsort
(10) Obligation:
TRS:
Rules:
qsort(
nil) →
nilqsort(
.(
y)) →
++(
qsort(
lowers(
y)),
.(
qsort(
greaters(
y))))
lowers(
nil) →
nillowers(
.(
z)) →
if(
.(
lowers(
z)),
lowers(
z))
greaters(
nil) →
nilgreaters(
.(
z)) →
if(
greaters(
z),
.(
y,
greaters(
z)))
Types:
qsort :: nil:.:++:if:. → nil:.:++:if:.
nil :: nil:.:++:if:.
. :: nil:.:++:if:. → nil:.:++:if:.
++ :: nil:.:++:if:. → nil:.:++:if:. → nil:.:++:if:.
lowers :: nil:.:++:if:. → nil:.:++:if:.
greaters :: nil:.:++:if:. → nil:.:++:if:.
if :: nil:.:++:if:. → nil:.:++:if:. → nil:.:++:if:.
. :: y → nil:.:++:if:. → nil:.:++:if:.
y :: y
hole_nil:.:++:if:.1_0 :: nil:.:++:if:.
hole_y2_0 :: y
gen_nil:.:++:if:.3_0 :: Nat → nil:.:++:if:.
Generator Equations:
gen_nil:.:++:if:.3_0(0) ⇔ nil
gen_nil:.:++:if:.3_0(+(x, 1)) ⇔ .(gen_nil:.:++:if:.3_0(x))
The following defined symbols remain to be analysed:
lowers, qsort, greaters
They will be analysed ascendingly in the following order:
lowers < qsort
greaters < qsort
(11) RewriteLemmaProof (EQUIVALENT transformation)
Proved the following rewrite lemma:
lowers(
gen_nil:.:++:if:.3_0(
+(
1,
n5_0))) →
*4_0, rt ∈ Ω(2
n)
Induction Base:
lowers(gen_nil:.:++:if:.3_0(+(1, 0)))
Induction Step:
lowers(gen_nil:.:++:if:.3_0(+(1, +(n5_0, 1)))) →RΩ(1)
if(.(lowers(gen_nil:.:++:if:.3_0(+(1, n5_0)))), lowers(gen_nil:.:++:if:.3_0(+(1, n5_0)))) →IH
if(.(*4_0), lowers(gen_nil:.:++:if:.3_0(+(1, n5_0)))) →IH
if(.(*4_0), *4_0)
We have rt ∈ Ω(2n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(2n)
(12) BOUNDS(2^n, INF)