(0) Obligation:

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

ap(ap(map, f), xs) → ap(ap(ap(if, ap(isEmpty, xs)), f), xs)
ap(ap(ap(if, true), f), xs) → null
ap(ap(ap(if, null), f), xs) → ap(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
ap(ap(if2, f), xs) → ap(ap(map, f), ap(dropLast, xs))
ap(isEmpty, null) → true
ap(isEmpty, ap(ap(cons, x), xs)) → null
ap(last, ap(ap(cons, x), null)) → x
ap(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(last, ap(ap(cons, y), ys))
ap(dropLast, ap(ap(cons, x), null)) → null
ap(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))

Q is empty.

(1) Overlay + Local Confluence (EQUIVALENT transformation)

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

(2) Obligation:

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

ap(ap(map, f), xs) → ap(ap(ap(if, ap(isEmpty, xs)), f), xs)
ap(ap(ap(if, true), f), xs) → null
ap(ap(ap(if, null), f), xs) → ap(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
ap(ap(if2, f), xs) → ap(ap(map, f), ap(dropLast, xs))
ap(isEmpty, null) → true
ap(isEmpty, ap(ap(cons, x), xs)) → null
ap(last, ap(ap(cons, x), null)) → x
ap(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(last, ap(ap(cons, y), ys))
ap(dropLast, ap(ap(cons, x), null)) → null
ap(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))

The set Q consists of the following terms:

ap(ap(map, x0), x1)
ap(ap(ap(if, true), x0), x1)
ap(ap(ap(if, null), x0), x1)
ap(ap(if2, x0), x1)
ap(isEmpty, null)
ap(isEmpty, ap(ap(cons, x0), x1))
ap(last, ap(ap(cons, x0), null))
ap(last, ap(ap(cons, x0), ap(ap(cons, x1), x2)))
ap(dropLast, ap(ap(cons, x0), null))
ap(dropLast, ap(ap(cons, x0), ap(ap(cons, x1), x2)))

(3) DependencyPairsProof (EQUIVALENT transformation)

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

(4) Obligation:

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

AP(ap(map, f), xs) → AP(ap(ap(if, ap(isEmpty, xs)), f), xs)
AP(ap(map, f), xs) → AP(ap(if, ap(isEmpty, xs)), f)
AP(ap(map, f), xs) → AP(if, ap(isEmpty, xs))
AP(ap(map, f), xs) → AP(isEmpty, xs)
AP(ap(ap(if, null), f), xs) → AP(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
AP(ap(ap(if, null), f), xs) → AP(cons, ap(f, ap(last, xs)))
AP(ap(ap(if, null), f), xs) → AP(f, ap(last, xs))
AP(ap(ap(if, null), f), xs) → AP(last, xs)
AP(ap(ap(if, null), f), xs) → AP(ap(if2, f), xs)
AP(ap(ap(if, null), f), xs) → AP(if2, f)
AP(ap(if2, f), xs) → AP(ap(map, f), ap(dropLast, xs))
AP(ap(if2, f), xs) → AP(map, f)
AP(ap(if2, f), xs) → AP(dropLast, xs)
AP(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → AP(last, ap(ap(cons, y), ys))
AP(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → AP(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))
AP(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → AP(dropLast, ap(ap(cons, y), ys))

The TRS R consists of the following rules:

ap(ap(map, f), xs) → ap(ap(ap(if, ap(isEmpty, xs)), f), xs)
ap(ap(ap(if, true), f), xs) → null
ap(ap(ap(if, null), f), xs) → ap(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
ap(ap(if2, f), xs) → ap(ap(map, f), ap(dropLast, xs))
ap(isEmpty, null) → true
ap(isEmpty, ap(ap(cons, x), xs)) → null
ap(last, ap(ap(cons, x), null)) → x
ap(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(last, ap(ap(cons, y), ys))
ap(dropLast, ap(ap(cons, x), null)) → null
ap(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))

The set Q consists of the following terms:

ap(ap(map, x0), x1)
ap(ap(ap(if, true), x0), x1)
ap(ap(ap(if, null), x0), x1)
ap(ap(if2, x0), x1)
ap(isEmpty, null)
ap(isEmpty, ap(ap(cons, x0), x1))
ap(last, ap(ap(cons, x0), null))
ap(last, ap(ap(cons, x0), ap(ap(cons, x1), x2)))
ap(dropLast, ap(ap(cons, x0), null))
ap(dropLast, ap(ap(cons, x0), ap(ap(cons, x1), x2)))

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

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 3 SCCs with 10 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

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

AP(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → AP(dropLast, ap(ap(cons, y), ys))

The TRS R consists of the following rules:

ap(ap(map, f), xs) → ap(ap(ap(if, ap(isEmpty, xs)), f), xs)
ap(ap(ap(if, true), f), xs) → null
ap(ap(ap(if, null), f), xs) → ap(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
ap(ap(if2, f), xs) → ap(ap(map, f), ap(dropLast, xs))
ap(isEmpty, null) → true
ap(isEmpty, ap(ap(cons, x), xs)) → null
ap(last, ap(ap(cons, x), null)) → x
ap(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(last, ap(ap(cons, y), ys))
ap(dropLast, ap(ap(cons, x), null)) → null
ap(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))

The set Q consists of the following terms:

ap(ap(map, x0), x1)
ap(ap(ap(if, true), x0), x1)
ap(ap(ap(if, null), x0), x1)
ap(ap(if2, x0), x1)
ap(isEmpty, null)
ap(isEmpty, ap(ap(cons, x0), x1))
ap(last, ap(ap(cons, x0), null))
ap(last, ap(ap(cons, x0), ap(ap(cons, x1), x2)))
ap(dropLast, ap(ap(cons, x0), null))
ap(dropLast, ap(ap(cons, x0), ap(ap(cons, x1), x2)))

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

(8) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04]. Here, we combined the reduction pair processor with the A-transformation [FROCOS05] which results in the following intermediate Q-DP Problem.
The a-transformed P is

dropLast1(cons(x, cons(y, ys))) → dropLast1(cons(y, ys))

The a-transformed usable rules are
none


The following pairs can be oriented strictly and are deleted.


AP(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → AP(dropLast, ap(ap(cons, y), ys))
The remaining pairs can at least be oriented weakly.
Used ordering: Recursive Path Order [RPO].
Precedence:
cons2 > dropLast11


The following usable rules [FROCOS05] were oriented: none

(9) Obligation:

Q DP problem:
P is empty.
The TRS R consists of the following rules:

ap(ap(map, f), xs) → ap(ap(ap(if, ap(isEmpty, xs)), f), xs)
ap(ap(ap(if, true), f), xs) → null
ap(ap(ap(if, null), f), xs) → ap(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
ap(ap(if2, f), xs) → ap(ap(map, f), ap(dropLast, xs))
ap(isEmpty, null) → true
ap(isEmpty, ap(ap(cons, x), xs)) → null
ap(last, ap(ap(cons, x), null)) → x
ap(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(last, ap(ap(cons, y), ys))
ap(dropLast, ap(ap(cons, x), null)) → null
ap(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))

The set Q consists of the following terms:

ap(ap(map, x0), x1)
ap(ap(ap(if, true), x0), x1)
ap(ap(ap(if, null), x0), x1)
ap(ap(if2, x0), x1)
ap(isEmpty, null)
ap(isEmpty, ap(ap(cons, x0), x1))
ap(last, ap(ap(cons, x0), null))
ap(last, ap(ap(cons, x0), ap(ap(cons, x1), x2)))
ap(dropLast, ap(ap(cons, x0), null))
ap(dropLast, ap(ap(cons, x0), ap(ap(cons, x1), x2)))

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

(10) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(11) TRUE

(12) Obligation:

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

AP(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → AP(last, ap(ap(cons, y), ys))

The TRS R consists of the following rules:

ap(ap(map, f), xs) → ap(ap(ap(if, ap(isEmpty, xs)), f), xs)
ap(ap(ap(if, true), f), xs) → null
ap(ap(ap(if, null), f), xs) → ap(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
ap(ap(if2, f), xs) → ap(ap(map, f), ap(dropLast, xs))
ap(isEmpty, null) → true
ap(isEmpty, ap(ap(cons, x), xs)) → null
ap(last, ap(ap(cons, x), null)) → x
ap(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(last, ap(ap(cons, y), ys))
ap(dropLast, ap(ap(cons, x), null)) → null
ap(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))

The set Q consists of the following terms:

ap(ap(map, x0), x1)
ap(ap(ap(if, true), x0), x1)
ap(ap(ap(if, null), x0), x1)
ap(ap(if2, x0), x1)
ap(isEmpty, null)
ap(isEmpty, ap(ap(cons, x0), x1))
ap(last, ap(ap(cons, x0), null))
ap(last, ap(ap(cons, x0), ap(ap(cons, x1), x2)))
ap(dropLast, ap(ap(cons, x0), null))
ap(dropLast, ap(ap(cons, x0), ap(ap(cons, x1), x2)))

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

(13) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04]. Here, we combined the reduction pair processor with the A-transformation [FROCOS05] which results in the following intermediate Q-DP Problem.
The a-transformed P is

last1(cons(x, cons(y, ys))) → last1(cons(y, ys))

The a-transformed usable rules are
none


The following pairs can be oriented strictly and are deleted.


AP(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → AP(last, ap(ap(cons, y), ys))
The remaining pairs can at least be oriented weakly.
Used ordering: Recursive Path Order [RPO].
Precedence:
cons2 > last11


The following usable rules [FROCOS05] were oriented: none

(14) Obligation:

Q DP problem:
P is empty.
The TRS R consists of the following rules:

ap(ap(map, f), xs) → ap(ap(ap(if, ap(isEmpty, xs)), f), xs)
ap(ap(ap(if, true), f), xs) → null
ap(ap(ap(if, null), f), xs) → ap(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
ap(ap(if2, f), xs) → ap(ap(map, f), ap(dropLast, xs))
ap(isEmpty, null) → true
ap(isEmpty, ap(ap(cons, x), xs)) → null
ap(last, ap(ap(cons, x), null)) → x
ap(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(last, ap(ap(cons, y), ys))
ap(dropLast, ap(ap(cons, x), null)) → null
ap(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))

The set Q consists of the following terms:

ap(ap(map, x0), x1)
ap(ap(ap(if, true), x0), x1)
ap(ap(ap(if, null), x0), x1)
ap(ap(if2, x0), x1)
ap(isEmpty, null)
ap(isEmpty, ap(ap(cons, x0), x1))
ap(last, ap(ap(cons, x0), null))
ap(last, ap(ap(cons, x0), ap(ap(cons, x1), x2)))
ap(dropLast, ap(ap(cons, x0), null))
ap(dropLast, ap(ap(cons, x0), ap(ap(cons, x1), x2)))

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

(15) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(16) TRUE

(17) Obligation:

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

AP(ap(ap(if, null), f), xs) → AP(f, ap(last, xs))
AP(ap(map, f), xs) → AP(ap(ap(if, ap(isEmpty, xs)), f), xs)
AP(ap(ap(if, null), f), xs) → AP(ap(if2, f), xs)
AP(ap(if2, f), xs) → AP(ap(map, f), ap(dropLast, xs))

The TRS R consists of the following rules:

ap(ap(map, f), xs) → ap(ap(ap(if, ap(isEmpty, xs)), f), xs)
ap(ap(ap(if, true), f), xs) → null
ap(ap(ap(if, null), f), xs) → ap(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
ap(ap(if2, f), xs) → ap(ap(map, f), ap(dropLast, xs))
ap(isEmpty, null) → true
ap(isEmpty, ap(ap(cons, x), xs)) → null
ap(last, ap(ap(cons, x), null)) → x
ap(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(last, ap(ap(cons, y), ys))
ap(dropLast, ap(ap(cons, x), null)) → null
ap(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))

The set Q consists of the following terms:

ap(ap(map, x0), x1)
ap(ap(ap(if, true), x0), x1)
ap(ap(ap(if, null), x0), x1)
ap(ap(if2, x0), x1)
ap(isEmpty, null)
ap(isEmpty, ap(ap(cons, x0), x1))
ap(last, ap(ap(cons, x0), null))
ap(last, ap(ap(cons, x0), ap(ap(cons, x1), x2)))
ap(dropLast, ap(ap(cons, x0), null))
ap(dropLast, ap(ap(cons, x0), ap(ap(cons, x1), x2)))

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

(18) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


AP(ap(ap(if, null), f), xs) → AP(f, ap(last, xs))
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
AP(x1, x2)  =  AP(x1)
ap(x1, x2)  =  ap(x2)
if  =  if
null  =  null
last  =  last
map  =  map
isEmpty  =  isEmpty
if2  =  if2
dropLast  =  dropLast
cons  =  cons
true  =  true

Recursive Path Order [RPO].
Precedence:
if2 > [AP1, if, map, isEmpty] > ap1 > dropLast > null > last
cons > ap1 > dropLast > null > last
true > last


The following usable rules [FROCOS05] were oriented: none

(19) Obligation:

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

AP(ap(map, f), xs) → AP(ap(ap(if, ap(isEmpty, xs)), f), xs)
AP(ap(ap(if, null), f), xs) → AP(ap(if2, f), xs)
AP(ap(if2, f), xs) → AP(ap(map, f), ap(dropLast, xs))

The TRS R consists of the following rules:

ap(ap(map, f), xs) → ap(ap(ap(if, ap(isEmpty, xs)), f), xs)
ap(ap(ap(if, true), f), xs) → null
ap(ap(ap(if, null), f), xs) → ap(ap(cons, ap(f, ap(last, xs))), ap(ap(if2, f), xs))
ap(ap(if2, f), xs) → ap(ap(map, f), ap(dropLast, xs))
ap(isEmpty, null) → true
ap(isEmpty, ap(ap(cons, x), xs)) → null
ap(last, ap(ap(cons, x), null)) → x
ap(last, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(last, ap(ap(cons, y), ys))
ap(dropLast, ap(ap(cons, x), null)) → null
ap(dropLast, ap(ap(cons, x), ap(ap(cons, y), ys))) → ap(ap(cons, x), ap(dropLast, ap(ap(cons, y), ys)))

The set Q consists of the following terms:

ap(ap(map, x0), x1)
ap(ap(ap(if, true), x0), x1)
ap(ap(ap(if, null), x0), x1)
ap(ap(if2, x0), x1)
ap(isEmpty, null)
ap(isEmpty, ap(ap(cons, x0), x1))
ap(last, ap(ap(cons, x0), null))
ap(last, ap(ap(cons, x0), ap(ap(cons, x1), x2)))
ap(dropLast, ap(ap(cons, x0), null))
ap(dropLast, ap(ap(cons, x0), ap(ap(cons, x1), x2)))

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