(0) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

Q is empty.

(1) Overlay + Local Confluence (EQUIVALENT transformation)

The TRS is overlay and locally confluent. By [NOC] we can switch to innermost.

(2) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

(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:

EQ(s(X), s(Y)) → EQ(X, Y)
LE(s(X), s(Y)) → LE(X, Y)
MIN(cons(N, cons(M, L))) → IFMIN(le(N, M), cons(N, cons(M, L)))
MIN(cons(N, cons(M, L))) → LE(N, M)
IFMIN(true, cons(N, cons(M, L))) → MIN(cons(N, L))
IFMIN(false, cons(N, cons(M, L))) → MIN(cons(M, L))
REPLACE(N, M, cons(K, L)) → IFREPL(eq(N, K), N, M, cons(K, L))
REPLACE(N, M, cons(K, L)) → EQ(N, K)
IFREPL(false, N, M, cons(K, L)) → REPLACE(N, M, L)
SELSORT(cons(N, L)) → IFSELSORT(eq(N, min(cons(N, L))), cons(N, L))
SELSORT(cons(N, L)) → EQ(N, min(cons(N, L)))
SELSORT(cons(N, L)) → MIN(cons(N, L))
IFSELSORT(true, cons(N, L)) → SELSORT(L)
IFSELSORT(false, cons(N, L)) → MIN(cons(N, L))
IFSELSORT(false, cons(N, L)) → SELSORT(replace(min(cons(N, L)), N, L))
IFSELSORT(false, cons(N, L)) → REPLACE(min(cons(N, L)), N, L)

The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 5 SCCs with 6 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

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

LE(s(X), s(Y)) → LE(X, Y)

The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(8) Obligation:

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

MIN(cons(N, cons(M, L))) → IFMIN(le(N, M), cons(N, cons(M, L)))
IFMIN(true, cons(N, cons(M, L))) → MIN(cons(N, L))
IFMIN(false, cons(N, cons(M, L))) → MIN(cons(M, L))

The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(9) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


MIN(cons(N, cons(M, L))) → IFMIN(le(N, M), cons(N, cons(M, L)))
IFMIN(true, cons(N, cons(M, L))) → MIN(cons(N, L))
IFMIN(false, cons(N, cons(M, L))) → MIN(cons(M, L))
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
MIN(x1)  =  MIN(x1)
cons(x1, x2)  =  cons(x2)
IFMIN(x1, x2)  =  IFMIN(x1, x2)
le(x1, x2)  =  le
true  =  true
false  =  false
eq(x1, x2)  =  eq
0  =  0
s(x1)  =  s
min(x1)  =  x1
nil  =  nil
ifmin(x1, x2)  =  x2
replace(x1, x2, x3)  =  x3
ifrepl(x1, x2, x3, x4)  =  x4
selsort(x1)  =  x1
ifselsort(x1, x2)  =  x2

Recursive Path Order [RPO].
Precedence:
cons1 > MIN1 > IFMIN2
cons1 > le > true
cons1 > le > false
cons1 > 0
cons1 > s
eq > true
eq > false
nil > 0
nil > s

The following usable rules [FROCOS05] were oriented:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

(10) Obligation:

Q DP problem:
P is empty.
The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(11) PisEmptyProof (EQUIVALENT transformation)

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

(12) TRUE

(13) Obligation:

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

EQ(s(X), s(Y)) → EQ(X, Y)

The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(14) Obligation:

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

REPLACE(N, M, cons(K, L)) → IFREPL(eq(N, K), N, M, cons(K, L))
IFREPL(false, N, M, cons(K, L)) → REPLACE(N, M, L)

The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(15) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


REPLACE(N, M, cons(K, L)) → IFREPL(eq(N, K), N, M, cons(K, L))
IFREPL(false, N, M, cons(K, L)) → REPLACE(N, M, L)
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
REPLACE(x1, x2, x3)  =  REPLACE(x3)
cons(x1, x2)  =  cons(x2)
IFREPL(x1, x2, x3, x4)  =  x4
eq(x1, x2)  =  eq
false  =  false
0  =  0
true  =  true
s(x1)  =  s
le(x1, x2)  =  le
min(x1)  =  min(x1)
nil  =  nil
ifmin(x1, x2)  =  ifmin(x2)
replace(x1, x2, x3)  =  x3
ifrepl(x1, x2, x3, x4)  =  x4
selsort(x1)  =  x1
ifselsort(x1, x2)  =  x2

Recursive Path Order [RPO].
Precedence:
eq > false > cons1 > min1 > 0 > REPLACE1
eq > false > cons1 > min1 > s > REPLACE1
eq > false > cons1 > min1 > ifmin1 > REPLACE1
eq > true > REPLACE1
le > false > cons1 > min1 > 0 > REPLACE1
le > false > cons1 > min1 > s > REPLACE1
le > false > cons1 > min1 > ifmin1 > REPLACE1
le > true > REPLACE1
nil > 0 > REPLACE1
nil > s > REPLACE1

The following usable rules [FROCOS05] were oriented:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

(16) Obligation:

Q DP problem:
P is empty.
The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(17) PisEmptyProof (EQUIVALENT transformation)

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

(18) TRUE

(19) Obligation:

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

IFSELSORT(true, cons(N, L)) → SELSORT(L)
SELSORT(cons(N, L)) → IFSELSORT(eq(N, min(cons(N, L))), cons(N, L))
IFSELSORT(false, cons(N, L)) → SELSORT(replace(min(cons(N, L)), N, L))

The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(20) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


IFSELSORT(true, cons(N, L)) → SELSORT(L)
IFSELSORT(false, cons(N, L)) → SELSORT(replace(min(cons(N, L)), N, L))
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
IFSELSORT(x1, x2)  =  x2
true  =  true
cons(x1, x2)  =  cons(x2)
SELSORT(x1)  =  x1
eq(x1, x2)  =  eq
min(x1)  =  x1
false  =  false
replace(x1, x2, x3)  =  x3
0  =  0
s(x1)  =  s
le(x1, x2)  =  le
nil  =  nil
ifmin(x1, x2)  =  x2
ifrepl(x1, x2, x3, x4)  =  x4
selsort(x1)  =  x1
ifselsort(x1, x2)  =  x2

Recursive Path Order [RPO].
Precedence:
eq > false > cons1 > 0 > true
eq > false > cons1 > s > true
le > false > cons1 > 0 > true
le > false > cons1 > s > true
nil > 0 > true

The following usable rules [FROCOS05] were oriented:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

(21) Obligation:

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

SELSORT(cons(N, L)) → IFSELSORT(eq(N, min(cons(N, L))), cons(N, L))

The TRS R consists of the following rules:

eq(0, 0) → true
eq(0, s(Y)) → false
eq(s(X), 0) → false
eq(s(X), s(Y)) → eq(X, Y)
le(0, Y) → true
le(s(X), 0) → false
le(s(X), s(Y)) → le(X, Y)
min(cons(0, nil)) → 0
min(cons(s(N), nil)) → s(N)
min(cons(N, cons(M, L))) → ifmin(le(N, M), cons(N, cons(M, L)))
ifmin(true, cons(N, cons(M, L))) → min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) → min(cons(M, L))
replace(N, M, nil) → nil
replace(N, M, cons(K, L)) → ifrepl(eq(N, K), N, M, cons(K, L))
ifrepl(true, N, M, cons(K, L)) → cons(M, L)
ifrepl(false, N, M, cons(K, L)) → cons(K, replace(N, M, L))
selsort(nil) → nil
selsort(cons(N, L)) → ifselsort(eq(N, min(cons(N, L))), cons(N, L))
ifselsort(true, cons(N, L)) → cons(N, selsort(L))
ifselsort(false, cons(N, L)) → cons(min(cons(N, L)), selsort(replace(min(cons(N, L)), N, L)))

The set Q consists of the following terms:

eq(0, 0)
eq(0, s(x0))
eq(s(x0), 0)
eq(s(x0), s(x1))
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
min(cons(0, nil))
min(cons(s(x0), nil))
min(cons(x0, cons(x1, x2)))
ifmin(true, cons(x0, cons(x1, x2)))
ifmin(false, cons(x0, cons(x1, x2)))
replace(x0, x1, nil)
replace(x0, x1, cons(x2, x3))
ifrepl(true, x0, x1, cons(x2, x3))
ifrepl(false, x0, x1, cons(x2, x3))
selsort(nil)
selsort(cons(x0, x1))
ifselsort(true, cons(x0, x1))
ifselsort(false, cons(x0, x1))

We have to consider all minimal (P,Q,R)-chains.

(22) DependencyGraphProof (EQUIVALENT transformation)

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

(23) TRUE