Term Rewriting System R:
[Y, X, N, M, L, K]
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)))

Termination of R to be shown.



   R
Dependency Pair Analysis



R contains the following Dependency Pairs:

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)

Furthermore, R contains five SCCs.


   R
DPs
       →DP Problem 1
Polynomial Ordering
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Polo
       →DP Problem 5
Polo


Dependency Pair:

EQ(s(X), s(Y)) -> EQ(X, Y)


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 following dependency pair can be strictly oriented:

EQ(s(X), s(Y)) -> EQ(X, Y)


There are no usable rules using the Ce-refinement that need to be oriented.

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(EQ(x1, x2))=  x1  
  POL(s(x1))=  1 + x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
           →DP Problem 6
Dependency Graph
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Polo
       →DP Problem 5
Polo


Dependency Pair:


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





Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polynomial Ordering
       →DP Problem 3
Polo
       →DP Problem 4
Polo
       →DP Problem 5
Polo


Dependency Pair:

LE(s(X), s(Y)) -> LE(X, Y)


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 following dependency pair can be strictly oriented:

LE(s(X), s(Y)) -> LE(X, Y)


There are no usable rules using the Ce-refinement that need to be oriented.

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(LE(x1, x2))=  x1  
  POL(s(x1))=  1 + x1  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
           →DP Problem 7
Dependency Graph
       →DP Problem 3
Polo
       →DP Problem 4
Polo
       →DP Problem 5
Polo


Dependency Pair:


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





Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polynomial Ordering
       →DP Problem 4
Polo
       →DP Problem 5
Polo


Dependency Pairs:

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


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 following dependency pair can be strictly oriented:

IFREPL(false, N, M, cons(K, L)) -> REPLACE(N, M, L)


Additionally, the following usable rules using the Ce-refinement can be oriented:

eq(0, 0) -> true
eq(0, s(Y)) -> false
eq(s(X), 0) -> false
eq(s(X), s(Y)) -> eq(X, Y)


Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(REPLACE(x1, x2, x3))=  x3  
  POL(eq(x1, x2))=  0  
  POL(0)=  0  
  POL(false)=  0  
  POL(cons(x1, x2))=  1 + x2  
  POL(true)=  0  
  POL(s(x1))=  0  
  POL(IFREPL(x1, x2, x3, x4))=  x4  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
           →DP Problem 8
Dependency Graph
       →DP Problem 4
Polo
       →DP Problem 5
Polo


Dependency Pair:

REPLACE(N, M, cons(K, L)) -> IFREPL(eq(N, K), N, M, cons(K, L))


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





Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Polynomial Ordering
       →DP Problem 5
Polo


Dependency Pairs:

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


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 following dependency pairs can be strictly oriented:

IFMIN(false, cons(N, cons(M, L))) -> MIN(cons(M, L))
IFMIN(true, cons(N, cons(M, L))) -> MIN(cons(N, L))


Additionally, the following usable rules using the Ce-refinement can be oriented:

le(0, Y) -> true
le(s(X), 0) -> false
le(s(X), s(Y)) -> le(X, Y)


Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(0)=  0  
  POL(false)=  0  
  POL(IFMIN(x1, x2))=  x2  
  POL(cons(x1, x2))=  1 + x2  
  POL(MIN(x1))=  x1  
  POL(true)=  0  
  POL(s(x1))=  0  
  POL(le(x1, x2))=  0  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Polo
           →DP Problem 9
Dependency Graph
       →DP Problem 5
Polo


Dependency Pair:

MIN(cons(N, cons(M, L))) -> IFMIN(le(N, M), cons(N, cons(M, L)))


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





Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Polo
       →DP Problem 5
Polynomial Ordering


Dependency Pairs:

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


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 following dependency pairs can be strictly oriented:

IFSELSORT(false, cons(N, L)) -> SELSORT(replace(min(cons(N, L)), N, L))
IFSELSORT(true, cons(N, L)) -> SELSORT(L)


Additionally, the following usable rules using the Ce-refinement can be oriented:

replace(N, M, nil) -> nil
replace(N, M, cons(K, L)) -> ifrepl(eq(N, K), N, M, cons(K, L))
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)))
ifrepl(true, N, M, cons(K, L)) -> cons(M, L)
ifrepl(false, N, M, cons(K, L)) -> cons(K, replace(N, M, L))
ifmin(true, cons(N, cons(M, L))) -> min(cons(N, L))
ifmin(false, cons(N, cons(M, L))) -> min(cons(M, L))
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)


Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(false)=  0  
  POL(true)=  0  
  POL(replace(x1, x2, x3))=  x3  
  POL(eq(x1, x2))=  0  
  POL(0)=  0  
  POL(SELSORT(x1))=  x1  
  POL(cons(x1, x2))=  1 + x2  
  POL(IFSELSORT(x1, x2))=  x2  
  POL(nil)=  0  
  POL(min(x1))=  0  
  POL(s(x1))=  0  
  POL(ifrepl(x1, x2, x3, x4))=  x4  
  POL(le(x1, x2))=  0  
  POL(ifmin(x1, x2))=  0  

resulting in one new DP problem.



   R
DPs
       →DP Problem 1
Polo
       →DP Problem 2
Polo
       →DP Problem 3
Polo
       →DP Problem 4
Polo
       →DP Problem 5
Polo
           →DP Problem 10
Dependency Graph


Dependency Pair:

SELSORT(cons(N, L)) -> IFSELSORT(eq(N, min(cons(N, L))), cons(N, L))


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





Using the Dependency Graph resulted in no new DP problems.

Termination of R successfully shown.
Duration:
0:00 minutes