Term Rewriting System R:
[X, Y, X1, X2]
fact(X) -> if(zero(X), ns(0), nprod(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))
prod(X1, X2) -> nprod(X1, X2)
if(true, X, Y) -> activate(X)
if(false, X, Y) -> activate(Y)
zero(0) -> true
zero(s(X)) -> false
p(s(X)) -> X
s(X) -> ns(X)
activate(ns(X)) -> s(X)
activate(nprod(X1, X2)) -> prod(X1, X2)
activate(X) -> X
Innermost Termination of R to be shown.
R
↳Removing Redundant Rules for Innermost Termination
Removing the following rules from R which left hand sides contain non normal subterms
add(s(X), Y) -> s(add(X, Y))
prod(s(X), Y) -> add(Y, prod(X, Y))
zero(s(X)) -> false
p(s(X)) -> X
R
↳RRRI
→TRS2
↳Dependency Pair Analysis
R contains the following Dependency Pairs:
FACT(X) -> IF(zero(X), ns(0), nprod(X, fact(p(X))))
FACT(X) -> ZERO(X)
FACT(X) -> FACT(p(X))
IF(true, X, Y) -> ACTIVATE(X)
IF(false, X, Y) -> ACTIVATE(Y)
ACTIVATE(ns(X)) -> S(X)
ACTIVATE(nprod(X1, X2)) -> PROD(X1, X2)
Furthermore, R contains one SCC.
R
↳RRRI
→TRS2
↳DPs
→DP Problem 1
↳Modular Removal of Rules
Dependency Pair:
FACT(X) -> FACT(p(X))
Rules:
fact(X) -> if(zero(X), ns(0), nprod(X, fact(p(X))))
if(true, X, Y) -> activate(X)
if(false, X, Y) -> activate(Y)
zero(0) -> true
add(0, X) -> X
prod(0, X) -> 0
prod(X1, X2) -> nprod(X1, X2)
activate(ns(X)) -> s(X)
activate(nprod(X1, X2)) -> prod(X1, X2)
activate(X) -> X
s(X) -> ns(X)
We have the following set of usable rules:
none
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(p(x1)) | = x1 |
We have the following set D of usable symbols: {FACT, p}
No Dependency Pairs can be deleted.
11 non usable rules have been deleted.
The result of this processor delivers one new DP problem.
R
↳RRRI
→TRS2
↳DPs
→DP Problem 1
↳MRR
...
→DP Problem 2
↳Non-Overlappingness Check
Dependency Pair:
FACT(X) -> FACT(p(X))
Rule:
none
R does not overlap into P. Moreover, R is locally confluent (all critical pairs are trivially joinable).Hence we can switch to innermost.
The transformation is resulting in one subcycle:
R
↳RRRI
→TRS2
↳DPs
→DP Problem 1
↳MRR
...
→DP Problem 3
↳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.
Innermost Non-Termination of R could be shown.
Duration:
0:02 minutes