Term Rewriting System R:
[x, y]
ge(x, 0) -> true
ge(0, s(x)) -> false
ge(s(x), s(y)) -> ge(x, y)
minus(x, 0) -> x
minus(s(x), s(y)) -> minus(x, y)
div(x, y) -> ify(ge(y, s(0)), x, y)
ify(false, x, y) -> divByZeroError
ify(true, x, y) -> if(ge(x, y), x, y)
if(false, x, y) -> 0
if(true, x, y) -> s(div(minus(x, y), y))

Termination of R to be shown.



   R
Overlay and local confluence Check



The TRS is overlay and locally confluent (all critical pairs are trivially joinable).Hence, we can switch to innermost.


   R
OC
       →TRS2
Dependency Pair Analysis



R contains the following Dependency Pairs:

GE(s(x), s(y)) -> GE(x, y)
MINUS(s(x), s(y)) -> MINUS(x, y)
DIV(x, y) -> IFY(ge(y, s(0)), x, y)
DIV(x, y) -> GE(y, s(0))
IFY(true, x, y) -> IF(ge(x, y), x, y)
IFY(true, x, y) -> GE(x, y)
IF(true, x, y) -> DIV(minus(x, y), y)
IF(true, x, y) -> MINUS(x, y)

Furthermore, R contains three SCCs.


   R
OC
       →TRS2
DPs
           →DP Problem 1
Usable Rules (Innermost)
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules


Dependency Pair:

GE(s(x), s(y)) -> GE(x, y)


Rules:


ge(x, 0) -> true
ge(0, s(x)) -> false
ge(s(x), s(y)) -> ge(x, y)
minus(x, 0) -> x
minus(s(x), s(y)) -> minus(x, y)
div(x, y) -> ify(ge(y, s(0)), x, y)
ify(false, x, y) -> divByZeroError
ify(true, x, y) -> if(ge(x, y), x, y)
if(false, x, y) -> 0
if(true, x, y) -> s(div(minus(x, y), y))


Strategy:

innermost




As we are in the innermost case, we can delete all 10 non-usable-rules.


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
             ...
               →DP Problem 4
Size-Change Principle
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules


Dependency Pair:

GE(s(x), s(y)) -> GE(x, y)


Rule:

none


Strategy:

innermost




We number the DPs as follows:
  1. GE(s(x), s(y)) -> GE(x, y)
and get the following Size-Change Graph(s):
{1} , {1}
1>1
2>2

which lead(s) to this/these maximal multigraph(s):
{1} , {1}
1>1
2>2

DP: empty set
Oriented Rules: none

We used the order Homeomorphic Embedding Order with Non-Strict Precedence.
trivial

with Argument Filtering System:
s(x1) -> s(x1)

We obtain no new DP problems.


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
Usable Rules (Innermost)
           →DP Problem 3
UsableRules


Dependency Pair:

MINUS(s(x), s(y)) -> MINUS(x, y)


Rules:


ge(x, 0) -> true
ge(0, s(x)) -> false
ge(s(x), s(y)) -> ge(x, y)
minus(x, 0) -> x
minus(s(x), s(y)) -> minus(x, y)
div(x, y) -> ify(ge(y, s(0)), x, y)
ify(false, x, y) -> divByZeroError
ify(true, x, y) -> if(ge(x, y), x, y)
if(false, x, y) -> 0
if(true, x, y) -> s(div(minus(x, y), y))


Strategy:

innermost




As we are in the innermost case, we can delete all 10 non-usable-rules.


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
             ...
               →DP Problem 5
Size-Change Principle
           →DP Problem 3
UsableRules


Dependency Pair:

MINUS(s(x), s(y)) -> MINUS(x, y)


Rule:

none


Strategy:

innermost




We number the DPs as follows:
  1. MINUS(s(x), s(y)) -> MINUS(x, y)
and get the following Size-Change Graph(s):
{1} , {1}
1>1
2>2

which lead(s) to this/these maximal multigraph(s):
{1} , {1}
1>1
2>2

DP: empty set
Oriented Rules: none

We used the order Homeomorphic Embedding Order with Non-Strict Precedence.
trivial

with Argument Filtering System:
s(x1) -> s(x1)

We obtain no new DP problems.


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
Usable Rules (Innermost)


Dependency Pairs:

IF(true, x, y) -> DIV(minus(x, y), y)
IFY(true, x, y) -> IF(ge(x, y), x, y)
DIV(x, y) -> IFY(ge(y, s(0)), x, y)


Rules:


ge(x, 0) -> true
ge(0, s(x)) -> false
ge(s(x), s(y)) -> ge(x, y)
minus(x, 0) -> x
minus(s(x), s(y)) -> minus(x, y)
div(x, y) -> ify(ge(y, s(0)), x, y)
ify(false, x, y) -> divByZeroError
ify(true, x, y) -> if(ge(x, y), x, y)
if(false, x, y) -> 0
if(true, x, y) -> s(div(minus(x, y), y))


Strategy:

innermost




As we are in the innermost case, we can delete all 5 non-usable-rules.


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 6
Narrowing Transformation


Dependency Pairs:

IF(true, x, y) -> DIV(minus(x, y), y)
IFY(true, x, y) -> IF(ge(x, y), x, y)
DIV(x, y) -> IFY(ge(y, s(0)), x, y)


Rules:


minus(s(x), s(y)) -> minus(x, y)
minus(x, 0) -> x
ge(x, 0) -> true
ge(s(x), s(y)) -> ge(x, y)
ge(0, s(x)) -> false


Strategy:

innermost




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

IFY(true, x, y) -> IF(ge(x, y), x, y)
three new Dependency Pairs are created:

IFY(true, x'', 0) -> IF(true, x'', 0)
IFY(true, s(x''), s(y'')) -> IF(ge(x'', y''), s(x''), s(y''))
IFY(true, 0, s(x'')) -> IF(false, 0, s(x''))

The transformation is resulting in one new DP problem:



   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 7
Narrowing Transformation


Dependency Pairs:

IFY(true, s(x''), s(y'')) -> IF(ge(x'', y''), s(x''), s(y''))
IFY(true, x'', 0) -> IF(true, x'', 0)
DIV(x, y) -> IFY(ge(y, s(0)), x, y)
IF(true, x, y) -> DIV(minus(x, y), y)


Rules:


minus(s(x), s(y)) -> minus(x, y)
minus(x, 0) -> x
ge(x, 0) -> true
ge(s(x), s(y)) -> ge(x, y)
ge(0, s(x)) -> false


Strategy:

innermost




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

DIV(x, y) -> IFY(ge(y, s(0)), x, y)
two new Dependency Pairs are created:

DIV(x, s(x'')) -> IFY(ge(x'', 0), x, s(x''))
DIV(x, 0) -> IFY(false, x, 0)

The transformation is resulting in one new DP problem:



   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 8
Rewriting Transformation


Dependency Pairs:

DIV(x, s(x'')) -> IFY(ge(x'', 0), x, s(x''))
IF(true, x, y) -> DIV(minus(x, y), y)
IFY(true, s(x''), s(y'')) -> IF(ge(x'', y''), s(x''), s(y''))


Rules:


minus(s(x), s(y)) -> minus(x, y)
minus(x, 0) -> x
ge(x, 0) -> true
ge(s(x), s(y)) -> ge(x, y)
ge(0, s(x)) -> false


Strategy:

innermost




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

DIV(x, s(x'')) -> IFY(ge(x'', 0), x, s(x''))
one new Dependency Pair is created:

DIV(x, s(x'')) -> IFY(true, x, s(x''))

The transformation is resulting in one new DP problem:



   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 9
Instantiation Transformation


Dependency Pairs:

IFY(true, s(x''), s(y'')) -> IF(ge(x'', y''), s(x''), s(y''))
DIV(x, s(x'')) -> IFY(true, x, s(x''))
IF(true, x, y) -> DIV(minus(x, y), y)


Rules:


minus(s(x), s(y)) -> minus(x, y)
minus(x, 0) -> x
ge(x, 0) -> true
ge(s(x), s(y)) -> ge(x, y)
ge(0, s(x)) -> false


Strategy:

innermost




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

IF(true, x, y) -> DIV(minus(x, y), y)
one new Dependency Pair is created:

IF(true, s(x'''''), s(y'''')) -> DIV(minus(s(x'''''), s(y'''')), s(y''''))

The transformation is resulting in one new DP problem:



   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 10
Rewriting Transformation


Dependency Pairs:

DIV(x, s(x'')) -> IFY(true, x, s(x''))
IF(true, s(x'''''), s(y'''')) -> DIV(minus(s(x'''''), s(y'''')), s(y''''))
IFY(true, s(x''), s(y'')) -> IF(ge(x'', y''), s(x''), s(y''))


Rules:


minus(s(x), s(y)) -> minus(x, y)
minus(x, 0) -> x
ge(x, 0) -> true
ge(s(x), s(y)) -> ge(x, y)
ge(0, s(x)) -> false


Strategy:

innermost




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

IF(true, s(x'''''), s(y'''')) -> DIV(minus(s(x'''''), s(y'''')), s(y''''))
one new Dependency Pair is created:

IF(true, s(x'''''), s(y'''')) -> DIV(minus(x''''', y''''), s(y''''))

The transformation is resulting in one new DP problem:



   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 11
Negative Polynomial Order


Dependency Pairs:

IF(true, s(x'''''), s(y'''')) -> DIV(minus(x''''', y''''), s(y''''))
IFY(true, s(x''), s(y'')) -> IF(ge(x'', y''), s(x''), s(y''))
DIV(x, s(x'')) -> IFY(true, x, s(x''))


Rules:


minus(s(x), s(y)) -> minus(x, y)
minus(x, 0) -> x
ge(x, 0) -> true
ge(s(x), s(y)) -> ge(x, y)
ge(0, s(x)) -> false


Strategy:

innermost




The following Dependency Pair can be strictly oriented using the given order.

IF(true, s(x'''''), s(y'''')) -> DIV(minus(x''''', y''''), s(y''''))


Moreover, the following usable rules (regarding the implicit AFS) are oriented.

minus(s(x), s(y)) -> minus(x, y)
minus(x, 0) -> x
ge(x, 0) -> true
ge(s(x), s(y)) -> ge(x, y)
ge(0, s(x)) -> false


Used ordering:
Polynomial Order with Interpretation:

POL( IF(x1, ..., x3) ) = x2

POL( s(x1) ) = x1 + 1

POL( DIV(x1, x2) ) = x1

POL( minus(x1, x2) ) = x1

POL( IFY(x1, ..., x3) ) = x2

POL( ge(x1, x2) ) = 0

POL( true ) = 0

POL( false ) = 0


This results in one new DP problem.


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 12
Dependency Graph


Dependency Pairs:

IFY(true, s(x''), s(y'')) -> IF(ge(x'', y''), s(x''), s(y''))
DIV(x, s(x'')) -> IFY(true, x, s(x''))


Rules:


minus(s(x), s(y)) -> minus(x, y)
minus(x, 0) -> x
ge(x, 0) -> true
ge(s(x), s(y)) -> ge(x, y)
ge(0, s(x)) -> false


Strategy:

innermost




Using the Dependency Graph resulted in no new DP problems.

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