Term Rewriting System R:
[X, Y]
fact(X) -> if(zero(X), s(0), prod(X, fact(p(X))))
add(0, X) -> X
add(s(X), Y) -> s(add(X, Y))
prod(0, X) -> 0
prod(s(X), Y) -> add(Y, prod(X, Y))
if(true, X, Y) -> X
if(false, X, Y) -> Y
zero(0) -> true
zero(s(X)) -> false
p(s(X)) -> X

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:

FACT(X) -> IF(zero(X), s(0), prod(X, fact(p(X))))
FACT(X) -> ZERO(X)
FACT(X) -> PROD(X, fact(p(X)))
FACT(X) -> FACT(p(X))
FACT(X) -> P(X)
ADD(s(X), Y) -> ADD(X, Y)
PROD(s(X), Y) -> ADD(Y, prod(X, Y))
PROD(s(X), Y) -> PROD(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:

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


Rules:


fact(X) -> if(zero(X), s(0), prod(X, fact(p(X))))
add(0, X) -> X
add(s(X), Y) -> s(add(X, Y))
prod(0, X) -> 0
prod(s(X), Y) -> add(Y, prod(X, Y))
if(true, X, Y) -> X
if(false, X, Y) -> Y
zero(0) -> true
zero(s(X)) -> false
p(s(X)) -> X


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:

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


Rule:

none


Strategy:

innermost




We number the DPs as follows:
  1. ADD(s(X), Y) -> ADD(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:

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


Rules:


fact(X) -> if(zero(X), s(0), prod(X, fact(p(X))))
add(0, X) -> X
add(s(X), Y) -> s(add(X, Y))
prod(0, X) -> 0
prod(s(X), Y) -> add(Y, prod(X, Y))
if(true, X, Y) -> X
if(false, X, Y) -> Y
zero(0) -> true
zero(s(X)) -> false
p(s(X)) -> X


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:

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


Rule:

none


Strategy:

innermost




We number the DPs as follows:
  1. PROD(s(X), Y) -> PROD(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 Pair:

FACT(X) -> FACT(p(X))


Rules:


fact(X) -> if(zero(X), s(0), prod(X, fact(p(X))))
add(0, X) -> X
add(s(X), Y) -> s(add(X, Y))
prod(0, X) -> 0
prod(s(X), Y) -> add(Y, prod(X, Y))
if(true, X, Y) -> X
if(false, X, Y) -> Y
zero(0) -> true
zero(s(X)) -> false
p(s(X)) -> X


Strategy:

innermost




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


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 6
Modular Removal of Rules


Dependency Pair:

FACT(X) -> FACT(p(X))


Rule:


p(s(X)) -> X


Strategy:

innermost




We have the following set of usable rules:

p(s(X)) -> X
To remove rules and DPs from this DP problem we used the following monotonic and CE-compatible order: Polynomial ordering.
Polynomial interpretation:
  POL(FACT(x1))=  x1  
  POL(s(x1))=  x1  
  POL(p(x1))=  x1  

We have the following set D of usable symbols: {FACT, p}
No Dependency Pairs can be deleted.
The following rules can be deleted as they contain symbols in their lhs which do not occur in D:

p(s(X)) -> X


The result of this processor delivers one new DP problem.



   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 7
Non Termination


Dependency Pair:

FACT(X) -> FACT(p(X))


Rule:

none


Strategy:

innermost




Found an infinite P-chain over R:
P =

FACT(X) -> FACT(p(X))

R = none

s = FACT(X)
evaluates to t =FACT(p(X))

Thus, s starts an infinite chain as s matches t.

Non-Termination of R could be shown.
Duration:
0:02 minutes