(0) Obligation:

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

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

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:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

QSORT(xs) → QS(half(length(xs)), xs)
QSORT(xs) → HALF(length(xs))
QSORT(xs) → LENGTH(xs)
QS(n, cons(x, xs)) → APPEND(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
QS(n, cons(x, xs)) → QS(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs)))
QS(n, cons(x, xs)) → HALF(n)
QS(n, cons(x, xs)) → FILTERLOW(get(n, cons(x, xs)), cons(x, xs))
QS(n, cons(x, xs)) → GET(n, cons(x, xs))
QS(n, cons(x, xs)) → QS(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))
QS(n, cons(x, xs)) → FILTERHIGH(get(n, cons(x, xs)), cons(x, xs))
FILTERLOW(n, cons(x, xs)) → IF1(ge(n, x), n, x, xs)
FILTERLOW(n, cons(x, xs)) → GE(n, x)
IF1(true, n, x, xs) → FILTERLOW(n, xs)
IF1(false, n, x, xs) → FILTERLOW(n, xs)
FILTERHIGH(n, cons(x, xs)) → IF2(ge(x, n), n, x, xs)
FILTERHIGH(n, cons(x, xs)) → GE(x, n)
IF2(true, n, x, xs) → FILTERHIGH(n, xs)
IF2(false, n, x, xs) → FILTERHIGH(n, xs)
GE(s(x), s(y)) → GE(x, y)
APPEND(cons(x, xs), ys) → APPEND(xs, ys)
LENGTH(cons(x, xs)) → LENGTH(xs)
HALF(s(s(x))) → HALF(x)
GET(s(n), cons(x, cons(y, xs))) → GET(n, cons(y, xs))

The TRS R consists of the following rules:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(5) DependencyGraphProof (EQUIVALENT transformation)

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

(6) Complex Obligation (AND)

(7) Obligation:

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

GET(s(n), cons(x, cons(y, xs))) → GET(n, cons(y, xs))

The TRS R consists of the following rules:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(8) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(9) Obligation:

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

GET(s(n), cons(x, cons(y, xs))) → GET(n, cons(y, xs))

R is empty.
The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(10) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

(11) Obligation:

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

GET(s(n), cons(x, cons(y, xs))) → GET(n, cons(y, xs))

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

(12) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • GET(s(n), cons(x, cons(y, xs))) → GET(n, cons(y, xs))
    The graph contains the following edges 1 > 1, 2 > 2

(13) YES

(14) Obligation:

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

HALF(s(s(x))) → HALF(x)

The TRS R consists of the following rules:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(15) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(16) Obligation:

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

HALF(s(s(x))) → HALF(x)

R is empty.
The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(17) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

(18) Obligation:

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

HALF(s(s(x))) → HALF(x)

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

(19) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • HALF(s(s(x))) → HALF(x)
    The graph contains the following edges 1 > 1

(20) YES

(21) Obligation:

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

LENGTH(cons(x, xs)) → LENGTH(xs)

The TRS R consists of the following rules:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(22) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(23) Obligation:

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

LENGTH(cons(x, xs)) → LENGTH(xs)

R is empty.
The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(24) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

(25) Obligation:

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

LENGTH(cons(x, xs)) → LENGTH(xs)

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

(26) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • LENGTH(cons(x, xs)) → LENGTH(xs)
    The graph contains the following edges 1 > 1

(27) YES

(28) Obligation:

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

APPEND(cons(x, xs), ys) → APPEND(xs, ys)

The TRS R consists of the following rules:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(29) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(30) Obligation:

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

APPEND(cons(x, xs), ys) → APPEND(xs, ys)

R is empty.
The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(31) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

(32) Obligation:

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

APPEND(cons(x, xs), ys) → APPEND(xs, ys)

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

(33) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • APPEND(cons(x, xs), ys) → APPEND(xs, ys)
    The graph contains the following edges 1 > 1, 2 >= 2

(34) YES

(35) Obligation:

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

GE(s(x), s(y)) → GE(x, y)

The TRS R consists of the following rules:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(36) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(37) Obligation:

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

GE(s(x), s(y)) → GE(x, y)

R is empty.
The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(38) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

(39) Obligation:

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

GE(s(x), s(y)) → GE(x, y)

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

(40) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • GE(s(x), s(y)) → GE(x, y)
    The graph contains the following edges 1 > 1, 2 > 2

(41) YES

(42) Obligation:

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

IF2(true, n, x, xs) → FILTERHIGH(n, xs)
FILTERHIGH(n, cons(x, xs)) → IF2(ge(x, n), n, x, xs)
IF2(false, n, x, xs) → FILTERHIGH(n, xs)

The TRS R consists of the following rules:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(43) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(44) Obligation:

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

IF2(true, n, x, xs) → FILTERHIGH(n, xs)
FILTERHIGH(n, cons(x, xs)) → IF2(ge(x, n), n, x, xs)
IF2(false, n, x, xs) → FILTERHIGH(n, xs)

The TRS R consists of the following rules:

ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(45) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

(46) Obligation:

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

IF2(true, n, x, xs) → FILTERHIGH(n, xs)
FILTERHIGH(n, cons(x, xs)) → IF2(ge(x, n), n, x, xs)
IF2(false, n, x, xs) → FILTERHIGH(n, xs)

The TRS R consists of the following rules:

ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)

The set Q consists of the following terms:

ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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

(47) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • FILTERHIGH(n, cons(x, xs)) → IF2(ge(x, n), n, x, xs)
    The graph contains the following edges 1 >= 2, 2 > 3, 2 > 4

  • IF2(true, n, x, xs) → FILTERHIGH(n, xs)
    The graph contains the following edges 2 >= 1, 4 >= 2

  • IF2(false, n, x, xs) → FILTERHIGH(n, xs)
    The graph contains the following edges 2 >= 1, 4 >= 2

(48) YES

(49) Obligation:

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

IF1(true, n, x, xs) → FILTERLOW(n, xs)
FILTERLOW(n, cons(x, xs)) → IF1(ge(n, x), n, x, xs)
IF1(false, n, x, xs) → FILTERLOW(n, xs)

The TRS R consists of the following rules:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(50) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(51) Obligation:

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

IF1(true, n, x, xs) → FILTERLOW(n, xs)
FILTERLOW(n, cons(x, xs)) → IF1(ge(n, x), n, x, xs)
IF1(false, n, x, xs) → FILTERLOW(n, xs)

The TRS R consists of the following rules:

ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(52) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

(53) Obligation:

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

IF1(true, n, x, xs) → FILTERLOW(n, xs)
FILTERLOW(n, cons(x, xs)) → IF1(ge(n, x), n, x, xs)
IF1(false, n, x, xs) → FILTERLOW(n, xs)

The TRS R consists of the following rules:

ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)

The set Q consists of the following terms:

ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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

(54) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • FILTERLOW(n, cons(x, xs)) → IF1(ge(n, x), n, x, xs)
    The graph contains the following edges 1 >= 2, 2 > 3, 2 > 4

  • IF1(true, n, x, xs) → FILTERLOW(n, xs)
    The graph contains the following edges 2 >= 1, 4 >= 2

  • IF1(false, n, x, xs) → FILTERLOW(n, xs)
    The graph contains the following edges 2 >= 1, 4 >= 2

(55) YES

(56) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))
QS(n, cons(x, xs)) → QS(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs)))

The TRS R consists of the following rules:

qsort(xs) → qs(half(length(xs)), xs)
qs(n, nil) → nil
qs(n, cons(x, xs)) → append(qs(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))), cons(get(n, cons(x, xs)), qs(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))))
filterlow(n, nil) → nil
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
append(nil, ys) → ys
append(cons(x, xs), ys) → cons(x, append(xs, ys))
length(nil) → 0
length(cons(x, xs)) → s(length(xs))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, nil) → 0
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(57) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(58) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))
QS(n, cons(x, xs)) → QS(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(59) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

qsort(x0)
qs(x0, nil)
qs(x0, cons(x1, x2))
append(nil, ys)
append(cons(x0, x1), ys)
length(nil)
length(cons(x0, x1))

(60) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs)))
QS(n, cons(x, xs)) → QS(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(61) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(n, cons(x, xs)) → QS(half(n), filterhigh(get(n, cons(x, xs)), cons(x, xs))) at position [1] we obtained the following new rules [LPAR04]:

QS(n, cons(x, xs)) → QS(half(n), if2(ge(x, get(n, cons(x, xs))), get(n, cons(x, xs)), x, xs))

(62) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs)))
QS(n, cons(x, xs)) → QS(half(n), if2(ge(x, get(n, cons(x, xs))), get(n, cons(x, xs)), x, xs))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(63) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(n, cons(x, xs)) → QS(half(n), filterlow(get(n, cons(x, xs)), cons(x, xs))) at position [1] we obtained the following new rules [LPAR04]:

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))

(64) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if2(ge(x, get(n, cons(x, xs))), get(n, cons(x, xs)), x, xs))
QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(65) Narrowing (EQUIVALENT transformation)

By narrowing [LPAR04] the rule QS(n, cons(x, xs)) → QS(half(n), if2(ge(x, get(n, cons(x, xs))), get(n, cons(x, xs)), x, xs)) at position [1] we obtained the following new rules [LPAR04]:

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), get(x0, cons(x1, nil)), x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, get(x0, cons(x1, nil))), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(s(x0), cons(x1, cons(x2, x3)))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

(66) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), get(x0, cons(x1, nil)), x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, get(x0, cons(x1, nil))), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(s(x0), cons(x1, cons(x2, x3)))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(67) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), get(x0, cons(x1, nil)), x1, nil)) at position [1,1] we obtained the following new rules [LPAR04]:

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))

(68) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, get(x0, cons(x1, nil))), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(s(x0), cons(x1, cons(x2, x3)))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(69) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2))) at position [0] we obtained the following new rules [LPAR04]:

QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))

(70) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, get(x0, cons(x1, nil))), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(s(x0), cons(x1, cons(x2, x3)))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(71) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3))) at position [1,1] we obtained the following new rules [LPAR04]:

QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

(72) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, get(x0, cons(x1, nil))), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(s(x0), cons(x1, cons(x2, x3)))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(73) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, get(x0, cons(x1, nil))), x1, x1, nil)) at position [1,0,1] we obtained the following new rules [LPAR04]:

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))

(74) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(s(x0), cons(x1, cons(x2, x3)))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(75) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2))) at position [0] we obtained the following new rules [LPAR04]:

QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))

(76) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(s(x0), cons(x1, cons(x2, x3)))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(77) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(s(x0), cons(x1, cons(x2, x3)))), get(x0, cons(x2, x3)), x1, cons(x2, x3))) at position [1,0,1] we obtained the following new rules [LPAR04]:

QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

(78) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(79) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2))) at position [1,1] we obtained the following new rules [LPAR04]:

QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))

(80) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(81) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, get(0, cons(x0, cons(x1, x2)))), x0, x0, cons(x1, x2))) at position [1,0,1] we obtained the following new rules [LPAR04]:

QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))

(82) Obligation:

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

QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs))
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(83) Narrowing (EQUIVALENT transformation)

By narrowing [LPAR04] the rule QS(n, cons(x, xs)) → QS(half(n), if1(ge(get(n, cons(x, xs)), x), get(n, cons(x, xs)), x, xs)) at position [1] we obtained the following new rules [LPAR04]:

QS(y0, cons(0, y2)) → QS(half(y0), if1(true, get(y0, cons(0, y2)), 0, y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), get(x0, cons(x1, nil)), x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(get(x0, cons(x1, nil)), x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(s(x0), cons(x1, cons(x2, x3))), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

(84) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(y0, cons(0, y2)) → QS(half(y0), if1(true, get(y0, cons(0, y2)), 0, y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), get(x0, cons(x1, nil)), x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(get(x0, cons(x1, nil)), x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(s(x0), cons(x1, cons(x2, x3))), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(85) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(y0, cons(0, y2)) → QS(half(y0), if1(true, get(y0, cons(0, y2)), 0, y2)) at position [1] we obtained the following new rules [LPAR04]:

QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))

(86) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), get(x0, cons(x1, nil)), x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(get(x0, cons(x1, nil)), x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(s(x0), cons(x1, cons(x2, x3))), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(87) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), get(x0, cons(x1, nil)), x1, nil)) at position [1,1] we obtained the following new rules [LPAR04]:

QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))

(88) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(get(x0, cons(x1, nil)), x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(s(x0), cons(x1, cons(x2, x3))), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(89) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2))) at position [0] we obtained the following new rules [LPAR04]:

QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))

(90) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(get(x0, cons(x1, nil)), x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(s(x0), cons(x1, cons(x2, x3))), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(91) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(s(x0), cons(x1, cons(x2, x3))), x1, cons(x2, x3))) at position [1,1] we obtained the following new rules [LPAR04]:

QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

(92) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(get(x0, cons(x1, nil)), x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(s(x0), cons(x1, cons(x2, x3))), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(93) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(get(x0, cons(x1, nil)), x1), x1, x1, nil)) at position [1,0,0] we obtained the following new rules [LPAR04]:

QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))

(94) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(s(x0), cons(x1, cons(x2, x3))), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(95) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(0, cons(x0, cons(x1, x2))) → QS(half(0), if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2))) at position [0] we obtained the following new rules [LPAR04]:

QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))

(96) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(s(x0), cons(x1, cons(x2, x3))), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(97) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(s(x0), cons(x1, cons(x2, x3))), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3))) at position [1,0,0] we obtained the following new rules [LPAR04]:

QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))

(98) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(99) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), get(0, cons(x0, cons(x1, x2))), x0, cons(x1, x2))) at position [1,1] we obtained the following new rules [LPAR04]:

QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

(100) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(101) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(get(0, cons(x0, cons(x1, x2))), x0), x0, x0, cons(x1, x2))) at position [1,0,0] we obtained the following new rules [LPAR04]:

QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

(102) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(103) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


QS(y0, cons(0, y2)) → QS(half(y0), filterlow(get(y0, cons(0, y2)), y2))
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial interpretation [POLO]:

POL(0) = 1   
POL(QS(x1, x2)) = x2   
POL(cons(x1, x2)) = x1 + x2   
POL(false) = 0   
POL(filterhigh(x1, x2)) = x2   
POL(filterlow(x1, x2)) = x2   
POL(ge(x1, x2)) = 0   
POL(get(x1, x2)) = 0   
POL(half(x1)) = 0   
POL(if1(x1, x2, x3, x4)) = x3 + x4   
POL(if2(x1, x2, x3, x4)) = x3 + x4   
POL(nil) = 0   
POL(s(x1)) = 0   
POL(true) = 0   

The following usable rules [FROCOS05] were oriented:

if2(true, n, x, xs) → filterhigh(n, xs)
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
if1(true, n, x, xs) → filterlow(n, xs)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
filterlow(n, nil) → nil
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterhigh(n, nil) → nil

(104) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(105) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if2(ge(x1, get(x0, cons(x2, x3))), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
QS(s(x0), cons(x1, cons(x2, x3))) → QS(half(s(x0)), if1(ge(get(x0, cons(x2, x3)), x1), get(x0, cons(x2, x3)), x1, cons(x2, x3)))
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial Order [NEGPOLO,POLO] with Interpretation:

POL( QS(x1, x2) ) = x1


POL( half(x1) ) = max{0, x1 - 1}


POL( 0 ) = 0


POL( s(x1) ) = x1 + 2


POL( if1(x1, ..., x4) ) = max{0, 2x3 - 2}


POL( if2(x1, ..., x4) ) = max{0, -1}


POL( ge(x1, x2) ) = max{0, -1}


POL( true ) = 0


POL( filterhigh(x1, x2) ) = 2x1 + 1


POL( cons(x1, x2) ) = 1


POL( false ) = 0


POL( get(x1, x2) ) = x2


POL( nil ) = 2


POL( filterlow(x1, x2) ) = max{0, 2x1 - 2}



The following usable rules [FROCOS05] were oriented:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))

(106) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
get(n, cons(x, nil)) → x
get(0, cons(x, cons(y, xs))) → x
get(s(n), cons(x, cons(y, xs))) → get(n, cons(y, xs))
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
ge(x, 0) → true
ge(0, s(x)) → false
ge(s(x), s(y)) → ge(x, y)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(true, n, x, xs) → filterhigh(n, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(107) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(108) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
if1(true, n, x, xs) → filterlow(n, xs)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
if2(true, n, x, xs) → filterhigh(n, xs)
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))
get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

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

(109) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

get(x0, nil)
get(x0, cons(x1, nil))
get(0, cons(x0, cons(x1, x2)))
get(s(x0), cons(x1, cons(x2, x3)))

(110) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
if1(true, n, x, xs) → filterlow(n, xs)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
if2(true, n, x, xs) → filterhigh(n, xs)
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))

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

(111) Induction-Processor (SOUND transformation)


This DP could be deleted by the Induction-Processor:
QS(x0, cons(x1, nil)) → QS(half(x0), if2(ge(x1, x1), x1, x1, nil))


This order was computed:
Polynomial interpretation [POLO]:

POL(0) = 0   
POL(QS(x1, x2)) = x2   
POL(cons(x1, x2)) = 1 + x2   
POL(false) = 1   
POL(filterhigh(x1, x2)) = x2   
POL(filterlow(x1, x2)) = x2   
POL(ge(x1, x2)) = 1   
POL(half(x1)) = 1 + x1   
POL(if1(x1, x2, x3, x4)) = 1 + x4   
POL(if2(x1, x2, x3, x4)) = x1 + x4   
POL(nil) = 0   
POL(s(x1)) = 1   
POL(true) = 1   

At least one of these decreasing rules is always used after the deleted DP:
if2(true, n824, x1054, xs614) → filterhigh(n824, xs614)


The following formula is valid:
x1:sort[a5].if2'(ge(x1 , x1 ), x1 , x1 , nil)=true


The transformed set:
if2'(true, n82, x105, xs61) → true
filterhigh'(n91, cons(x116, xs68)) → if2'(ge(x116, n91), n91, x116, xs68)
if2'(false, n100, x127, xs75) → filterhigh'(n100, xs75)
filterhigh'(n109, nil) → false
ge(x, 0) → true
ge(s(x9), s(y')) → ge(x9, y')
if1(true, n14, x20, xs10) → filterlow(n14, xs10)
filterlow(n23, cons(x31, xs17)) → if1(ge(n23, x31), n23, x31, xs17)
if1(false, n32, x42, xs24) → cons(x42, filterlow(n32, xs24))
filterlow(n41, nil) → nil
ge(0, s(x63)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x94))) → s(half(x94))
if2(true, n82, x105, xs61) → filterhigh(n82, xs61)
filterhigh(n91, cons(x116, xs68)) → if2(ge(x116, n91), n91, x116, xs68)
if2(false, n100, x127, xs75) → cons(x127, filterhigh(n100, xs75))
filterhigh(n109, nil) → nil
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a67](witness_sort[a67], witness_sort[a67]) → true


The proof given by the theorem prover:
The following input was given to ACL2:
(set-ruler-extenders :all)

(defun trs_isbool (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_true
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (eq
        'trs_false
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a0] (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_0
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (consp
        (cdr
          x
        )
      )
      (eq
        'trs_s
        (car
          x
        )
      )
      (trs_issort[a0]
        (car
          (cdr
            x
          )
        )
      )
      (eq
        (cdr
          (cdr
            x
          )
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a67] (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_witness_sort[a67]
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a5] (x)
  (or
    (and
      (consp
        x
      )
      (consp
        (cdr
          x
        )
      )
      (consp
        (cdr
          (cdr
            x
          )
        )
      )
      (eq
        'trs_cons
        (car
          x
        )
      )
      (trs_issort[a0]
        (car
          (cdr
            x
          )
        )
      )
      (trs_issort[a5]
        (car
          (cdr
            (cdr
              x
            )
          )
        )
      )
      (eq
        (cdr
          (cdr
            (cdr
              x
            )
          )
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (eq
        'trs_nil
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_half (x0)
  (if
    (and
      (trs_issort[a0]
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_0
        )
      )
      (list 'trs_0
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_s
          )
          (eq
            (car
              (car
                (cdr
                  x0
                )
              )
            )
            'trs_0
          )
        )
        (list 'trs_0
        )
        (if
          (and
          )
          (list 'trs_s
            (trs_half
              (car
                (cdr
                  (car
                    (cdr
                      x0
                    )
                  )
                )
              )
            )
          )
          (list 'trs_0
          )
        )
      )
    )
    (list 'trs_0
    )
  )
)
(defun trs_ge (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a0]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_0
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_s
          )
          (eq
            (car
              x1
            )
            'trs_s
          )
        )
        (trs_ge
          (car
            (cdr
              x0
            )
          )
          (car
            (cdr
              x1
            )
          )
        )
        (if
          (and
          )
          (list 'trs_false
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a67] (x0 x1)
  (if
    (and
      (trs_issort[a67]
        x0
      )
      (trs_issort[a67]
        x1
      )
    )
    (if
      (and
      )
      (list 'trs_true
      )
      (list 'trs_true
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a0] (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a0]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_0
        )
        (eq
          (car
            x1
          )
          'trs_0
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_0
          )
          (eq
            (car
              x1
            )
            'trs_s
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_s
            )
            (eq
              (car
                x1
              )
              'trs_0
            )
          )
          (list 'trs_false
          )
          (if
            (and
            )
            (trs_equal_sort[a0]
              (car
                (cdr
                  x0
                )
              )
              (car
                (cdr
                  x1
                )
              )
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_isa_false (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_false
      )
      (if
        (and
        )
        (list 'trs_true
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_isa_true (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_not (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_false
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_or (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        x1
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_and (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      x1
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_bool (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x1
          )
          'trs_false
        )
      )
      (list 'trs_false
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_false
          )
          (eq
            (car
              x1
            )
            'trs_true
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_true
            )
            (eq
              (car
                x1
              )
              'trs_true
            )
          )
          (list 'trs_true
          )
          (if
            (and
            )
            (list 'trs_true
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_if2 (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x3
          )
          'trs_cons
        )
      )
      (trs_if2
        (trs_ge
          (car
            (cdr
              x3
            )
          )
          x1
        )
        x1
        (car
          (cdr
            x3
          )
        )
        (car
          (cdr
            (cdr
              x3
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_true
          )
          (eq
            (car
              x3
            )
            'trs_nil
          )
        )
        (list 'trs_nil
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_false
            )
            (eq
              (car
                x3
              )
              'trs_cons
            )
          )
          (list 'trs_cons
            x2
            (trs_if2
              (trs_ge
                (car
                  (cdr
                    x3
                  )
                )
                x1
              )
              x1
              (car
                (cdr
                  x3
                )
              )
              (car
                (cdr
                  (cdr
                    x3
                  )
                )
              )
            )
          )
          (if
            (and
            )
            (list 'trs_cons
              x2
              (list 'trs_nil
              )
            )
            (list 'trs_nil
            )
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_if1 (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x3
          )
          'trs_cons
        )
      )
      (trs_if1
        (trs_ge
          x1
          (car
            (cdr
              x3
            )
          )
        )
        x1
        (car
          (cdr
            x3
          )
        )
        (car
          (cdr
            (cdr
              x3
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_true
          )
          (eq
            (car
              x3
            )
            'trs_nil
          )
        )
        (list 'trs_nil
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_false
            )
            (eq
              (car
                x3
              )
              'trs_cons
            )
          )
          (list 'trs_cons
            x2
            (trs_if1
              (trs_ge
                x1
                (car
                  (cdr
                    x3
                  )
                )
              )
              x1
              (car
                (cdr
                  x3
                )
              )
              (car
                (cdr
                  (cdr
                    x3
                  )
                )
              )
            )
          )
          (if
            (and
            )
            (list 'trs_cons
              x2
              (list 'trs_nil
              )
            )
            (list 'trs_nil
            )
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_if2prime (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_false
          )
          (eq
            (car
              x3
            )
            'trs_cons
          )
        )
        (trs_if2prime
          (trs_ge
            (car
              (cdr
                x3
              )
            )
            x1
          )
          x1
          (car
            (cdr
              x3
            )
          )
          (car
            (cdr
              (cdr
                x3
              )
            )
          )
        )
        (if
          (and
          )
          (list 'trs_false
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_filterhigh (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_nil
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                (car
                  (cdr
                    x1
                  )
                )
                x0
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (trs_filterhigh
          x0
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  (car
                    (cdr
                      x1
                    )
                  )
                  x0
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (list 'trs_cons
            (car
              (cdr
                x1
              )
            )
            (trs_filterhigh
              x0
              (car
                (cdr
                  (cdr
                    x1
                  )
                )
              )
            )
          )
          (list 'trs_nil
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_filterlow (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_nil
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                x0
                (car
                  (cdr
                    x1
                  )
                )
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (trs_filterlow
          x0
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  x0
                  (car
                    (cdr
                      x1
                    )
                  )
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (list 'trs_cons
            (car
              (cdr
                x1
              )
            )
            (trs_filterlow
              x0
              (car
                (cdr
                  (cdr
                    x1
                  )
                )
              )
            )
          )
          (list 'trs_nil
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_filterhighprime (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_false
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                (car
                  (cdr
                    x1
                  )
                )
                x0
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (list 'trs_true
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  (car
                    (cdr
                      x1
                    )
                  )
                  x0
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (trs_filterhighprime
            x0
            (car
              (cdr
                (cdr
                  x1
                )
              )
            )
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a5] (x0 x1)
  (if
    (and
      (trs_issort[a5]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_cons
        )
        (eq
          (car
            x1
          )
          'trs_cons
        )
      )
      (trs_and
        (trs_equal_sort[a5]
          (car
            (cdr
              x0
            )
          )
          (car
            (cdr
              x1
            )
          )
        )
        (trs_equal_sort[a5]
          (car
            (cdr
              (cdr
                x0
              )
            )
          )
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_cons
          )
          (eq
            (car
              x1
            )
            'trs_nil
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_nil
            )
            (eq
              (car
                x1
              )
              'trs_cons
            )
          )
          (list 'trs_false
          )
          (if
            (and
            )
            (list 'trs_true
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(with-prover-time-limit 3
  (defthm test
    (implies
      (and
        (trs_issort[a5] trs_x1)
      )
      (eq
        (trs_if2prime
          (trs_ge
            trs_x1
            trs_x1
          )
          trs_x1
          trs_x1
          (list 'trs_nil
          )
        )
        (list 'trs_true
        )
      )
    )
    :hints (("Goal" :do-not '(generalize)))
  )
)


The following output was given by ACL2:
This is SBCL 1.0.29.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at .

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

 ACL2 Version 3.6 built February 12, 2010  14:59:57.
 Copyright (C) 2009  University of Texas at Austin
 ACL2 comes with ABSOLUTELY NO WARRANTY.  This is free software and you
 are welcome to redistribute it under certain conditions.  For details,
 see the GNU General Public License.

 Initialized with (INITIALIZE-ACL2 'INCLUDE-BOOK *ACL2-PASS-2-FILES*).
 See the documentation topic note-3-6 for recent changes.
 Note: We have modified the prompt in some underlying Lisps to further
 distinguish it from the ACL2 prompt.

ACL2 Version 3.6.  Level 1.  Cbd "/home/petersk/workspace/benchmark/".
Distributed books directory "/home/petersk/download/acl2-sources/books/".
Type :help for help.
Type (good-bye) to quit completely out of ACL2.

ACL2 !> :ALL
ACL2 !>
Since TRS_ISBOOL is non-recursive, its admission is trivial.  We observe
that the type of TRS_ISBOOL is described by the theorem 
(OR (EQUAL (TRS_ISBOOL X) T) (EQUAL (TRS_ISBOOL X) NIL)).  We used
the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISBOOL ...)
Rules: ((:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISBOOL
ACL2 !>
For the admission of TRS_ISSORT[A0] we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (NOT (AND (CONSP X)
                        (EQ 'TRS_0 (CAR X))
                        (EQ (CDR X) NIL)))
              (CONSP X)
              (CONSP (CDR X))
              (EQ 'TRS_S (CAR X)))
         (O< (ACL2-COUNT (CADR X))
             (ACL2-COUNT X))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (NOT (AND (CONSP X)
                        (EQUAL 'TRS_0 (CAR X))
                        (EQUAL (CDR X) NIL)))
              (CONSP X)
              (CONSP (CDR X))
              (EQUAL 'TRS_S (CAR X)))
         (O< (ACL2-COUNT (CADR X))
             (ACL2-COUNT X))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP and
O<, the :executable-counterparts of ACL2-COUNT and EQUAL, primitive
type reasoning, the :rewrite rule UNICITY-OF-0 and the :type-prescription
rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (EQUAL 'TRS_S (CAR X)))
         (< (ACL2-COUNT (CADR X))
            (+ 1 (ACL2-COUNT (CDR X))))).

The destructor terms (CAR X) and (CDR X) can be eliminated.  Furthermore,
those terms are at the root of a chain of two rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X by (CONS X1 X2), (CAR X)
by X1 and (CDR X) by X2 and restrict the type of the new variable X1
to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again, to
replace X2 by (CONS X3 X4), (CAR X2) by X3 and (CDR X2) by X4.    These
steps produce the following goal.

Goal'''
(IMPLIES (AND (CONSP (CONS X3 X4))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              (NOT (EQUAL X1 NIL))
              (CONSP (LIST* X1 X3 X4))
              (EQUAL 'TRS_S X1))
         (< (ACL2-COUNT X3)
            (+ 1 (ACL2-COUNT (CONS X3 X4))))).

By case analysis we reduce the conjecture to

Goal'4'
(IMPLIES (AND (CONSP (CONS X3 X4))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              X1 (CONSP (LIST* X1 X3 X4))
              (EQUAL 'TRS_S X1))
         (< (ACL2-COUNT X3)
            (+ 1 (ACL2-COUNT (CONS X3 X4))))).

This simplifies, using the :definition ACL2-COUNT, the :executable-
counterparts of EQUAL, NOT and SYMBOLP, primitive type reasoning and
the :rewrite rules CAR-CONS and CDR-CONS, to

Goal'5'
(< (ACL2-COUNT X3)
   (+ 1 1 (ACL2-COUNT X3)
      (ACL2-COUNT X4))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_ISSORT[A0].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_ISSORT[A0] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A0] X) T) (EQUAL (TRS_ISSORT[A0] X) NIL)). 
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISSORT[A0] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_ISSORT[A0]
ACL2 !>
Since TRS_ISSORT[A67] is non-recursive, its admission is trivial. 
We observe that the type of TRS_ISSORT[A67] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A67] X) T) (EQUAL (TRS_ISSORT[A67] X) NIL)).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISSORT[A67] ...)
Rules: ((:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_ISSORT[A67]
ACL2 !>
For the admission of TRS_ISSORT[A5] we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQ 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (O< (ACL2-COUNT (CADDR X))
             (ACL2-COUNT X))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQUAL 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (O< (ACL2-COUNT (CADDR X))
             (ACL2-COUNT X))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP and
O<, the :executable-counterpart of ACL2-COUNT, primitive type reasoning,
the :rewrite rule UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT,
to

Goal''
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQUAL 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (< (ACL2-COUNT (CADDR X))
            (+ 1 1 (ACL2-COUNT (CADR X))
               (ACL2-COUNT (CDDR X))))).

The destructor terms (CAR X) and (CDR X) can be eliminated.  Furthermore,
those terms are at the root of a chain of three rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X by (CONS X1 X2), (CAR X)
by X1 and (CDR X) by X2 and restrict the type of the new variable X1
to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again, to
replace X2 by (CONS X3 X4), (CAR X2) by X3 and (CDR X2) by X4.  (3)
Finally, use CAR-CDR-ELIM to replace X4 by (CONS X5 X6), (CAR X4) by
X5 and (CDR X4) by X6.    These steps produce the following goal.

Goal'''
(IMPLIES (AND (CONSP (CONS X5 X6))
              (CONSP (LIST* X3 X5 X6))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              (NOT (EQUAL X1 NIL))
              (CONSP (LIST* X1 X3 X5 X6))
              (EQUAL 'TRS_CONS X1)
              (TRS_ISSORT[A0] X3))
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               (ACL2-COUNT (CONS X5 X6))))).

By case analysis we reduce the conjecture to

Goal'4'
(IMPLIES (AND (CONSP (CONS X5 X6))
              (CONSP (LIST* X3 X5 X6))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              X1 (CONSP (LIST* X1 X3 X5 X6))
              (EQUAL 'TRS_CONS X1)
              (TRS_ISSORT[A0] X3))
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               (ACL2-COUNT (CONS X5 X6))))).

This simplifies, using the :definition ACL2-COUNT, the :executable-
counterparts of EQUAL, NOT and SYMBOLP, primitive type reasoning and
the :rewrite rules CAR-CONS and CDR-CONS, to

Goal'5'
(IMPLIES (TRS_ISSORT[A0] X3)
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               1 (ACL2-COUNT X5)
               (ACL2-COUNT X6)))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_ISSORT[A5].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_ISSORT[A5] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A5] X) T) (EQUAL (TRS_ISSORT[A5] X) NIL)). 
We used the :executable-counterpart of EQUAL, primitive type reasoning
and the :type-prescription rule TRS_ISSORT[A0].

Summary
Form:  ( DEFUN TRS_ISSORT[A5] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_ISSORT[A0]))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_ISSORT[A5]
ACL2 !>
For the admission of TRS_HALF we will use the relation O< (which is
known to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X0).  The non-trivial part of the measure conjecture is

Goal
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (NOT (EQ (CAR X0) 'TRS_0))
              (NOT (AND (EQ (CAR X0) 'TRS_S)
                        (EQ (CAADR X0) 'TRS_0)))
              T)
         (O< (ACL2-COUNT (CADADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (NOT (EQUAL (CAR X0) 'TRS_0))
              (NOT (AND (EQUAL (CAR X0) 'TRS_S)
                        (EQUAL (CAADR X0) 'TRS_0))))
         (O< (ACL2-COUNT (CADADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (EQUAL 'TRS_S (CAR X0))
              (CONSP (CADR X0))
              (CONSP (CDADR X0))
              (EQUAL 'TRS_S (CAADR X0))
              (TRS_ISSORT[A0] (CADADR X0))
              (NOT (CDDADR X0))
              (NOT (CDDR X0)))
         (< (ACL2-COUNT (CADADR X0))
            (+ 1 1 1 1 (ACL2-COUNT (CADADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_HALF.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_HALF is described by the theorem 
(AND (CONSP (TRS_HALF X0)) (TRUE-LISTP (TRS_HALF X0))).  We used primitive
type reasoning.

Summary
Form:  ( DEFUN TRS_HALF ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_HALF
ACL2 !>
For the admission of TRS_GE we will use the relation O< (which is known
to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X0).  The non-trivial part of the measure conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A0] X1))
              (NOT (EQ (CAR X1) 'TRS_0))
              (AND (EQ (CAR X0) 'TRS_S)
                   (EQ (CAR X1) 'TRS_S)))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A0] X1)
              (NOT (EQUAL (CAR X1) 'TRS_0))
              (EQUAL (CAR X0) 'TRS_S)
              (EQUAL (CAR X1) 'TRS_S))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (NOT (CDDR X0))
              (TRS_ISSORT[A0] X1)
              (EQUAL (CAR X0) 'TRS_S)
              (EQUAL (CAR X1) 'TRS_S))
         (< (ACL2-COUNT (CADR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_GE.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_GE is described by the theorem 
(AND (CONSP (TRS_GE X0 X1)) (TRUE-LISTP (TRS_GE X0 X1))).  

Summary
Form:  ( DEFUN TRS_GE ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_GE
ACL2 !>
Since TRS_EQUAL_SORT[A67] is non-recursive, its admission is trivial.
We observe that the type of TRS_EQUAL_SORT[A67] is described by the
theorem 
(AND (CONSP (TRS_EQUAL_SORT[A67] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A67] X0 X1))).

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A67] ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_EQUAL_SORT[A67]
ACL2 !>
For the admission of TRS_EQUAL_SORT[A0] we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X0).  The non-trivial part of the measure
conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A0] X1))
              (NOT (AND (EQ (CAR X0) 'TRS_0)
                        (EQ (CAR X1) 'TRS_0)))
              (NOT (AND (EQ (CAR X0) 'TRS_0)
                        (EQ (CAR X1) 'TRS_S)))
              (NOT (AND (EQ (CAR X0) 'TRS_S)
                        (EQ (CAR X1) 'TRS_0)))
              T)
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A0] X1)
              (NOT (AND (EQUAL (CAR X0) 'TRS_0)
                        (EQUAL (CAR X1) 'TRS_0)))
              (NOT (AND (EQUAL (CAR X0) 'TRS_0)
                        (EQUAL (CAR X1) 'TRS_S)))
              (NOT (AND (EQUAL (CAR X0) 'TRS_S)
                        (EQUAL (CAR X1) 'TRS_0))))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (EQUAL 'TRS_S (CAR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (NOT (CDDR X0))
              (TRS_ISSORT[A0] X1)
              (NOT (EQUAL (CAR X1) 'TRS_0)))
         (< (ACL2-COUNT (CADR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_EQUAL_SORT[A0].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_EQUAL_SORT[A0] is described by the theorem
(AND (CONSP (TRS_EQUAL_SORT[A0] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A0] X0 X1))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A0] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_EQUAL_SORT[A0]
ACL2 !>
Since TRS_ISA_FALSE is non-recursive, its admission is trivial.  We
observe that the type of TRS_ISA_FALSE is described by the theorem
(AND (CONSP (TRS_ISA_FALSE X0)) (TRUE-LISTP (TRS_ISA_FALSE X0))). 

Summary
Form:  ( DEFUN TRS_ISA_FALSE ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISA_FALSE
ACL2 !>
Since TRS_ISA_TRUE is non-recursive, its admission is trivial.  We
observe that the type of TRS_ISA_TRUE is described by the theorem 
(AND (CONSP (TRS_ISA_TRUE X0)) (TRUE-LISTP (TRS_ISA_TRUE X0))).  

Summary
Form:  ( DEFUN TRS_ISA_TRUE ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISA_TRUE
ACL2 !>
Since TRS_NOT is non-recursive, its admission is trivial.  We observe
that the type of TRS_NOT is described by the theorem 
(AND (CONSP (TRS_NOT X0)) (TRUE-LISTP (TRS_NOT X0))).  

Summary
Form:  ( DEFUN TRS_NOT ...)
Rules: NIL
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_NOT
ACL2 !>
Since TRS_OR is non-recursive, its admission is trivial.  We observe
that the type of TRS_OR is described by the theorem 
(OR (AND (CONSP (TRS_OR X0 X1))
         (TRUE-LISTP (TRS_OR X0 X1)))
    (EQUAL (TRS_OR X0 X1) X1)).

Summary
Form:  ( DEFUN TRS_OR ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_OR
ACL2 !>
Since TRS_AND is non-recursive, its admission is trivial.  We observe
that the type of TRS_AND is described by the theorem 
(OR (AND (CONSP (TRS_AND X0 X1))
         (TRUE-LISTP (TRS_AND X0 X1)))
    (EQUAL (TRS_AND X0 X1) X1)).

Summary
Form:  ( DEFUN TRS_AND ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_AND
ACL2 !>
Since TRS_EQUAL_BOOL is non-recursive, its admission is trivial.  We
observe that the type of TRS_EQUAL_BOOL is described by the theorem
(AND (CONSP (TRS_EQUAL_BOOL X0 X1)) (TRUE-LISTP (TRS_EQUAL_BOOL X0 X1))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_EQUAL_BOOL ...)
Rules: ((:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_EQUAL_BOOL
ACL2 !>
For the admission of TRS_IF2 we will use the relation O< (which is
known to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X3).  The non-trivial part of the measure conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (AND (EQ (CAR X0) 'TRS_TRUE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))
     (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (NOT (AND (EQ (CAR X0) 'TRS_TRUE)
                             (EQ (CAR X3) 'TRS_NIL)))
                   (AND (EQ (CAR X0) 'TRS_FALSE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to the following two conjectures.

Subgoal 2
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (AND (EQUAL (CAR X0) 'TRS_TRUE)
                        (EQUAL (CAR X3) 'TRS_NIL)))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF2.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_IF2 is described by the theorem 
(AND (CONSP (TRS_IF2 X0 X1 X2 X3)) (TRUE-LISTP (TRS_IF2 X0 X1 X2 X3))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_IF2 ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.00, other: 0.01)
 TRS_IF2
ACL2 !>
For the admission of TRS_IF1 we will use the relation O< (which is
known to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X3).  The non-trivial part of the measure conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (AND (EQ (CAR X0) 'TRS_TRUE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))
     (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (NOT (AND (EQ (CAR X0) 'TRS_TRUE)
                             (EQ (CAR X3) 'TRS_NIL)))
                   (AND (EQ (CAR X0) 'TRS_FALSE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to the following two conjectures.

Subgoal 2
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (AND (EQUAL (CAR X0) 'TRS_TRUE)
                        (EQUAL (CAR X3) 'TRS_NIL)))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF1.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_IF1 is described by the theorem 
(AND (CONSP (TRS_IF1 X0 X1 X2 X3)) (TRUE-LISTP (TRS_IF1 X0 X1 X2 X3))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_IF1 ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.03 seconds (prove: 0.02, print: 0.00, other: 0.01)
 TRS_IF1
ACL2 !>
For the admission of TRS_IF2PRIME we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X3).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (AND (TRS_ISBOOL X0)
                   (TRS_ISSORT[A0] X1)
                   (TRS_ISSORT[A0] X2)
                   (TRS_ISSORT[A5] X3))
              (NOT (EQ (CAR X0) 'TRS_TRUE))
              (AND (EQ (CAR X0) 'TRS_FALSE)
                   (EQ (CAR X3) 'TRS_CONS)))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Goal'
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (EQUAL (CAR X0) 'TRS_TRUE))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal'''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF2PRIME. 
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_IF2PRIME is described by the theorem 
(AND (CONSP (TRS_IF2PRIME X0 X1 X2 X3))
     (TRUE-LISTP (TRS_IF2PRIME X0 X1 X2 X3))).

Summary
Form:  ( DEFUN TRS_IF2PRIME ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_IF2PRIME
ACL2 !>
For the admission of TRS_FILTERHIGH we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X1).  The non-trivial part of the measure conjecture
is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (EQ (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                       '(TRS_TRUE))
                       '(TRS_FALSE)))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))
     (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Subgoal 2'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE (CADR X1) X0)))
              (NOT (CDR (TRS_GE (CADR X1) X0))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                     '(TRS_TRUE))
                     '(TRS_TRUE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to the following three conjectures.

Subgoal 1.3
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL 'TRS_TRUE
                     (CAR (TRS_GE (CADR X1) X0))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (CDR (TRS_GE (CADR X1) X0)))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE (CADR X1) X0)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERHIGH.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERHIGH is described by the theorem
(AND (CONSP (TRS_FILTERHIGH X0 X1)) (TRUE-LISTP (TRS_FILTERHIGH X0 X1))).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_FILTERHIGH ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.01, other: 0.00)
 TRS_FILTERHIGH
ACL2 !>
For the admission of TRS_FILTERLOW we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X1).  The non-trivial part of the measure conjecture
is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                       '(TRS_TRUE))
                       '(TRS_FALSE)))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))
     (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Subgoal 2'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE X0 (CADR X1))))
              (NOT (CDR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_TRUE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to the following three conjectures.

Subgoal 1.3
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL 'TRS_TRUE
                     (CAR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (CDR (TRS_GE X0 (CADR X1))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE X0 (CADR X1))))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERLOW.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERLOW is described by the theorem
(AND (CONSP (TRS_FILTERLOW X0 X1)) (TRUE-LISTP (TRS_FILTERLOW X0 X1))).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_FILTERLOW ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.01, other: 0.00)
 TRS_FILTERLOW
ACL2 !>
For the admission of TRS_FILTERHIGHPRIME we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X1).  The non-trivial part of the measure
conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A5] X1))
              (NOT (EQ (CAR X1) 'TRS_NIL))
              (NOT (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (EQ (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                  '(TRS_TRUE))
                  '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (NOT (AND (EQUAL (CAR X1) 'TRS_CONS)
                        (EQUAL (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                               '(TRS_TRUE))
                               '(TRS_TRUE))))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Goal''
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE (CADR X1) X0)))
              (NOT (CDR (TRS_GE (CADR X1) X0))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERHIGHPRIME.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERHIGHPRIME is described by the theorem
(AND (CONSP (TRS_FILTERHIGHPRIME X0 X1))
     (TRUE-LISTP (TRS_FILTERHIGHPRIME X0 X1))).

Summary
Form:  ( DEFUN TRS_FILTERHIGHPRIME ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.01, other: 0.00)
 TRS_FILTERHIGHPRIME
ACL2 !>
For the admission of TRS_EQUAL_SORT[A5] we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X0).  The non-trivial part of the measure
conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A5] X0)
                        (TRS_ISSORT[A5] X1))
                   (AND (EQ (CAR X0) 'TRS_CONS)
                        (EQ (CAR X1) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X0))
                  (ACL2-COUNT X0)))
     (IMPLIES (AND (AND (TRS_ISSORT[A5] X0)
                        (TRS_ISSORT[A5] X1))
                   (AND (EQ (CAR X0) 'TRS_CONS)
                        (EQ (CAR X1) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADR X0))
                  (ACL2-COUNT X0)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (CONSP (CDDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (TRS_ISSORT[A5] (CADDR X0))
              (NOT (CDDDR X0))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X0))
            (+ 1 (ACL2-COUNT (CDR X0))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (CONSP (CDDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (TRS_ISSORT[A5] (CADDR X0))
              (NOT (CDDDR X0))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))
               1 (ACL2-COUNT (CADDR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions O-FINP and O< and the :type-
prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADR X0))
            (ACL2-COUNT X0))).

The destructor terms (CAR X0) and (CDR X0) can be eliminated.  Furthermore,
those terms are at the root of a chain of two rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X0 by (CONS X2 X3), (CAR X0)
by X2 and (CDR X0) by X3 and restrict the type of the new variable
X2 to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again,
to replace X3 by (CONS X4 X5), (CAR X3) by X4 and (CDR X3) by X5. 
  These steps produce the following three goals.

Subgoal 1.3
(IMPLIES (AND (NOT (CONSP X0))
              (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADR X0))
            (ACL2-COUNT X0))).

But we reduce the conjecture to T, by primitive type reasoning.

Subgoal 1.2
(IMPLIES (AND (NOT (CONSP X3))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              (NOT (EQUAL X2 NIL))
              (CONSP (CONS X2 X3))
              (TRS_ISSORT[A5] (CONS X2 X3))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CAR X3))
            (ACL2-COUNT (CONS X2 X3)))).

By case analysis we reduce the conjecture to

Subgoal 1.2'
(IMPLIES (AND (NOT (CONSP X3))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              X2 (CONSP (CONS X2 X3))
              (TRS_ISSORT[A5] (CONS X2 X3))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CAR X3))
            (ACL2-COUNT (CONS X2 X3)))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterparts of EQUAL, NOT and SYMBOLP, primitive type
reasoning and the :rewrite rules CAR-CONS and CDR-CONS.

Subgoal 1.1
(IMPLIES (AND (CONSP (CONS X4 X5))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              (NOT (EQUAL X2 NIL))
              (CONSP (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (ACL2-COUNT (LIST* X2 X4 X5)))).

By case analysis we reduce the conjecture to

Subgoal 1.1'
(IMPLIES (AND (CONSP (CONS X4 X5))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              X2 (CONSP (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (ACL2-COUNT (LIST* X2 X4 X5)))).

This simplifies, using the :definitions ACL2-COUNT, FIX and TRS_ISSORT[A5],
the :executable-counterparts of ACL2-COUNT, EQUAL, NOT and SYMBOLP,
primitive type reasoning, the :rewrite rules CAR-CONS, CDR-CONS and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1.1''
(IMPLIES (AND (CONSP X5)
              (TRS_ISSORT[A0] X4)
              (TRS_ISSORT[A5] (CAR X5))
              (NOT (CDR X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (+ 1 1 (ACL2-COUNT X4)
               (ACL2-COUNT X5)))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_EQUAL_SORT[A5].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_EQUAL_SORT[A5] is described by the theorem
(AND (CONSP (TRS_EQUAL_SORT[A5] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A5] X0 X1))).
We used the :executable-counterpart of EQUAL, primitive type reasoning
and the :type-prescription rule TRS_AND.

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A5] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A5])
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_AND))
Warnings:  None
Time:  0.02 seconds (prove: 0.02, print: 0.00, other: 0.00)
 TRS_EQUAL_SORT[A5]
ACL2 !>
[Note:  A hint was supplied for our processing of the goal above. 
Thanks!]

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (TRS_ISSORT[A5] TRS_X1)
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X1)
                              TRS_X1 TRS_X1 '(TRS_NIL))
                '(TRS_TRUE))).

This simplifies, using the :definitions TRS_IF2PRIME and TRS_ISBOOL,
the :executable-counterparts of CAR, EQUAL and TRS_ISSORT[A5], primitive
type reasoning and the :type-prescription rules TRS_GE and TRS_ISSORT[A0],
to

Goal''
(IMPLIES (AND (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

Name the formula above *1.

Perhaps we can prove *1 by induction.  Four induction schemes are suggested
by this conjecture.  Subsumption reduces that number to three.  These
merge into two derived induction schemes.  One of these has a score
higher than the other.  

We will induct according to a scheme suggested by (TRS_ISSORT[A0] TRS_X1).
This suggestion was produced using the :induction rules TRS_GE and
TRS_ISSORT[A0].  If we let (:P TRS_X1) denote *1 above then the induction
scheme we'll use is
(AND (IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                             (EQ 'TRS_0 (CAR TRS_X1))
                             (EQ (CDR TRS_X1) NIL)))
                   (NOT (CONSP TRS_X1)))
              (:P TRS_X1))
     (IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                             (EQ 'TRS_0 (CAR TRS_X1))
                             (EQ (CDR TRS_X1) NIL)))
                   (CONSP TRS_X1)
                   (NOT (CONSP (CDR TRS_X1))))
              (:P TRS_X1))
     (IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                             (EQ 'TRS_0 (CAR TRS_X1))
                             (EQ (CDR TRS_X1) NIL)))
                   (CONSP TRS_X1)
                   (CONSP (CDR TRS_X1))
                   (NOT (EQ 'TRS_S (CAR TRS_X1))))
              (:P TRS_X1))
     (IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                             (EQ 'TRS_0 (CAR TRS_X1))
                             (EQ (CDR TRS_X1) NIL)))
                   (CONSP TRS_X1)
                   (CONSP (CDR TRS_X1))
                   (EQ 'TRS_S (CAR TRS_X1))
                   (:P (CADR TRS_X1)))
              (:P TRS_X1))
     (IMPLIES (AND (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL))
                   (NOT (CONSP TRS_X1)))
              (:P TRS_X1))
     (IMPLIES (AND (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL))
                   (CONSP TRS_X1)
                   (NOT (EQ 'TRS_0 (CAR TRS_X1))))
              (:P TRS_X1))
     (IMPLIES (AND (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL))
                   (CONSP TRS_X1)
                   (EQ 'TRS_0 (CAR TRS_X1)))
              (:P TRS_X1))).
This induction is justified by the same argument used to admit 
TRS_ISSORT[A0].  When applied to the goal at hand the above induction
scheme produces eight nontautological subgoals.

Subgoal *1/8
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL)))
              (NOT (CONSP TRS_X1))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/8'
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQUAL 'TRS_0 (CAR TRS_X1))
                        (EQUAL (CDR TRS_X1) NIL)))
              (NOT (CONSP TRS_X1))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5].

Subgoal *1/7
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (NOT (CONSP (CDR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/7'
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQUAL 'TRS_0 (CAR TRS_X1))
                        (EQUAL (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (NOT (CONSP (CDR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

But simplification reduces this to T, using the :definitions TRS_GE,
TRS_ISSORT[A0] and TRS_ISSORT[A5], the :executable-counterparts of
CAR, CONSP and EQUAL and primitive type reasoning.

Subgoal *1/6
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (NOT (EQ 'TRS_S (CAR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/6'
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQUAL 'TRS_0 (CAR TRS_X1))
                        (EQUAL (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (NOT (EQUAL 'TRS_S (CAR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

But simplification reduces this to T, using the :definitions TRS_GE
and TRS_ISSORT[A0], the :executable-counterparts of CAR and EQUAL and
primitive type reasoning.

Subgoal *1/5
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (EQ 'TRS_S (CAR TRS_X1))
              (NOT (TRS_ISSORT[A0] (CADR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/5'
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQUAL 'TRS_0 (CAR TRS_X1))
                        (EQUAL (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (EQUAL 'TRS_S (CAR TRS_X1))
              (NOT (TRS_ISSORT[A0] (CADR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterpart of EQUAL and primitive type reasoning.

Subgoal *1/4
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (EQ 'TRS_S (CAR TRS_X1))
              (CDR (TRS_GE (CADR TRS_X1) (CADR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/4'
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQUAL 'TRS_0 (CAR TRS_X1))
                        (EQUAL (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (EQUAL 'TRS_S (CAR TRS_X1))
              (CDR (TRS_GE (CADR TRS_X1) (CADR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterpart of EQUAL and primitive type reasoning.

Subgoal *1/3
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (EQ 'TRS_S (CAR TRS_X1))
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE (CADR TRS_X1) (CADR TRS_X1)))))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/3'
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQUAL 'TRS_0 (CAR TRS_X1))
                        (EQUAL (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (EQUAL 'TRS_S (CAR TRS_X1))
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE (CADR TRS_X1) (CADR TRS_X1)))))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterpart of EQUAL and primitive type reasoning.

Subgoal *1/2
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQ 'TRS_0 (CAR TRS_X1))
                        (EQ (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (EQ 'TRS_S (CAR TRS_X1))
              (NOT (TRS_ISSORT[A5] (CADR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/2'
(IMPLIES (AND (NOT (AND (CONSP TRS_X1)
                        (EQUAL 'TRS_0 (CAR TRS_X1))
                        (EQUAL (CDR TRS_X1) NIL)))
              (CONSP TRS_X1)
              (CONSP (CDR TRS_X1))
              (EQUAL 'TRS_S (CAR TRS_X1))
              (NOT (TRS_ISSORT[A5] (CADR TRS_X1)))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterpart of EQUAL and primitive type reasoning.

Subgoal *1/1
(IMPLIES (AND (AND (CONSP TRS_X1)
                   (EQ 'TRS_0 (CAR TRS_X1))
                   (EQ (CDR TRS_X1) NIL))
              (CONSP TRS_X1)
              (EQ 'TRS_0 (CAR TRS_X1))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/1'
(IMPLIES (AND (CONSP TRS_X1)
              (EQUAL 'TRS_0 (CAR TRS_X1))
              (NOT (CDR TRS_X1))
              (TRS_ISSORT[A5] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1)))
              (NOT (CDR (TRS_GE TRS_X1 TRS_X1))))
         (NOT (TRS_ISSORT[A0] TRS_X1))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterparts of CONSP and EQUAL and primitive type
reasoning.

That completes the proof of *1.

Q.E.D.

Summary
Form:  ( DEFTHM TEST ...)
Rules: ((:DEFINITION EQ)
        (:DEFINITION NOT)
        (:DEFINITION TRS_GE)
        (:DEFINITION TRS_IF2PRIME)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A0])
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART CONSP)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISSORT[A5])
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:INDUCTION TRS_GE)
        (:INDUCTION TRS_ISSORT[A0])
        (:TYPE-PRESCRIPTION TRS_GE)
        (:TYPE-PRESCRIPTION TRS_ISSORT[A0]))
Warnings:  None
Time:  0.02 seconds (prove: 0.02, print: 0.00, other: 0.00)
 TEST
ACL2 !>Bye.

(112) Complex Obligation (AND)

(113) Obligation:

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

QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
if1(true, n, x, xs) → filterlow(n, xs)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
if2(true, n, x, xs) → filterhigh(n, xs)
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))

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

(114) Induction-Processor (SOUND transformation)


This DP could be deleted by the Induction-Processor:
QS(0, cons(x0, cons(x1, x2))) → QS(0, if2(ge(x0, x0), x0, x0, cons(x1, x2)))


This order was computed:
Polynomial interpretation [POLO]:

POL(0) = 1   
POL(QS(x1, x2)) = x2   
POL(cons(x1, x2)) = 1 + x2   
POL(false) = 0   
POL(filterhigh(x1, x2)) = x2   
POL(filterlow(x1, x2)) = x2   
POL(ge(x1, x2)) = 1   
POL(half(x1)) = 1 + x1   
POL(if1(x1, x2, x3, x4)) = 1 + x4   
POL(if2(x1, x2, x3, x4)) = 1 + x4   
POL(nil) = 0   
POL(s(x1)) = 1   
POL(true) = 1   

At least one of these decreasing rules is always used after the deleted DP:
if2(true, n821, x1051, xs611) → filterhigh(n821, xs611)


The following formula is valid:
x0:sort[a0],x1:sort[a5],x2:sort[a0].if2'(ge(x0 , x0 ), x0 , x0 , cons(x1 , x2 ))=true


The transformed set:
if2'(true, n82, x105, xs61) → true
filterhigh'(n91, cons(x116, xs68)) → if2'(ge(x116, n91), n91, x116, xs68)
if2'(false, n100, x127, xs75) → filterhigh'(n100, xs75)
filterhigh'(n109, nil) → false
ge(x, 0) → true
ge(s(x9), s(y')) → ge(x9, y')
if1(true, n14, x20, xs10) → filterlow(n14, xs10)
filterlow(n23, cons(x31, xs17)) → if1(ge(n23, x31), n23, x31, xs17)
if1(false, n32, x42, xs24) → cons(x42, filterlow(n32, xs24))
filterlow(n41, nil) → nil
ge(0, s(x63)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x94))) → s(half(x94))
if2(true, n82, x105, xs61) → filterhigh(n82, xs61)
filterhigh(n91, cons(x116, xs68)) → if2(ge(x116, n91), n91, x116, xs68)
if2(false, n100, x127, xs75) → cons(x127, filterhigh(n100, xs75))
filterhigh(n109, nil) → nil
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a65](witness_sort[a65], witness_sort[a65]) → true


The proof given by the theorem prover:
The following input was given to ACL2:
(set-ruler-extenders :all)

(defun trs_isbool (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_true
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (eq
        'trs_false
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a0] (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_0
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (consp
        (cdr
          x
        )
      )
      (eq
        'trs_s
        (car
          x
        )
      )
      (trs_issort[a0]
        (car
          (cdr
            x
          )
        )
      )
      (eq
        (cdr
          (cdr
            x
          )
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a65] (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_witness_sort[a65]
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a5] (x)
  (or
    (and
      (consp
        x
      )
      (consp
        (cdr
          x
        )
      )
      (consp
        (cdr
          (cdr
            x
          )
        )
      )
      (eq
        'trs_cons
        (car
          x
        )
      )
      (trs_issort[a0]
        (car
          (cdr
            x
          )
        )
      )
      (trs_issort[a5]
        (car
          (cdr
            (cdr
              x
            )
          )
        )
      )
      (eq
        (cdr
          (cdr
            (cdr
              x
            )
          )
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (eq
        'trs_nil
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_half (x0)
  (if
    (and
      (trs_issort[a0]
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_0
        )
      )
      (list 'trs_0
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_s
          )
          (eq
            (car
              (car
                (cdr
                  x0
                )
              )
            )
            'trs_0
          )
        )
        (list 'trs_0
        )
        (if
          (and
          )
          (list 'trs_s
            (trs_half
              (car
                (cdr
                  (car
                    (cdr
                      x0
                    )
                  )
                )
              )
            )
          )
          (list 'trs_0
          )
        )
      )
    )
    (list 'trs_0
    )
  )
)
(defun trs_ge (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a0]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_0
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_s
          )
          (eq
            (car
              x1
            )
            'trs_s
          )
        )
        (trs_ge
          (car
            (cdr
              x0
            )
          )
          (car
            (cdr
              x1
            )
          )
        )
        (if
          (and
          )
          (list 'trs_false
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a65] (x0 x1)
  (if
    (and
      (trs_issort[a65]
        x0
      )
      (trs_issort[a65]
        x1
      )
    )
    (if
      (and
      )
      (list 'trs_true
      )
      (list 'trs_true
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a0] (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a0]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_0
        )
        (eq
          (car
            x1
          )
          'trs_0
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_0
          )
          (eq
            (car
              x1
            )
            'trs_s
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_s
            )
            (eq
              (car
                x1
              )
              'trs_0
            )
          )
          (list 'trs_false
          )
          (if
            (and
            )
            (trs_equal_sort[a0]
              (car
                (cdr
                  x0
                )
              )
              (car
                (cdr
                  x1
                )
              )
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_isa_false (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_false
      )
      (if
        (and
        )
        (list 'trs_true
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_isa_true (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_not (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_false
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_or (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        x1
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_and (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      x1
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_bool (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x1
          )
          'trs_false
        )
      )
      (list 'trs_false
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_false
          )
          (eq
            (car
              x1
            )
            'trs_true
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_true
            )
            (eq
              (car
                x1
              )
              'trs_true
            )
          )
          (list 'trs_true
          )
          (if
            (and
            )
            (list 'trs_true
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_if2 (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x3
          )
          'trs_cons
        )
      )
      (trs_if2
        (trs_ge
          (car
            (cdr
              x3
            )
          )
          x1
        )
        x1
        (car
          (cdr
            x3
          )
        )
        (car
          (cdr
            (cdr
              x3
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_true
          )
          (eq
            (car
              x3
            )
            'trs_nil
          )
        )
        (list 'trs_nil
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_false
            )
            (eq
              (car
                x3
              )
              'trs_cons
            )
          )
          (list 'trs_cons
            x2
            (trs_if2
              (trs_ge
                (car
                  (cdr
                    x3
                  )
                )
                x1
              )
              x1
              (car
                (cdr
                  x3
                )
              )
              (car
                (cdr
                  (cdr
                    x3
                  )
                )
              )
            )
          )
          (if
            (and
            )
            (list 'trs_cons
              x2
              (list 'trs_nil
              )
            )
            (list 'trs_nil
            )
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_if1 (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x3
          )
          'trs_cons
        )
      )
      (trs_if1
        (trs_ge
          x1
          (car
            (cdr
              x3
            )
          )
        )
        x1
        (car
          (cdr
            x3
          )
        )
        (car
          (cdr
            (cdr
              x3
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_true
          )
          (eq
            (car
              x3
            )
            'trs_nil
          )
        )
        (list 'trs_nil
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_false
            )
            (eq
              (car
                x3
              )
              'trs_cons
            )
          )
          (list 'trs_cons
            x2
            (trs_if1
              (trs_ge
                x1
                (car
                  (cdr
                    x3
                  )
                )
              )
              x1
              (car
                (cdr
                  x3
                )
              )
              (car
                (cdr
                  (cdr
                    x3
                  )
                )
              )
            )
          )
          (if
            (and
            )
            (list 'trs_cons
              x2
              (list 'trs_nil
              )
            )
            (list 'trs_nil
            )
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_if2prime (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_false
          )
          (eq
            (car
              x3
            )
            'trs_cons
          )
        )
        (trs_if2prime
          (trs_ge
            (car
              (cdr
                x3
              )
            )
            x1
          )
          x1
          (car
            (cdr
              x3
            )
          )
          (car
            (cdr
              (cdr
                x3
              )
            )
          )
        )
        (if
          (and
          )
          (list 'trs_false
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_filterhigh (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_nil
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                (car
                  (cdr
                    x1
                  )
                )
                x0
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (trs_filterhigh
          x0
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  (car
                    (cdr
                      x1
                    )
                  )
                  x0
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (list 'trs_cons
            (car
              (cdr
                x1
              )
            )
            (trs_filterhigh
              x0
              (car
                (cdr
                  (cdr
                    x1
                  )
                )
              )
            )
          )
          (list 'trs_nil
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_filterlow (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_nil
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                x0
                (car
                  (cdr
                    x1
                  )
                )
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (trs_filterlow
          x0
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  x0
                  (car
                    (cdr
                      x1
                    )
                  )
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (list 'trs_cons
            (car
              (cdr
                x1
              )
            )
            (trs_filterlow
              x0
              (car
                (cdr
                  (cdr
                    x1
                  )
                )
              )
            )
          )
          (list 'trs_nil
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_filterhighprime (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_false
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                (car
                  (cdr
                    x1
                  )
                )
                x0
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (list 'trs_true
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  (car
                    (cdr
                      x1
                    )
                  )
                  x0
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (trs_filterhighprime
            x0
            (car
              (cdr
                (cdr
                  x1
                )
              )
            )
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a5] (x0 x1)
  (if
    (and
      (trs_issort[a5]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_cons
        )
        (eq
          (car
            x1
          )
          'trs_cons
        )
      )
      (trs_and
        (trs_equal_sort[a5]
          (car
            (cdr
              x0
            )
          )
          (car
            (cdr
              x1
            )
          )
        )
        (trs_equal_sort[a5]
          (car
            (cdr
              (cdr
                x0
              )
            )
          )
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_cons
          )
          (eq
            (car
              x1
            )
            'trs_nil
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_nil
            )
            (eq
              (car
                x1
              )
              'trs_cons
            )
          )
          (list 'trs_false
          )
          (if
            (and
            )
            (list 'trs_true
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(with-prover-time-limit 3
  (defthm test
    (implies
      (and
        (trs_issort[a0] trs_x0)
        (trs_issort[a5] trs_x1)
        (trs_issort[a0] trs_x2)
      )
      (eq
        (trs_if2prime
          (trs_ge
            trs_x0
            trs_x0
          )
          trs_x0
          trs_x0
          (list 'trs_cons
            trs_x1
            trs_x2
          )
        )
        (list 'trs_true
        )
      )
    )
    :hints (("Goal" :do-not '(generalize)))
  )
)


The following output was given by ACL2:
This is SBCL 1.0.29.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at .

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

 ACL2 Version 3.6 built February 12, 2010  14:59:57.
 Copyright (C) 2009  University of Texas at Austin
 ACL2 comes with ABSOLUTELY NO WARRANTY.  This is free software and you
 are welcome to redistribute it under certain conditions.  For details,
 see the GNU General Public License.

 Initialized with (INITIALIZE-ACL2 'INCLUDE-BOOK *ACL2-PASS-2-FILES*).
 See the documentation topic note-3-6 for recent changes.
 Note: We have modified the prompt in some underlying Lisps to further
 distinguish it from the ACL2 prompt.

ACL2 Version 3.6.  Level 1.  Cbd "/home/petersk/workspace/benchmark/".
Distributed books directory "/home/petersk/download/acl2-sources/books/".
Type :help for help.
Type (good-bye) to quit completely out of ACL2.

ACL2 !> :ALL
ACL2 !>
Since TRS_ISBOOL is non-recursive, its admission is trivial.  We observe
that the type of TRS_ISBOOL is described by the theorem 
(OR (EQUAL (TRS_ISBOOL X) T) (EQUAL (TRS_ISBOOL X) NIL)).  We used
the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISBOOL ...)
Rules: ((:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISBOOL
ACL2 !>
For the admission of TRS_ISSORT[A0] we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (NOT (AND (CONSP X)
                        (EQ 'TRS_0 (CAR X))
                        (EQ (CDR X) NIL)))
              (CONSP X)
              (CONSP (CDR X))
              (EQ 'TRS_S (CAR X)))
         (O< (ACL2-COUNT (CADR X))
             (ACL2-COUNT X))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (NOT (AND (CONSP X)
                        (EQUAL 'TRS_0 (CAR X))
                        (EQUAL (CDR X) NIL)))
              (CONSP X)
              (CONSP (CDR X))
              (EQUAL 'TRS_S (CAR X)))
         (O< (ACL2-COUNT (CADR X))
             (ACL2-COUNT X))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP and
O<, the :executable-counterparts of ACL2-COUNT and EQUAL, primitive
type reasoning, the :rewrite rule UNICITY-OF-0 and the :type-prescription
rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (EQUAL 'TRS_S (CAR X)))
         (< (ACL2-COUNT (CADR X))
            (+ 1 (ACL2-COUNT (CDR X))))).

The destructor terms (CAR X) and (CDR X) can be eliminated.  Furthermore,
those terms are at the root of a chain of two rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X by (CONS X1 X2), (CAR X)
by X1 and (CDR X) by X2 and restrict the type of the new variable X1
to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again, to
replace X2 by (CONS X3 X4), (CAR X2) by X3 and (CDR X2) by X4.    These
steps produce the following goal.

Goal'''
(IMPLIES (AND (CONSP (CONS X3 X4))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              (NOT (EQUAL X1 NIL))
              (CONSP (LIST* X1 X3 X4))
              (EQUAL 'TRS_S X1))
         (< (ACL2-COUNT X3)
            (+ 1 (ACL2-COUNT (CONS X3 X4))))).

By case analysis we reduce the conjecture to

Goal'4'
(IMPLIES (AND (CONSP (CONS X3 X4))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              X1 (CONSP (LIST* X1 X3 X4))
              (EQUAL 'TRS_S X1))
         (< (ACL2-COUNT X3)
            (+ 1 (ACL2-COUNT (CONS X3 X4))))).

This simplifies, using the :definition ACL2-COUNT, the :executable-
counterparts of EQUAL, NOT and SYMBOLP, primitive type reasoning and
the :rewrite rules CAR-CONS and CDR-CONS, to

Goal'5'
(< (ACL2-COUNT X3)
   (+ 1 1 (ACL2-COUNT X3)
      (ACL2-COUNT X4))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_ISSORT[A0].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_ISSORT[A0] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A0] X) T) (EQUAL (TRS_ISSORT[A0] X) NIL)). 
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISSORT[A0] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_ISSORT[A0]
ACL2 !>
Since TRS_ISSORT[A65] is non-recursive, its admission is trivial. 
We observe that the type of TRS_ISSORT[A65] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A65] X) T) (EQUAL (TRS_ISSORT[A65] X) NIL)).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISSORT[A65] ...)
Rules: ((:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISSORT[A65]
ACL2 !>
For the admission of TRS_ISSORT[A5] we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQ 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (O< (ACL2-COUNT (CADDR X))
             (ACL2-COUNT X))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQUAL 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (O< (ACL2-COUNT (CADDR X))
             (ACL2-COUNT X))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP and
O<, the :executable-counterpart of ACL2-COUNT, primitive type reasoning,
the :rewrite rule UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT,
to

Goal''
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQUAL 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (< (ACL2-COUNT (CADDR X))
            (+ 1 1 (ACL2-COUNT (CADR X))
               (ACL2-COUNT (CDDR X))))).

The destructor terms (CAR X) and (CDR X) can be eliminated.  Furthermore,
those terms are at the root of a chain of three rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X by (CONS X1 X2), (CAR X)
by X1 and (CDR X) by X2 and restrict the type of the new variable X1
to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again, to
replace X2 by (CONS X3 X4), (CAR X2) by X3 and (CDR X2) by X4.  (3)
Finally, use CAR-CDR-ELIM to replace X4 by (CONS X5 X6), (CAR X4) by
X5 and (CDR X4) by X6.    These steps produce the following goal.

Goal'''
(IMPLIES (AND (CONSP (CONS X5 X6))
              (CONSP (LIST* X3 X5 X6))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              (NOT (EQUAL X1 NIL))
              (CONSP (LIST* X1 X3 X5 X6))
              (EQUAL 'TRS_CONS X1)
              (TRS_ISSORT[A0] X3))
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               (ACL2-COUNT (CONS X5 X6))))).

By case analysis we reduce the conjecture to

Goal'4'
(IMPLIES (AND (CONSP (CONS X5 X6))
              (CONSP (LIST* X3 X5 X6))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              X1 (CONSP (LIST* X1 X3 X5 X6))
              (EQUAL 'TRS_CONS X1)
              (TRS_ISSORT[A0] X3))
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               (ACL2-COUNT (CONS X5 X6))))).

This simplifies, using the :definition ACL2-COUNT, the :executable-
counterparts of EQUAL, NOT and SYMBOLP, primitive type reasoning and
the :rewrite rules CAR-CONS and CDR-CONS, to

Goal'5'
(IMPLIES (TRS_ISSORT[A0] X3)
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               1 (ACL2-COUNT X5)
               (ACL2-COUNT X6)))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_ISSORT[A5].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_ISSORT[A5] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A5] X) T) (EQUAL (TRS_ISSORT[A5] X) NIL)). 
We used the :executable-counterpart of EQUAL, primitive type reasoning
and the :type-prescription rule TRS_ISSORT[A0].

Summary
Form:  ( DEFUN TRS_ISSORT[A5] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_ISSORT[A0]))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_ISSORT[A5]
ACL2 !>
For the admission of TRS_HALF we will use the relation O< (which is
known to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X0).  The non-trivial part of the measure conjecture is

Goal
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (NOT (EQ (CAR X0) 'TRS_0))
              (NOT (AND (EQ (CAR X0) 'TRS_S)
                        (EQ (CAADR X0) 'TRS_0)))
              T)
         (O< (ACL2-COUNT (CADADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (NOT (EQUAL (CAR X0) 'TRS_0))
              (NOT (AND (EQUAL (CAR X0) 'TRS_S)
                        (EQUAL (CAADR X0) 'TRS_0))))
         (O< (ACL2-COUNT (CADADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (EQUAL 'TRS_S (CAR X0))
              (CONSP (CADR X0))
              (CONSP (CDADR X0))
              (EQUAL 'TRS_S (CAADR X0))
              (TRS_ISSORT[A0] (CADADR X0))
              (NOT (CDDADR X0))
              (NOT (CDDR X0)))
         (< (ACL2-COUNT (CADADR X0))
            (+ 1 1 1 1 (ACL2-COUNT (CADADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_HALF.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_HALF is described by the theorem 
(AND (CONSP (TRS_HALF X0)) (TRUE-LISTP (TRS_HALF X0))).  We used primitive
type reasoning.

Summary
Form:  ( DEFUN TRS_HALF ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_HALF
ACL2 !>
For the admission of TRS_GE we will use the relation O< (which is known
to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X0).  The non-trivial part of the measure conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A0] X1))
              (NOT (EQ (CAR X1) 'TRS_0))
              (AND (EQ (CAR X0) 'TRS_S)
                   (EQ (CAR X1) 'TRS_S)))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A0] X1)
              (NOT (EQUAL (CAR X1) 'TRS_0))
              (EQUAL (CAR X0) 'TRS_S)
              (EQUAL (CAR X1) 'TRS_S))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (NOT (CDDR X0))
              (TRS_ISSORT[A0] X1)
              (EQUAL (CAR X0) 'TRS_S)
              (EQUAL (CAR X1) 'TRS_S))
         (< (ACL2-COUNT (CADR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_GE.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_GE is described by the theorem 
(AND (CONSP (TRS_GE X0 X1)) (TRUE-LISTP (TRS_GE X0 X1))).  

Summary
Form:  ( DEFUN TRS_GE ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_GE
ACL2 !>
Since TRS_EQUAL_SORT[A65] is non-recursive, its admission is trivial.
We observe that the type of TRS_EQUAL_SORT[A65] is described by the
theorem 
(AND (CONSP (TRS_EQUAL_SORT[A65] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A65] X0 X1))).

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A65] ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_EQUAL_SORT[A65]
ACL2 !>
For the admission of TRS_EQUAL_SORT[A0] we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X0).  The non-trivial part of the measure
conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A0] X1))
              (NOT (AND (EQ (CAR X0) 'TRS_0)
                        (EQ (CAR X1) 'TRS_0)))
              (NOT (AND (EQ (CAR X0) 'TRS_0)
                        (EQ (CAR X1) 'TRS_S)))
              (NOT (AND (EQ (CAR X0) 'TRS_S)
                        (EQ (CAR X1) 'TRS_0)))
              T)
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A0] X1)
              (NOT (AND (EQUAL (CAR X0) 'TRS_0)
                        (EQUAL (CAR X1) 'TRS_0)))
              (NOT (AND (EQUAL (CAR X0) 'TRS_0)
                        (EQUAL (CAR X1) 'TRS_S)))
              (NOT (AND (EQUAL (CAR X0) 'TRS_S)
                        (EQUAL (CAR X1) 'TRS_0))))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (EQUAL 'TRS_S (CAR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (NOT (CDDR X0))
              (TRS_ISSORT[A0] X1)
              (NOT (EQUAL (CAR X1) 'TRS_0)))
         (< (ACL2-COUNT (CADR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_EQUAL_SORT[A0].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_EQUAL_SORT[A0] is described by the theorem
(AND (CONSP (TRS_EQUAL_SORT[A0] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A0] X0 X1))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A0] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_EQUAL_SORT[A0]
ACL2 !>
Since TRS_ISA_FALSE is non-recursive, its admission is trivial.  We
observe that the type of TRS_ISA_FALSE is described by the theorem
(AND (CONSP (TRS_ISA_FALSE X0)) (TRUE-LISTP (TRS_ISA_FALSE X0))). 

Summary
Form:  ( DEFUN TRS_ISA_FALSE ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISA_FALSE
ACL2 !>
Since TRS_ISA_TRUE is non-recursive, its admission is trivial.  We
observe that the type of TRS_ISA_TRUE is described by the theorem 
(AND (CONSP (TRS_ISA_TRUE X0)) (TRUE-LISTP (TRS_ISA_TRUE X0))).  

Summary
Form:  ( DEFUN TRS_ISA_TRUE ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISA_TRUE
ACL2 !>
Since TRS_NOT is non-recursive, its admission is trivial.  We observe
that the type of TRS_NOT is described by the theorem 
(AND (CONSP (TRS_NOT X0)) (TRUE-LISTP (TRS_NOT X0))).  

Summary
Form:  ( DEFUN TRS_NOT ...)
Rules: NIL
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_NOT
ACL2 !>
Since TRS_OR is non-recursive, its admission is trivial.  We observe
that the type of TRS_OR is described by the theorem 
(OR (AND (CONSP (TRS_OR X0 X1))
         (TRUE-LISTP (TRS_OR X0 X1)))
    (EQUAL (TRS_OR X0 X1) X1)).

Summary
Form:  ( DEFUN TRS_OR ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_OR
ACL2 !>
Since TRS_AND is non-recursive, its admission is trivial.  We observe
that the type of TRS_AND is described by the theorem 
(OR (AND (CONSP (TRS_AND X0 X1))
         (TRUE-LISTP (TRS_AND X0 X1)))
    (EQUAL (TRS_AND X0 X1) X1)).

Summary
Form:  ( DEFUN TRS_AND ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_AND
ACL2 !>
Since TRS_EQUAL_BOOL is non-recursive, its admission is trivial.  We
observe that the type of TRS_EQUAL_BOOL is described by the theorem
(AND (CONSP (TRS_EQUAL_BOOL X0 X1)) (TRUE-LISTP (TRS_EQUAL_BOOL X0 X1))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_EQUAL_BOOL ...)
Rules: ((:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_EQUAL_BOOL
ACL2 !>
For the admission of TRS_IF2 we will use the relation O< (which is
known to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X3).  The non-trivial part of the measure conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (AND (EQ (CAR X0) 'TRS_TRUE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))
     (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (NOT (AND (EQ (CAR X0) 'TRS_TRUE)
                             (EQ (CAR X3) 'TRS_NIL)))
                   (AND (EQ (CAR X0) 'TRS_FALSE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to the following two conjectures.

Subgoal 2
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (AND (EQUAL (CAR X0) 'TRS_TRUE)
                        (EQUAL (CAR X3) 'TRS_NIL)))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF2.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_IF2 is described by the theorem 
(AND (CONSP (TRS_IF2 X0 X1 X2 X3)) (TRUE-LISTP (TRS_IF2 X0 X1 X2 X3))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_IF2 ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.00, other: 0.01)
 TRS_IF2
ACL2 !>
For the admission of TRS_IF1 we will use the relation O< (which is
known to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X3).  The non-trivial part of the measure conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (AND (EQ (CAR X0) 'TRS_TRUE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))
     (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (NOT (AND (EQ (CAR X0) 'TRS_TRUE)
                             (EQ (CAR X3) 'TRS_NIL)))
                   (AND (EQ (CAR X0) 'TRS_FALSE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to the following two conjectures.

Subgoal 2
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (AND (EQUAL (CAR X0) 'TRS_TRUE)
                        (EQUAL (CAR X3) 'TRS_NIL)))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF1.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_IF1 is described by the theorem 
(AND (CONSP (TRS_IF1 X0 X1 X2 X3)) (TRUE-LISTP (TRS_IF1 X0 X1 X2 X3))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_IF1 ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.02 seconds (prove: 0.02, print: 0.00, other: 0.00)
 TRS_IF1
ACL2 !>
For the admission of TRS_IF2PRIME we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X3).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (AND (TRS_ISBOOL X0)
                   (TRS_ISSORT[A0] X1)
                   (TRS_ISSORT[A0] X2)
                   (TRS_ISSORT[A5] X3))
              (NOT (EQ (CAR X0) 'TRS_TRUE))
              (AND (EQ (CAR X0) 'TRS_FALSE)
                   (EQ (CAR X3) 'TRS_CONS)))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Goal'
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (EQUAL (CAR X0) 'TRS_TRUE))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal'''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF2PRIME. 
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_IF2PRIME is described by the theorem 
(AND (CONSP (TRS_IF2PRIME X0 X1 X2 X3))
     (TRUE-LISTP (TRS_IF2PRIME X0 X1 X2 X3))).

Summary
Form:  ( DEFUN TRS_IF2PRIME ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_IF2PRIME
ACL2 !>
For the admission of TRS_FILTERHIGH we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X1).  The non-trivial part of the measure conjecture
is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (EQ (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                       '(TRS_TRUE))
                       '(TRS_FALSE)))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))
     (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Subgoal 2'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE (CADR X1) X0)))
              (NOT (CDR (TRS_GE (CADR X1) X0))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                     '(TRS_TRUE))
                     '(TRS_TRUE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to the following three conjectures.

Subgoal 1.3
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL 'TRS_TRUE
                     (CAR (TRS_GE (CADR X1) X0))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (CDR (TRS_GE (CADR X1) X0)))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE (CADR X1) X0)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERHIGH.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERHIGH is described by the theorem
(AND (CONSP (TRS_FILTERHIGH X0 X1)) (TRUE-LISTP (TRS_FILTERHIGH X0 X1))).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_FILTERHIGH ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.00, other: 0.01)
 TRS_FILTERHIGH
ACL2 !>
For the admission of TRS_FILTERLOW we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X1).  The non-trivial part of the measure conjecture
is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                       '(TRS_TRUE))
                       '(TRS_FALSE)))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))
     (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Subgoal 2'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE X0 (CADR X1))))
              (NOT (CDR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_TRUE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to the following three conjectures.

Subgoal 1.3
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL 'TRS_TRUE
                     (CAR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (CDR (TRS_GE X0 (CADR X1))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE X0 (CADR X1))))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERLOW.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERLOW is described by the theorem
(AND (CONSP (TRS_FILTERLOW X0 X1)) (TRUE-LISTP (TRS_FILTERLOW X0 X1))).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_FILTERLOW ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_FILTERLOW
ACL2 !>
For the admission of TRS_FILTERHIGHPRIME we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X1).  The non-trivial part of the measure
conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A5] X1))
              (NOT (EQ (CAR X1) 'TRS_NIL))
              (NOT (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (EQ (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                  '(TRS_TRUE))
                  '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (NOT (AND (EQUAL (CAR X1) 'TRS_CONS)
                        (EQUAL (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                               '(TRS_TRUE))
                               '(TRS_TRUE))))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE (CADR X1) X0)
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Goal''
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE (CADR X1) X0)))
              (NOT (CDR (TRS_GE (CADR X1) X0))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERHIGHPRIME.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERHIGHPRIME is described by the theorem
(AND (CONSP (TRS_FILTERHIGHPRIME X0 X1))
     (TRUE-LISTP (TRS_FILTERHIGHPRIME X0 X1))).

Summary
Form:  ( DEFUN TRS_FILTERHIGHPRIME ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_FILTERHIGHPRIME
ACL2 !>
For the admission of TRS_EQUAL_SORT[A5] we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X0).  The non-trivial part of the measure
conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A5] X0)
                        (TRS_ISSORT[A5] X1))
                   (AND (EQ (CAR X0) 'TRS_CONS)
                        (EQ (CAR X1) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X0))
                  (ACL2-COUNT X0)))
     (IMPLIES (AND (AND (TRS_ISSORT[A5] X0)
                        (TRS_ISSORT[A5] X1))
                   (AND (EQ (CAR X0) 'TRS_CONS)
                        (EQ (CAR X1) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADR X0))
                  (ACL2-COUNT X0)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (CONSP (CDDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (TRS_ISSORT[A5] (CADDR X0))
              (NOT (CDDDR X0))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X0))
            (+ 1 (ACL2-COUNT (CDR X0))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (CONSP (CDDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (TRS_ISSORT[A5] (CADDR X0))
              (NOT (CDDDR X0))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))
               1 (ACL2-COUNT (CADDR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions O-FINP and O< and the :type-
prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADR X0))
            (ACL2-COUNT X0))).

The destructor terms (CAR X0) and (CDR X0) can be eliminated.  Furthermore,
those terms are at the root of a chain of two rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X0 by (CONS X2 X3), (CAR X0)
by X2 and (CDR X0) by X3 and restrict the type of the new variable
X2 to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again,
to replace X3 by (CONS X4 X5), (CAR X3) by X4 and (CDR X3) by X5. 
  These steps produce the following three goals.

Subgoal 1.3
(IMPLIES (AND (NOT (CONSP X0))
              (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADR X0))
            (ACL2-COUNT X0))).

But we reduce the conjecture to T, by primitive type reasoning.

Subgoal 1.2
(IMPLIES (AND (NOT (CONSP X3))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              (NOT (EQUAL X2 NIL))
              (CONSP (CONS X2 X3))
              (TRS_ISSORT[A5] (CONS X2 X3))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CAR X3))
            (ACL2-COUNT (CONS X2 X3)))).

By case analysis we reduce the conjecture to

Subgoal 1.2'
(IMPLIES (AND (NOT (CONSP X3))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              X2 (CONSP (CONS X2 X3))
              (TRS_ISSORT[A5] (CONS X2 X3))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CAR X3))
            (ACL2-COUNT (CONS X2 X3)))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterparts of EQUAL, NOT and SYMBOLP, primitive type
reasoning and the :rewrite rules CAR-CONS and CDR-CONS.

Subgoal 1.1
(IMPLIES (AND (CONSP (CONS X4 X5))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              (NOT (EQUAL X2 NIL))
              (CONSP (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (ACL2-COUNT (LIST* X2 X4 X5)))).

By case analysis we reduce the conjecture to

Subgoal 1.1'
(IMPLIES (AND (CONSP (CONS X4 X5))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              X2 (CONSP (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (ACL2-COUNT (LIST* X2 X4 X5)))).

This simplifies, using the :definitions ACL2-COUNT, FIX and TRS_ISSORT[A5],
the :executable-counterparts of ACL2-COUNT, EQUAL, NOT and SYMBOLP,
primitive type reasoning, the :rewrite rules CAR-CONS, CDR-CONS and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1.1''
(IMPLIES (AND (CONSP X5)
              (TRS_ISSORT[A0] X4)
              (TRS_ISSORT[A5] (CAR X5))
              (NOT (CDR X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (+ 1 1 (ACL2-COUNT X4)
               (ACL2-COUNT X5)))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_EQUAL_SORT[A5].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_EQUAL_SORT[A5] is described by the theorem
(AND (CONSP (TRS_EQUAL_SORT[A5] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A5] X0 X1))).
We used the :executable-counterpart of EQUAL, primitive type reasoning
and the :type-prescription rule TRS_AND.

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A5] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A5])
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_AND))
Warnings:  None
Time:  0.02 seconds (prove: 0.02, print: 0.00, other: 0.00)
 TRS_EQUAL_SORT[A5]
ACL2 !>
[Note:  A hint was supplied for our processing of the goal above. 
Thanks!]

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X0 TRS_X0)
                              TRS_X0
                              TRS_X0 (LIST 'TRS_CONS TRS_X1 TRS_X2))
                '(TRS_TRUE))).

This simplifies, using the :definitions TRS_IF2PRIME, TRS_ISBOOL and
TRS_ISSORT[A5], the :executable-counterpart of EQUAL, primitive type
reasoning, the :rewrite rules CAR-CONS and CDR-CONS and the :type-
prescription rules TRS_GE, TRS_ISSORT[A0] and TRS_ISSORT[A5], to

Goal''
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

Name the formula above *1.

Perhaps we can prove *1 by induction.  Nine induction schemes are suggested
by this conjecture.  Subsumption reduces that number to eight.  These
merge into four derived induction schemes.  However, one of these is
flawed and so we are left with three viable candidates.  By considering
those suggested by the largest number of non-primitive recursive functions,
we narrow the field to one.  

We will induct according to a scheme suggested by 
(TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0) TRS_X0 TRS_X1 TRS_X2).  This suggestion
was produced using the :induction rules TRS_IF2PRIME and TRS_ISSORT[A5].
If we let (:P TRS_X0 TRS_X1 TRS_X2) denote *1 above then the induction
scheme we'll use is
(AND (IMPLIES (NOT (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2)))
              (:P TRS_X0 TRS_X1 TRS_X2))
     (IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2))
                   (NOT (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                            'TRS_TRUE))
                   (NOT (AND (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                                 'TRS_FALSE)
                             (EQ (CAR TRS_X2) 'TRS_CONS)))
                   T)
              (:P TRS_X0 TRS_X1 TRS_X2))
     (IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2))
                   (NOT (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                            'TRS_TRUE))
                   (AND (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                            'TRS_FALSE)
                        (EQ (CAR TRS_X2) 'TRS_CONS))
                   (:P TRS_X0 (CADR TRS_X2)
                       (CADDR TRS_X2)))
              (:P TRS_X0 TRS_X1 TRS_X2))
     (IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2))
                   (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_TRUE))
              (:P TRS_X0 TRS_X1 TRS_X2))).
This induction is justified by the same argument used to admit TRS_IF2PRIME.
Note, however, that the unmeasured variable TRS_X1 is being instantiated.
When applied to the goal at hand the above induction scheme produces
eight nontautological subgoals.

Subgoal *1/8
(IMPLIES (AND (NOT (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_IF2PRIME,
TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterpart of EQUAL,
primitive type reasoning and the :type-prescription rules TRS_GE, 
TRS_ISSORT[A0] and TRS_ISSORT[A5].

Subgoal *1/7
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_TRUE))
              (NOT (AND (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                            'TRS_FALSE)
                        (EQ (CAR TRS_X2) 'TRS_CONS)))
              T (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/7'
(IMPLIES (AND (CONSP (TRS_GE TRS_X1 TRS_X0))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                          'TRS_TRUE))
              (NOT (AND (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                               'TRS_FALSE)
                        (EQUAL (CAR TRS_X2) 'TRS_CONS)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterparts of CONSP and EQUAL,
primitive type reasoning and the :type-prescription rule TRS_GE.

Subgoal *1/6
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (EQUAL (TRS_IF2PRIME (TRS_GE (CADR TRS_X2) TRS_X0)
                                   TRS_X0 (CADR TRS_X2)
                                   (CADDR TRS_X2))
                     '(TRS_TRUE))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/6'
(IMPLIES (AND (CONSP (TRS_GE TRS_X1 TRS_X0))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (EQUAL (TRS_IF2PRIME (TRS_GE (CADR TRS_X2) TRS_X0)
                                   TRS_X0 (CADR TRS_X2)
                                   (CADDR TRS_X2))
                     '(TRS_TRUE))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterpart of EQUAL, primitive
type reasoning and the :type-prescription rule TRS_GE.

Subgoal *1/5
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (NOT (TRS_ISSORT[A5] (CADDR TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/5'
(IMPLIES (AND (CONSP (TRS_GE TRS_X1 TRS_X0))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (NOT (TRS_ISSORT[A5] (CADDR TRS_X2)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterpart of EQUAL, primitive type reasoning and
the :type-prescription rule TRS_GE.

Subgoal *1/4
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (NOT (TRS_ISSORT[A0] (CADR TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/4'
(IMPLIES (AND (CONSP (TRS_GE TRS_X1 TRS_X0))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (NOT (TRS_ISSORT[A0] (CADR TRS_X2)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterpart of EQUAL, primitive type reasoning and
the :type-prescription rule TRS_GE.

Subgoal *1/3
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (NOT (TRS_ISSORT[A0] (CADDR TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/3'
(IMPLIES (AND (CONSP (TRS_GE TRS_X1 TRS_X0))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (NOT (TRS_ISSORT[A0] (CADDR TRS_X2)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterpart of EQUAL, primitive
type reasoning and the :type-prescription rule TRS_GE.

Subgoal *1/2
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (NOT (TRS_ISSORT[A5] (CADR TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/2'
(IMPLIES (AND (CONSP (TRS_GE TRS_X1 TRS_X0))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (NOT (TRS_ISSORT[A5] (CADR TRS_X2)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterpart of EQUAL, primitive
type reasoning and the :type-prescription rule TRS_GE.

Subgoal *1/1
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X1 TRS_X0))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (EQ (CAR (TRS_GE TRS_X1 TRS_X0))
                  'TRS_TRUE)
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/1'
(IMPLIES (AND (CONSP (TRS_GE TRS_X1 TRS_X0))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X1 TRS_X0)))
                     (EQUAL (CDR (TRS_GE TRS_X1 TRS_X0))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (EQUAL (CAR (TRS_GE TRS_X1 TRS_X0))
                     'TRS_TRUE)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF2PRIME (TRS_GE TRS_X1 TRS_X0)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterparts of CONSP and EQUAL,
primitive type reasoning and the :type-prescription rule TRS_GE.

That completes the proof of *1.

Q.E.D.

Summary
Form:  ( DEFTHM TEST ...)
Rules: ((:DEFINITION EQ)
        (:DEFINITION NOT)
        (:DEFINITION TRS_IF2PRIME)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A0])
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART CONSP)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:INDUCTION TRS_IF2PRIME)
        (:INDUCTION TRS_ISSORT[A5])
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:TYPE-PRESCRIPTION TRS_GE)
        (:TYPE-PRESCRIPTION TRS_ISSORT[A0])
        (:TYPE-PRESCRIPTION TRS_ISSORT[A5]))
Warnings:  None
Time:  0.07 seconds (prove: 0.05, print: 0.02, other: 0.00)
 TEST
ACL2 !>Bye.

(115) Complex Obligation (AND)

(116) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
if1(true, n, x, xs) → filterlow(n, xs)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
if2(true, n, x, xs) → filterhigh(n, xs)
filterhigh(n, cons(x, xs)) → if2(ge(x, n), n, x, xs)
if2(false, n, x, xs) → cons(x, filterhigh(n, xs))
filterhigh(n, nil) → nil

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))

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

(117) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(118) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))

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

(119) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

filterhigh(x0, nil)
filterhigh(x0, cons(x1, x2))
if2(true, x0, x1, x2)
if2(false, x0, x1, x2)

(120) Obligation:

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

QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))

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

(121) Induction-Processor (SOUND transformation)


This DP could be deleted by the Induction-Processor:
QS(x0, cons(x1, nil)) → QS(half(x0), if1(ge(x1, x1), x1, x1, nil))


This order was computed:
Polynomial interpretation [POLO]:

POL(0) = 1   
POL(QS(x1, x2)) = x2   
POL(cons(x1, x2)) = 1 + x2   
POL(false) = 1   
POL(filterlow(x1, x2)) = x2   
POL(ge(x1, x2)) = 1   
POL(half(x1)) = x1   
POL(if1(x1, x2, x3, x4)) = x1 + x4   
POL(nil) = 0   
POL(s(x1)) = 1   
POL(true) = 1   

At least one of these decreasing rules is always used after the deleted DP:
if1(true, n101, x211, xs71) → filterlow(n101, xs71)


The following formula is valid:
x1:sort[a0].if1'(ge(x1 , x1 ), x1 , x1 , nil)=true


The transformed set:
filterlow'(n5, cons(x13, xs3)) → if1'(ge(n5, x13), n5, x13, xs3)
if1'(true, n10, x21, xs7) → true
if1'(false, n15, x29, xs11) → filterlow'(n15, xs11)
filterlow'(n20, nil) → false
ge(x, 0) → true
ge(s(x5), s(y')) → ge(x5, y')
filterlow(n5, cons(x13, xs3)) → if1(ge(n5, x13), n5, x13, xs3)
if1(true, n10, x21, xs7) → filterlow(n10, xs7)
if1(false, n15, x29, xs11) → cons(x29, filterlow(n15, xs11))
filterlow(n20, nil) → nil
ge(0, s(x44)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x66))) → s(half(x66))
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a44](witness_sort[a44], witness_sort[a44]) → true


The proof given by the theorem prover:
The following input was given to ACL2:
(set-ruler-extenders :all)

(defun trs_isbool (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_true
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (eq
        'trs_false
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a0] (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_0
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (consp
        (cdr
          x
        )
      )
      (eq
        'trs_s
        (car
          x
        )
      )
      (trs_issort[a0]
        (car
          (cdr
            x
          )
        )
      )
      (eq
        (cdr
          (cdr
            x
          )
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a44] (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_witness_sort[a44]
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a5] (x)
  (or
    (and
      (consp
        x
      )
      (consp
        (cdr
          x
        )
      )
      (consp
        (cdr
          (cdr
            x
          )
        )
      )
      (eq
        'trs_cons
        (car
          x
        )
      )
      (trs_issort[a0]
        (car
          (cdr
            x
          )
        )
      )
      (trs_issort[a5]
        (car
          (cdr
            (cdr
              x
            )
          )
        )
      )
      (eq
        (cdr
          (cdr
            (cdr
              x
            )
          )
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (eq
        'trs_nil
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_half (x0)
  (if
    (and
      (trs_issort[a0]
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_0
        )
      )
      (list 'trs_0
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_s
          )
          (eq
            (car
              (car
                (cdr
                  x0
                )
              )
            )
            'trs_0
          )
        )
        (list 'trs_0
        )
        (if
          (and
          )
          (list 'trs_s
            (trs_half
              (car
                (cdr
                  (car
                    (cdr
                      x0
                    )
                  )
                )
              )
            )
          )
          (list 'trs_0
          )
        )
      )
    )
    (list 'trs_0
    )
  )
)
(defun trs_ge (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a0]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_0
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_s
          )
          (eq
            (car
              x1
            )
            'trs_s
          )
        )
        (trs_ge
          (car
            (cdr
              x0
            )
          )
          (car
            (cdr
              x1
            )
          )
        )
        (if
          (and
          )
          (list 'trs_false
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a44] (x0 x1)
  (if
    (and
      (trs_issort[a44]
        x0
      )
      (trs_issort[a44]
        x1
      )
    )
    (if
      (and
      )
      (list 'trs_true
      )
      (list 'trs_true
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a0] (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a0]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_0
        )
        (eq
          (car
            x1
          )
          'trs_0
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_0
          )
          (eq
            (car
              x1
            )
            'trs_s
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_s
            )
            (eq
              (car
                x1
              )
              'trs_0
            )
          )
          (list 'trs_false
          )
          (if
            (and
            )
            (trs_equal_sort[a0]
              (car
                (cdr
                  x0
                )
              )
              (car
                (cdr
                  x1
                )
              )
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_isa_false (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_false
      )
      (if
        (and
        )
        (list 'trs_true
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_isa_true (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_not (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_false
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_or (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        x1
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_and (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      x1
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_bool (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x1
          )
          'trs_false
        )
      )
      (list 'trs_false
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_false
          )
          (eq
            (car
              x1
            )
            'trs_true
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_true
            )
            (eq
              (car
                x1
              )
              'trs_true
            )
          )
          (list 'trs_true
          )
          (if
            (and
            )
            (list 'trs_true
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_if1 (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x3
          )
          'trs_cons
        )
      )
      (trs_if1
        (trs_ge
          x1
          (car
            (cdr
              x3
            )
          )
        )
        x1
        (car
          (cdr
            x3
          )
        )
        (car
          (cdr
            (cdr
              x3
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_true
          )
          (eq
            (car
              x3
            )
            'trs_nil
          )
        )
        (list 'trs_nil
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_false
            )
            (eq
              (car
                x3
              )
              'trs_cons
            )
          )
          (list 'trs_cons
            x2
            (trs_if1
              (trs_ge
                x1
                (car
                  (cdr
                    x3
                  )
                )
              )
              x1
              (car
                (cdr
                  x3
                )
              )
              (car
                (cdr
                  (cdr
                    x3
                  )
                )
              )
            )
          )
          (if
            (and
            )
            (list 'trs_cons
              x2
              (list 'trs_nil
              )
            )
            (list 'trs_nil
            )
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_if1prime (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_false
          )
          (eq
            (car
              x3
            )
            'trs_cons
          )
        )
        (trs_if1prime
          (trs_ge
            x1
            (car
              (cdr
                x3
              )
            )
          )
          x1
          (car
            (cdr
              x3
            )
          )
          (car
            (cdr
              (cdr
                x3
              )
            )
          )
        )
        (if
          (and
          )
          (list 'trs_false
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_filterlow (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_nil
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                x0
                (car
                  (cdr
                    x1
                  )
                )
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (trs_filterlow
          x0
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  x0
                  (car
                    (cdr
                      x1
                    )
                  )
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (list 'trs_cons
            (car
              (cdr
                x1
              )
            )
            (trs_filterlow
              x0
              (car
                (cdr
                  (cdr
                    x1
                  )
                )
              )
            )
          )
          (list 'trs_nil
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_filterlowprime (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_false
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                x0
                (car
                  (cdr
                    x1
                  )
                )
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (list 'trs_true
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  x0
                  (car
                    (cdr
                      x1
                    )
                  )
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (trs_filterlowprime
            x0
            (car
              (cdr
                (cdr
                  x1
                )
              )
            )
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a5] (x0 x1)
  (if
    (and
      (trs_issort[a5]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_cons
        )
        (eq
          (car
            x1
          )
          'trs_cons
        )
      )
      (trs_and
        (trs_equal_sort[a5]
          (car
            (cdr
              x0
            )
          )
          (car
            (cdr
              x1
            )
          )
        )
        (trs_equal_sort[a5]
          (car
            (cdr
              (cdr
                x0
              )
            )
          )
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_cons
          )
          (eq
            (car
              x1
            )
            'trs_nil
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_nil
            )
            (eq
              (car
                x1
              )
              'trs_cons
            )
          )
          (list 'trs_false
          )
          (if
            (and
            )
            (list 'trs_true
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(with-prover-time-limit 3
  (defthm test
    (implies
      (and
        (trs_issort[a0] trs_x1)
      )
      (eq
        (trs_if1prime
          (trs_ge
            trs_x1
            trs_x1
          )
          trs_x1
          trs_x1
          (list 'trs_nil
          )
        )
        (list 'trs_true
        )
      )
    )
    :hints (("Goal" :do-not '(generalize)))
  )
)


The following output was given by ACL2:
This is SBCL 1.0.29.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at .

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

 ACL2 Version 3.6 built February 12, 2010  14:59:57.
 Copyright (C) 2009  University of Texas at Austin
 ACL2 comes with ABSOLUTELY NO WARRANTY.  This is free software and you
 are welcome to redistribute it under certain conditions.  For details,
 see the GNU General Public License.

 Initialized with (INITIALIZE-ACL2 'INCLUDE-BOOK *ACL2-PASS-2-FILES*).
 See the documentation topic note-3-6 for recent changes.
 Note: We have modified the prompt in some underlying Lisps to further
 distinguish it from the ACL2 prompt.

ACL2 Version 3.6.  Level 1.  Cbd "/home/petersk/workspace/benchmark/".
Distributed books directory "/home/petersk/download/acl2-sources/books/".
Type :help for help.
Type (good-bye) to quit completely out of ACL2.

ACL2 !> :ALL
ACL2 !>
Since TRS_ISBOOL is non-recursive, its admission is trivial.  We observe
that the type of TRS_ISBOOL is described by the theorem 
(OR (EQUAL (TRS_ISBOOL X) T) (EQUAL (TRS_ISBOOL X) NIL)).  We used
the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISBOOL ...)
Rules: ((:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_ISBOOL
ACL2 !>
For the admission of TRS_ISSORT[A0] we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (NOT (AND (CONSP X)
                        (EQ 'TRS_0 (CAR X))
                        (EQ (CDR X) NIL)))
              (CONSP X)
              (CONSP (CDR X))
              (EQ 'TRS_S (CAR X)))
         (O< (ACL2-COUNT (CADR X))
             (ACL2-COUNT X))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (NOT (AND (CONSP X)
                        (EQUAL 'TRS_0 (CAR X))
                        (EQUAL (CDR X) NIL)))
              (CONSP X)
              (CONSP (CDR X))
              (EQUAL 'TRS_S (CAR X)))
         (O< (ACL2-COUNT (CADR X))
             (ACL2-COUNT X))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP and
O<, the :executable-counterparts of ACL2-COUNT and EQUAL, primitive
type reasoning, the :rewrite rule UNICITY-OF-0 and the :type-prescription
rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (EQUAL 'TRS_S (CAR X)))
         (< (ACL2-COUNT (CADR X))
            (+ 1 (ACL2-COUNT (CDR X))))).

The destructor terms (CAR X) and (CDR X) can be eliminated.  Furthermore,
those terms are at the root of a chain of two rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X by (CONS X1 X2), (CAR X)
by X1 and (CDR X) by X2 and restrict the type of the new variable X1
to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again, to
replace X2 by (CONS X3 X4), (CAR X2) by X3 and (CDR X2) by X4.    These
steps produce the following goal.

Goal'''
(IMPLIES (AND (CONSP (CONS X3 X4))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              (NOT (EQUAL X1 NIL))
              (CONSP (LIST* X1 X3 X4))
              (EQUAL 'TRS_S X1))
         (< (ACL2-COUNT X3)
            (+ 1 (ACL2-COUNT (CONS X3 X4))))).

By case analysis we reduce the conjecture to

Goal'4'
(IMPLIES (AND (CONSP (CONS X3 X4))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              X1 (CONSP (LIST* X1 X3 X4))
              (EQUAL 'TRS_S X1))
         (< (ACL2-COUNT X3)
            (+ 1 (ACL2-COUNT (CONS X3 X4))))).

This simplifies, using the :definition ACL2-COUNT, the :executable-
counterparts of EQUAL, NOT and SYMBOLP, primitive type reasoning and
the :rewrite rules CAR-CONS and CDR-CONS, to

Goal'5'
(< (ACL2-COUNT X3)
   (+ 1 1 (ACL2-COUNT X3)
      (ACL2-COUNT X4))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_ISSORT[A0].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_ISSORT[A0] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A0] X) T) (EQUAL (TRS_ISSORT[A0] X) NIL)). 
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISSORT[A0] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_ISSORT[A0]
ACL2 !>
Since TRS_ISSORT[A44] is non-recursive, its admission is trivial. 
We observe that the type of TRS_ISSORT[A44] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A44] X) T) (EQUAL (TRS_ISSORT[A44] X) NIL)).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISSORT[A44] ...)
Rules: ((:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISSORT[A44]
ACL2 !>
For the admission of TRS_ISSORT[A5] we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQ 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (O< (ACL2-COUNT (CADDR X))
             (ACL2-COUNT X))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQUAL 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (O< (ACL2-COUNT (CADDR X))
             (ACL2-COUNT X))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP and
O<, the :executable-counterpart of ACL2-COUNT, primitive type reasoning,
the :rewrite rule UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT,
to

Goal''
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQUAL 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (< (ACL2-COUNT (CADDR X))
            (+ 1 1 (ACL2-COUNT (CADR X))
               (ACL2-COUNT (CDDR X))))).

The destructor terms (CAR X) and (CDR X) can be eliminated.  Furthermore,
those terms are at the root of a chain of three rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X by (CONS X1 X2), (CAR X)
by X1 and (CDR X) by X2 and restrict the type of the new variable X1
to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again, to
replace X2 by (CONS X3 X4), (CAR X2) by X3 and (CDR X2) by X4.  (3)
Finally, use CAR-CDR-ELIM to replace X4 by (CONS X5 X6), (CAR X4) by
X5 and (CDR X4) by X6.    These steps produce the following goal.

Goal'''
(IMPLIES (AND (CONSP (CONS X5 X6))
              (CONSP (LIST* X3 X5 X6))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              (NOT (EQUAL X1 NIL))
              (CONSP (LIST* X1 X3 X5 X6))
              (EQUAL 'TRS_CONS X1)
              (TRS_ISSORT[A0] X3))
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               (ACL2-COUNT (CONS X5 X6))))).

By case analysis we reduce the conjecture to

Goal'4'
(IMPLIES (AND (CONSP (CONS X5 X6))
              (CONSP (LIST* X3 X5 X6))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              X1 (CONSP (LIST* X1 X3 X5 X6))
              (EQUAL 'TRS_CONS X1)
              (TRS_ISSORT[A0] X3))
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               (ACL2-COUNT (CONS X5 X6))))).

This simplifies, using the :definition ACL2-COUNT, the :executable-
counterparts of EQUAL, NOT and SYMBOLP, primitive type reasoning and
the :rewrite rules CAR-CONS and CDR-CONS, to

Goal'5'
(IMPLIES (TRS_ISSORT[A0] X3)
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               1 (ACL2-COUNT X5)
               (ACL2-COUNT X6)))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_ISSORT[A5].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_ISSORT[A5] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A5] X) T) (EQUAL (TRS_ISSORT[A5] X) NIL)). 
We used the :executable-counterpart of EQUAL, primitive type reasoning
and the :type-prescription rule TRS_ISSORT[A0].

Summary
Form:  ( DEFUN TRS_ISSORT[A5] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_ISSORT[A0]))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_ISSORT[A5]
ACL2 !>
For the admission of TRS_HALF we will use the relation O< (which is
known to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X0).  The non-trivial part of the measure conjecture is

Goal
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (NOT (EQ (CAR X0) 'TRS_0))
              (NOT (AND (EQ (CAR X0) 'TRS_S)
                        (EQ (CAADR X0) 'TRS_0)))
              T)
         (O< (ACL2-COUNT (CADADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (NOT (EQUAL (CAR X0) 'TRS_0))
              (NOT (AND (EQUAL (CAR X0) 'TRS_S)
                        (EQUAL (CAADR X0) 'TRS_0))))
         (O< (ACL2-COUNT (CADADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (EQUAL 'TRS_S (CAR X0))
              (CONSP (CADR X0))
              (CONSP (CDADR X0))
              (EQUAL 'TRS_S (CAADR X0))
              (TRS_ISSORT[A0] (CADADR X0))
              (NOT (CDDADR X0))
              (NOT (CDDR X0)))
         (< (ACL2-COUNT (CADADR X0))
            (+ 1 1 1 1 (ACL2-COUNT (CADADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_HALF.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_HALF is described by the theorem 
(AND (CONSP (TRS_HALF X0)) (TRUE-LISTP (TRS_HALF X0))).  We used primitive
type reasoning.

Summary
Form:  ( DEFUN TRS_HALF ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.01, other: 0.00)
 TRS_HALF
ACL2 !>
For the admission of TRS_GE we will use the relation O< (which is known
to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X0).  The non-trivial part of the measure conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A0] X1))
              (NOT (EQ (CAR X1) 'TRS_0))
              (AND (EQ (CAR X0) 'TRS_S)
                   (EQ (CAR X1) 'TRS_S)))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A0] X1)
              (NOT (EQUAL (CAR X1) 'TRS_0))
              (EQUAL (CAR X0) 'TRS_S)
              (EQUAL (CAR X1) 'TRS_S))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (NOT (CDDR X0))
              (TRS_ISSORT[A0] X1)
              (EQUAL (CAR X0) 'TRS_S)
              (EQUAL (CAR X1) 'TRS_S))
         (< (ACL2-COUNT (CADR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_GE.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_GE is described by the theorem 
(AND (CONSP (TRS_GE X0 X1)) (TRUE-LISTP (TRS_GE X0 X1))).  

Summary
Form:  ( DEFUN TRS_GE ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.01, other: 0.00)
 TRS_GE
ACL2 !>
Since TRS_EQUAL_SORT[A44] is non-recursive, its admission is trivial.
We observe that the type of TRS_EQUAL_SORT[A44] is described by the
theorem 
(AND (CONSP (TRS_EQUAL_SORT[A44] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A44] X0 X1))).

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A44] ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_EQUAL_SORT[A44]
ACL2 !>
For the admission of TRS_EQUAL_SORT[A0] we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X0).  The non-trivial part of the measure
conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A0] X1))
              (NOT (AND (EQ (CAR X0) 'TRS_0)
                        (EQ (CAR X1) 'TRS_0)))
              (NOT (AND (EQ (CAR X0) 'TRS_0)
                        (EQ (CAR X1) 'TRS_S)))
              (NOT (AND (EQ (CAR X0) 'TRS_S)
                        (EQ (CAR X1) 'TRS_0)))
              T)
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A0] X1)
              (NOT (AND (EQUAL (CAR X0) 'TRS_0)
                        (EQUAL (CAR X1) 'TRS_0)))
              (NOT (AND (EQUAL (CAR X0) 'TRS_0)
                        (EQUAL (CAR X1) 'TRS_S)))
              (NOT (AND (EQUAL (CAR X0) 'TRS_S)
                        (EQUAL (CAR X1) 'TRS_0))))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (EQUAL 'TRS_S (CAR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (NOT (CDDR X0))
              (TRS_ISSORT[A0] X1)
              (NOT (EQUAL (CAR X1) 'TRS_0)))
         (< (ACL2-COUNT (CADR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_EQUAL_SORT[A0].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_EQUAL_SORT[A0] is described by the theorem
(AND (CONSP (TRS_EQUAL_SORT[A0] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A0] X0 X1))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A0] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_EQUAL_SORT[A0]
ACL2 !>
Since TRS_ISA_FALSE is non-recursive, its admission is trivial.  We
observe that the type of TRS_ISA_FALSE is described by the theorem
(AND (CONSP (TRS_ISA_FALSE X0)) (TRUE-LISTP (TRS_ISA_FALSE X0))). 

Summary
Form:  ( DEFUN TRS_ISA_FALSE ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISA_FALSE
ACL2 !>
Since TRS_ISA_TRUE is non-recursive, its admission is trivial.  We
observe that the type of TRS_ISA_TRUE is described by the theorem 
(AND (CONSP (TRS_ISA_TRUE X0)) (TRUE-LISTP (TRS_ISA_TRUE X0))).  

Summary
Form:  ( DEFUN TRS_ISA_TRUE ...)
Rules: NIL
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_ISA_TRUE
ACL2 !>
Since TRS_NOT is non-recursive, its admission is trivial.  We observe
that the type of TRS_NOT is described by the theorem 
(AND (CONSP (TRS_NOT X0)) (TRUE-LISTP (TRS_NOT X0))).  

Summary
Form:  ( DEFUN TRS_NOT ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_NOT
ACL2 !>
Since TRS_OR is non-recursive, its admission is trivial.  We observe
that the type of TRS_OR is described by the theorem 
(OR (AND (CONSP (TRS_OR X0 X1))
         (TRUE-LISTP (TRS_OR X0 X1)))
    (EQUAL (TRS_OR X0 X1) X1)).

Summary
Form:  ( DEFUN TRS_OR ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_OR
ACL2 !>
Since TRS_AND is non-recursive, its admission is trivial.  We observe
that the type of TRS_AND is described by the theorem 
(OR (AND (CONSP (TRS_AND X0 X1))
         (TRUE-LISTP (TRS_AND X0 X1)))
    (EQUAL (TRS_AND X0 X1) X1)).

Summary
Form:  ( DEFUN TRS_AND ...)
Rules: NIL
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_AND
ACL2 !>
Since TRS_EQUAL_BOOL is non-recursive, its admission is trivial.  We
observe that the type of TRS_EQUAL_BOOL is described by the theorem
(AND (CONSP (TRS_EQUAL_BOOL X0 X1)) (TRUE-LISTP (TRS_EQUAL_BOOL X0 X1))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_EQUAL_BOOL ...)
Rules: ((:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_EQUAL_BOOL
ACL2 !>
For the admission of TRS_IF1 we will use the relation O< (which is
known to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X3).  The non-trivial part of the measure conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (AND (EQ (CAR X0) 'TRS_TRUE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))
     (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (NOT (AND (EQ (CAR X0) 'TRS_TRUE)
                             (EQ (CAR X3) 'TRS_NIL)))
                   (AND (EQ (CAR X0) 'TRS_FALSE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to the following two conjectures.

Subgoal 2
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (AND (EQUAL (CAR X0) 'TRS_TRUE)
                        (EQUAL (CAR X3) 'TRS_NIL)))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF1.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_IF1 is described by the theorem 
(AND (CONSP (TRS_IF1 X0 X1 X2 X3)) (TRUE-LISTP (TRS_IF1 X0 X1 X2 X3))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_IF1 ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.02 seconds (prove: 0.02, print: 0.00, other: 0.00)
 TRS_IF1
ACL2 !>
For the admission of TRS_IF1PRIME we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X3).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (AND (TRS_ISBOOL X0)
                   (TRS_ISSORT[A0] X1)
                   (TRS_ISSORT[A0] X2)
                   (TRS_ISSORT[A5] X3))
              (NOT (EQ (CAR X0) 'TRS_TRUE))
              (AND (EQ (CAR X0) 'TRS_FALSE)
                   (EQ (CAR X3) 'TRS_CONS)))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Goal'
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (EQUAL (CAR X0) 'TRS_TRUE))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal'''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF1PRIME. 
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_IF1PRIME is described by the theorem 
(AND (CONSP (TRS_IF1PRIME X0 X1 X2 X3))
     (TRUE-LISTP (TRS_IF1PRIME X0 X1 X2 X3))).

Summary
Form:  ( DEFUN TRS_IF1PRIME ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.00, other: 0.01)
 TRS_IF1PRIME
ACL2 !>
For the admission of TRS_FILTERLOW we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X1).  The non-trivial part of the measure conjecture
is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                       '(TRS_TRUE))
                       '(TRS_FALSE)))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))
     (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Subgoal 2'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE X0 (CADR X1))))
              (NOT (CDR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_TRUE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to the following three conjectures.

Subgoal 1.3
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL 'TRS_TRUE
                     (CAR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (CDR (TRS_GE X0 (CADR X1))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE X0 (CADR X1))))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERLOW.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERLOW is described by the theorem
(AND (CONSP (TRS_FILTERLOW X0 X1)) (TRUE-LISTP (TRS_FILTERLOW X0 X1))).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_FILTERLOW ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.00, other: 0.01)
 TRS_FILTERLOW
ACL2 !>
For the admission of TRS_FILTERLOWPRIME we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X1).  The non-trivial part of the measure
conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A5] X1))
              (NOT (EQ (CAR X1) 'TRS_NIL))
              (NOT (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                  '(TRS_TRUE))
                  '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (NOT (AND (EQUAL (CAR X1) 'TRS_CONS)
                        (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                               '(TRS_TRUE))
                               '(TRS_TRUE))))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Goal''
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE X0 (CADR X1))))
              (NOT (CDR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERLOWPRIME.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERLOWPRIME is described by the theorem
(AND (CONSP (TRS_FILTERLOWPRIME X0 X1))
     (TRUE-LISTP (TRS_FILTERLOWPRIME X0 X1))).

Summary
Form:  ( DEFUN TRS_FILTERLOWPRIME ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_FILTERLOWPRIME
ACL2 !>
For the admission of TRS_EQUAL_SORT[A5] we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X0).  The non-trivial part of the measure
conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A5] X0)
                        (TRS_ISSORT[A5] X1))
                   (AND (EQ (CAR X0) 'TRS_CONS)
                        (EQ (CAR X1) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X0))
                  (ACL2-COUNT X0)))
     (IMPLIES (AND (AND (TRS_ISSORT[A5] X0)
                        (TRS_ISSORT[A5] X1))
                   (AND (EQ (CAR X0) 'TRS_CONS)
                        (EQ (CAR X1) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADR X0))
                  (ACL2-COUNT X0)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (CONSP (CDDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (TRS_ISSORT[A5] (CADDR X0))
              (NOT (CDDDR X0))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X0))
            (+ 1 (ACL2-COUNT (CDR X0))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (CONSP (CDDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (TRS_ISSORT[A5] (CADDR X0))
              (NOT (CDDDR X0))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))
               1 (ACL2-COUNT (CADDR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions O-FINP and O< and the :type-
prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADR X0))
            (ACL2-COUNT X0))).

The destructor terms (CAR X0) and (CDR X0) can be eliminated.  Furthermore,
those terms are at the root of a chain of two rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X0 by (CONS X2 X3), (CAR X0)
by X2 and (CDR X0) by X3 and restrict the type of the new variable
X2 to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again,
to replace X3 by (CONS X4 X5), (CAR X3) by X4 and (CDR X3) by X5. 
  These steps produce the following three goals.

Subgoal 1.3
(IMPLIES (AND (NOT (CONSP X0))
              (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADR X0))
            (ACL2-COUNT X0))).

But we reduce the conjecture to T, by primitive type reasoning.

Subgoal 1.2
(IMPLIES (AND (NOT (CONSP X3))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              (NOT (EQUAL X2 NIL))
              (CONSP (CONS X2 X3))
              (TRS_ISSORT[A5] (CONS X2 X3))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CAR X3))
            (ACL2-COUNT (CONS X2 X3)))).

By case analysis we reduce the conjecture to

Subgoal 1.2'
(IMPLIES (AND (NOT (CONSP X3))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              X2 (CONSP (CONS X2 X3))
              (TRS_ISSORT[A5] (CONS X2 X3))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CAR X3))
            (ACL2-COUNT (CONS X2 X3)))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterparts of EQUAL, NOT and SYMBOLP, primitive type
reasoning and the :rewrite rules CAR-CONS and CDR-CONS.

Subgoal 1.1
(IMPLIES (AND (CONSP (CONS X4 X5))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              (NOT (EQUAL X2 NIL))
              (CONSP (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (ACL2-COUNT (LIST* X2 X4 X5)))).

By case analysis we reduce the conjecture to

Subgoal 1.1'
(IMPLIES (AND (CONSP (CONS X4 X5))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              X2 (CONSP (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (ACL2-COUNT (LIST* X2 X4 X5)))).

This simplifies, using the :definitions ACL2-COUNT, FIX and TRS_ISSORT[A5],
the :executable-counterparts of ACL2-COUNT, EQUAL, NOT and SYMBOLP,
primitive type reasoning, the :rewrite rules CAR-CONS, CDR-CONS and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1.1''
(IMPLIES (AND (CONSP X5)
              (TRS_ISSORT[A0] X4)
              (TRS_ISSORT[A5] (CAR X5))
              (NOT (CDR X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (+ 1 1 (ACL2-COUNT X4)
               (ACL2-COUNT X5)))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_EQUAL_SORT[A5].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_EQUAL_SORT[A5] is described by the theorem
(AND (CONSP (TRS_EQUAL_SORT[A5] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A5] X0 X1))).
We used the :executable-counterpart of EQUAL, primitive type reasoning
and the :type-prescription rule TRS_AND.

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A5] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A5])
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_AND))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.00, other: 0.01)
 TRS_EQUAL_SORT[A5]
ACL2 !>
[Note:  A hint was supplied for our processing of the goal above. 
Thanks!]

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (TRS_ISSORT[A0] TRS_X1)
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X1 TRS_X1)
                              TRS_X1 TRS_X1 '(TRS_NIL))
                '(TRS_TRUE))).

This simplifies, using the :definitions TRS_IF1PRIME and TRS_ISBOOL,
the :executable-counterparts of CAR, EQUAL and TRS_ISSORT[A5], primitive
type reasoning and the :type-prescription rules TRS_GE and TRS_ISSORT[A0],
to

Goal''
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

Name the formula above *1.

Perhaps we can prove *1 by induction.  Three induction schemes are
suggested by this conjecture.  Subsumption reduces that number to two.
These merge into one derived induction scheme.  

We will induct according to a scheme suggested by (TRS_GE TRS_X1 TRS_X1).
This suggestion was produced using the :induction rules TRS_GE and
TRS_ISSORT[A0].  If we let (:P TRS_X1) denote *1 above then the induction
scheme we'll use is
(AND (IMPLIES (NOT (AND (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A0] TRS_X1)))
              (:P TRS_X1))
     (IMPLIES (AND (AND (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A0] TRS_X1))
                   (NOT (EQ (CAR TRS_X1) 'TRS_0))
                   (NOT (AND (EQ (CAR TRS_X1) 'TRS_S)
                             (EQ (CAR TRS_X1) 'TRS_S)))
                   T)
              (:P TRS_X1))
     (IMPLIES (AND (AND (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A0] TRS_X1))
                   (NOT (EQ (CAR TRS_X1) 'TRS_0))
                   (AND (EQ (CAR TRS_X1) 'TRS_S)
                        (EQ (CAR TRS_X1) 'TRS_S))
                   (:P (CADR TRS_X1)))
              (:P TRS_X1))
     (IMPLIES (AND (AND (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A0] TRS_X1))
                   (EQ (CAR TRS_X1) 'TRS_0))
              (:P TRS_X1))).
This induction is justified by the same argument used to admit TRS_GE.
When applied to the goal at hand the above induction scheme produces
five nontautological subgoals.

Subgoal *1/5
(IMPLIES (AND (AND (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A0] TRS_X1))
              (NOT (EQ (CAR TRS_X1) 'TRS_0))
              (NOT (AND (EQ (CAR TRS_X1) 'TRS_S)
                        (EQ (CAR TRS_X1) 'TRS_S)))
              T (TRS_ISSORT[A0] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/5'
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X1)
              (NOT (EQUAL (CAR TRS_X1) 'TRS_0))
              (NOT (AND (EQUAL (CAR TRS_X1) 'TRS_S)
                        (EQUAL (CAR TRS_X1) 'TRS_S)))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A0]
and primitive type reasoning.

Subgoal *1/4
(IMPLIES (AND (AND (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A0] TRS_X1))
              (NOT (EQ (CAR TRS_X1) 'TRS_0))
              (AND (EQ (CAR TRS_X1) 'TRS_S)
                   (EQ (CAR TRS_X1) 'TRS_S))
              (CDR (TRS_GE (CADR TRS_X1) (CADR TRS_X1)))
              (TRS_ISSORT[A0] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/4'
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X1)
              (NOT (EQUAL (CAR TRS_X1) 'TRS_0))
              (EQUAL (CAR TRS_X1) 'TRS_S)
              (CDR (TRS_GE (CADR TRS_X1) (CADR TRS_X1)))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

But simplification reduces this to T, using the :definitions TRS_GE
and TRS_ISSORT[A0], the :executable-counterpart of EQUAL, primitive
type reasoning and the :type-prescription rules TRS_GE and TRS_ISSORT[A0].

Subgoal *1/3
(IMPLIES (AND (AND (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A0] TRS_X1))
              (NOT (EQ (CAR TRS_X1) 'TRS_0))
              (AND (EQ (CAR TRS_X1) 'TRS_S)
                   (EQ (CAR TRS_X1) 'TRS_S))
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE (CADR TRS_X1) (CADR TRS_X1)))))
              (TRS_ISSORT[A0] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/3'
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X1)
              (NOT (EQUAL (CAR TRS_X1) 'TRS_0))
              (EQUAL (CAR TRS_X1) 'TRS_S)
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE (CADR TRS_X1) (CADR TRS_X1)))))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

But simplification reduces this to T, using the :definitions TRS_GE
and TRS_ISSORT[A0], the :executable-counterpart of EQUAL, primitive
type reasoning and the :type-prescription rule TRS_ISSORT[A0].

Subgoal *1/2
(IMPLIES (AND (AND (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A0] TRS_X1))
              (NOT (EQ (CAR TRS_X1) 'TRS_0))
              (AND (EQ (CAR TRS_X1) 'TRS_S)
                   (EQ (CAR TRS_X1) 'TRS_S))
              (NOT (TRS_ISSORT[A0] (CADR TRS_X1)))
              (TRS_ISSORT[A0] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/2'
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X1)
              (NOT (EQUAL (CAR TRS_X1) 'TRS_0))
              (EQUAL (CAR TRS_X1) 'TRS_S)
              (NOT (TRS_ISSORT[A0] (CADR TRS_X1)))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A0]
and the :executable-counterpart of EQUAL.

Subgoal *1/1
(IMPLIES (AND (AND (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A0] TRS_X1))
              (EQ (CAR TRS_X1) 'TRS_0)
              (TRS_ISSORT[A0] TRS_X1)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

By the simple :definition EQ we reduce the conjecture to

Subgoal *1/1'
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X1)
              (EQUAL (CAR TRS_X1) 'TRS_0)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X1 TRS_X1))))
         (CDR (TRS_GE TRS_X1 TRS_X1))).

But simplification reduces this to T, using the :definitions TRS_GE
and TRS_ISSORT[A0], the :executable-counterparts of CAR and EQUAL and
primitive type reasoning.

That completes the proof of *1.

Q.E.D.

Summary
Form:  ( DEFTHM TEST ...)
Rules: ((:DEFINITION EQ)
        (:DEFINITION NOT)
        (:DEFINITION TRS_GE)
        (:DEFINITION TRS_IF1PRIME)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISSORT[A5])
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:INDUCTION TRS_GE)
        (:INDUCTION TRS_ISSORT[A0])
        (:TYPE-PRESCRIPTION TRS_GE)
        (:TYPE-PRESCRIPTION TRS_ISSORT[A0]))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.01, other: 0.00)
 TEST
ACL2 !>Bye.

(122) Complex Obligation (AND)

(123) Obligation:

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

QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(true, n, x, xs) → filterlow(n, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))

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

(124) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(125) Obligation:

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

QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
if1(true, n, x, xs) → filterlow(n, xs)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))
half(0)
half(s(0))
half(s(s(x0)))

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

(126) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

half(0)
half(s(0))
half(s(s(x0)))

(127) Obligation:

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

QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))

The TRS R consists of the following rules:

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
if1(true, n, x, xs) → filterlow(n, xs)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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

(128) Induction-Processor (SOUND transformation)


This DP could be deleted by the Induction-Processor:
QS(0, cons(x0, cons(x1, x2))) → QS(0, if1(ge(x0, x0), x0, x0, cons(x1, x2)))


This order was computed:
Polynomial interpretation [POLO]:

POL(0) = 0   
POL(QS(x1, x2)) = x2   
POL(cons(x1, x2)) = 1 + x2   
POL(false) = 0   
POL(filterlow(x1, x2)) = x2   
POL(ge(x1, x2)) = 1   
POL(if1(x1, x2, x3, x4)) = 1 + x4   
POL(nil) = 0   
POL(s(x1)) = 0   
POL(true) = 1   

At least one of these decreasing rules is always used after the deleted DP:
if1(true, n6'', x12'', xs4'') → filterlow(n6'', xs4'')


The following formula is valid:
x0:sort[a0],x1:sort[a5],x2:sort[a0].if1'(ge(x0 , x0 ), x0 , x0 , cons(x1 , x2 ))=true


The transformed set:
if1'(true, n6, x12, xs4) → true
filterlow'(n11, cons(x19, xs8)) → if1'(ge(n11, x19), n11, x19, xs8)
if1'(false, n16, x26, xs12) → filterlow'(n16, xs12)
filterlow'(n21, nil) → false
ge(x, 0) → true
ge(s(x5), s(y')) → ge(x5, y')
if1(true, n6, x12, xs4) → filterlow(n6, xs4)
filterlow(n11, cons(x19, xs8)) → if1(ge(n11, x19), n11, x19, xs8)
if1(false, n16, x26, xs12) → cons(x26, filterlow(n16, xs12))
filterlow(n21, nil) → nil
ge(0, s(x39)) → false
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a39](witness_sort[a39], witness_sort[a39]) → true


The proof given by the theorem prover:
The following input was given to ACL2:
(set-ruler-extenders :all)

(defun trs_isbool (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_true
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (eq
        'trs_false
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a0] (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_0
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (consp
        (cdr
          x
        )
      )
      (eq
        'trs_s
        (car
          x
        )
      )
      (trs_issort[a0]
        (car
          (cdr
            x
          )
        )
      )
      (eq
        (cdr
          (cdr
            x
          )
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a39] (x)
  (or
    (and
      (consp
        x
      )
      (eq
        'trs_witness_sort[a39]
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_issort[a5] (x)
  (or
    (and
      (consp
        x
      )
      (consp
        (cdr
          x
        )
      )
      (consp
        (cdr
          (cdr
            x
          )
        )
      )
      (eq
        'trs_cons
        (car
          x
        )
      )
      (trs_issort[a0]
        (car
          (cdr
            x
          )
        )
      )
      (trs_issort[a5]
        (car
          (cdr
            (cdr
              x
            )
          )
        )
      )
      (eq
        (cdr
          (cdr
            (cdr
              x
            )
          )
        )
        'nil
      )
    )
    (and
      (consp
        x
      )
      (eq
        'trs_nil
        (car
          x
        )
      )
      (eq
        (cdr
          x
        )
        'nil
      )
    )
  )
)
(defun trs_ge (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a0]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_0
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_s
          )
          (eq
            (car
              x1
            )
            'trs_s
          )
        )
        (trs_ge
          (car
            (cdr
              x0
            )
          )
          (car
            (cdr
              x1
            )
          )
        )
        (if
          (and
          )
          (list 'trs_false
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a39] (x0 x1)
  (if
    (and
      (trs_issort[a39]
        x0
      )
      (trs_issort[a39]
        x1
      )
    )
    (if
      (and
      )
      (list 'trs_true
      )
      (list 'trs_true
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a0] (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a0]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_0
        )
        (eq
          (car
            x1
          )
          'trs_0
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_0
          )
          (eq
            (car
              x1
            )
            'trs_s
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_s
            )
            (eq
              (car
                x1
              )
              'trs_0
            )
          )
          (list 'trs_false
          )
          (if
            (and
            )
            (trs_equal_sort[a0]
              (car
                (cdr
                  x0
                )
              )
              (car
                (cdr
                  x1
                )
              )
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_isa_false (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_false
      )
      (if
        (and
        )
        (list 'trs_true
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_isa_true (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_not (x0)
  (if
    (and
      (trs_isbool
        x0
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_false
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_or (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
        )
        x1
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_and (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      x1
      (if
        (and
        )
        (list 'trs_false
        )
        (list 'trs_true
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_bool (x0 x1)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_isbool
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x1
          )
          'trs_false
        )
      )
      (list 'trs_false
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_false
          )
          (eq
            (car
              x1
            )
            'trs_true
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_true
            )
            (eq
              (car
                x1
              )
              'trs_true
            )
          )
          (list 'trs_true
          )
          (if
            (and
            )
            (list 'trs_true
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_if1 (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
        (eq
          (car
            x3
          )
          'trs_cons
        )
      )
      (trs_if1
        (trs_ge
          x1
          (car
            (cdr
              x3
            )
          )
        )
        x1
        (car
          (cdr
            x3
          )
        )
        (car
          (cdr
            (cdr
              x3
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_true
          )
          (eq
            (car
              x3
            )
            'trs_nil
          )
        )
        (list 'trs_nil
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_false
            )
            (eq
              (car
                x3
              )
              'trs_cons
            )
          )
          (list 'trs_cons
            x2
            (trs_if1
              (trs_ge
                x1
                (car
                  (cdr
                    x3
                  )
                )
              )
              x1
              (car
                (cdr
                  x3
                )
              )
              (car
                (cdr
                  (cdr
                    x3
                  )
                )
              )
            )
          )
          (if
            (and
            )
            (list 'trs_cons
              x2
              (list 'trs_nil
              )
            )
            (list 'trs_nil
            )
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_if1prime (x0 x1 x2 x3)
  (if
    (and
      (trs_isbool
        x0
      )
      (trs_issort[a0]
        x1
      )
      (trs_issort[a0]
        x2
      )
      (trs_issort[a5]
        x3
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_true
        )
      )
      (list 'trs_true
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_false
          )
          (eq
            (car
              x3
            )
            'trs_cons
          )
        )
        (trs_if1prime
          (trs_ge
            x1
            (car
              (cdr
                x3
              )
            )
          )
          x1
          (car
            (cdr
              x3
            )
          )
          (car
            (cdr
              (cdr
                x3
              )
            )
          )
        )
        (if
          (and
          )
          (list 'trs_false
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_filterlow (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_nil
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                x0
                (car
                  (cdr
                    x1
                  )
                )
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (trs_filterlow
          x0
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  x0
                  (car
                    (cdr
                      x1
                    )
                  )
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (list 'trs_cons
            (car
              (cdr
                x1
              )
            )
            (trs_filterlow
              x0
              (car
                (cdr
                  (cdr
                    x1
                  )
                )
              )
            )
          )
          (list 'trs_nil
          )
        )
      )
    )
    (list 'trs_nil
    )
  )
)
(defun trs_filterlowprime (x0 x1)
  (if
    (and
      (trs_issort[a0]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x1
          )
          'trs_nil
        )
      )
      (list 'trs_false
      )
      (if
        (and
          (eq
            (car
              x1
            )
            'trs_cons
          )
          (eq
            (trs_equal_bool
              (trs_ge
                x0
                (car
                  (cdr
                    x1
                  )
                )
              )
              (list 'trs_true
              )
            )
            (list 'trs_true
            )
          )
        )
        (list 'trs_true
        )
        (if
          (and
            (eq
              (trs_equal_bool
                (trs_ge
                  x0
                  (car
                    (cdr
                      x1
                    )
                  )
                )
                (list 'trs_true
                )
              )
              (list 'trs_false
              )
            )
          )
          (trs_filterlowprime
            x0
            (car
              (cdr
                (cdr
                  x1
                )
              )
            )
          )
          (list 'trs_true
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(defun trs_equal_sort[a5] (x0 x1)
  (if
    (and
      (trs_issort[a5]
        x0
      )
      (trs_issort[a5]
        x1
      )
    )
    (if
      (and
        (eq
          (car
            x0
          )
          'trs_cons
        )
        (eq
          (car
            x1
          )
          'trs_cons
        )
      )
      (trs_and
        (trs_equal_sort[a5]
          (car
            (cdr
              x0
            )
          )
          (car
            (cdr
              x1
            )
          )
        )
        (trs_equal_sort[a5]
          (car
            (cdr
              (cdr
                x0
              )
            )
          )
          (car
            (cdr
              (cdr
                x1
              )
            )
          )
        )
      )
      (if
        (and
          (eq
            (car
              x0
            )
            'trs_cons
          )
          (eq
            (car
              x1
            )
            'trs_nil
          )
        )
        (list 'trs_false
        )
        (if
          (and
            (eq
              (car
                x0
              )
              'trs_nil
            )
            (eq
              (car
                x1
              )
              'trs_cons
            )
          )
          (list 'trs_false
          )
          (if
            (and
            )
            (list 'trs_true
            )
            (list 'trs_true
            )
          )
        )
      )
    )
    (list 'trs_true
    )
  )
)
(with-prover-time-limit 3
  (defthm test
    (implies
      (and
        (trs_issort[a0] trs_x0)
        (trs_issort[a5] trs_x1)
        (trs_issort[a0] trs_x2)
      )
      (eq
        (trs_if1prime
          (trs_ge
            trs_x0
            trs_x0
          )
          trs_x0
          trs_x0
          (list 'trs_cons
            trs_x1
            trs_x2
          )
        )
        (list 'trs_true
        )
      )
    )
    :hints (("Goal" :do-not '(generalize)))
  )
)


The following output was given by ACL2:
This is SBCL 1.0.29.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at .

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

 ACL2 Version 3.6 built February 12, 2010  14:59:57.
 Copyright (C) 2009  University of Texas at Austin
 ACL2 comes with ABSOLUTELY NO WARRANTY.  This is free software and you
 are welcome to redistribute it under certain conditions.  For details,
 see the GNU General Public License.

 Initialized with (INITIALIZE-ACL2 'INCLUDE-BOOK *ACL2-PASS-2-FILES*).
 See the documentation topic note-3-6 for recent changes.
 Note: We have modified the prompt in some underlying Lisps to further
 distinguish it from the ACL2 prompt.

ACL2 Version 3.6.  Level 1.  Cbd "/home/petersk/workspace/benchmark/".
Distributed books directory "/home/petersk/download/acl2-sources/books/".
Type :help for help.
Type (good-bye) to quit completely out of ACL2.

ACL2 !> :ALL
ACL2 !>
Since TRS_ISBOOL is non-recursive, its admission is trivial.  We observe
that the type of TRS_ISBOOL is described by the theorem 
(OR (EQUAL (TRS_ISBOOL X) T) (EQUAL (TRS_ISBOOL X) NIL)).  We used
the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISBOOL ...)
Rules: ((:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISBOOL
ACL2 !>
For the admission of TRS_ISSORT[A0] we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (NOT (AND (CONSP X)
                        (EQ 'TRS_0 (CAR X))
                        (EQ (CDR X) NIL)))
              (CONSP X)
              (CONSP (CDR X))
              (EQ 'TRS_S (CAR X)))
         (O< (ACL2-COUNT (CADR X))
             (ACL2-COUNT X))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (NOT (AND (CONSP X)
                        (EQUAL 'TRS_0 (CAR X))
                        (EQUAL (CDR X) NIL)))
              (CONSP X)
              (CONSP (CDR X))
              (EQUAL 'TRS_S (CAR X)))
         (O< (ACL2-COUNT (CADR X))
             (ACL2-COUNT X))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP and
O<, the :executable-counterparts of ACL2-COUNT and EQUAL, primitive
type reasoning, the :rewrite rule UNICITY-OF-0 and the :type-prescription
rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (EQUAL 'TRS_S (CAR X)))
         (< (ACL2-COUNT (CADR X))
            (+ 1 (ACL2-COUNT (CDR X))))).

The destructor terms (CAR X) and (CDR X) can be eliminated.  Furthermore,
those terms are at the root of a chain of two rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X by (CONS X1 X2), (CAR X)
by X1 and (CDR X) by X2 and restrict the type of the new variable X1
to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again, to
replace X2 by (CONS X3 X4), (CAR X2) by X3 and (CDR X2) by X4.    These
steps produce the following goal.

Goal'''
(IMPLIES (AND (CONSP (CONS X3 X4))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              (NOT (EQUAL X1 NIL))
              (CONSP (LIST* X1 X3 X4))
              (EQUAL 'TRS_S X1))
         (< (ACL2-COUNT X3)
            (+ 1 (ACL2-COUNT (CONS X3 X4))))).

By case analysis we reduce the conjecture to

Goal'4'
(IMPLIES (AND (CONSP (CONS X3 X4))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              X1 (CONSP (LIST* X1 X3 X4))
              (EQUAL 'TRS_S X1))
         (< (ACL2-COUNT X3)
            (+ 1 (ACL2-COUNT (CONS X3 X4))))).

This simplifies, using the :definition ACL2-COUNT, the :executable-
counterparts of EQUAL, NOT and SYMBOLP, primitive type reasoning and
the :rewrite rules CAR-CONS and CDR-CONS, to

Goal'5'
(< (ACL2-COUNT X3)
   (+ 1 1 (ACL2-COUNT X3)
      (ACL2-COUNT X4))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_ISSORT[A0].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_ISSORT[A0] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A0] X) T) (EQUAL (TRS_ISSORT[A0] X) NIL)). 
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISSORT[A0] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_ISSORT[A0]
ACL2 !>
Since TRS_ISSORT[A39] is non-recursive, its admission is trivial. 
We observe that the type of TRS_ISSORT[A39] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A39] X) T) (EQUAL (TRS_ISSORT[A39] X) NIL)).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_ISSORT[A39] ...)
Rules: ((:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISSORT[A39]
ACL2 !>
For the admission of TRS_ISSORT[A5] we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQ 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (O< (ACL2-COUNT (CADDR X))
             (ACL2-COUNT X))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQUAL 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (O< (ACL2-COUNT (CADDR X))
             (ACL2-COUNT X))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP and
O<, the :executable-counterpart of ACL2-COUNT, primitive type reasoning,
the :rewrite rule UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT,
to

Goal''
(IMPLIES (AND (CONSP X)
              (CONSP (CDR X))
              (CONSP (CDDR X))
              (EQUAL 'TRS_CONS (CAR X))
              (TRS_ISSORT[A0] (CADR X)))
         (< (ACL2-COUNT (CADDR X))
            (+ 1 1 (ACL2-COUNT (CADR X))
               (ACL2-COUNT (CDDR X))))).

The destructor terms (CAR X) and (CDR X) can be eliminated.  Furthermore,
those terms are at the root of a chain of three rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X by (CONS X1 X2), (CAR X)
by X1 and (CDR X) by X2 and restrict the type of the new variable X1
to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again, to
replace X2 by (CONS X3 X4), (CAR X2) by X3 and (CDR X2) by X4.  (3)
Finally, use CAR-CDR-ELIM to replace X4 by (CONS X5 X6), (CAR X4) by
X5 and (CDR X4) by X6.    These steps produce the following goal.

Goal'''
(IMPLIES (AND (CONSP (CONS X5 X6))
              (CONSP (LIST* X3 X5 X6))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              (NOT (EQUAL X1 NIL))
              (CONSP (LIST* X1 X3 X5 X6))
              (EQUAL 'TRS_CONS X1)
              (TRS_ISSORT[A0] X3))
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               (ACL2-COUNT (CONS X5 X6))))).

By case analysis we reduce the conjecture to

Goal'4'
(IMPLIES (AND (CONSP (CONS X5 X6))
              (CONSP (LIST* X3 X5 X6))
              (SYMBOLP X1)
              (NOT (EQUAL X1 T))
              X1 (CONSP (LIST* X1 X3 X5 X6))
              (EQUAL 'TRS_CONS X1)
              (TRS_ISSORT[A0] X3))
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               (ACL2-COUNT (CONS X5 X6))))).

This simplifies, using the :definition ACL2-COUNT, the :executable-
counterparts of EQUAL, NOT and SYMBOLP, primitive type reasoning and
the :rewrite rules CAR-CONS and CDR-CONS, to

Goal'5'
(IMPLIES (TRS_ISSORT[A0] X3)
         (< (ACL2-COUNT X5)
            (+ 1 1 (ACL2-COUNT X3)
               1 (ACL2-COUNT X5)
               (ACL2-COUNT X6)))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_ISSORT[A5].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_ISSORT[A5] is described by the theorem
(OR (EQUAL (TRS_ISSORT[A5] X) T) (EQUAL (TRS_ISSORT[A5] X) NIL)). 
We used the :executable-counterpart of EQUAL, primitive type reasoning
and the :type-prescription rule TRS_ISSORT[A0].

Summary
Form:  ( DEFUN TRS_ISSORT[A5] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_ISSORT[A0]))
Warnings:  None
Time:  0.02 seconds (prove: 0.00, print: 0.01, other: 0.01)
 TRS_ISSORT[A5]
ACL2 !>
For the admission of TRS_GE we will use the relation O< (which is known
to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X0).  The non-trivial part of the measure conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A0] X1))
              (NOT (EQ (CAR X1) 'TRS_0))
              (AND (EQ (CAR X0) 'TRS_S)
                   (EQ (CAR X1) 'TRS_S)))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A0] X1)
              (NOT (EQUAL (CAR X1) 'TRS_0))
              (EQUAL (CAR X0) 'TRS_S)
              (EQUAL (CAR X1) 'TRS_S))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (NOT (CDDR X0))
              (TRS_ISSORT[A0] X1)
              (EQUAL (CAR X0) 'TRS_S)
              (EQUAL (CAR X1) 'TRS_S))
         (< (ACL2-COUNT (CADR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_GE.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_GE is described by the theorem 
(AND (CONSP (TRS_GE X0 X1)) (TRUE-LISTP (TRS_GE X0 X1))).  

Summary
Form:  ( DEFUN TRS_GE ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_GE
ACL2 !>
Since TRS_EQUAL_SORT[A39] is non-recursive, its admission is trivial.
We observe that the type of TRS_EQUAL_SORT[A39] is described by the
theorem 
(AND (CONSP (TRS_EQUAL_SORT[A39] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A39] X0 X1))).

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A39] ...)
Rules: NIL
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_EQUAL_SORT[A39]
ACL2 !>
For the admission of TRS_EQUAL_SORT[A0] we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X0).  The non-trivial part of the measure
conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A0] X1))
              (NOT (AND (EQ (CAR X0) 'TRS_0)
                        (EQ (CAR X1) 'TRS_0)))
              (NOT (AND (EQ (CAR X0) 'TRS_0)
                        (EQ (CAR X1) 'TRS_S)))
              (NOT (AND (EQ (CAR X0) 'TRS_S)
                        (EQ (CAR X1) 'TRS_0)))
              T)
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A0] X1)
              (NOT (AND (EQUAL (CAR X0) 'TRS_0)
                        (EQUAL (CAR X1) 'TRS_0)))
              (NOT (AND (EQUAL (CAR X0) 'TRS_0)
                        (EQUAL (CAR X1) 'TRS_S)))
              (NOT (AND (EQUAL (CAR X0) 'TRS_S)
                        (EQUAL (CAR X1) 'TRS_0))))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A0], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rules COMMUTATIVITY-OF-+
and UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (EQUAL 'TRS_S (CAR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (NOT (CDDR X0))
              (TRS_ISSORT[A0] X1)
              (NOT (EQUAL (CAR X1) 'TRS_0)))
         (< (ACL2-COUNT (CADR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_EQUAL_SORT[A0].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_EQUAL_SORT[A0] is described by the theorem
(AND (CONSP (TRS_EQUAL_SORT[A0] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A0] X0 X1))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A0] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A0])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_EQUAL_SORT[A0]
ACL2 !>
Since TRS_ISA_FALSE is non-recursive, its admission is trivial.  We
observe that the type of TRS_ISA_FALSE is described by the theorem
(AND (CONSP (TRS_ISA_FALSE X0)) (TRUE-LISTP (TRS_ISA_FALSE X0))). 

Summary
Form:  ( DEFUN TRS_ISA_FALSE ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISA_FALSE
ACL2 !>
Since TRS_ISA_TRUE is non-recursive, its admission is trivial.  We
observe that the type of TRS_ISA_TRUE is described by the theorem 
(AND (CONSP (TRS_ISA_TRUE X0)) (TRUE-LISTP (TRS_ISA_TRUE X0))).  

Summary
Form:  ( DEFUN TRS_ISA_TRUE ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_ISA_TRUE
ACL2 !>
Since TRS_NOT is non-recursive, its admission is trivial.  We observe
that the type of TRS_NOT is described by the theorem 
(AND (CONSP (TRS_NOT X0)) (TRUE-LISTP (TRS_NOT X0))).  

Summary
Form:  ( DEFUN TRS_NOT ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_NOT
ACL2 !>
Since TRS_OR is non-recursive, its admission is trivial.  We observe
that the type of TRS_OR is described by the theorem 
(OR (AND (CONSP (TRS_OR X0 X1))
         (TRUE-LISTP (TRS_OR X0 X1)))
    (EQUAL (TRS_OR X0 X1) X1)).

Summary
Form:  ( DEFUN TRS_OR ...)
Rules: NIL
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_OR
ACL2 !>
Since TRS_AND is non-recursive, its admission is trivial.  We observe
that the type of TRS_AND is described by the theorem 
(OR (AND (CONSP (TRS_AND X0 X1))
         (TRUE-LISTP (TRS_AND X0 X1)))
    (EQUAL (TRS_AND X0 X1) X1)).

Summary
Form:  ( DEFUN TRS_AND ...)
Rules: NIL
Warnings:  None
Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
 TRS_AND
ACL2 !>
Since TRS_EQUAL_BOOL is non-recursive, its admission is trivial.  We
observe that the type of TRS_EQUAL_BOOL is described by the theorem
(AND (CONSP (TRS_EQUAL_BOOL X0 X1)) (TRUE-LISTP (TRS_EQUAL_BOOL X0 X1))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_EQUAL_BOOL ...)
Rules: ((:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.00, other: 0.01)
 TRS_EQUAL_BOOL
ACL2 !>
For the admission of TRS_IF1 we will use the relation O< (which is
known to be well-founded on the domain recognized by O-P) and the measure
(ACL2-COUNT X3).  The non-trivial part of the measure conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (AND (EQ (CAR X0) 'TRS_TRUE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))
     (IMPLIES (AND (AND (TRS_ISBOOL X0)
                        (TRS_ISSORT[A0] X1)
                        (TRS_ISSORT[A0] X2)
                        (TRS_ISSORT[A5] X3))
                   (NOT (AND (EQ (CAR X0) 'TRS_TRUE)
                             (EQ (CAR X3) 'TRS_NIL)))
                   (AND (EQ (CAR X0) 'TRS_FALSE)
                        (EQ (CAR X3) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X3))
                  (ACL2-COUNT X3)))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to the following two conjectures.

Subgoal 2
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_TRUE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (AND (EQUAL (CAR X0) 'TRS_TRUE)
                        (EQUAL (CAR X3) 'TRS_NIL)))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF1.  Thus,
we admit this function under the principle of definition.  We observe
that the type of TRS_IF1 is described by the theorem 
(AND (CONSP (TRS_IF1 X0 X1 X2 X3)) (TRUE-LISTP (TRS_IF1 X0 X1 X2 X3))).
We used the :executable-counterpart of EQUAL and primitive type reasoning.

Summary
Form:  ( DEFUN TRS_IF1 ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.00, other: 0.01)
 TRS_IF1
ACL2 !>
For the admission of TRS_IF1PRIME we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X3).  The non-trivial part of the measure conjecture
is

Goal
(IMPLIES (AND (AND (TRS_ISBOOL X0)
                   (TRS_ISSORT[A0] X1)
                   (TRS_ISSORT[A0] X2)
                   (TRS_ISSORT[A5] X3))
              (NOT (EQ (CAR X0) 'TRS_TRUE))
              (AND (EQ (CAR X0) 'TRS_FALSE)
                   (EQ (CAR X3) 'TRS_CONS)))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Goal'
(IMPLIES (AND (CONSP X0)
              (COND ((EQUAL 'TRS_TRUE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    ((EQUAL 'TRS_FALSE (CAR X0))
                     (EQUAL (CDR X0) NIL))
                    (T NIL))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (TRS_ISSORT[A5] X3)
              (NOT (EQUAL (CAR X0) 'TRS_TRUE))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X3))
             (ACL2-COUNT X3))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Goal''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 (ACL2-COUNT (CDR X3))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Goal'''
(IMPLIES (AND (CONSP X0)
              (NOT (CDR X0))
              (TRS_ISSORT[A0] X1)
              (TRS_ISSORT[A0] X2)
              (CONSP X3)
              (CONSP (CDR X3))
              (CONSP (CDDR X3))
              (TRS_ISSORT[A0] (CADR X3))
              (TRS_ISSORT[A5] (CADDR X3))
              (NOT (CDDDR X3))
              (EQUAL (CAR X0) 'TRS_FALSE)
              (EQUAL (CAR X3) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X3))
            (+ 1 1 (ACL2-COUNT (CADR X3))
               1 (ACL2-COUNT (CADDR X3))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_IF1PRIME. 
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_IF1PRIME is described by the theorem 
(AND (CONSP (TRS_IF1PRIME X0 X1 X2 X3))
     (TRUE-LISTP (TRS_IF1PRIME X0 X1 X2 X3))).

Summary
Form:  ( DEFUN TRS_IF1PRIME ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT))
Warnings:  None
Time:  0.01 seconds (prove: 0.00, print: 0.01, other: 0.00)
 TRS_IF1PRIME
ACL2 !>
For the admission of TRS_FILTERLOW we will use the relation O< (which
is known to be well-founded on the domain recognized by O-P) and the
measure (ACL2-COUNT X1).  The non-trivial part of the measure conjecture
is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                       '(TRS_TRUE))
                       '(TRS_FALSE)))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))
     (IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                        (TRS_ISSORT[A5] X1))
                   (NOT (EQ (CAR X1) 'TRS_NIL))
                   (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (O< (ACL2-COUNT (CADDR X1))
                  (ACL2-COUNT X1)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Subgoal 2'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE X0 (CADR X1))))
              (NOT (CDR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_TRUE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to the following three conjectures.

Subgoal 1.3
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (EQUAL 'TRS_TRUE
                     (CAR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.2
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (CDR (TRS_GE X0 (CADR X1))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1.1
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL (CAR X1) 'TRS_CONS)
              (NOT (EQUAL 'TRS_FALSE
                          (CAR (TRS_GE X0 (CADR X1))))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERLOW.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERLOW is described by the theorem
(AND (CONSP (TRS_FILTERLOW X0 X1)) (TRUE-LISTP (TRS_FILTERLOW X0 X1))).
We used primitive type reasoning.

Summary
Form:  ( DEFUN TRS_FILTERLOW ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_FILTERLOW
ACL2 !>
For the admission of TRS_FILTERLOWPRIME we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X1).  The non-trivial part of the measure
conjecture is

Goal
(IMPLIES (AND (AND (TRS_ISSORT[A0] X0)
                   (TRS_ISSORT[A5] X1))
              (NOT (EQ (CAR X1) 'TRS_NIL))
              (NOT (AND (EQ (CAR X1) 'TRS_CONS)
                        (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                            '(TRS_TRUE))
                            '(TRS_TRUE))))
              (EQ (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                  '(TRS_TRUE))
                  '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (TRS_ISSORT[A5] X1)
              (NOT (EQUAL (CAR X1) 'TRS_NIL))
              (NOT (AND (EQUAL (CAR X1) 'TRS_CONS)
                        (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                               '(TRS_TRUE))
                               '(TRS_TRUE))))
              (EQUAL (TRS_EQUAL_BOOL (TRS_GE X0 (CADR X1))
                                     '(TRS_TRUE))
                     '(TRS_FALSE)))
         (O< (ACL2-COUNT (CADDR X1))
             (ACL2-COUNT X1))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<,
TRS_EQUAL_BOOL, TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterparts
of ACL2-COUNT, CAR, EQUAL and TRS_ISBOOL, primitive type reasoning,
the :rewrite rules COMMUTATIVITY-OF-+ and UNICITY-OF-0 and the :type-
prescription rules ACL2-COUNT and TRS_GE, to

Goal''
(IMPLIES (AND (TRS_ISSORT[A0] X0)
              (CONSP X1)
              (CONSP (CDR X1))
              (CONSP (CDDR X1))
              (EQUAL 'TRS_CONS (CAR X1))
              (TRS_ISSORT[A0] (CADR X1))
              (TRS_ISSORT[A5] (CADDR X1))
              (NOT (CDDDR X1))
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE X0 (CADR X1))))
              (NOT (CDR (TRS_GE X0 (CADR X1)))))
         (< (ACL2-COUNT (CADDR X1))
            (+ 1 1 (ACL2-COUNT (CADR X1))
               1 (ACL2-COUNT (CADDR X1))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_FILTERLOWPRIME.
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_FILTERLOWPRIME is described by the theorem
(AND (CONSP (TRS_FILTERLOWPRIME X0 X1))
     (TRUE-LISTP (TRS_FILTERLOWPRIME X0 X1))).

Summary
Form:  ( DEFUN TRS_FILTERLOWPRIME ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_EQUAL_BOOL)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART CAR)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART TRS_ISBOOL)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_GE))
Warnings:  None
Time:  0.01 seconds (prove: 0.01, print: 0.00, other: 0.00)
 TRS_FILTERLOWPRIME
ACL2 !>
For the admission of TRS_EQUAL_SORT[A5] we will use the relation O<
(which is known to be well-founded on the domain recognized by O-P)
and the measure (ACL2-COUNT X0).  The non-trivial part of the measure
conjecture is

Goal
(AND (IMPLIES (AND (AND (TRS_ISSORT[A5] X0)
                        (TRS_ISSORT[A5] X1))
                   (AND (EQ (CAR X0) 'TRS_CONS)
                        (EQ (CAR X1) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADDR X0))
                  (ACL2-COUNT X0)))
     (IMPLIES (AND (AND (TRS_ISSORT[A5] X0)
                        (TRS_ISSORT[A5] X1))
                   (AND (EQ (CAR X0) 'TRS_CONS)
                        (EQ (CAR X1) 'TRS_CONS)))
              (O< (ACL2-COUNT (CADR X0))
                  (ACL2-COUNT X0)))).

By the simple :definition EQ we reduce the conjecture to the following
two conjectures.

Subgoal 2
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (O< (ACL2-COUNT (CADDR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions ACL2-COUNT, FIX, O-FINP, O<
and TRS_ISSORT[A5], the :executable-counterparts of ACL2-COUNT and
EQUAL, primitive type reasoning, the :rewrite rule UNICITY-OF-0 and
the :type-prescription rule ACL2-COUNT, to

Subgoal 2'
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (CONSP (CDDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (TRS_ISSORT[A5] (CADDR X0))
              (NOT (CDDDR X0))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X0))
            (+ 1 (ACL2-COUNT (CDR X0))))).

This simplifies, using the :definitions ACL2-COUNT and FIX, the :executable-
counterpart of ACL2-COUNT, the :rewrite rules COMMUTATIVITY-OF-+ and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 2''
(IMPLIES (AND (CONSP X0)
              (CONSP (CDR X0))
              (CONSP (CDDR X0))
              (TRS_ISSORT[A0] (CADR X0))
              (TRS_ISSORT[A5] (CADDR X0))
              (NOT (CDDDR X0))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADDR X0))
            (+ 1 1 (ACL2-COUNT (CADR X0))
               1 (ACL2-COUNT (CADDR X0))))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Subgoal 1
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (O< (ACL2-COUNT (CADR X0))
             (ACL2-COUNT X0))).

This simplifies, using the :definitions O-FINP and O< and the :type-
prescription rule ACL2-COUNT, to

Subgoal 1'
(IMPLIES (AND (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADR X0))
            (ACL2-COUNT X0))).

The destructor terms (CAR X0) and (CDR X0) can be eliminated.  Furthermore,
those terms are at the root of a chain of two rounds of destructor
elimination. (1) Use CAR-CDR-ELIM to replace X0 by (CONS X2 X3), (CAR X0)
by X2 and (CDR X0) by X3 and restrict the type of the new variable
X2 to be that of the term it replaces.  (2) Use CAR-CDR-ELIM, again,
to replace X3 by (CONS X4 X5), (CAR X3) by X4 and (CDR X3) by X5. 
  These steps produce the following three goals.

Subgoal 1.3
(IMPLIES (AND (NOT (CONSP X0))
              (TRS_ISSORT[A5] X0)
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X0) 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CADR X0))
            (ACL2-COUNT X0))).

But we reduce the conjecture to T, by primitive type reasoning.

Subgoal 1.2
(IMPLIES (AND (NOT (CONSP X3))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              (NOT (EQUAL X2 NIL))
              (CONSP (CONS X2 X3))
              (TRS_ISSORT[A5] (CONS X2 X3))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CAR X3))
            (ACL2-COUNT (CONS X2 X3)))).

By case analysis we reduce the conjecture to

Subgoal 1.2'
(IMPLIES (AND (NOT (CONSP X3))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              X2 (CONSP (CONS X2 X3))
              (TRS_ISSORT[A5] (CONS X2 X3))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT (CAR X3))
            (ACL2-COUNT (CONS X2 X3)))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterparts of EQUAL, NOT and SYMBOLP, primitive type
reasoning and the :rewrite rules CAR-CONS and CDR-CONS.

Subgoal 1.1
(IMPLIES (AND (CONSP (CONS X4 X5))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              (NOT (EQUAL X2 NIL))
              (CONSP (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (ACL2-COUNT (LIST* X2 X4 X5)))).

By case analysis we reduce the conjecture to

Subgoal 1.1'
(IMPLIES (AND (CONSP (CONS X4 X5))
              (SYMBOLP X2)
              (NOT (EQUAL X2 T))
              X2 (CONSP (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] (LIST* X2 X4 X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL X2 'TRS_CONS)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (ACL2-COUNT (LIST* X2 X4 X5)))).

This simplifies, using the :definitions ACL2-COUNT, FIX and TRS_ISSORT[A5],
the :executable-counterparts of ACL2-COUNT, EQUAL, NOT and SYMBOLP,
primitive type reasoning, the :rewrite rules CAR-CONS, CDR-CONS and
UNICITY-OF-0 and the :type-prescription rule ACL2-COUNT, to

Subgoal 1.1''
(IMPLIES (AND (CONSP X5)
              (TRS_ISSORT[A0] X4)
              (TRS_ISSORT[A5] (CAR X5))
              (NOT (CDR X5))
              (TRS_ISSORT[A5] X1)
              (EQUAL (CAR X1) 'TRS_CONS))
         (< (ACL2-COUNT X4)
            (+ 1 1 (ACL2-COUNT X4)
               (ACL2-COUNT X5)))).

But simplification reduces this to T, using linear arithmetic, primitive
type reasoning and the :type-prescription rule ACL2-COUNT.

Q.E.D.

That completes the proof of the measure theorem for TRS_EQUAL_SORT[A5].
Thus, we admit this function under the principle of definition.  We
observe that the type of TRS_EQUAL_SORT[A5] is described by the theorem
(AND (CONSP (TRS_EQUAL_SORT[A5] X0 X1))
     (TRUE-LISTP (TRS_EQUAL_SORT[A5] X0 X1))).
We used the :executable-counterpart of EQUAL, primitive type reasoning
and the :type-prescription rule TRS_AND.

Summary
Form:  ( DEFUN TRS_EQUAL_SORT[A5] ...)
Rules: ((:DEFINITION ACL2-COUNT)
        (:DEFINITION EQ)
        (:DEFINITION FIX)
        (:DEFINITION NOT)
        (:DEFINITION O-FINP)
        (:DEFINITION O<)
        (:DEFINITION TRS_ISSORT[A5])
        (:ELIM CAR-CDR-ELIM)
        (:EXECUTABLE-COUNTERPART ACL2-COUNT)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:EXECUTABLE-COUNTERPART NOT)
        (:EXECUTABLE-COUNTERPART SYMBOLP)
        (:FAKE-RUNE-FOR-LINEAR NIL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:REWRITE COMMUTATIVITY-OF-+)
        (:REWRITE UNICITY-OF-0)
        (:TYPE-PRESCRIPTION ACL2-COUNT)
        (:TYPE-PRESCRIPTION TRS_AND))
Warnings:  None
Time:  0.02 seconds (prove: 0.01, print: 0.01, other: 0.00)
 TRS_EQUAL_SORT[A5]
ACL2 !>
[Note:  A hint was supplied for our processing of the goal above. 
Thanks!]

By the simple :definition EQ we reduce the conjecture to

Goal'
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X0)
                              TRS_X0
                              TRS_X0 (LIST 'TRS_CONS TRS_X1 TRS_X2))
                '(TRS_TRUE))).

This simplifies, using the :definitions TRS_IF1PRIME, TRS_ISBOOL and
TRS_ISSORT[A5], the :executable-counterpart of EQUAL, primitive type
reasoning, the :rewrite rules CAR-CONS and CDR-CONS and the :type-
prescription rules TRS_GE, TRS_ISSORT[A0] and TRS_ISSORT[A5], to

Goal''
(IMPLIES (AND (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

Name the formula above *1.

Perhaps we can prove *1 by induction.  Nine induction schemes are suggested
by this conjecture.  Subsumption reduces that number to eight.  These
merge into four derived induction schemes.  However, one of these is
flawed and so we are left with three viable candidates.  By considering
those suggested by the largest number of non-primitive recursive functions,
we narrow the field to one.  

We will induct according to a scheme suggested by 
(TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1) TRS_X0 TRS_X1 TRS_X2).  This suggestion
was produced using the :induction rules TRS_IF1PRIME and TRS_ISSORT[A5].
If we let (:P TRS_X0 TRS_X1 TRS_X2) denote *1 above then the induction
scheme we'll use is
(AND (IMPLIES (NOT (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2)))
              (:P TRS_X0 TRS_X1 TRS_X2))
     (IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2))
                   (NOT (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                            'TRS_TRUE))
                   (NOT (AND (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                                 'TRS_FALSE)
                             (EQ (CAR TRS_X2) 'TRS_CONS)))
                   T)
              (:P TRS_X0 TRS_X1 TRS_X2))
     (IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2))
                   (NOT (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                            'TRS_TRUE))
                   (AND (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                            'TRS_FALSE)
                        (EQ (CAR TRS_X2) 'TRS_CONS))
                   (:P TRS_X0 (CADR TRS_X2)
                       (CADDR TRS_X2)))
              (:P TRS_X0 TRS_X1 TRS_X2))
     (IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2))
                   (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_TRUE))
              (:P TRS_X0 TRS_X1 TRS_X2))).
This induction is justified by the same argument used to admit TRS_IF1PRIME.
Note, however, that the unmeasured variable TRS_X1 is being instantiated.
When applied to the goal at hand the above induction scheme produces
eight nontautological subgoals.

Subgoal *1/8
(IMPLIES (AND (NOT (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                        (TRS_ISSORT[A0] TRS_X0)
                        (TRS_ISSORT[A0] TRS_X1)
                        (TRS_ISSORT[A5] TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_IF1PRIME,
TRS_ISBOOL and TRS_ISSORT[A5], the :executable-counterpart of EQUAL,
primitive type reasoning and the :type-prescription rules TRS_GE, 
TRS_ISSORT[A0] and TRS_ISSORT[A5].

Subgoal *1/7
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_TRUE))
              (NOT (AND (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                            'TRS_FALSE)
                        (EQ (CAR TRS_X2) 'TRS_CONS)))
              T (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/7'
(IMPLIES (AND (CONSP (TRS_GE TRS_X0 TRS_X1))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                          'TRS_TRUE))
              (NOT (AND (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                               'TRS_FALSE)
                        (EQUAL (CAR TRS_X2) 'TRS_CONS)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterparts of CONSP and EQUAL,
primitive type reasoning and the :type-prescription rule TRS_GE.

Subgoal *1/6
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 (CADR TRS_X2))
                                   TRS_X0 (CADR TRS_X2)
                                   (CADDR TRS_X2))
                     '(TRS_TRUE))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/6'
(IMPLIES (AND (CONSP (TRS_GE TRS_X0 TRS_X1))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 (CADR TRS_X2))
                                   TRS_X0 (CADR TRS_X2)
                                   (CADDR TRS_X2))
                     '(TRS_TRUE))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterpart of EQUAL, primitive
type reasoning and the :type-prescription rule TRS_GE.

Subgoal *1/5
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (NOT (TRS_ISSORT[A5] (CADDR TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/5'
(IMPLIES (AND (CONSP (TRS_GE TRS_X0 TRS_X1))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (NOT (TRS_ISSORT[A5] (CADDR TRS_X2)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterpart of EQUAL, primitive type reasoning and
the :type-prescription rule TRS_GE.

Subgoal *1/4
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (NOT (TRS_ISSORT[A0] (CADR TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/4'
(IMPLIES (AND (CONSP (TRS_GE TRS_X0 TRS_X1))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (NOT (TRS_ISSORT[A0] (CADR TRS_X2)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definition TRS_ISSORT[A5],
the :executable-counterpart of EQUAL, primitive type reasoning and
the :type-prescription rule TRS_GE.

Subgoal *1/3
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (NOT (TRS_ISSORT[A0] (CADDR TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/3'
(IMPLIES (AND (CONSP (TRS_GE TRS_X0 TRS_X1))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (NOT (TRS_ISSORT[A0] (CADDR TRS_X2)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterpart of EQUAL, primitive
type reasoning and the :type-prescription rule TRS_GE.

Subgoal *1/2
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (NOT (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_TRUE))
              (AND (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                       'TRS_FALSE)
                   (EQ (CAR TRS_X2) 'TRS_CONS))
              (NOT (TRS_ISSORT[A5] (CADR TRS_X2)))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/2'
(IMPLIES (AND (CONSP (TRS_GE TRS_X0 TRS_X1))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (NOT (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                          'TRS_TRUE))
              (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                     'TRS_FALSE)
              (EQUAL (CAR TRS_X2) 'TRS_CONS)
              (NOT (TRS_ISSORT[A5] (CADR TRS_X2)))
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterpart of EQUAL, primitive
type reasoning and the :type-prescription rule TRS_GE.

Subgoal *1/1
(IMPLIES (AND (AND (TRS_ISBOOL (TRS_GE TRS_X0 TRS_X1))
                   (TRS_ISSORT[A0] TRS_X0)
                   (TRS_ISSORT[A0] TRS_X1)
                   (TRS_ISSORT[A5] TRS_X2))
              (EQ (CAR (TRS_GE TRS_X0 TRS_X1))
                  'TRS_TRUE)
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0)))
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

By the simple :definitions EQ and TRS_ISBOOL we reduce the conjecture
to

Subgoal *1/1'
(IMPLIES (AND (CONSP (TRS_GE TRS_X0 TRS_X1))
              (COND ((EQUAL 'TRS_TRUE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    ((EQUAL 'TRS_FALSE
                            (CAR (TRS_GE TRS_X0 TRS_X1)))
                     (EQUAL (CDR (TRS_GE TRS_X0 TRS_X1))
                            NIL))
                    (T NIL))
              (TRS_ISSORT[A0] TRS_X0)
              (TRS_ISSORT[A0] TRS_X1)
              (TRS_ISSORT[A5] TRS_X2)
              (EQUAL (CAR (TRS_GE TRS_X0 TRS_X1))
                     'TRS_TRUE)
              (TRS_ISSORT[A5] TRS_X1)
              (TRS_ISSORT[A0] TRS_X2)
              (EQUAL 'TRS_FALSE
                     (CAR (TRS_GE TRS_X0 TRS_X0)))
              (NOT (CDR (TRS_GE TRS_X0 TRS_X0))))
         (EQUAL (TRS_IF1PRIME (TRS_GE TRS_X0 TRS_X1)
                              TRS_X0 TRS_X1 TRS_X2)
                '(TRS_TRUE))).

But simplification reduces this to T, using the :definitions TRS_ISSORT[A0]
and TRS_ISSORT[A5], the :executable-counterparts of CONSP and EQUAL,
primitive type reasoning and the :type-prescription rule TRS_GE.

That completes the proof of *1.

Q.E.D.

Summary
Form:  ( DEFTHM TEST ...)
Rules: ((:DEFINITION EQ)
        (:DEFINITION NOT)
        (:DEFINITION TRS_IF1PRIME)
        (:DEFINITION TRS_ISBOOL)
        (:DEFINITION TRS_ISSORT[A0])
        (:DEFINITION TRS_ISSORT[A5])
        (:EXECUTABLE-COUNTERPART CONSP)
        (:EXECUTABLE-COUNTERPART EQUAL)
        (:FAKE-RUNE-FOR-TYPE-SET NIL)
        (:INDUCTION TRS_IF1PRIME)
        (:INDUCTION TRS_ISSORT[A5])
        (:REWRITE CAR-CONS)
        (:REWRITE CDR-CONS)
        (:TYPE-PRESCRIPTION TRS_GE)
        (:TYPE-PRESCRIPTION TRS_ISSORT[A0])
        (:TYPE-PRESCRIPTION TRS_ISSORT[A5]))
Warnings:  None
Time:  0.06 seconds (prove: 0.04, print: 0.02, other: 0.00)
 TEST
ACL2 !>Bye.

(129) Complex Obligation (AND)

(130) Obligation:

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

ge(x, 0) → true
ge(s(x), s(y)) → ge(x, y)
if1(true, n, x, xs) → filterlow(n, xs)
filterlow(n, cons(x, xs)) → if1(ge(n, x), n, x, xs)
if1(false, n, x, xs) → cons(x, filterlow(n, xs))
filterlow(n, nil) → nil
ge(0, s(x)) → false

The set Q consists of the following terms:

filterlow(x0, nil)
filterlow(x0, cons(x1, x2))
if1(true, x0, x1, x2)
if1(false, x0, x1, x2)
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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

(131) PisEmptyProof (EQUIVALENT transformation)

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

(132) YES

(133) Obligation:

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

if1'(true, n6, x12, xs4) → true
filterlow'(n11, cons(x19, xs8)) → if1'(ge(n11, x19), n11, x19, xs8)
if1'(false, n16, x26, xs12) → filterlow'(n16, xs12)
filterlow'(n21, nil) → false
ge(x, 0) → true
ge(s(x5), s(y')) → ge(x5, y')
if1(true, n6, x12, xs4) → filterlow(n6, xs4)
filterlow(n11, cons(x19, xs8)) → if1(ge(n11, x19), n11, x19, xs8)
if1(false, n16, x26, xs12) → cons(x26, filterlow(n16, xs12))
filterlow(n21, nil) → nil
ge(0, s(x39)) → false
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a39](witness_sort[a39], witness_sort[a39]) → true

Q is empty.

(134) QTRSRRRProof (EQUIVALENT transformation)

Used ordering:
Combined order from the following AFS and order.
if1'(x1, x2, x3, x4)  =  if1'(x1, x2, x3, x4)
true  =  true
filterlow'(x1, x2)  =  filterlow'(x1, x2)
cons(x1, x2)  =  cons(x1, x2)
ge(x1, x2)  =  ge(x1, x2)
false  =  false
nil  =  nil
0  =  0
s(x1)  =  s(x1)
if1(x1, x2, x3, x4)  =  if1(x1, x2, x3, x4)
filterlow(x1, x2)  =  filterlow(x1, x2)
equal_bool(x1, x2)  =  equal_bool(x1, x2)
and(x1, x2)  =  and(x1, x2)
or(x1, x2)  =  or(x1, x2)
not(x1)  =  x1
isa_true(x1)  =  isa_true(x1)
isa_false(x1)  =  isa_false(x1)
equal_sort[a0](x1, x2)  =  equal_sort[a0](x1, x2)
equal_sort[a5](x1, x2)  =  equal_sort[a5](x1, x2)
equal_sort[a39](x1, x2)  =  equal_sort[a39](x1, x2)
witness_sort[a39]  =  witness_sort[a39]

Recursive path order with status [RPO].
Quasi-Precedence:
s1 > equalsort[a0]2 > [if1'4, true, filterlow'2, false, 0, equalsort[a39]2, witnesssort[a39]] > [if14, filterlow2] > cons2 > and2
s1 > equalsort[a0]2 > [if1'4, true, filterlow'2, false, 0, equalsort[a39]2, witnesssort[a39]] > [if14, filterlow2] > ge2
isafalse1 > [if1'4, true, filterlow'2, false, 0, equalsort[a39]2, witnesssort[a39]] > [if14, filterlow2] > cons2 > and2
isafalse1 > [if1'4, true, filterlow'2, false, 0, equalsort[a39]2, witnesssort[a39]] > [if14, filterlow2] > ge2
equalsort[a5]2 > [if1'4, true, filterlow'2, false, 0, equalsort[a39]2, witnesssort[a39]] > [if14, filterlow2] > cons2 > and2
equalsort[a5]2 > [if1'4, true, filterlow'2, false, 0, equalsort[a39]2, witnesssort[a39]] > [if14, filterlow2] > ge2

Status:
if1'4: [4,2,1,3]
true: multiset
filterlow'2: [2,1]
cons2: multiset
ge2: [1,2]
false: multiset
nil: multiset
0: multiset
s1: [1]
if14: [2,4,3,1]
filterlow2: [1,2]
equalbool2: multiset
and2: multiset
or2: [2,1]
isatrue1: multiset
isafalse1: multiset
equalsort[a0]2: multiset
equalsort[a5]2: [1,2]
equalsort[a39]2: [2,1]
witnesssort[a39]: multiset

With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly:

if1'(true, n6, x12, xs4) → true
filterlow'(n11, cons(x19, xs8)) → if1'(ge(n11, x19), n11, x19, xs8)
if1'(false, n16, x26, xs12) → filterlow'(n16, xs12)
filterlow'(n21, nil) → false
ge(x, 0) → true
ge(s(x5), s(y')) → ge(x5, y')
if1(true, n6, x12, xs4) → filterlow(n6, xs4)
filterlow(n11, cons(x19, xs8)) → if1(ge(n11, x19), n11, x19, xs8)
if1(false, n16, x26, xs12) → cons(x26, filterlow(n16, xs12))
filterlow(n21, nil) → nil
ge(0, s(x39)) → false
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a39](witness_sort[a39], witness_sort[a39]) → true


(135) Obligation:

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

not(false) → true
not(true) → false

Q is empty.

(136) QTRSRRRProof (EQUIVALENT transformation)

Used ordering:
Polynomial interpretation [POLO]:

POL(false) = 1   
POL(not(x1)) = 2 + 2·x1   
POL(true) = 2   
With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly:

not(false) → true
not(true) → false


(137) Obligation:

Q restricted rewrite system:
R is empty.
Q is empty.

(138) RisEmptyProof (EQUIVALENT transformation)

The TRS R is empty. Hence, termination is trivially proven.

(139) YES

(140) Obligation:

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

filterlow'(n5, cons(x13, xs3)) → if1'(ge(n5, x13), n5, x13, xs3)
if1'(true, n10, x21, xs7) → true
if1'(false, n15, x29, xs11) → filterlow'(n15, xs11)
filterlow'(n20, nil) → false
ge(x, 0) → true
ge(s(x5), s(y')) → ge(x5, y')
filterlow(n5, cons(x13, xs3)) → if1(ge(n5, x13), n5, x13, xs3)
if1(true, n10, x21, xs7) → filterlow(n10, xs7)
if1(false, n15, x29, xs11) → cons(x29, filterlow(n15, xs11))
filterlow(n20, nil) → nil
ge(0, s(x44)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x66))) → s(half(x66))
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a44](witness_sort[a44], witness_sort[a44]) → true

Q is empty.

(141) QTRSRRRProof (EQUIVALENT transformation)

Used ordering:
Combined order from the following AFS and order.
filterlow'(x1, x2)  =  filterlow'(x1, x2)
cons(x1, x2)  =  cons(x1, x2)
if1'(x1, x2, x3, x4)  =  if1'(x1, x2, x3, x4)
ge(x1, x2)  =  ge(x1, x2)
true  =  true
false  =  false
nil  =  nil
0  =  0
s(x1)  =  x1
filterlow(x1, x2)  =  filterlow(x1, x2)
if1(x1, x2, x3, x4)  =  if1(x1, x2, x3, x4)
half(x1)  =  half(x1)
equal_bool(x1, x2)  =  equal_bool(x1, x2)
and(x1, x2)  =  and(x1, x2)
or(x1, x2)  =  or(x1, x2)
not(x1)  =  not(x1)
isa_true(x1)  =  isa_true(x1)
isa_false(x1)  =  isa_false(x1)
equal_sort[a0](x1, x2)  =  equal_sort[a0](x1, x2)
equal_sort[a5](x1, x2)  =  equal_sort[a5](x1, x2)
equal_sort[a44](x1, x2)  =  equal_sort[a44](x1, x2)
witness_sort[a44]  =  witness_sort[a44]

Recursive path order with status [RPO].
Quasi-Precedence:
[filterlow2, if14] > cons2 > [filterlow'2, if1'4] > false > [ge2, true]
[filterlow2, if14] > cons2 > equalsort[a5]2 > and2 > false > [ge2, true]
[filterlow2, if14] > nil > false > [ge2, true]
half1 > 0 > false > [ge2, true]
equalbool2 > false > [ge2, true]
or2 > [ge2, true]
not1 > false > [ge2, true]
isatrue1 > false > [ge2, true]
isafalse1 > false > [ge2, true]
equalsort[a0]2 > false > [ge2, true]
equalsort[a44]2 > [ge2, true]

Status:
filterlow'2: [2,1]
cons2: multiset
if1'4: [4,2,3,1]
ge2: multiset
true: multiset
false: multiset
nil: multiset
0: multiset
filterlow2: [2,1]
if14: [4,2,1,3]
half1: multiset
equalbool2: multiset
and2: multiset
or2: multiset
not1: [1]
isatrue1: multiset
isafalse1: [1]
equalsort[a0]2: [2,1]
equalsort[a5]2: [2,1]
equalsort[a44]2: [2,1]
witnesssort[a44]: multiset

With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly:

filterlow'(n5, cons(x13, xs3)) → if1'(ge(n5, x13), n5, x13, xs3)
if1'(true, n10, x21, xs7) → true
if1'(false, n15, x29, xs11) → filterlow'(n15, xs11)
filterlow'(n20, nil) → false
ge(x, 0) → true
filterlow(n5, cons(x13, xs3)) → if1(ge(n5, x13), n5, x13, xs3)
if1(true, n10, x21, xs7) → filterlow(n10, xs7)
if1(false, n15, x29, xs11) → cons(x29, filterlow(n15, xs11))
filterlow(n20, nil) → nil
ge(0, s(x44)) → false
half(0) → 0
half(s(0)) → 0
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a44](witness_sort[a44], witness_sort[a44]) → true


(142) Obligation:

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

ge(s(x5), s(y')) → ge(x5, y')
half(s(s(x66))) → s(half(x66))
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)

Q is empty.

(143) QTRSRRRProof (EQUIVALENT transformation)

Used ordering:
Polynomial interpretation [POLO]:

POL(equal_sort[a0](x1, x2)) = x1 + x2   
POL(ge(x1, x2)) = x1 + x2   
POL(half(x1)) = x1   
POL(s(x1)) = 1 + x1   
With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly:

ge(s(x5), s(y')) → ge(x5, y')
half(s(s(x66))) → s(half(x66))
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)


(144) Obligation:

Q restricted rewrite system:
R is empty.
Q is empty.

(145) RisEmptyProof (EQUIVALENT transformation)

The TRS R is empty. Hence, termination is trivially proven.

(146) YES

(147) Obligation:

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

if2'(true, n82, x105, xs61) → true
filterhigh'(n91, cons(x116, xs68)) → if2'(ge(x116, n91), n91, x116, xs68)
if2'(false, n100, x127, xs75) → filterhigh'(n100, xs75)
filterhigh'(n109, nil) → false
ge(x, 0) → true
ge(s(x9), s(y')) → ge(x9, y')
if1(true, n14, x20, xs10) → filterlow(n14, xs10)
filterlow(n23, cons(x31, xs17)) → if1(ge(n23, x31), n23, x31, xs17)
if1(false, n32, x42, xs24) → cons(x42, filterlow(n32, xs24))
filterlow(n41, nil) → nil
ge(0, s(x63)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x94))) → s(half(x94))
if2(true, n82, x105, xs61) → filterhigh(n82, xs61)
filterhigh(n91, cons(x116, xs68)) → if2(ge(x116, n91), n91, x116, xs68)
if2(false, n100, x127, xs75) → cons(x127, filterhigh(n100, xs75))
filterhigh(n109, nil) → nil
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a65](witness_sort[a65], witness_sort[a65]) → true

Q is empty.

(148) QTRSRRRProof (EQUIVALENT transformation)

Used ordering:
Combined order from the following AFS and order.
if2'(x1, x2, x3, x4)  =  if2'(x1, x2, x3, x4)
true  =  true
filterhigh'(x1, x2)  =  filterhigh'(x1, x2)
cons(x1, x2)  =  cons(x1, x2)
ge(x1, x2)  =  ge(x1, x2)
false  =  false
nil  =  nil
0  =  0
s(x1)  =  s(x1)
if1(x1, x2, x3, x4)  =  if1(x1, x2, x3, x4)
filterlow(x1, x2)  =  filterlow(x1, x2)
half(x1)  =  x1
if2(x1, x2, x3, x4)  =  if2(x1, x2, x3, x4)
filterhigh(x1, x2)  =  filterhigh(x1, x2)
equal_bool(x1, x2)  =  equal_bool(x1, x2)
and(x1, x2)  =  and(x1, x2)
or(x1, x2)  =  or(x1, x2)
not(x1)  =  not(x1)
isa_true(x1)  =  x1
isa_false(x1)  =  x1
equal_sort[a0](x1, x2)  =  equal_sort[a0](x1, x2)
equal_sort[a5](x1, x2)  =  equal_sort[a5](x1, x2)
equal_sort[a65](x1, x2)  =  equal_sort[a65](x1, x2)
witness_sort[a65]  =  witness_sort[a65]

Recursive path order with status [RPO].
Quasi-Precedence:
nil > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
nil > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
nil > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
nil > [true, false, equalsort[a0]2, equalsort[a5]2] > and2
0 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
0 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
0 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
0 > [true, false, equalsort[a0]2, equalsort[a5]2] > and2
[if24, filterhigh2] > cons2
[if24, filterhigh2] > ge2
equalbool2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
equalbool2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
equalbool2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
equalbool2 > [true, false, equalsort[a0]2, equalsort[a5]2] > and2
or2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
or2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
or2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
or2 > [true, false, equalsort[a0]2, equalsort[a5]2] > and2
witnesssort[a65] > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
witnesssort[a65] > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
witnesssort[a65] > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
witnesssort[a65] > [true, false, equalsort[a0]2, equalsort[a5]2] > and2

Status:
if2'4: [4,2,3,1]
true: multiset
filterhigh'2: [2,1]
cons2: [2,1]
ge2: multiset
false: multiset
nil: multiset
0: multiset
s1: [1]
if14: [2,4,1,3]
filterlow2: [1,2]
if24: [2,4,3,1]
filterhigh2: [1,2]
equalbool2: [2,1]
and2: [2,1]
or2: [2,1]
not1: [1]
equalsort[a0]2: [1,2]
equalsort[a5]2: [1,2]
equalsort[a65]2: [2,1]
witnesssort[a65]: multiset

With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly:

if2'(true, n82, x105, xs61) → true
filterhigh'(n91, cons(x116, xs68)) → if2'(ge(x116, n91), n91, x116, xs68)
if2'(false, n100, x127, xs75) → filterhigh'(n100, xs75)
filterhigh'(n109, nil) → false
ge(x, 0) → true
ge(s(x9), s(y')) → ge(x9, y')
if1(true, n14, x20, xs10) → filterlow(n14, xs10)
filterlow(n23, cons(x31, xs17)) → if1(ge(n23, x31), n23, x31, xs17)
if1(false, n32, x42, xs24) → cons(x42, filterlow(n32, xs24))
filterlow(n41, nil) → nil
ge(0, s(x63)) → false
half(s(0)) → 0
half(s(s(x94))) → s(half(x94))
if2(true, n82, x105, xs61) → filterhigh(n82, xs61)
filterhigh(n91, cons(x116, xs68)) → if2(ge(x116, n91), n91, x116, xs68)
if2(false, n100, x127, xs75) → cons(x127, filterhigh(n100, xs75))
filterhigh(n109, nil) → nil
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a65](witness_sort[a65], witness_sort[a65]) → true


(149) Obligation:

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

half(0) → 0
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true

Q is empty.

(150) QTRSRRRProof (EQUIVALENT transformation)

Used ordering:
Polynomial interpretation [POLO]:

POL(0) = 1   
POL(false) = 2   
POL(half(x1)) = 2 + 2·x1   
POL(isa_false(x1)) = 2 + 2·x1   
POL(isa_true(x1)) = 1 + 2·x1   
POL(true) = 1   
With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly:

half(0) → 0
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true


(151) Obligation:

Q restricted rewrite system:
R is empty.
Q is empty.

(152) RisEmptyProof (EQUIVALENT transformation)

The TRS R is empty. Hence, termination is trivially proven.

(153) YES

(154) Obligation:

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

if2'(true, n82, x105, xs61) → true
filterhigh'(n91, cons(x116, xs68)) → if2'(ge(x116, n91), n91, x116, xs68)
if2'(false, n100, x127, xs75) → filterhigh'(n100, xs75)
filterhigh'(n109, nil) → false
ge(x, 0) → true
ge(s(x9), s(y')) → ge(x9, y')
if1(true, n14, x20, xs10) → filterlow(n14, xs10)
filterlow(n23, cons(x31, xs17)) → if1(ge(n23, x31), n23, x31, xs17)
if1(false, n32, x42, xs24) → cons(x42, filterlow(n32, xs24))
filterlow(n41, nil) → nil
ge(0, s(x63)) → false
half(0) → 0
half(s(0)) → 0
half(s(s(x94))) → s(half(x94))
if2(true, n82, x105, xs61) → filterhigh(n82, xs61)
filterhigh(n91, cons(x116, xs68)) → if2(ge(x116, n91), n91, x116, xs68)
if2(false, n100, x127, xs75) → cons(x127, filterhigh(n100, xs75))
filterhigh(n109, nil) → nil
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a67](witness_sort[a67], witness_sort[a67]) → true

Q is empty.

(155) QTRSRRRProof (EQUIVALENT transformation)

Used ordering:
Combined order from the following AFS and order.
if2'(x1, x2, x3, x4)  =  if2'(x1, x2, x3, x4)
true  =  true
filterhigh'(x1, x2)  =  filterhigh'(x1, x2)
cons(x1, x2)  =  cons(x1, x2)
ge(x1, x2)  =  ge(x1, x2)
false  =  false
nil  =  nil
0  =  0
s(x1)  =  s(x1)
if1(x1, x2, x3, x4)  =  if1(x1, x2, x3, x4)
filterlow(x1, x2)  =  filterlow(x1, x2)
half(x1)  =  x1
if2(x1, x2, x3, x4)  =  if2(x1, x2, x3, x4)
filterhigh(x1, x2)  =  filterhigh(x1, x2)
equal_bool(x1, x2)  =  equal_bool(x1, x2)
and(x1, x2)  =  and(x1, x2)
or(x1, x2)  =  or(x1, x2)
not(x1)  =  not(x1)
isa_true(x1)  =  x1
isa_false(x1)  =  x1
equal_sort[a0](x1, x2)  =  equal_sort[a0](x1, x2)
equal_sort[a5](x1, x2)  =  equal_sort[a5](x1, x2)
equal_sort[a67](x1, x2)  =  equal_sort[a67](x1, x2)
witness_sort[a67]  =  witness_sort[a67]

Recursive path order with status [RPO].
Quasi-Precedence:
nil > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
nil > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
nil > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
nil > [true, false, equalsort[a0]2, equalsort[a5]2] > and2
0 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
0 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
0 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
0 > [true, false, equalsort[a0]2, equalsort[a5]2] > and2
[if24, filterhigh2] > cons2
[if24, filterhigh2] > ge2
equalbool2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
equalbool2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
equalbool2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
equalbool2 > [true, false, equalsort[a0]2, equalsort[a5]2] > and2
or2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
or2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
or2 > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
or2 > [true, false, equalsort[a0]2, equalsort[a5]2] > and2
witnesssort[a67] > [true, false, equalsort[a0]2, equalsort[a5]2] > [if2'4, filterhigh'2] > ge2
witnesssort[a67] > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > cons2
witnesssort[a67] > [true, false, equalsort[a0]2, equalsort[a5]2] > [if14, filterlow2] > ge2
witnesssort[a67] > [true, false, equalsort[a0]2, equalsort[a5]2] > and2

Status:
if2'4: [4,2,3,1]
true: multiset
filterhigh'2: [2,1]
cons2: [2,1]
ge2: multiset
false: multiset
nil: multiset
0: multiset
s1: [1]
if14: [2,4,1,3]
filterlow2: [1,2]
if24: [2,4,3,1]
filterhigh2: [1,2]
equalbool2: [2,1]
and2: [2,1]
or2: [2,1]
not1: [1]
equalsort[a0]2: [1,2]
equalsort[a5]2: [1,2]
equalsort[a67]2: [2,1]
witnesssort[a67]: multiset

With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly:

if2'(true, n82, x105, xs61) → true
filterhigh'(n91, cons(x116, xs68)) → if2'(ge(x116, n91), n91, x116, xs68)
if2'(false, n100, x127, xs75) → filterhigh'(n100, xs75)
filterhigh'(n109, nil) → false
ge(x, 0) → true
ge(s(x9), s(y')) → ge(x9, y')
if1(true, n14, x20, xs10) → filterlow(n14, xs10)
filterlow(n23, cons(x31, xs17)) → if1(ge(n23, x31), n23, x31, xs17)
if1(false, n32, x42, xs24) → cons(x42, filterlow(n32, xs24))
filterlow(n41, nil) → nil
ge(0, s(x63)) → false
half(s(0)) → 0
half(s(s(x94))) → s(half(x94))
if2(true, n82, x105, xs61) → filterhigh(n82, xs61)
filterhigh(n91, cons(x116, xs68)) → if2(ge(x116, n91), n91, x116, xs68)
if2(false, n100, x127, xs75) → cons(x127, filterhigh(n100, xs75))
filterhigh(n109, nil) → nil
equal_bool(true, false) → false
equal_bool(false, true) → false
equal_bool(true, true) → true
equal_bool(false, false) → true
and(true, x) → x
and(false, x) → false
or(true, x) → true
or(false, x) → x
not(false) → true
not(true) → false
equal_sort[a0](0, 0) → true
equal_sort[a0](0, s(x0)) → false
equal_sort[a0](s(x0), 0) → false
equal_sort[a0](s(x0), s(x1)) → equal_sort[a0](x0, x1)
equal_sort[a5](cons(x0, x1), cons(x2, x3)) → and(equal_sort[a5](x0, x2), equal_sort[a5](x1, x3))
equal_sort[a5](cons(x0, x1), nil) → false
equal_sort[a5](nil, cons(x0, x1)) → false
equal_sort[a5](nil, nil) → true
equal_sort[a67](witness_sort[a67], witness_sort[a67]) → true


(156) Obligation:

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

half(0) → 0
isa_true(true) → true
isa_true(false) → false
isa_false(true) → false
isa_false(false) → true

Q is empty.

(157) QTRSRRRProof (EQUIVALENT transformation)

Used ordering:
Polynomial interpretation [POLO]:

POL(0) = 0   
POL(false) = 0   
POL(half(x1)) = 1 + x1   
POL(isa_false(x1)) = 1 + x1   
POL(isa_true(x1)) = x1   
POL(true) = 0   
With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly:

half(0) → 0
isa_false(true) → false
isa_false(false) → true


(158) Obligation:

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

isa_true(true) → true
isa_true(false) → false

Q is empty.

(159) QTRSRRRProof (EQUIVALENT transformation)

Used ordering:
Polynomial interpretation [POLO]:

POL(false) = 1   
POL(isa_true(x1)) = 2 + 2·x1   
POL(true) = 1   
With this ordering the following rules can be removed by the rule removal processor [LPAR04] because they are oriented strictly:

isa_true(true) → true
isa_true(false) → false


(160) Obligation:

Q restricted rewrite system:
R is empty.
Q is empty.

(161) RisEmptyProof (EQUIVALENT transformation)

The TRS R is empty. Hence, termination is trivially proven.

(162) YES