Term Rewriting System R:
[x, y, z]
bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))

Termination of R to be shown.



   R
Dependency Pair Analysis



R contains the following Dependency Pairs:

BSORT(.(x, y)) -> LAST(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
BSORT(.(x, y)) -> BUBBLE(.(x, y))
BSORT(.(x, y)) -> BSORT(butlast(bubble(.(x, y))))
BSORT(.(x, y)) -> BUTLAST(bubble(.(x, y)))
BUBBLE(.(x, .(y, z))) -> BUBBLE(.(x, z))
BUBBLE(.(x, .(y, z))) -> BUBBLE(.(y, z))
LAST(.(x, .(y, z))) -> LAST(.(y, z))
BUTLAST(.(x, .(y, z))) -> BUTLAST(.(y, z))

Furthermore, R contains four SCCs.


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


Dependency Pair:

LAST(.(x, .(y, z))) -> LAST(.(y, z))


Rules:


bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))





The following dependency pair can be strictly oriented:

LAST(.(x, .(y, z))) -> LAST(.(y, z))


There are no usable rules w.r.t. to the implicit AFS that need to be oriented.

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(LAST(x1))=  1 + x1  
  POL(.(x1, x2))=  1 + x2  

resulting in one new DP problem.



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


Dependency Pair:


Rules:


bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))





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
Nar


Dependency Pairs:

BUBBLE(.(x, .(y, z))) -> BUBBLE(.(y, z))
BUBBLE(.(x, .(y, z))) -> BUBBLE(.(x, z))


Rules:


bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))





The following dependency pairs can be strictly oriented:

BUBBLE(.(x, .(y, z))) -> BUBBLE(.(y, z))
BUBBLE(.(x, .(y, z))) -> BUBBLE(.(x, z))


There are no usable rules w.r.t. to the implicit AFS that need to be oriented.

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(BUBBLE(x1))=  1 + x1  
  POL(.(x1, x2))=  1 + x2  

resulting in one new DP problem.



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


Dependency Pair:


Rules:


bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))





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
Nar


Dependency Pair:

BUTLAST(.(x, .(y, z))) -> BUTLAST(.(y, z))


Rules:


bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))





The following dependency pair can be strictly oriented:

BUTLAST(.(x, .(y, z))) -> BUTLAST(.(y, z))


There are no usable rules w.r.t. to the implicit AFS that need to be oriented.

Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(BUTLAST(x1))=  1 + x1  
  POL(.(x1, x2))=  1 + x2  

resulting in one new DP problem.



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


Dependency Pair:


Rules:


bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))





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
Narrowing Transformation


Dependency Pair:

BSORT(.(x, y)) -> BSORT(butlast(bubble(.(x, y))))


Rules:


bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

BSORT(.(x, y)) -> BSORT(butlast(bubble(.(x, y))))
two new Dependency Pairs are created:

BSORT(.(x'', nil)) -> BSORT(butlast(.(x'', nil)))
BSORT(.(x'', .(y'', z'))) -> BSORT(butlast(if(<=(x'', y''), .(y'', bubble(.(x'', z'))), .(x'', bubble(.(y'', z'))))))

The transformation is resulting in one new DP problem:



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


Dependency Pairs:

BSORT(.(x'', .(y'', z'))) -> BSORT(butlast(if(<=(x'', y''), .(y'', bubble(.(x'', z'))), .(x'', bubble(.(y'', z'))))))
BSORT(.(x'', nil)) -> BSORT(butlast(.(x'', nil)))


Rules:


bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))





The following dependency pair can be strictly oriented:

BSORT(.(x'', .(y'', z'))) -> BSORT(butlast(if(<=(x'', y''), .(y'', bubble(.(x'', z'))), .(x'', bubble(.(y'', z'))))))


Additionally, the following usable rules w.r.t. to the implicit AFS can be oriented:

butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))


Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(if(x1, x2, x3))=  0  
  POL(butlast(x1))=  x1  
  POL(nil)=  0  
  POL(.(x1, x2))=  1  
  POL(bubble(x1))=  0  
  POL(BSORT(x1))=  1 + x1  
  POL(<=(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
Nar
           →DP Problem 8
Polo
             ...
               →DP Problem 9
Narrowing Transformation


Dependency Pair:

BSORT(.(x'', nil)) -> BSORT(butlast(.(x'', nil)))


Rules:


bsort(nil) -> nil
bsort(.(x, y)) -> last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) -> nil
bubble(.(x, nil)) -> .(x, nil)
bubble(.(x, .(y, z))) -> if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) -> 0
last(.(x, nil)) -> x
last(.(x, .(y, z))) -> last(.(y, z))
butlast(nil) -> nil
butlast(.(x, nil)) -> nil
butlast(.(x, .(y, z))) -> .(x, butlast(.(y, z)))





On this DP problem, a Narrowing SCC transformation can be performed.
As a result of transforming the rule

BSORT(.(x'', nil)) -> BSORT(butlast(.(x'', nil)))
one new Dependency Pair is created:

BSORT(.(x''', nil)) -> BSORT(nil)

The transformation is resulting in no new DP problems.


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