(0) Obligation:

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.

(1) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LPAR04] we result in the following initial DP problem.

(2) Obligation:

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

AP(ap(f, x), x) → AP(ap(x, ap(f, x)), ap(ap(cons, x), nil))
AP(ap(f, x), x) → AP(x, ap(f, x))
AP(ap(f, x), x) → AP(ap(cons, x), nil)
AP(ap(f, x), x) → AP(cons, x)
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))

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

(3) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 1 SCC with 2 less nodes.

(4) Obligation:

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

AP(ap(f, x), x) → AP(x, ap(f, x))
AP(ap(f, x), x) → AP(ap(x, ap(f, 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)

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 minimal (P,Q,R)-chains.

(5) NonLoopProof (EQUIVALENT transformation)

By Theorem 8 [NONLOOP] we deduce infiniteness of the QDP.
We apply the theorem with m = 1, b = 0,
σ' = [ ], and μ' = [ ] on the rule
AP(ap(ap(foldr, ap(f, foldr)), ap(ap(cons, foldr), nil)), ap(ap(cons, foldr), nil))[ ]n[x1 / foldr, x0 / ap(ap(cons, foldr), nil)] → AP(ap(ap(foldr, ap(f, foldr)), ap(ap(cons, foldr), nil)), ap(ap(cons, foldr), nil))[ ]n[x1 / foldr, x0 / ap(ap(cons, foldr), nil)]
This rule is correct for the QDP as the following derivation shows:

intermediate steps: Equivalent (Simplify mu) - Instantiate mu - Instantiation
AP(ap(ap(foldr, ap(f, x2)), x1), ap(ap(cons, x2), nil))[ ]n[ ] → AP(ap(ap(x2, ap(f, x2)), ap(ap(cons, x2), nil)), x1)[ ]n[ ]
    by Narrowing at position: [1]
        intermediate steps: Instantiation
        AP(ap(ap(foldr, ap(f, x2)), x1), ap(ap(cons, x2), x0))[ ]n[ ] → AP(ap(ap(x2, ap(f, x2)), ap(ap(cons, x2), nil)), ap(ap(ap(foldr, ap(f, x2)), x1), x0))[ ]n[ ]
            by Narrowing at position: [0]
                intermediate steps: Instantiation - Instantiation
                AP(ap(ap(foldr, g), h), ap(ap(cons, x), xs))[ ]n[ ] → AP(ap(g, x), ap(ap(ap(foldr, g), h), xs))[ ]n[ ]
                    by OriginalRule from TRS P

                intermediate steps: Instantiation - Instantiation
                ap(ap(f, x), x)[ ]n[ ] → ap(ap(x, ap(f, x)), ap(ap(cons, x), nil))[ ]n[ ]
                    by OriginalRule from TRS R

        intermediate steps: Instantiation - Instantiation - Instantiation
        ap(ap(ap(foldr, g), h), nil)[ ]n[ ] → h[ ]n[ ]
            by OriginalRule from TRS R

(6) NO