Term Rewriting System R:
[xs, ys, x, y, p]
app(app(app(if, true), xs), ys) -> xs
app(app(app(if, false), xs), ys) -> ys
app(app(sub, x), 0) -> x
app(app(sub, app(s, x)), app(s, y)) -> app(app(sub, x), y)
app(app(gtr, 0), y) -> false
app(app(gtr, app(s, x)), 0) -> true
app(app(gtr, app(s, x)), app(s, y)) -> app(app(gtr, x), y)
app(app(d, x), 0) -> true
app(app(d, app(s, x)), app(s, y)) -> app(app(app(if, app(app(gtr, x), y)), false), app(app(d, app(s, x)), app(app(sub, y), x)))
app(len, nil) -> 0
app(len, app(app(cons, x), xs)) -> app(s, app(len, xs))
app(app(filter, p), nil) -> nil
app(app(filter, p), app(app(cons, x), xs)) -> app(app(app(if, app(p, x)), app(app(cons, x), app(app(filter, p), xs))), app(app(filter, p), xs))

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:

APP(app(sub, app(s, x)), app(s, y)) -> APP(app(sub, x), y)
APP(app(sub, app(s, x)), app(s, y)) -> APP(sub, x)
APP(app(gtr, app(s, x)), app(s, y)) -> APP(app(gtr, x), y)
APP(app(gtr, app(s, x)), app(s, y)) -> APP(gtr, x)
APP(app(d, app(s, x)), app(s, y)) -> APP(app(app(if, app(app(gtr, x), y)), false), app(app(d, app(s, x)), app(app(sub, y), x)))
APP(app(d, app(s, x)), app(s, y)) -> APP(app(if, app(app(gtr, x), y)), false)
APP(app(d, app(s, x)), app(s, y)) -> APP(if, app(app(gtr, x), y))
APP(app(d, app(s, x)), app(s, y)) -> APP(app(gtr, x), y)
APP(app(d, app(s, x)), app(s, y)) -> APP(gtr, x)
APP(app(d, app(s, x)), app(s, y)) -> APP(app(d, app(s, x)), app(app(sub, y), x))
APP(app(d, app(s, x)), app(s, y)) -> APP(app(sub, y), x)
APP(app(d, app(s, x)), app(s, y)) -> APP(sub, y)
APP(len, app(app(cons, x), xs)) -> APP(s, app(len, xs))
APP(len, app(app(cons, x), xs)) -> APP(len, xs)
APP(app(filter, p), app(app(cons, x), xs)) -> APP(app(app(if, app(p, x)), app(app(cons, x), app(app(filter, p), xs))), app(app(filter, p), xs))
APP(app(filter, p), app(app(cons, x), xs)) -> APP(app(if, app(p, x)), app(app(cons, x), app(app(filter, p), xs)))
APP(app(filter, p), app(app(cons, x), xs)) -> APP(if, app(p, x))
APP(app(filter, p), app(app(cons, x), xs)) -> APP(p, x)
APP(app(filter, p), app(app(cons, x), xs)) -> APP(app(cons, x), app(app(filter, p), xs))
APP(app(filter, p), app(app(cons, x), xs)) -> APP(app(filter, p), xs)

Furthermore, R contains five SCCs.


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


Dependency Pair:

APP(app(sub, app(s, x)), app(s, y)) -> APP(app(sub, x), y)


Rules:


app(app(app(if, true), xs), ys) -> xs
app(app(app(if, false), xs), ys) -> ys
app(app(sub, x), 0) -> x
app(app(sub, app(s, x)), app(s, y)) -> app(app(sub, x), y)
app(app(gtr, 0), y) -> false
app(app(gtr, app(s, x)), 0) -> true
app(app(gtr, app(s, x)), app(s, y)) -> app(app(gtr, x), y)
app(app(d, x), 0) -> true
app(app(d, app(s, x)), app(s, y)) -> app(app(app(if, app(app(gtr, x), y)), false), app(app(d, app(s, x)), app(app(sub, y), x)))
app(len, nil) -> 0
app(len, app(app(cons, x), xs)) -> app(s, app(len, xs))
app(app(filter, p), nil) -> nil
app(app(filter, p), app(app(cons, x), xs)) -> app(app(app(if, app(p, x)), app(app(cons, x), app(app(filter, p), xs))), app(app(filter, p), xs))


Strategy:

innermost




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


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
             ...
               →DP Problem 6
A-Transformation
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
           →DP Problem 4
UsableRules
           →DP Problem 5
UsableRules


Dependency Pair:

APP(app(sub, app(s, x)), app(s, y)) -> APP(app(sub, x), y)


Rule:

none


Strategy:

innermost




We have an applicative DP problem with proper arity. Thus we can use the A-Transformation to obtain one new DP problem which consists of the A-transformed TRSs.


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


Dependency Pair:

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


Rule:

none


Strategy:

innermost




We number the DPs as follows:
  1. SUB(s(x), s(y)) -> SUB(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
           →DP Problem 4
UsableRules
           →DP Problem 5
UsableRules


Dependency Pair:

APP(app(gtr, app(s, x)), app(s, y)) -> APP(app(gtr, x), y)


Rules:


app(app(app(if, true), xs), ys) -> xs
app(app(app(if, false), xs), ys) -> ys
app(app(sub, x), 0) -> x
app(app(sub, app(s, x)), app(s, y)) -> app(app(sub, x), y)
app(app(gtr, 0), y) -> false
app(app(gtr, app(s, x)), 0) -> true
app(app(gtr, app(s, x)), app(s, y)) -> app(app(gtr, x), y)
app(app(d, x), 0) -> true
app(app(d, app(s, x)), app(s, y)) -> app(app(app(if, app(app(gtr, x), y)), false), app(app(d, app(s, x)), app(app(sub, y), x)))
app(len, nil) -> 0
app(len, app(app(cons, x), xs)) -> app(s, app(len, xs))
app(app(filter, p), nil) -> nil
app(app(filter, p), app(app(cons, x), xs)) -> app(app(app(if, app(p, x)), app(app(cons, x), app(app(filter, p), xs))), app(app(filter, p), xs))


Strategy:

innermost




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


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
             ...
               →DP Problem 8
A-Transformation
           →DP Problem 3
UsableRules
           →DP Problem 4
UsableRules
           →DP Problem 5
UsableRules


Dependency Pair:

APP(app(gtr, app(s, x)), app(s, y)) -> APP(app(gtr, x), y)


Rule:

none


Strategy:

innermost




We have an applicative DP problem with proper arity. Thus we can use the A-Transformation to obtain one new DP problem which consists of the A-transformed TRSs.


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


Dependency Pair:

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


Rule:

none


Strategy:

innermost




We number the DPs as follows:
  1. GTR(s(x), s(y)) -> GTR(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)
           →DP Problem 4
UsableRules
           →DP Problem 5
UsableRules


Dependency Pair:

APP(len, app(app(cons, x), xs)) -> APP(len, xs)


Rules:


app(app(app(if, true), xs), ys) -> xs
app(app(app(if, false), xs), ys) -> ys
app(app(sub, x), 0) -> x
app(app(sub, app(s, x)), app(s, y)) -> app(app(sub, x), y)
app(app(gtr, 0), y) -> false
app(app(gtr, app(s, x)), 0) -> true
app(app(gtr, app(s, x)), app(s, y)) -> app(app(gtr, x), y)
app(app(d, x), 0) -> true
app(app(d, app(s, x)), app(s, y)) -> app(app(app(if, app(app(gtr, x), y)), false), app(app(d, app(s, x)), app(app(sub, y), x)))
app(len, nil) -> 0
app(len, app(app(cons, x), xs)) -> app(s, app(len, xs))
app(app(filter, p), nil) -> nil
app(app(filter, p), app(app(cons, x), xs)) -> app(app(app(if, app(p, x)), app(app(cons, x), app(app(filter, p), xs))), app(app(filter, p), xs))


Strategy:

innermost




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


   R
OC
       →TRS2
DPs
           →DP Problem 1
UsableRules
           →DP Problem 2
UsableRules
           →DP Problem 3
UsableRules
             ...
               →DP Problem 10
A-Transformation
           →DP Problem 4
UsableRules
           →DP Problem 5
UsableRules


Dependency Pair:

APP(len, app(app(cons, x), xs)) -> APP(len, xs)


Rule:

none


Strategy:

innermost




We have an applicative DP problem with proper arity. Thus we can use the A-Transformation to obtain one new DP problem which consists of the A-transformed TRSs.


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


Dependency Pair:

LEN(cons(x, xs)) -> LEN(xs)


Rule:

none


Strategy:

innermost




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

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

DP: empty set
Oriented Rules: none

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

with Argument Filtering System:
cons(x1, x2) -> cons(x1, x2)

We obtain no new DP problems.


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


Dependency Pair:

APP(app(d, app(s, x)), app(s, y)) -> APP(app(d, app(s, x)), app(app(sub, y), x))


Rules:


app(app(app(if, true), xs), ys) -> xs
app(app(app(if, false), xs), ys) -> ys
app(app(sub, x), 0) -> x
app(app(sub, app(s, x)), app(s, y)) -> app(app(sub, x), y)
app(app(gtr, 0), y) -> false
app(app(gtr, app(s, x)), 0) -> true
app(app(gtr, app(s, x)), app(s, y)) -> app(app(gtr, x), y)
app(app(d, x), 0) -> true
app(app(d, app(s, x)), app(s, y)) -> app(app(app(if, app(app(gtr, x), y)), false), app(app(d, app(s, x)), app(app(sub, y), x)))
app(len, nil) -> 0
app(len, app(app(cons, x), xs)) -> app(s, app(len, xs))
app(app(filter, p), nil) -> nil
app(app(filter, p), app(app(cons, x), xs)) -> app(app(app(if, app(p, x)), app(app(cons, x), app(app(filter, p), xs))), app(app(filter, p), xs))


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 3
UsableRules
           →DP Problem 4
UsableRules
             ...
               →DP Problem 12
A-Transformation
           →DP Problem 5
UsableRules


Dependency Pair:

APP(app(d, app(s, x)), app(s, y)) -> APP(app(d, app(s, x)), app(app(sub, y), x))


Rules:


app(app(sub, x), 0) -> x
app(app(sub, app(s, x)), app(s, y)) -> app(app(sub, x), y)


Strategy:

innermost




We have an applicative DP problem with proper arity. Thus we can use the A-Transformation to obtain one new DP problem which consists of the A-transformed TRSs.


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


Dependency Pair:

D(s(x), s(y)) -> D(s(x), sub(y, x))


Rules:


sub(x, 0) -> x
sub(s(x), s(y)) -> sub(x, y)


Strategy:

innermost




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

D(s(x), s(y)) -> D(s(x), sub(y, x))


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

sub(s(x), s(y)) -> sub(x, y)
sub(x, 0) -> x


Used ordering:
Polynomial Order with Interpretation:

POL( D(x1, x2) ) = x2

POL( s(x1) ) = x1 + 1

POL( sub(x1, x2) ) = x1


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 4
UsableRules
             ...
               →DP Problem 14
Dependency Graph
           →DP Problem 5
UsableRules


Dependency Pair:


Rules:


sub(x, 0) -> x
sub(s(x), s(y)) -> sub(x, y)


Strategy:

innermost




Using the Dependency Graph resulted in no new DP problems.


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


Dependency Pairs:

APP(app(filter, p), app(app(cons, x), xs)) -> APP(app(filter, p), xs)
APP(app(filter, p), app(app(cons, x), xs)) -> APP(p, x)


Rules:


app(app(app(if, true), xs), ys) -> xs
app(app(app(if, false), xs), ys) -> ys
app(app(sub, x), 0) -> x
app(app(sub, app(s, x)), app(s, y)) -> app(app(sub, x), y)
app(app(gtr, 0), y) -> false
app(app(gtr, app(s, x)), 0) -> true
app(app(gtr, app(s, x)), app(s, y)) -> app(app(gtr, x), y)
app(app(d, x), 0) -> true
app(app(d, app(s, x)), app(s, y)) -> app(app(app(if, app(app(gtr, x), y)), false), app(app(d, app(s, x)), app(app(sub, y), x)))
app(len, nil) -> 0
app(len, app(app(cons, x), xs)) -> app(s, app(len, xs))
app(app(filter, p), nil) -> nil
app(app(filter, p), app(app(cons, x), xs)) -> app(app(app(if, app(p, x)), app(app(cons, x), app(app(filter, p), xs))), app(app(filter, p), xs))


Strategy:

innermost




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


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


Dependency Pairs:

APP(app(filter, p), app(app(cons, x), xs)) -> APP(app(filter, p), xs)
APP(app(filter, p), app(app(cons, x), xs)) -> APP(p, x)


Rule:

none


Strategy:

innermost




We number the DPs as follows:
  1. APP(app(filter, p), app(app(cons, x), xs)) -> APP(app(filter, p), xs)
  2. APP(app(filter, p), app(app(cons, x), xs)) -> APP(p, x)
and get the following Size-Change Graph(s):
{1, 2} , {1, 2}
1=1
2>2
{1, 2} , {1, 2}
1>1
2>2

which lead(s) to this/these maximal multigraph(s):
{1, 2} , {1, 2}
1>1
2>2
{1, 2} , {1, 2}
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:
app(x1, x2) -> app(x1, x2)

We obtain no new DP problems.

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