Term Rewriting System R:
[y, x]
le(0, y) -> true
le(s(x), 0) -> false
le(s(x), s(y)) -> le(x, y)
minus(x, 0) -> x
minus(0, x) -> 0
minus(s(x), s(y)) -> minus(x, y)
gcd(0, y) -> y
gcd(s(x), 0) -> s(x)
gcd(s(x), s(y)) -> ifgcd(le(y, x), s(x), s(y))
ifgcd(true, x, y) -> gcd(minus(x, y), y)
ifgcd(false, x, y) -> gcd(minus(y, 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:

LE(s(x), s(y)) -> LE(x, y)
MINUS(s(x), s(y)) -> MINUS(x, y)
GCD(s(x), s(y)) -> IFGCD(le(y, x), s(x), s(y))
GCD(s(x), s(y)) -> LE(y, x)
IFGCD(true, x, y) -> GCD(minus(x, y), y)
IFGCD(true, x, y) -> MINUS(x, y)
IFGCD(false, x, y) -> GCD(minus(y, x), x)
IFGCD(false, x, y) -> MINUS(y, x)

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:

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


Rules:


le(0, y) -> true
le(s(x), 0) -> false
le(s(x), s(y)) -> le(x, y)
minus(x, 0) -> x
minus(0, x) -> 0
minus(s(x), s(y)) -> minus(x, y)
gcd(0, y) -> y
gcd(s(x), 0) -> s(x)
gcd(s(x), s(y)) -> ifgcd(le(y, x), s(x), s(y))
ifgcd(true, x, y) -> gcd(minus(x, y), y)
ifgcd(false, x, y) -> gcd(minus(y, x), x)


Strategy:

innermost




As we are in the innermost case, we can delete all 11 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:

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


Rule:

none


Strategy:

innermost




We number the DPs as follows:
  1. LE(s(x), s(y)) -> LE(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:


le(0, y) -> true
le(s(x), 0) -> false
le(s(x), s(y)) -> le(x, y)
minus(x, 0) -> x
minus(0, x) -> 0
minus(s(x), s(y)) -> minus(x, y)
gcd(0, y) -> y
gcd(s(x), 0) -> s(x)
gcd(s(x), s(y)) -> ifgcd(le(y, x), s(x), s(y))
ifgcd(true, x, y) -> gcd(minus(x, y), y)
ifgcd(false, x, y) -> gcd(minus(y, x), x)


Strategy:

innermost




As we are in the innermost case, we can delete all 11 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:

IFGCD(false, x, y) -> GCD(minus(y, x), x)
IFGCD(true, x, y) -> GCD(minus(x, y), y)
GCD(s(x), s(y)) -> IFGCD(le(y, x), s(x), s(y))


Rules:


le(0, y) -> true
le(s(x), 0) -> false
le(s(x), s(y)) -> le(x, y)
minus(x, 0) -> x
minus(0, x) -> 0
minus(s(x), s(y)) -> minus(x, y)
gcd(0, y) -> y
gcd(s(x), 0) -> s(x)
gcd(s(x), s(y)) -> ifgcd(le(y, x), s(x), s(y))
ifgcd(true, x, y) -> gcd(minus(x, y), y)
ifgcd(false, x, y) -> gcd(minus(y, x), x)


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:

IFGCD(false, x, y) -> GCD(minus(y, x), x)
IFGCD(true, x, y) -> GCD(minus(x, y), y)
GCD(s(x), s(y)) -> IFGCD(le(y, x), s(x), s(y))


Rules:


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


Strategy:

innermost




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

IFGCD(false, x, y) -> GCD(minus(y, x), x)
three new Dependency Pairs are created:

IFGCD(false, s(y''), s(x'')) -> GCD(minus(x'', y''), s(y''))
IFGCD(false, 0, y') -> GCD(y', 0)
IFGCD(false, x'', 0) -> GCD(0, 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:

IFGCD(false, s(y''), s(x'')) -> GCD(minus(x'', y''), s(y''))
GCD(s(x), s(y)) -> IFGCD(le(y, x), s(x), s(y))
IFGCD(true, x, y) -> GCD(minus(x, y), y)


Rules:


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


Strategy:

innermost




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

IFGCD(true, x, y) -> GCD(minus(x, y), y)
three new Dependency Pairs are created:

IFGCD(true, s(x''), s(y'')) -> GCD(minus(x'', y''), s(y''))
IFGCD(true, x'', 0) -> GCD(x'', 0)
IFGCD(true, 0, y') -> GCD(0, 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 8
Narrowing Transformation


Dependency Pairs:

IFGCD(true, s(x''), s(y'')) -> GCD(minus(x'', y''), s(y''))
GCD(s(x), s(y)) -> IFGCD(le(y, x), s(x), s(y))
IFGCD(false, s(y''), s(x'')) -> GCD(minus(x'', y''), s(y''))


Rules:


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


Strategy:

innermost




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

GCD(s(x), s(y)) -> IFGCD(le(y, x), s(x), s(y))
three new Dependency Pairs are created:

GCD(s(s(y'')), s(s(x''))) -> IFGCD(le(x'', y''), s(s(y'')), s(s(x'')))
GCD(s(x'), s(0)) -> IFGCD(true, s(x'), s(0))
GCD(s(0), s(s(x''))) -> IFGCD(false, s(0), s(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:

GCD(s(0), s(s(x''))) -> IFGCD(false, s(0), s(s(x'')))
GCD(s(x'), s(0)) -> IFGCD(true, s(x'), s(0))
IFGCD(false, s(y''), s(x'')) -> GCD(minus(x'', y''), s(y''))
GCD(s(s(y'')), s(s(x''))) -> IFGCD(le(x'', y''), s(s(y'')), s(s(x'')))
IFGCD(true, s(x''), s(y'')) -> GCD(minus(x'', y''), s(y''))


Rules:


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


Strategy:

innermost




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

IFGCD(false, s(y''), s(x'')) -> GCD(minus(x'', y''), s(y''))
two new Dependency Pairs are created:

IFGCD(false, s(s(y'''')), s(s(x''''))) -> GCD(minus(s(x''''), s(y'''')), s(s(y'''')))
IFGCD(false, s(0), s(s(x''''))) -> GCD(minus(s(x''''), 0), s(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 10
Rewriting Transformation


Dependency Pairs:

IFGCD(false, s(s(y'''')), s(s(x''''))) -> GCD(minus(s(x''''), s(y'''')), s(s(y'''')))
GCD(s(s(y'')), s(s(x''))) -> IFGCD(le(x'', y''), s(s(y'')), s(s(x'')))
IFGCD(true, s(x''), s(y'')) -> GCD(minus(x'', y''), s(y''))
GCD(s(x'), s(0)) -> IFGCD(true, s(x'), s(0))
IFGCD(false, s(0), s(s(x''''))) -> GCD(minus(s(x''''), 0), s(0))
GCD(s(0), s(s(x''))) -> IFGCD(false, s(0), s(s(x'')))


Rules:


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


Strategy:

innermost




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

IFGCD(false, s(0), s(s(x''''))) -> GCD(minus(s(x''''), 0), s(0))
one new Dependency Pair is created:

IFGCD(false, s(0), s(s(x''''))) -> GCD(s(x''''), s(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 11
Instantiation Transformation


Dependency Pairs:

IFGCD(false, s(0), s(s(x''''))) -> GCD(s(x''''), s(0))
GCD(s(0), s(s(x''))) -> IFGCD(false, s(0), s(s(x'')))
GCD(s(x'), s(0)) -> IFGCD(true, s(x'), s(0))
IFGCD(true, s(x''), s(y'')) -> GCD(minus(x'', y''), s(y''))
GCD(s(s(y'')), s(s(x''))) -> IFGCD(le(x'', y''), s(s(y'')), s(s(x'')))
IFGCD(false, s(s(y'''')), s(s(x''''))) -> GCD(minus(s(x''''), s(y'''')), s(s(y'''')))


Rules:


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


Strategy:

innermost




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

IFGCD(true, s(x''), s(y'')) -> GCD(minus(x'', y''), s(y''))
two new Dependency Pairs are created:

IFGCD(true, s(s(y'''')), s(s(x''''))) -> GCD(minus(s(y''''), s(x'''')), s(s(x'''')))
IFGCD(true, s(x''''), s(0)) -> GCD(minus(x'''', 0), s(0))

The transformation is resulting in two new DP problems:



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


Dependency Pairs:

IFGCD(true, s(x''''), s(0)) -> GCD(minus(x'''', 0), s(0))
GCD(s(x'), s(0)) -> IFGCD(true, s(x'), s(0))


Rules:


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


Strategy:

innermost




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


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


Dependency Pairs:

IFGCD(true, s(x''''), s(0)) -> GCD(minus(x'''', 0), s(0))
GCD(s(x'), s(0)) -> IFGCD(true, s(x'), s(0))


Rules:


minus(x, 0) -> x
minus(0, x) -> 0


Strategy:

innermost




We have the following set of usable rules:

minus(x, 0) -> x
minus(0, x) -> 0
To remove rules and DPs from this DP problem we used the following monotonic and CE-compatible order: Polynomial ordering.
Polynomial interpretation:
  POL(0)=  0  
  POL(GCD(x1, x2))=  x1 + x2  
  POL(minus(x1, x2))=  x1 + x2  
  POL(IF_GCD(x1, x2, x3))=  x1 + x2 + x3  
  POL(true)=  0  
  POL(s(x1))=  1 + x1  

We have the following set D of usable symbols: {0, GCD, minus, IFGCD, true, s}
The following Dependency Pairs can be deleted as the lhs is strictly greater than the corresponding rhs:

IFGCD(true, s(x''''), s(0)) -> GCD(minus(x'''', 0), s(0))

No Rules can be deleted.

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 15
Modular Removal of Rules


Dependency Pair:

GCD(s(x'), s(0)) -> IFGCD(true, s(x'), s(0))


Rules:


minus(x, 0) -> x
minus(0, x) -> 0


Strategy:

innermost




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(0)=  0  
  POL(GCD(x1, x2))=  x1 + x2  
  POL(IF_GCD(x1, x2, x3))=  x1 + x2 + x3  
  POL(true)=  0  
  POL(s(x1))=  x1  

We have the following set D of usable symbols: {0, IFGCD, true, s}
The following Dependency Pairs can be deleted as they contain symbols in their lhs which do not occur in D:

GCD(s(x'), s(0)) -> IFGCD(true, s(x'), s(0))

No Rules can be deleted.

After the removal, there are no SCCs in the dependency graph which results in no DP problems which have to be solved.



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


Dependency Pairs:

IFGCD(true, s(s(y'''')), s(s(x''''))) -> GCD(minus(s(y''''), s(x'''')), s(s(x'''')))
IFGCD(false, s(s(y'''')), s(s(x''''))) -> GCD(minus(s(x''''), s(y'''')), s(s(y'''')))
GCD(s(s(y'')), s(s(x''))) -> IFGCD(le(x'', y''), s(s(y'')), s(s(x'')))


Rules:


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


Strategy:

innermost




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

IFGCD(true, s(s(y'''')), s(s(x''''))) -> GCD(minus(s(y''''), s(x'''')), s(s(x'''')))
IFGCD(false, s(s(y'''')), s(s(x''''))) -> GCD(minus(s(x''''), s(y'''')), s(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
minus(0, x) -> 0
le(s(x), s(y)) -> le(x, y)
le(0, y) -> true
le(s(x), 0) -> false


Used ordering:
Polynomial Order with Interpretation:

POL( IFGCD(x1, ..., x3) ) = x2 + x3

POL( s(x1) ) = x1 + 1

POL( GCD(x1, x2) ) = x1 + x2

POL( minus(x1, x2) ) = x1

POL( 0 ) = 0

POL( le(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 16
Dependency Graph


Dependency Pair:

GCD(s(s(y'')), s(s(x''))) -> IFGCD(le(x'', y''), s(s(y'')), s(s(x'')))


Rules:


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


Strategy:

innermost




Using the Dependency Graph resulted in no new DP problems.

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