(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)
ab
ac

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

ab
ac

The signature Sigma is {c, a, b}

(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)
ab
ac

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)
ab
ac

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)
ab
ac

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) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


GE(s(x), s(y)) → GE(x, y)
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
GE(x1, x2)  =  GE(x1)
s(x1)  =  s(x1)

Recursive path order with status [RPO].
Precedence:
s1 > GE1

Status:
s1: multiset
GE1: multiset

The following usable rules [FROCOS05] were oriented: none

(9) Obligation:

Q DP problem:
P is empty.
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)
ab
ac

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) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(11) TRUE

(12) 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)
ab
ac

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.

(13) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


PLUS(s(x), y) → PLUS(x, y)
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
PLUS(x1, x2)  =  PLUS(x1)
s(x1)  =  s(x1)

Recursive path order with status [RPO].
Precedence:
s1 > PLUS1

Status:
s1: multiset
PLUS1: multiset

The following usable rules [FROCOS05] were oriented: none

(14) Obligation:

Q DP problem:
P is empty.
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)
ab
ac

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.

(15) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(16) TRUE

(17) 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)
ab
ac

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.

(18) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


IF_LOW(false, n, cons(m, x)) → LOW(n, x)
IF_LOW(true, n, cons(m, x)) → LOW(n, x)
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
IF_LOW(x1, x2, x3)  =  x3
false  =  false
cons(x1, x2)  =  cons(x2)
LOW(x1, x2)  =  x2
ge(x1, x2)  =  ge
true  =  true
0  =  0
s(x1)  =  s

Recursive path order with status [RPO].
Precedence:
0 > false
s > ge > false

Status:
cons1: multiset
true: multiset
ge: multiset
false: multiset
s: multiset
0: multiset

The following usable rules [FROCOS05] were oriented: none

(19) Obligation:

Q DP problem:
The TRS P consists of the following rules:

LOW(n, cons(m, x)) → IF_LOW(ge(m, n), n, cons(m, 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)
ab
ac

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.

(20) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 1 less node.

(21) TRUE

(22) 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)
ab
ac

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.

(23) 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)
ab
ac

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.

(24) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


IF_HIGH(false, n, cons(m, x)) → HIGH(n, x)
IF_HIGH(true, n, cons(m, x)) → HIGH(n, x)
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
IF_HIGH(x1, x2, x3)  =  x3
false  =  false
cons(x1, x2)  =  cons(x2)
HIGH(x1, x2)  =  x2
ge(x1, x2)  =  ge
true  =  true
0  =  0
s(x1)  =  s

Recursive path order with status [RPO].
Precedence:
0 > false
s > ge > false

Status:
cons1: multiset
true: multiset
ge: multiset
false: multiset
s: multiset
0: multiset

The following usable rules [FROCOS05] were oriented: none

(25) Obligation:

Q DP problem:
The TRS P consists of the following rules:

HIGH(n, cons(m, x)) → IF_HIGH(ge(m, n), n, cons(m, 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)
ab
ac

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.

(26) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 1 less node.

(27) TRUE

(28) 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)
ab
ac

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.