(0) Obligation:

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

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

Q is empty.

(1) DependencyPairsProof (EQUIVALENT transformation)

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

(2) Obligation:

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

A__TERMS(N) → A__SQR(mark(N))
A__TERMS(N) → MARK(N)
A__ADD(0, X) → MARK(X)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(terms(X)) → A__TERMS(mark(X))
MARK(terms(X)) → MARK(X)
MARK(sqr(X)) → A__SQR(mark(X))
MARK(sqr(X)) → MARK(X)
MARK(add(X1, X2)) → A__ADD(mark(X1), mark(X2))
MARK(add(X1, X2)) → MARK(X1)
MARK(add(X1, X2)) → MARK(X2)
MARK(dbl(X)) → A__DBL(mark(X))
MARK(dbl(X)) → MARK(X)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
MARK(first(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(recip(X)) → MARK(X)

The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

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

(3) DependencyGraphProof (EQUIVALENT transformation)

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

(4) Obligation:

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

A__TERMS(N) → MARK(N)
MARK(terms(X)) → A__TERMS(mark(X))
MARK(terms(X)) → MARK(X)
MARK(sqr(X)) → MARK(X)
MARK(add(X1, X2)) → A__ADD(mark(X1), mark(X2))
A__ADD(0, X) → MARK(X)
MARK(add(X1, X2)) → MARK(X1)
MARK(add(X1, X2)) → MARK(X2)
MARK(dbl(X)) → MARK(X)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(first(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(recip(X)) → MARK(X)

The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

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

(5) QDPSizeChangeProof (EQUIVALENT transformation)

We used the following order and afs together with the size-change analysis [AAECC05] to show that there are no infinite chains for this DP problem.

Order:Combined order from the following AFS and order.
mark(x1)  =  x1
terms(x1)  =  terms(x1)
a__terms(x1)  =  a__terms(x1)
sqr(x1)  =  sqr(x1)
a__sqr(x1)  =  a__sqr(x1)
add(x1, x2)  =  add(x1, x2)
a__add(x1, x2)  =  a__add(x1, x2)
0  =  0
dbl(x1)  =  dbl(x1)
a__dbl(x1)  =  a__dbl(x1)
first(x1, x2)  =  first(x1, x2)
a__first(x1, x2)  =  a__first(x1, x2)
cons(x1, x2)  =  cons(x1)
recip(x1)  =  recip(x1)
s(x1)  =  s
nil  =  nil

Lexicographic path order with status [LPO].
Quasi-Precedence:

[add2, aadd2] > [terms1, aterms1, s] > [sqr1, asqr1] > 0 > cons1
[add2, aadd2] > [terms1, aterms1, s] > recip1 > cons1
[dbl1, adbl1] > [terms1, aterms1, s] > [sqr1, asqr1] > 0 > cons1
[dbl1, adbl1] > [terms1, aterms1, s] > recip1 > cons1
[first2, afirst2] > nil > cons1

Status:
terms1: [1]
aterms1: [1]
sqr1: [1]
asqr1: [1]
add2: [1,2]
aadd2: [1,2]
0: []
dbl1: [1]
adbl1: [1]
first2: [1,2]
afirst2: [1,2]
cons1: [1]
recip1: [1]
s: []
nil: []

AFS:
mark(x1)  =  x1
terms(x1)  =  terms(x1)
a__terms(x1)  =  a__terms(x1)
sqr(x1)  =  sqr(x1)
a__sqr(x1)  =  a__sqr(x1)
add(x1, x2)  =  add(x1, x2)
a__add(x1, x2)  =  a__add(x1, x2)
0  =  0
dbl(x1)  =  dbl(x1)
a__dbl(x1)  =  a__dbl(x1)
first(x1, x2)  =  first(x1, x2)
a__first(x1, x2)  =  a__first(x1, x2)
cons(x1, x2)  =  cons(x1)
recip(x1)  =  recip(x1)
s(x1)  =  s
nil  =  nil

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

  • MARK(terms(X)) → A__TERMS(mark(X)) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

  • A__TERMS(N) → MARK(N) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 >= 1

  • A__ADD(0, X) → MARK(X) (allowed arguments on rhs = {1})
    The graph contains the following edges 2 >= 1

  • A__FIRST(s(X), cons(Y, Z)) → MARK(Y) (allowed arguments on rhs = {1})
    The graph contains the following edges 2 > 1

  • MARK(add(X1, X2)) → A__ADD(mark(X1), mark(X2)) (allowed arguments on rhs = {2})
    The graph contains the following edges 1 > 2

  • MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2)) (allowed arguments on rhs = {2})
    The graph contains the following edges 1 > 2

  • MARK(terms(X)) → MARK(X) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

  • MARK(sqr(X)) → MARK(X) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

  • MARK(add(X1, X2)) → MARK(X1) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

  • MARK(add(X1, X2)) → MARK(X2) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

  • MARK(dbl(X)) → MARK(X) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

  • MARK(first(X1, X2)) → MARK(X1) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

  • MARK(first(X1, X2)) → MARK(X2) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

  • MARK(cons(X1, X2)) → MARK(X1) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

  • MARK(recip(X)) → MARK(X) (allowed arguments on rhs = {1})
    The graph contains the following edges 1 > 1

We oriented the following set of usable rules [AAECC05,FROCOS05].


mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
a__add(0, X) → mark(X)
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__terms(X) → terms(X)
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__sqr(X) → sqr(X)
a__add(s(X), Y) → s(add(X, Y))
a__add(X1, X2) → add(X1, X2)
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__dbl(X) → dbl(X)
a__first(0, X) → nil
a__first(X1, X2) → first(X1, X2)

(6) TRUE