(0) Obligation:

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

nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

Q is empty.

(1) Overlay + Local Confluence (EQUIVALENT transformation)

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

(2) Obligation:

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

nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

(3) DependencyPairsProof (EQUIVALENT transformation)

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

(4) Obligation:

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

NTHTAIL(n, l) → COND(ge(n, length(l)), n, l)
NTHTAIL(n, l) → GE(n, length(l))
NTHTAIL(n, l) → LENGTH(l)
COND(false, n, l) → TAIL(nthtail(s(n), l))
COND(false, n, l) → NTHTAIL(s(n), l)
LENGTH(cons(x, l)) → LENGTH(l)
GE(s(u), s(v)) → GE(u, v)

The TRS R consists of the following rules:

nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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

(5) DependencyGraphProof (EQUIVALENT transformation)

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

(6) Complex Obligation (AND)

(7) Obligation:

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

GE(s(u), s(v)) → GE(u, v)

The TRS R consists of the following rules:

nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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:

GE(s(u), s(v)) → GE(u, v)

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

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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].

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

(11) Obligation:

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

GE(s(u), s(v)) → GE(u, v)

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:

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

(13) TRUE

(14) Obligation:

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

LENGTH(cons(x, l)) → LENGTH(l)

The TRS R consists of the following rules:

nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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:

LENGTH(cons(x, l)) → LENGTH(l)

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

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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].

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

(18) Obligation:

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

LENGTH(cons(x, l)) → LENGTH(l)

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:

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

(20) TRUE

(21) Obligation:

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

COND(false, n, l) → NTHTAIL(s(n), l)
NTHTAIL(n, l) → COND(ge(n, length(l)), n, l)

The TRS R consists of the following rules:

nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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:

COND(false, n, l) → NTHTAIL(s(n), l)
NTHTAIL(n, l) → COND(ge(n, length(l)), n, l)

The TRS R consists of the following rules:

length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))
length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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].

nthtail(x0, x1)
cond(true, x0, x1)
cond(false, x0, x1)
tail(nil)
tail(cons(x0, x1))

(25) Obligation:

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

COND(false, n, l) → NTHTAIL(s(n), l)
NTHTAIL(n, l) → COND(ge(n, length(l)), n, l)

The TRS R consists of the following rules:

length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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

(26) Instantiation (EQUIVALENT transformation)

By instantiating [LPAR04] the rule NTHTAIL(n, l) → COND(ge(n, length(l)), n, l) we obtained the following new rules [LPAR04]:

NTHTAIL(s(z0), z1) → COND(ge(s(z0), length(z1)), s(z0), z1)

(27) Obligation:

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

COND(false, n, l) → NTHTAIL(s(n), l)
NTHTAIL(s(z0), z1) → COND(ge(s(z0), length(z1)), s(z0), z1)

The TRS R consists of the following rules:

length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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

(28) NonInfProof (EQUIVALENT transformation)

The DP Problem is simplified using the Induction Calculus [NONINF] with the following steps:
Note that final constraints are written in bold face.


For Pair COND(false, n, l) → NTHTAIL(s(n), l) the following chains were created:
  • We consider the chain NTHTAIL(n, l) → COND(ge(n, length(l)), n, l), COND(false, n, l) → NTHTAIL(s(n), l) which results in the following constraint:

    (1)    (COND(ge(x2, length(x3)), x2, x3)=COND(false, x4, x5) ⇒ COND(false, x4, x5)≥NTHTAIL(s(x4), x5))



    We simplified constraint (1) using rules (I), (II), (III), (VII) which results in the following new constraint:

    (2)    (length(x3)=x12ge(x2, x12)=falseCOND(false, x2, x3)≥NTHTAIL(s(x2), x3))



    We simplified constraint (2) using rule (V) (with possible (I) afterwards) using induction on ge(x2, x12)=false which results in the following new constraints:

    (3)    (false=falselength(x3)=s(x14) ⇒ COND(false, 0, x3)≥NTHTAIL(s(0), x3))


    (4)    (ge(x16, x15)=falselength(x3)=s(x15)∧(∀x17:ge(x16, x15)=falselength(x17)=x15COND(false, x16, x17)≥NTHTAIL(s(x16), x17)) ⇒ COND(false, s(x16), x3)≥NTHTAIL(s(s(x16)), x3))



    We simplified constraint (3) using rules (I), (II) which results in the following new constraint:

    (5)    (length(x3)=s(x14) ⇒ COND(false, 0, x3)≥NTHTAIL(s(0), x3))



    We simplified constraint (4) using rule (V) (with possible (I) afterwards) using induction on length(x3)=s(x15) which results in the following new constraint:

    (6)    (s(length(x21))=s(x15)∧ge(x16, x15)=false∧(∀x17:ge(x16, x15)=falselength(x17)=x15COND(false, x16, x17)≥NTHTAIL(s(x16), x17))∧(∀x23,x24,x25:length(x21)=s(x23)∧ge(x24, x23)=false∧(∀x25:ge(x24, x23)=falselength(x25)=x23COND(false, x24, x25)≥NTHTAIL(s(x24), x25)) ⇒ COND(false, s(x24), x21)≥NTHTAIL(s(s(x24)), x21)) ⇒ COND(false, s(x16), cons(x22, x21))≥NTHTAIL(s(s(x16)), cons(x22, x21)))



    We simplified constraint (5) using rule (V) (with possible (I) afterwards) using induction on length(x3)=s(x14) which results in the following new constraint:

    (7)    (s(length(x18))=s(x14)∧(∀x20:length(x18)=s(x20) ⇒ COND(false, 0, x18)≥NTHTAIL(s(0), x18)) ⇒ COND(false, 0, cons(x19, x18))≥NTHTAIL(s(0), cons(x19, x18)))



    We simplified constraint (7) using rules (I), (II), (IV) which results in the following new constraint:

    (8)    (COND(false, 0, cons(x19, x18))≥NTHTAIL(s(0), cons(x19, x18)))



    We simplified constraint (6) using rules (I), (II) which results in the following new constraint:

    (9)    (length(x21)=x15ge(x16, x15)=false∧(∀x17:ge(x16, x15)=falselength(x17)=x15COND(false, x16, x17)≥NTHTAIL(s(x16), x17))∧(∀x23,x24,x25:length(x21)=s(x23)∧ge(x24, x23)=false∧(∀x25:ge(x24, x23)=falselength(x25)=x23COND(false, x24, x25)≥NTHTAIL(s(x24), x25)) ⇒ COND(false, s(x24), x21)≥NTHTAIL(s(s(x24)), x21)) ⇒ COND(false, s(x16), cons(x22, x21))≥NTHTAIL(s(s(x16)), cons(x22, x21)))



    We simplified constraint (9) using rule (VI) where we applied the induction hypothesis (∀x17:ge(x16, x15)=falselength(x17)=x15COND(false, x16, x17)≥NTHTAIL(s(x16), x17)) with σ = [x17 / x21] which results in the following new constraint:

    (10)    (COND(false, x16, x21)≥NTHTAIL(s(x16), x21)∧(∀x23,x24,x25:length(x21)=s(x23)∧ge(x24, x23)=false∧(∀x25:ge(x24, x23)=falselength(x25)=x23COND(false, x24, x25)≥NTHTAIL(s(x24), x25)) ⇒ COND(false, s(x24), x21)≥NTHTAIL(s(s(x24)), x21)) ⇒ COND(false, s(x16), cons(x22, x21))≥NTHTAIL(s(s(x16)), cons(x22, x21)))



    We simplified constraint (10) using rule (IV) which results in the following new constraint:

    (11)    (COND(false, x16, x21)≥NTHTAIL(s(x16), x21) ⇒ COND(false, s(x16), cons(x22, x21))≥NTHTAIL(s(s(x16)), cons(x22, x21)))







For Pair NTHTAIL(n, l) → COND(ge(n, length(l)), n, l) the following chains were created:
  • We consider the chain COND(false, n, l) → NTHTAIL(s(n), l), NTHTAIL(n, l) → COND(ge(n, length(l)), n, l) which results in the following constraint:

    (12)    (NTHTAIL(s(x6), x7)=NTHTAIL(x8, x9) ⇒ NTHTAIL(x8, x9)≥COND(ge(x8, length(x9)), x8, x9))



    We simplified constraint (12) using rules (I), (II), (III) which results in the following new constraint:

    (13)    (NTHTAIL(s(x6), x7)≥COND(ge(s(x6), length(x7)), s(x6), x7))







To summarize, we get the following constraints P for the following pairs.
  • COND(false, n, l) → NTHTAIL(s(n), l)
    • (COND(false, 0, cons(x19, x18))≥NTHTAIL(s(0), cons(x19, x18)))
    • (COND(false, x16, x21)≥NTHTAIL(s(x16), x21) ⇒ COND(false, s(x16), cons(x22, x21))≥NTHTAIL(s(s(x16)), cons(x22, x21)))

  • NTHTAIL(n, l) → COND(ge(n, length(l)), n, l)
    • (NTHTAIL(s(x6), x7)≥COND(ge(s(x6), length(x7)), s(x6), x7))




The constraints for P> respective Pbound are constructed from P where we just replace every occurence of "t ≥ s" in P by "t > s" respective "t ≥ c". Here c stands for the fresh constant used for Pbound.
Using the following integer polynomial ordering the resulting constraints can be solved
Polynomial interpretation [NONINF]:

POL(0) = 0   
POL(COND(x1, x2, x3)) = -1 - x1 - x2 + x3   
POL(NTHTAIL(x1, x2)) = -x1 + x2   
POL(c) = -1   
POL(cons(x1, x2)) = 1 + x2   
POL(false) = 0   
POL(ge(x1, x2)) = 0   
POL(length(x1)) = 0   
POL(nil) = 0   
POL(s(x1)) = 1 + x1   
POL(true) = 0   

The following pairs are in P>:

NTHTAIL(n, l) → COND(ge(n, length(l)), n, l)
The following pairs are in Pbound:

COND(false, n, l) → NTHTAIL(s(n), l)
The following rules are usable:

falsege(0, s(v))
truege(u, 0)
ge(u, v) → ge(s(u), s(v))

(29) Complex Obligation (AND)

(30) Obligation:

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

COND(false, n, l) → NTHTAIL(s(n), l)

The TRS R consists of the following rules:

length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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

(31) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 1 less node.

(32) TRUE

(33) Obligation:

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

NTHTAIL(n, l) → COND(ge(n, length(l)), n, l)

The TRS R consists of the following rules:

length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)

The set Q consists of the following terms:

length(nil)
length(cons(x0, x1))
ge(x0, 0)
ge(0, s(x0))
ge(s(x0), s(x1))

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

(34) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 1 less node.

(35) TRUE