(0) Obligation:
Q restricted rewrite system:
The TRS R consists of the following rules:
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
quicksort(x) → ifquick(isempty(x), x)
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
a → b
a → c
Q is empty.
(1) AAECC Innermost (EQUIVALENT transformation)
We have applied [NOC,AAECCNOC] to switch to innermost. The TRS R 1 is
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
quicksort(x) → ifquick(isempty(x), x)
The TRS R 2 is
a → b
a → c
The signature Sigma is {
a,
b,
c}
(2) Obligation:
Q restricted rewrite system:
The TRS R consists of the following rules:
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
quicksort(x) → ifquick(isempty(x), x)
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
a → b
a → c
The set Q consists of the following terms:
average(x0, x1)
if(true, x0, x1)
if(false, x0, x1)
averIter(x0, x1, x2)
ifIter(true, x0, x1, x2)
ifIter(false, x0, x1, x2)
append(nil, x0)
append(cons(x0, x1), x2)
low(x0, nil)
low(x0, cons(x1, x2))
if_low(false, x0, cons(x1, x2))
if_low(true, x0, cons(x1, x2))
high(x0, nil)
high(x0, cons(x1, x2))
if_high(false, x0, cons(x1, x2))
if_high(true, x0, cons(x1, x2))
quicksort(x0)
ifquick(true, x0)
ifquick(false, x0)
plus(0, x0)
plus(s(x0), x1)
isempty(nil)
isempty(cons(x0, x1))
head(nil)
head(cons(x0, x1))
tail(nil)
tail(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
a
(3) DependencyPairsProof (EQUIVALENT transformation)
Using Dependency Pairs [AG00,LPAR04] we result in the following initial DP problem.
(4) Obligation:
Q DP problem:
The TRS P consists of the following rules:
AVERAGE(x, y) → IF(ge(x, y), x, y)
AVERAGE(x, y) → GE(x, y)
IF(true, x, y) → AVERITER(y, x, y)
IF(false, x, y) → AVERITER(x, y, x)
AVERITER(x, y, z) → IFITER(ge(x, y), x, y, z)
AVERITER(x, y, z) → GE(x, y)
IFITER(false, x, y, z) → AVERITER(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
IFITER(false, x, y, z) → PLUS(x, s(s(s(0))))
IFITER(false, x, y, z) → PLUS(y, s(0))
IFITER(false, x, y, z) → PLUS(z, s(0))
LOW(n, cons(m, x)) → IF_LOW(ge(m, n), n, cons(m, x))
LOW(n, cons(m, x)) → GE(m, n)
IF_LOW(false, n, cons(m, x)) → LOW(n, x)
IF_LOW(true, n, cons(m, x)) → LOW(n, x)
HIGH(n, cons(m, x)) → IF_HIGH(ge(m, n), n, cons(m, x))
HIGH(n, cons(m, x)) → GE(m, n)
IF_HIGH(false, n, cons(m, x)) → HIGH(n, x)
IF_HIGH(true, n, cons(m, x)) → AVERAGE(m, m)
IF_HIGH(true, n, cons(m, x)) → HIGH(n, x)
QUICKSORT(x) → IFQUICK(isempty(x), x)
QUICKSORT(x) → ISEMPTY(x)
IFQUICK(false, x) → APPEND(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
IFQUICK(false, x) → QUICKSORT(low(head(x), tail(x)))
IFQUICK(false, x) → LOW(head(x), tail(x))
IFQUICK(false, x) → HEAD(x)
IFQUICK(false, x) → TAIL(x)
IFQUICK(false, x) → QUICKSORT(high(head(x), tail(x)))
IFQUICK(false, x) → HIGH(head(x), tail(x))
PLUS(s(x), y) → PLUS(x, y)
GE(s(x), s(y)) → GE(x, y)
The TRS R consists of the following rules:
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
quicksort(x) → ifquick(isempty(x), x)
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
a → b
a → c
The set Q consists of the following terms:
average(x0, x1)
if(true, x0, x1)
if(false, x0, x1)
averIter(x0, x1, x2)
ifIter(true, x0, x1, x2)
ifIter(false, x0, x1, x2)
append(nil, x0)
append(cons(x0, x1), x2)
low(x0, nil)
low(x0, cons(x1, x2))
if_low(false, x0, cons(x1, x2))
if_low(true, x0, cons(x1, x2))
high(x0, nil)
high(x0, cons(x1, x2))
if_high(false, x0, cons(x1, x2))
if_high(true, x0, cons(x1, x2))
quicksort(x0)
ifquick(true, x0)
ifquick(false, x0)
plus(0, x0)
plus(s(x0), x1)
isempty(nil)
isempty(cons(x0, x1))
head(nil)
head(cons(x0, x1))
tail(nil)
tail(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
a
We have to consider all minimal (P,Q,R)-chains.
(5) DependencyGraphProof (EQUIVALENT transformation)
The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 6 SCCs with 17 less nodes.
(6) Complex Obligation (AND)
(7) Obligation:
Q DP problem:
The TRS P consists of the following rules:
GE(s(x), s(y)) → GE(x, y)
The TRS R consists of the following rules:
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
quicksort(x) → ifquick(isempty(x), x)
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
a → b
a → c
The set Q consists of the following terms:
average(x0, x1)
if(true, x0, x1)
if(false, x0, x1)
averIter(x0, x1, x2)
ifIter(true, x0, x1, x2)
ifIter(false, x0, x1, x2)
append(nil, x0)
append(cons(x0, x1), x2)
low(x0, nil)
low(x0, cons(x1, x2))
if_low(false, x0, cons(x1, x2))
if_low(true, x0, cons(x1, x2))
high(x0, nil)
high(x0, cons(x1, x2))
if_high(false, x0, cons(x1, x2))
if_high(true, x0, cons(x1, x2))
quicksort(x0)
ifquick(true, x0)
ifquick(false, x0)
plus(0, x0)
plus(s(x0), x1)
isempty(nil)
isempty(cons(x0, x1))
head(nil)
head(cons(x0, x1))
tail(nil)
tail(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
a
We have to consider all minimal (P,Q,R)-chains.
(8) Obligation:
Q DP problem:
The TRS P consists of the following rules:
PLUS(s(x), y) → PLUS(x, y)
The TRS R consists of the following rules:
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
quicksort(x) → ifquick(isempty(x), x)
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
a → b
a → c
The set Q consists of the following terms:
average(x0, x1)
if(true, x0, x1)
if(false, x0, x1)
averIter(x0, x1, x2)
ifIter(true, x0, x1, x2)
ifIter(false, x0, x1, x2)
append(nil, x0)
append(cons(x0, x1), x2)
low(x0, nil)
low(x0, cons(x1, x2))
if_low(false, x0, cons(x1, x2))
if_low(true, x0, cons(x1, x2))
high(x0, nil)
high(x0, cons(x1, x2))
if_high(false, x0, cons(x1, x2))
if_high(true, x0, cons(x1, x2))
quicksort(x0)
ifquick(true, x0)
ifquick(false, x0)
plus(0, x0)
plus(s(x0), x1)
isempty(nil)
isempty(cons(x0, x1))
head(nil)
head(cons(x0, x1))
tail(nil)
tail(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
a
We have to consider all minimal (P,Q,R)-chains.
(9) Obligation:
Q DP problem:
The TRS P consists of the following rules:
IF_LOW(false, n, cons(m, x)) → LOW(n, x)
LOW(n, cons(m, x)) → IF_LOW(ge(m, n), n, cons(m, x))
IF_LOW(true, n, cons(m, x)) → LOW(n, x)
The TRS R consists of the following rules:
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
quicksort(x) → ifquick(isempty(x), x)
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
a → b
a → c
The set Q consists of the following terms:
average(x0, x1)
if(true, x0, x1)
if(false, x0, x1)
averIter(x0, x1, x2)
ifIter(true, x0, x1, x2)
ifIter(false, x0, x1, x2)
append(nil, x0)
append(cons(x0, x1), x2)
low(x0, nil)
low(x0, cons(x1, x2))
if_low(false, x0, cons(x1, x2))
if_low(true, x0, cons(x1, x2))
high(x0, nil)
high(x0, cons(x1, x2))
if_high(false, x0, cons(x1, x2))
if_high(true, x0, cons(x1, x2))
quicksort(x0)
ifquick(true, x0)
ifquick(false, x0)
plus(0, x0)
plus(s(x0), x1)
isempty(nil)
isempty(cons(x0, x1))
head(nil)
head(cons(x0, x1))
tail(nil)
tail(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
a
We have to consider all minimal (P,Q,R)-chains.
(10) Obligation:
Q DP problem:
The TRS P consists of the following rules:
IFITER(false, x, y, z) → AVERITER(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
AVERITER(x, y, z) → IFITER(ge(x, y), x, y, z)
The TRS R consists of the following rules:
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
quicksort(x) → ifquick(isempty(x), x)
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
a → b
a → c
The set Q consists of the following terms:
average(x0, x1)
if(true, x0, x1)
if(false, x0, x1)
averIter(x0, x1, x2)
ifIter(true, x0, x1, x2)
ifIter(false, x0, x1, x2)
append(nil, x0)
append(cons(x0, x1), x2)
low(x0, nil)
low(x0, cons(x1, x2))
if_low(false, x0, cons(x1, x2))
if_low(true, x0, cons(x1, x2))
high(x0, nil)
high(x0, cons(x1, x2))
if_high(false, x0, cons(x1, x2))
if_high(true, x0, cons(x1, x2))
quicksort(x0)
ifquick(true, x0)
ifquick(false, x0)
plus(0, x0)
plus(s(x0), x1)
isempty(nil)
isempty(cons(x0, x1))
head(nil)
head(cons(x0, x1))
tail(nil)
tail(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
a
We have to consider all minimal (P,Q,R)-chains.
(11) Obligation:
Q DP problem:
The TRS P consists of the following rules:
IF_HIGH(false, n, cons(m, x)) → HIGH(n, x)
HIGH(n, cons(m, x)) → IF_HIGH(ge(m, n), n, cons(m, x))
IF_HIGH(true, n, cons(m, x)) → HIGH(n, x)
The TRS R consists of the following rules:
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
quicksort(x) → ifquick(isempty(x), x)
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
a → b
a → c
The set Q consists of the following terms:
average(x0, x1)
if(true, x0, x1)
if(false, x0, x1)
averIter(x0, x1, x2)
ifIter(true, x0, x1, x2)
ifIter(false, x0, x1, x2)
append(nil, x0)
append(cons(x0, x1), x2)
low(x0, nil)
low(x0, cons(x1, x2))
if_low(false, x0, cons(x1, x2))
if_low(true, x0, cons(x1, x2))
high(x0, nil)
high(x0, cons(x1, x2))
if_high(false, x0, cons(x1, x2))
if_high(true, x0, cons(x1, x2))
quicksort(x0)
ifquick(true, x0)
ifquick(false, x0)
plus(0, x0)
plus(s(x0), x1)
isempty(nil)
isempty(cons(x0, x1))
head(nil)
head(cons(x0, x1))
tail(nil)
tail(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
a
We have to consider all minimal (P,Q,R)-chains.
(12) Obligation:
Q DP problem:
The TRS P consists of the following rules:
IFQUICK(false, x) → QUICKSORT(low(head(x), tail(x)))
QUICKSORT(x) → IFQUICK(isempty(x), x)
IFQUICK(false, x) → QUICKSORT(high(head(x), tail(x)))
The TRS R consists of the following rules:
average(x, y) → if(ge(x, y), x, y)
if(true, x, y) → averIter(y, x, y)
if(false, x, y) → averIter(x, y, x)
averIter(x, y, z) → ifIter(ge(x, y), x, y, z)
ifIter(true, x, y, z) → z
ifIter(false, x, y, z) → averIter(plus(x, s(s(s(0)))), plus(y, s(0)), plus(z, s(0)))
append(nil, y) → y
append(cons(n, x), y) → cons(n, app(x, y))
low(n, nil) → nil
low(n, cons(m, x)) → if_low(ge(m, n), n, cons(m, x))
if_low(false, n, cons(m, x)) → cons(m, low(n, x))
if_low(true, n, cons(m, x)) → low(n, x)
high(n, nil) → nil
high(n, cons(m, x)) → if_high(ge(m, n), n, cons(m, x))
if_high(false, n, cons(m, x)) → high(n, x)
if_high(true, n, cons(m, x)) → cons(average(m, m), high(n, x))
quicksort(x) → ifquick(isempty(x), x)
ifquick(true, x) → nil
ifquick(false, x) → append(quicksort(low(head(x), tail(x))), cons(tail(x), quicksort(high(head(x), tail(x)))))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
isempty(nil) → true
isempty(cons(n, x)) → false
head(nil) → error
head(cons(n, x)) → n
tail(nil) → nil
tail(cons(n, x)) → x
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
a → b
a → c
The set Q consists of the following terms:
average(x0, x1)
if(true, x0, x1)
if(false, x0, x1)
averIter(x0, x1, x2)
ifIter(true, x0, x1, x2)
ifIter(false, x0, x1, x2)
append(nil, x0)
append(cons(x0, x1), x2)
low(x0, nil)
low(x0, cons(x1, x2))
if_low(false, x0, cons(x1, x2))
if_low(true, x0, cons(x1, x2))
high(x0, nil)
high(x0, cons(x1, x2))
if_high(false, x0, cons(x1, x2))
if_high(true, x0, cons(x1, x2))
quicksort(x0)
ifquick(true, x0)
ifquick(false, x0)
plus(0, x0)
plus(s(x0), x1)
isempty(nil)
isempty(cons(x0, x1))
head(nil)
head(cons(x0, x1))
tail(nil)
tail(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
a
We have to consider all minimal (P,Q,R)-chains.