(0) Obligation:

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

isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))

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:

isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))

The set Q consists of the following terms:

isLeaf(leaf)
isLeaf(cons(x0, x1))
left(cons(x0, x1))
right(cons(x0, x1))
concat(leaf, x0)
concat(cons(x0, x1), x2)
less_leaves(x0, x1)
if1(x0, true, x1, x2)
if1(x0, false, x1, x2)
if2(true, x0, x1)
if2(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:

CONCAT(cons(u, v), y) → CONCAT(v, y)
LESS_LEAVES(u, v) → IF1(isLeaf(u), isLeaf(v), u, v)
LESS_LEAVES(u, v) → ISLEAF(u)
LESS_LEAVES(u, v) → ISLEAF(v)
IF1(b, false, u, v) → IF2(b, u, v)
IF2(false, u, v) → LESS_LEAVES(concat(left(u), right(u)), concat(left(v), right(v)))
IF2(false, u, v) → CONCAT(left(u), right(u))
IF2(false, u, v) → LEFT(u)
IF2(false, u, v) → RIGHT(u)
IF2(false, u, v) → CONCAT(left(v), right(v))
IF2(false, u, v) → LEFT(v)
IF2(false, u, v) → RIGHT(v)

The TRS R consists of the following rules:

isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))

The set Q consists of the following terms:

isLeaf(leaf)
isLeaf(cons(x0, x1))
left(cons(x0, x1))
right(cons(x0, x1))
concat(leaf, x0)
concat(cons(x0, x1), x2)
less_leaves(x0, x1)
if1(x0, true, x1, x2)
if1(x0, false, x1, x2)
if2(true, x0, x1)
if2(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 8 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

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

CONCAT(cons(u, v), y) → CONCAT(v, y)

The TRS R consists of the following rules:

isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))

The set Q consists of the following terms:

isLeaf(leaf)
isLeaf(cons(x0, x1))
left(cons(x0, x1))
right(cons(x0, x1))
concat(leaf, x0)
concat(cons(x0, x1), x2)
less_leaves(x0, x1)
if1(x0, true, x1, x2)
if1(x0, false, x1, x2)
if2(true, x0, x1)
if2(false, x0, x1)

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

(8) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


CONCAT(cons(u, v), y) → CONCAT(v, y)
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
CONCAT(x1, x2)  =  x1
cons(x1, x2)  =  cons(x1, x2)
isLeaf(x1)  =  isLeaf
leaf  =  leaf
true  =  true
false  =  false
left(x1)  =  left(x1)
right(x1)  =  right(x1)
concat(x1, x2)  =  concat(x1, x2)
less_leaves(x1, x2)  =  less_leaves
if1(x1, x2, x3, x4)  =  x1
if2(x1, x2, x3)  =  x1

Lexicographic Path Order [LPO].
Precedence:
leaf > [isLeaf, true, false, lessleaves]
left1 > [isLeaf, true, false, lessleaves]
right1 > [isLeaf, true, false, lessleaves]
concat2 > cons2 > [isLeaf, true, false, lessleaves]


The following usable rules [FROCOS05] were oriented:

isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))

(9) Obligation:

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

isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))

The set Q consists of the following terms:

isLeaf(leaf)
isLeaf(cons(x0, x1))
left(cons(x0, x1))
right(cons(x0, x1))
concat(leaf, x0)
concat(cons(x0, x1), x2)
less_leaves(x0, x1)
if1(x0, true, x1, x2)
if1(x0, false, x1, x2)
if2(true, x0, x1)
if2(false, x0, x1)

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:

IF2(false, u, v) → LESS_LEAVES(concat(left(u), right(u)), concat(left(v), right(v)))
LESS_LEAVES(u, v) → IF1(isLeaf(u), isLeaf(v), u, v)
IF1(b, false, u, v) → IF2(b, u, v)

The TRS R consists of the following rules:

isLeaf(leaf) → true
isLeaf(cons(u, v)) → false
left(cons(u, v)) → u
right(cons(u, v)) → v
concat(leaf, y) → y
concat(cons(u, v), y) → cons(u, concat(v, y))
less_leaves(u, v) → if1(isLeaf(u), isLeaf(v), u, v)
if1(b, true, u, v) → false
if1(b, false, u, v) → if2(b, u, v)
if2(true, u, v) → true
if2(false, u, v) → less_leaves(concat(left(u), right(u)), concat(left(v), right(v)))

The set Q consists of the following terms:

isLeaf(leaf)
isLeaf(cons(x0, x1))
left(cons(x0, x1))
right(cons(x0, x1))
concat(leaf, x0)
concat(cons(x0, x1), x2)
less_leaves(x0, x1)
if1(x0, true, x1, x2)
if1(x0, false, x1, x2)
if2(true, x0, x1)
if2(false, x0, x1)

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