(0) Obligation:

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

p(s(x)) → x
p(0) → 0
le(0, y) → true
le(s(x), 0) → false
le(s(x), s(y)) → le(x, y)
average(x, y) → if(le(x, 0), le(y, 0), le(y, s(0)), le(y, s(s(0))), x, y)
if(true, b1, b2, b3, x, y) → if2(b1, b2, b3, x, y)
if(false, b1, b2, b3, x, y) → average(p(x), s(y))
if2(true, b2, b3, x, y) → 0
if2(false, b2, b3, x, y) → if3(b2, b3, x, y)
if3(true, b3, x, y) → 0
if3(false, b3, x, y) → if4(b3, x, y)
if4(true, x, y) → s(0)
if4(false, x, y) → average(s(x), p(p(y)))

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:

p(s(x)) → x
p(0) → 0
le(0, y) → true
le(s(x), 0) → false
le(s(x), s(y)) → le(x, y)
average(x, y) → if(le(x, 0), le(y, 0), le(y, s(0)), le(y, s(s(0))), x, y)
if(true, b1, b2, b3, x, y) → if2(b1, b2, b3, x, y)
if(false, b1, b2, b3, x, y) → average(p(x), s(y))
if2(true, b2, b3, x, y) → 0
if2(false, b2, b3, x, y) → if3(b2, b3, x, y)
if3(true, b3, x, y) → 0
if3(false, b3, x, y) → if4(b3, x, y)
if4(true, x, y) → s(0)
if4(false, x, y) → average(s(x), p(p(y)))

The set Q consists of the following terms:

p(s(x0))
p(0)
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
average(x0, x1)
if(true, x0, x1, x2, x3, x4)
if(false, x0, x1, x2, x3, x4)
if2(true, x0, x1, x2, x3)
if2(false, x0, x1, x2, x3)
if3(true, x0, x1, x2)
if3(false, x0, x1, x2)
if4(true, x0, x1)
if4(false, x0, x1)

(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:

LE(s(x), s(y)) → LE(x, y)
AVERAGE(x, y) → IF(le(x, 0), le(y, 0), le(y, s(0)), le(y, s(s(0))), x, y)
AVERAGE(x, y) → LE(x, 0)
AVERAGE(x, y) → LE(y, 0)
AVERAGE(x, y) → LE(y, s(0))
AVERAGE(x, y) → LE(y, s(s(0)))
IF(true, b1, b2, b3, x, y) → IF2(b1, b2, b3, x, y)
IF(false, b1, b2, b3, x, y) → AVERAGE(p(x), s(y))
IF(false, b1, b2, b3, x, y) → P(x)
IF2(false, b2, b3, x, y) → IF3(b2, b3, x, y)
IF3(false, b3, x, y) → IF4(b3, x, y)
IF4(false, x, y) → AVERAGE(s(x), p(p(y)))
IF4(false, x, y) → P(p(y))
IF4(false, x, y) → P(y)

The TRS R consists of the following rules:

p(s(x)) → x
p(0) → 0
le(0, y) → true
le(s(x), 0) → false
le(s(x), s(y)) → le(x, y)
average(x, y) → if(le(x, 0), le(y, 0), le(y, s(0)), le(y, s(s(0))), x, y)
if(true, b1, b2, b3, x, y) → if2(b1, b2, b3, x, y)
if(false, b1, b2, b3, x, y) → average(p(x), s(y))
if2(true, b2, b3, x, y) → 0
if2(false, b2, b3, x, y) → if3(b2, b3, x, y)
if3(true, b3, x, y) → 0
if3(false, b3, x, y) → if4(b3, x, y)
if4(true, x, y) → s(0)
if4(false, x, y) → average(s(x), p(p(y)))

The set Q consists of the following terms:

p(s(x0))
p(0)
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
average(x0, x1)
if(true, x0, x1, x2, x3, x4)
if(false, x0, x1, x2, x3, x4)
if2(true, x0, x1, x2, x3)
if2(false, x0, x1, x2, x3)
if3(true, x0, x1, x2)
if3(false, x0, x1, x2)
if4(true, x0, x1)
if4(false, x0, x1)

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

(5) DependencyGraphProof (EQUIVALENT transformation)

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

(6) Complex Obligation (AND)

(7) Obligation:

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

LE(s(x), s(y)) → LE(x, y)

The TRS R consists of the following rules:

p(s(x)) → x
p(0) → 0
le(0, y) → true
le(s(x), 0) → false
le(s(x), s(y)) → le(x, y)
average(x, y) → if(le(x, 0), le(y, 0), le(y, s(0)), le(y, s(s(0))), x, y)
if(true, b1, b2, b3, x, y) → if2(b1, b2, b3, x, y)
if(false, b1, b2, b3, x, y) → average(p(x), s(y))
if2(true, b2, b3, x, y) → 0
if2(false, b2, b3, x, y) → if3(b2, b3, x, y)
if3(true, b3, x, y) → 0
if3(false, b3, x, y) → if4(b3, x, y)
if4(true, x, y) → s(0)
if4(false, x, y) → average(s(x), p(p(y)))

The set Q consists of the following terms:

p(s(x0))
p(0)
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
average(x0, x1)
if(true, x0, x1, x2, x3, x4)
if(false, x0, x1, x2, x3, x4)
if2(true, x0, x1, x2, x3)
if2(false, x0, x1, x2, x3)
if3(true, x0, x1, x2)
if3(false, x0, x1, x2)
if4(true, x0, x1)
if4(false, x0, x1)

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

(8) Obligation:

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

AVERAGE(x, y) → IF(le(x, 0), le(y, 0), le(y, s(0)), le(y, s(s(0))), x, y)
IF(true, b1, b2, b3, x, y) → IF2(b1, b2, b3, x, y)
IF2(false, b2, b3, x, y) → IF3(b2, b3, x, y)
IF3(false, b3, x, y) → IF4(b3, x, y)
IF4(false, x, y) → AVERAGE(s(x), p(p(y)))
IF(false, b1, b2, b3, x, y) → AVERAGE(p(x), s(y))

The TRS R consists of the following rules:

p(s(x)) → x
p(0) → 0
le(0, y) → true
le(s(x), 0) → false
le(s(x), s(y)) → le(x, y)
average(x, y) → if(le(x, 0), le(y, 0), le(y, s(0)), le(y, s(s(0))), x, y)
if(true, b1, b2, b3, x, y) → if2(b1, b2, b3, x, y)
if(false, b1, b2, b3, x, y) → average(p(x), s(y))
if2(true, b2, b3, x, y) → 0
if2(false, b2, b3, x, y) → if3(b2, b3, x, y)
if3(true, b3, x, y) → 0
if3(false, b3, x, y) → if4(b3, x, y)
if4(true, x, y) → s(0)
if4(false, x, y) → average(s(x), p(p(y)))

The set Q consists of the following terms:

p(s(x0))
p(0)
le(0, x0)
le(s(x0), 0)
le(s(x0), s(x1))
average(x0, x1)
if(true, x0, x1, x2, x3, x4)
if(false, x0, x1, x2, x3, x4)
if2(true, x0, x1, x2, x3)
if2(false, x0, x1, x2, x3)
if3(true, x0, x1, x2)
if3(false, x0, x1, x2)
if4(true, x0, x1)
if4(false, x0, x1)

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