Term Rewriting System R:
[X, Y]
p(0) -> 0
p(s(X)) -> X
leq(0, Y) -> true
leq(s(X), 0) -> false
leq(s(X), s(Y)) -> leq(X, Y)
if(true, X, Y) -> X
if(false, X, Y) -> Y
diff(X, Y) -> if(leq(X, Y), 0, s(diff(p(X), 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:

LEQ(s(X), s(Y)) -> LEQ(X, Y)
DIFF(X, Y) -> IF(leq(X, Y), 0, s(diff(p(X), Y)))
DIFF(X, Y) -> LEQ(X, Y)
DIFF(X, Y) -> DIFF(p(X), Y)
DIFF(X, Y) -> P(X)

Furthermore, R contains two SCCs.


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


Dependency Pair:

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


Rules:


p(0) -> 0
p(s(X)) -> X
leq(0, Y) -> true
leq(s(X), 0) -> false
leq(s(X), s(Y)) -> leq(X, Y)
if(true, X, Y) -> X
if(false, X, Y) -> Y
diff(X, Y) -> if(leq(X, Y), 0, s(diff(p(X), Y)))


Strategy:

innermost




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


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


Dependency Pair:

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


Rule:

none


Strategy:

innermost




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


Dependency Pair:

DIFF(X, Y) -> DIFF(p(X), Y)


Rules:


p(0) -> 0
p(s(X)) -> X
leq(0, Y) -> true
leq(s(X), 0) -> false
leq(s(X), s(Y)) -> leq(X, Y)
if(true, X, Y) -> X
if(false, X, Y) -> Y
diff(X, Y) -> if(leq(X, Y), 0, s(diff(p(X), Y)))


Strategy:

innermost




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


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


Dependency Pair:

DIFF(X, Y) -> DIFF(p(X), Y)


Rules:


p(s(X)) -> X
p(0) -> 0


Strategy:

innermost




We have the following set of usable rules:

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

We have the following set D of usable symbols: {DIFF, 0, 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 5
Non Termination


Dependency Pair:

DIFF(X, Y) -> DIFF(p(X), Y)


Rule:


p(0) -> 0


Strategy:

innermost




Found an infinite P-chain over R:
P =

DIFF(X, Y) -> DIFF(p(X), Y)

R =

p(0) -> 0

s = DIFF(X, Y)
evaluates to t =DIFF(p(X), Y)

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

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