Termination w.r.t. Q of the following Term Rewriting System could be disproven:

Q restricted rewrite system:
The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

Q is empty.


QTRS
  ↳ Overlay + Local Confluence

Q restricted rewrite system:
The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

Q is empty.

The TRS is overlay and locally confluent. By [19] we can switch to innermost.

↳ QTRS
  ↳ Overlay + Local Confluence
QTRS
      ↳ DependencyPairsProof

Q restricted rewrite system:
The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

The set Q consists of the following terms:

ap(ap(f, x0), x0)
ap(ap(ap(foldr, x0), x1), nil)
ap(ap(ap(foldr, x0), x1), ap(ap(cons, x2), x3))


Using Dependency Pairs [1,15] we result in the following initial DP problem:
Q DP problem:
The TRS P consists of the following rules:

AP(ap(f, x), x) → AP(ap(cons, x), nil)
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(g, x), ap(ap(ap(foldr, g), h), xs))
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(g, x)
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(ap(foldr, g), h), xs)
AP(ap(f, x), x) → AP(x, ap(f, x))
AP(ap(f, x), x) → AP(cons, x)
AP(ap(f, x), x) → AP(ap(x, ap(f, x)), ap(ap(cons, x), nil))

The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

The set Q consists of the following terms:

ap(ap(f, x0), x0)
ap(ap(ap(foldr, x0), x1), nil)
ap(ap(ap(foldr, x0), x1), ap(ap(cons, x2), x3))

We have to consider all minimal (P,Q,R)-chains.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
QDP
          ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

AP(ap(f, x), x) → AP(ap(cons, x), nil)
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(g, x), ap(ap(ap(foldr, g), h), xs))
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(g, x)
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(ap(foldr, g), h), xs)
AP(ap(f, x), x) → AP(x, ap(f, x))
AP(ap(f, x), x) → AP(cons, x)
AP(ap(f, x), x) → AP(ap(x, ap(f, x)), ap(ap(cons, x), nil))

The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

The set Q consists of the following terms:

ap(ap(f, x0), x0)
ap(ap(ap(foldr, x0), x1), nil)
ap(ap(ap(foldr, x0), x1), ap(ap(cons, x2), x3))

We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 3 less nodes.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
QDP
              ↳ ForwardInstantiation

Q DP problem:
The TRS P consists of the following rules:

AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(g, x), ap(ap(ap(foldr, g), h), xs))
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(g, x)
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(ap(foldr, g), h), xs)
AP(ap(f, x), x) → AP(ap(x, ap(f, x)), ap(ap(cons, x), nil))

The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

The set Q consists of the following terms:

ap(ap(f, x0), x0)
ap(ap(ap(foldr, x0), x1), nil)
ap(ap(ap(foldr, x0), x1), ap(ap(cons, x2), x3))

We have to consider all minimal (P,Q,R)-chains.
By forward instantiating [14] the rule AP(ap(f, x), x) → AP(ap(x, ap(f, x)), ap(ap(cons, x), nil)) we obtained the following new rules:

AP(ap(f, ap(foldr, y_0)), ap(foldr, y_0)) → AP(ap(ap(foldr, y_0), ap(f, ap(foldr, y_0))), ap(ap(cons, ap(foldr, y_0)), nil))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ QDP
              ↳ ForwardInstantiation
QDP
                  ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

AP(ap(f, ap(foldr, y_0)), ap(foldr, y_0)) → AP(ap(ap(foldr, y_0), ap(f, ap(foldr, y_0))), ap(ap(cons, ap(foldr, y_0)), nil))
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(g, x), ap(ap(ap(foldr, g), h), xs))
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(g, x)
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(ap(foldr, g), h), xs)

The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

The set Q consists of the following terms:

ap(ap(f, x0), x0)
ap(ap(ap(foldr, x0), x1), nil)
ap(ap(ap(foldr, x0), x1), ap(ap(cons, x2), x3))

We have to consider all minimal (P,Q,R)-chains.
By narrowing [15] the rule AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(g, x), ap(ap(ap(foldr, g), h), xs)) at position [1] we obtained the following new rules:

AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), ap(ap(cons, x2), x3))) → AP(ap(x0, y2), ap(ap(x0, x2), ap(ap(ap(foldr, x0), x1), x3)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), nil)) → AP(ap(x0, y2), x1)



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ QDP
              ↳ ForwardInstantiation
                ↳ QDP
                  ↳ Narrowing
QDP
                      ↳ ForwardInstantiation

Q DP problem:
The TRS P consists of the following rules:

AP(ap(f, ap(foldr, y_0)), ap(foldr, y_0)) → AP(ap(ap(foldr, y_0), ap(f, ap(foldr, y_0))), ap(ap(cons, ap(foldr, y_0)), nil))
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(g, x)
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(ap(foldr, g), h), xs)
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), ap(ap(cons, x2), x3))) → AP(ap(x0, y2), ap(ap(x0, x2), ap(ap(ap(foldr, x0), x1), x3)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), nil)) → AP(ap(x0, y2), x1)

The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

The set Q consists of the following terms:

ap(ap(f, x0), x0)
ap(ap(ap(foldr, x0), x1), nil)
ap(ap(ap(foldr, x0), x1), ap(ap(cons, x2), x3))

We have to consider all minimal (P,Q,R)-chains.
By forward instantiating [14] the rule AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(g, x) we obtained the following new rules:

AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), nil)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), nil))
AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, ap(foldr, y_1)), x3)) → AP(ap(f, ap(foldr, y_0)), ap(foldr, y_1))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), ap(ap(cons, y_3), y_4))), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), y_3)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), y_3))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ QDP
              ↳ ForwardInstantiation
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ ForwardInstantiation
QDP
                          ↳ ForwardInstantiation

Q DP problem:
The TRS P consists of the following rules:

AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), nil)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), nil))
AP(ap(f, ap(foldr, y_0)), ap(foldr, y_0)) → AP(ap(ap(foldr, y_0), ap(f, ap(foldr, y_0))), ap(ap(cons, ap(foldr, y_0)), nil))
AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, ap(foldr, y_1)), x3)) → AP(ap(f, ap(foldr, y_0)), ap(foldr, y_1))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), ap(ap(cons, y_3), y_4))), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))
AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(ap(foldr, g), h), xs)
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), y_3)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), y_3))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), ap(ap(cons, x2), x3))) → AP(ap(x0, y2), ap(ap(x0, x2), ap(ap(ap(foldr, x0), x1), x3)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), nil)) → AP(ap(x0, y2), x1)

The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

The set Q consists of the following terms:

ap(ap(f, x0), x0)
ap(ap(ap(foldr, x0), x1), nil)
ap(ap(ap(foldr, x0), x1), ap(ap(cons, x2), x3))

We have to consider all minimal (P,Q,R)-chains.
By forward instantiating [14] the rule AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → AP(ap(ap(foldr, g), h), xs) we obtained the following new rules:

AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), y_4)), y_5))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), y_4)), y_5))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), nil)), y_4))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), nil)), y_4))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), ap(ap(cons, y_4), y_5))), y_6))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), ap(ap(cons, y_4), y_5))), y_6))
AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, x2), ap(ap(cons, ap(foldr, y_2)), y_3))) → AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, ap(foldr, y_2)), y_3))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), nil))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), nil))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), y_3))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), y_3))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ QDP
              ↳ ForwardInstantiation
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ ForwardInstantiation
                        ↳ QDP
                          ↳ ForwardInstantiation
QDP
                              ↳ MNOCProof

Q DP problem:
The TRS P consists of the following rules:

AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), nil)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), nil))
AP(ap(f, ap(foldr, y_0)), ap(foldr, y_0)) → AP(ap(ap(foldr, y_0), ap(f, ap(foldr, y_0))), ap(ap(cons, ap(foldr, y_0)), nil))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), nil)), y_4))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), nil)), y_4))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))
AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, ap(foldr, y_1)), x3)) → AP(ap(f, ap(foldr, y_0)), ap(foldr, y_1))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), ap(ap(cons, y_3), y_4))), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), nil)) → AP(ap(x0, y2), x1)
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), y_4)), y_5))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), y_4)), y_5))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), ap(ap(cons, y_4), y_5))), y_6))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), ap(ap(cons, y_4), y_5))), y_6))
AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, x2), ap(ap(cons, ap(foldr, y_2)), y_3))) → AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, ap(foldr, y_2)), y_3))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), nil))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), nil))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), y_3)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), y_3))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), ap(ap(cons, x2), x3))) → AP(ap(x0, y2), ap(ap(x0, x2), ap(ap(ap(foldr, x0), x1), x3)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), y_3))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), y_3))

The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

The set Q consists of the following terms:

ap(ap(f, x0), x0)
ap(ap(ap(foldr, x0), x1), nil)
ap(ap(ap(foldr, x0), x1), ap(ap(cons, x2), x3))

We have to consider all minimal (P,Q,R)-chains.
We use the modular non-overlap check [17] to decrease Q to the empty set.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ QDP
              ↳ ForwardInstantiation
                ↳ QDP
                  ↳ Narrowing
                    ↳ QDP
                      ↳ ForwardInstantiation
                        ↳ QDP
                          ↳ ForwardInstantiation
                            ↳ QDP
                              ↳ MNOCProof
QDP
                                  ↳ NonTerminationProof

Q DP problem:
The TRS P consists of the following rules:

AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), nil)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), nil))
AP(ap(f, ap(foldr, y_0)), ap(foldr, y_0)) → AP(ap(ap(foldr, y_0), ap(f, ap(foldr, y_0))), ap(ap(cons, ap(foldr, y_0)), nil))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), nil)), y_4))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), nil)), y_4))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))
AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, ap(foldr, y_1)), x3)) → AP(ap(f, ap(foldr, y_0)), ap(foldr, y_1))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), ap(ap(cons, y_3), y_4))), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), nil)) → AP(ap(x0, y2), x1)
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), y_4)), y_5))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), y_4)), y_5))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), ap(ap(cons, y_4), y_5))), y_6))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), ap(ap(cons, y_4), y_5))), y_6))
AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, x2), ap(ap(cons, ap(foldr, y_2)), y_3))) → AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, ap(foldr, y_2)), y_3))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), nil))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), nil))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), y_3)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), y_3))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), ap(ap(cons, x2), x3))) → AP(ap(x0, y2), ap(ap(x0, x2), ap(ap(ap(foldr, x0), x1), x3)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), y_3))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), y_3))

The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))

Q is empty.
We have to consider all (P,Q,R)-chains.
We used the non-termination processor [17] to show that the DP problem is infinite.
Found a loop by narrowing to the left:

The TRS P consists of the following rules:

AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), nil)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), nil))
AP(ap(f, ap(foldr, y_0)), ap(foldr, y_0)) → AP(ap(ap(foldr, y_0), ap(f, ap(foldr, y_0))), ap(ap(cons, ap(foldr, y_0)), nil))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), nil)), y_4))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), nil)), y_4))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))
AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, ap(foldr, y_1)), x3)) → AP(ap(f, ap(foldr, y_0)), ap(foldr, y_1))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), ap(ap(cons, y_3), y_4))), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), ap(ap(cons, y_3), y_4)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), nil)) → AP(ap(x0, y2), x1)
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), y_4)), y_5))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), y_4)), y_5))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, x2), ap(ap(cons, ap(ap(cons, y_3), ap(ap(cons, y_4), y_5))), y_6))) → AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_3), ap(ap(cons, y_4), y_5))), y_6))
AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, x2), ap(ap(cons, ap(foldr, y_2)), y_3))) → AP(ap(ap(foldr, ap(f, ap(foldr, y_0))), x1), ap(ap(cons, ap(foldr, y_2)), y_3))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), nil))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), nil))
AP(ap(ap(foldr, ap(ap(foldr, y_0), y_1)), x1), ap(ap(cons, ap(ap(cons, y_2), y_3)), x3)) → AP(ap(ap(foldr, y_0), y_1), ap(ap(cons, y_2), y_3))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), ap(ap(cons, x2), x3))) → AP(ap(x0, y2), ap(ap(x0, x2), ap(ap(ap(foldr, x0), x1), x3)))
AP(ap(ap(foldr, x0), x1), ap(ap(cons, x2), ap(ap(cons, y_2), y_3))) → AP(ap(ap(foldr, x0), x1), ap(ap(cons, y_2), y_3))

The TRS R consists of the following rules:

ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))
ap(ap(ap(foldr, g), h), nil) → h
ap(ap(ap(foldr, g), h), ap(ap(cons, x), xs)) → ap(ap(g, x), ap(ap(ap(foldr, g), h), xs))


s = AP(ap(ap(f, foldr), foldr), ap(ap(cons, y2), nil)) evaluates to t =AP(ap(ap(f, foldr), y2), ap(ap(cons, foldr), nil))

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:




Rewriting sequence

AP(ap(ap(f, foldr), foldr), ap(ap(cons, foldr), nil))AP(ap(ap(foldr, ap(f, foldr)), ap(ap(cons, foldr), nil)), ap(ap(cons, foldr), nil))
with rule ap(ap(f, x), x) → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil)) at position [0] and matcher [x / foldr]

AP(ap(ap(foldr, ap(f, foldr)), ap(ap(cons, foldr), nil)), ap(ap(cons, foldr), nil))AP(ap(ap(f, foldr), foldr), ap(ap(cons, foldr), nil))
with rule AP(ap(ap(foldr, x0), x1), ap(ap(cons, y2), nil)) → AP(ap(x0, y2), x1)

Now applying the matcher to the start term leads to a term which is equal to the last term in the rewriting sequence


All these steps are and every following step will be a correct step w.r.t to Q.