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

Innermost 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
Argument Filtering and Ordering
       →DP Problem 2
AFS
       →DP Problem 3
AFS
       →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)))


Strategy:

innermost




The following dependency pair can be strictly oriented:

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


There are no usable rules for innermost that need to be oriented.
Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(LAST(x1))=  1 + x1  
  POL(.(x1, x2))=  1 + x1 + x2  

resulting in one new DP problem.
Used Argument Filtering System:
LAST(x1) -> LAST(x1)
.(x1, x2) -> .(x1, x2)


   R
DPs
       →DP Problem 1
AFS
           →DP Problem 5
Dependency Graph
       →DP Problem 2
AFS
       →DP Problem 3
AFS
       →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)))


Strategy:

innermost




Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
AFS
       →DP Problem 2
Argument Filtering and Ordering
       →DP Problem 3
AFS
       →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)))


Strategy:

innermost




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 for innermost that need to be oriented.
Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(BUBBLE(x1))=  1 + x1  
  POL(.(x1, x2))=  1 + x1 + x2  

resulting in one new DP problem.
Used Argument Filtering System:
BUBBLE(x1) -> BUBBLE(x1)
.(x1, x2) -> .(x1, x2)


   R
DPs
       →DP Problem 1
AFS
       →DP Problem 2
AFS
           →DP Problem 6
Dependency Graph
       →DP Problem 3
AFS
       →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)))


Strategy:

innermost




Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
AFS
       →DP Problem 2
AFS
       →DP Problem 3
Argument Filtering and 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)))


Strategy:

innermost




The following dependency pair can be strictly oriented:

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


There are no usable rules for innermost that need to be oriented.
Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(BUTLAST(x1))=  1 + x1  
  POL(.(x1, x2))=  1 + x1 + x2  

resulting in one new DP problem.
Used Argument Filtering System:
BUTLAST(x1) -> BUTLAST(x1)
.(x1, x2) -> .(x1, x2)


   R
DPs
       →DP Problem 1
AFS
       →DP Problem 2
AFS
       →DP Problem 3
AFS
           →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)))


Strategy:

innermost




Using the Dependency Graph resulted in no new DP problems.


   R
DPs
       →DP Problem 1
AFS
       →DP Problem 2
AFS
       →DP Problem 3
AFS
       →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)))


Strategy:

innermost




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
AFS
       →DP Problem 2
AFS
       →DP Problem 3
AFS
       →DP Problem 4
Nar
           →DP Problem 8
Rewriting Transformation


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


Strategy:

innermost




On this DP problem, a Rewriting 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 one new DP problem:



   R
DPs
       →DP Problem 1
AFS
       →DP Problem 2
AFS
       →DP Problem 3
AFS
       →DP Problem 4
Nar
           →DP Problem 8
Rw
             ...
               →DP Problem 9
Argument Filtering and Ordering


Dependency Pair:

BSORT(.(x'', .(y'', z'))) -> BSORT(butlast(if(<=(x'', y''), .(y'', bubble(.(x'', z'))), .(x'', bubble(.(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)))


Strategy:

innermost




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


The following usable rules for innermost can be oriented:

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


Used ordering: Polynomial ordering with Polynomial interpretation:
  POL(butlast(x1))=  x1  
  POL(nil)=  0  
  POL(.(x1, x2))=  1 + x1 + x2  
  POL(BSORT(x1))=  x1  
  POL(bubble(x1))=  x1  
  POL(<=(x1, x2))=  x1 + x2  

resulting in one new DP problem.
Used Argument Filtering System:
BSORT(x1) -> BSORT(x1)
.(x1, x2) -> .(x1, x2)
butlast(x1) -> butlast(x1)
if(x1, x2, x3) -> x1
<=(x1, x2) -> <=(x1, x2)
bubble(x1) -> bubble(x1)


   R
DPs
       →DP Problem 1
AFS
       →DP Problem 2
AFS
       →DP Problem 3
AFS
       →DP Problem 4
Nar
           →DP Problem 8
Rw
             ...
               →DP Problem 10
Dependency Graph


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


Strategy:

innermost




Using the Dependency Graph resulted in no new DP problems.

Innermost Termination of R successfully shown.
Duration:
0:01 minutes