Termination of the following Term Rewriting System could be proven:

Context-sensitive rewrite system:
The TRS R consists of the following rules:

natsFrom(N) → cons(N, natsFrom(s(N)))
fst(pair(XS, YS)) → XS
snd(pair(XS, YS)) → YS
splitAt(0, XS) → pair(nil, XS)
splitAt(s(N), cons(X, XS)) → u(splitAt(N, XS), N, X, XS)
u(pair(YS, ZS), N, X, XS) → pair(cons(X, YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → XS
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))

The replacement map contains the following entries:

natsFrom: {1}
cons: {1}
s: {1}
fst: {1}
pair: {1, 2}
snd: {1}
splitAt: {1, 2}
0: empty set
nil: empty set
u: {1}
head: {1}
tail: {1}
sel: {1, 2}
afterNth: {1, 2}
take: {1, 2}


CSR
  ↳ CSRInnermostProof

Context-sensitive rewrite system:
The TRS R consists of the following rules:

natsFrom(N) → cons(N, natsFrom(s(N)))
fst(pair(XS, YS)) → XS
snd(pair(XS, YS)) → YS
splitAt(0, XS) → pair(nil, XS)
splitAt(s(N), cons(X, XS)) → u(splitAt(N, XS), N, X, XS)
u(pair(YS, ZS), N, X, XS) → pair(cons(X, YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → XS
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))

The replacement map contains the following entries:

natsFrom: {1}
cons: {1}
s: {1}
fst: {1}
pair: {1, 2}
snd: {1}
splitAt: {1, 2}
0: empty set
nil: empty set
u: {1}
head: {1}
tail: {1}
sel: {1, 2}
afterNth: {1, 2}
take: {1, 2}

The CSR is orthogonal. By [10] we can switch to innermost.

↳ CSR
  ↳ CSRInnermostProof
CSR
      ↳ CSDependencyPairsProof

Context-sensitive rewrite system:
The TRS R consists of the following rules:

natsFrom(N) → cons(N, natsFrom(s(N)))
fst(pair(XS, YS)) → XS
snd(pair(XS, YS)) → YS
splitAt(0, XS) → pair(nil, XS)
splitAt(s(N), cons(X, XS)) → u(splitAt(N, XS), N, X, XS)
u(pair(YS, ZS), N, X, XS) → pair(cons(X, YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → XS
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))

The replacement map contains the following entries:

natsFrom: {1}
cons: {1}
s: {1}
fst: {1}
pair: {1, 2}
snd: {1}
splitAt: {1, 2}
0: empty set
nil: empty set
u: {1}
head: {1}
tail: {1}
sel: {1, 2}
afterNth: {1, 2}
take: {1, 2}

Innermost Strategy.

Using Improved CS-DPs we result in the following initial Q-CSDP problem.

↳ CSR
  ↳ CSRInnermostProof
    ↳ CSR
      ↳ CSDependencyPairsProof
QCSDP
          ↳ QCSDependencyGraphProof

Q-restricted context-sensitive dependency pair problem:
The symbols in {natsFrom, s, fst, pair, snd, splitAt, head, tail, sel, afterNth, take, SPLITAT, HEAD, SEL, AFTERNTH, FST, TAKE, SND, TAIL, NATSFROM} are replacing on all positions.
For all symbols f in {cons, u, U} we have µ(f) = {1}.
The symbols in {U} are not replacing on any position.

The ordinary context-sensitive dependency pairs DPo are:

SPLITAT(s(N), cons(X, XS)) → U(splitAt(N, XS), N, X, XS)
SPLITAT(s(N), cons(X, XS)) → SPLITAT(N, XS)
SEL(N, XS) → HEAD(afterNth(N, XS))
SEL(N, XS) → AFTERNTH(N, XS)
TAKE(N, XS) → FST(splitAt(N, XS))
TAKE(N, XS) → SPLITAT(N, XS)
AFTERNTH(N, XS) → SND(splitAt(N, XS))
AFTERNTH(N, XS) → SPLITAT(N, XS)

The collapsing dependency pairs are DPc:

SPLITAT(s(N), cons(X, XS)) → XS
U(pair(YS, ZS), N, X, XS) → X
TAIL(cons(N, XS)) → XS


The hidden terms of R are:

natsFrom(s(N))

Every hiding context is built from:

s on positions {1}
natsFrom on positions {1}

Hence, the new unhiding pairs DPu are :

SPLITAT(s(N), cons(X, XS)) → U(XS)
U(pair(YS, ZS), N, X, XS) → U(X)
TAIL(cons(N, XS)) → U(XS)
U(s(x_0)) → U(x_0)
U(natsFrom(x_0)) → U(x_0)
U(natsFrom(s(N))) → NATSFROM(s(N))

The TRS R consists of the following rules:

natsFrom(N) → cons(N, natsFrom(s(N)))
fst(pair(XS, YS)) → XS
snd(pair(XS, YS)) → YS
splitAt(0, XS) → pair(nil, XS)
splitAt(s(N), cons(X, XS)) → u(splitAt(N, XS), N, X, XS)
u(pair(YS, ZS), N, X, XS) → pair(cons(X, YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → XS
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))

The set Q consists of the following terms:

natsFrom(x0)
fst(pair(x0, x1))
snd(pair(x0, x1))
splitAt(0, x0)
splitAt(s(x0), cons(x1, x2))
u(pair(x0, x1), x2, x3, x4)
head(cons(x0, x1))
tail(cons(x0, x1))
sel(x0, x1)
take(x0, x1)
afterNth(x0, x1)


The approximation of the Context-Sensitive Dependency Graph contains 2 SCCs with 9 less nodes.


↳ CSR
  ↳ CSRInnermostProof
    ↳ CSR
      ↳ CSDependencyPairsProof
        ↳ QCSDP
          ↳ QCSDependencyGraphProof
            ↳ AND
QCSDP
                ↳ QCSDPSubtermProof
              ↳ QCSDP

Q-restricted context-sensitive dependency pair problem:
The symbols in {natsFrom, s, fst, pair, snd, splitAt, head, tail, sel, afterNth, take} are replacing on all positions.
For all symbols f in {cons, u} we have µ(f) = {1}.
The symbols in {U} are not replacing on any position.

The TRS P consists of the following rules:

U(s(x_0)) → U(x_0)
U(natsFrom(x_0)) → U(x_0)

The TRS R consists of the following rules:

natsFrom(N) → cons(N, natsFrom(s(N)))
fst(pair(XS, YS)) → XS
snd(pair(XS, YS)) → YS
splitAt(0, XS) → pair(nil, XS)
splitAt(s(N), cons(X, XS)) → u(splitAt(N, XS), N, X, XS)
u(pair(YS, ZS), N, X, XS) → pair(cons(X, YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → XS
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))

The set Q consists of the following terms:

natsFrom(x0)
fst(pair(x0, x1))
snd(pair(x0, x1))
splitAt(0, x0)
splitAt(s(x0), cons(x1, x2))
u(pair(x0, x1), x2, x3, x4)
head(cons(x0, x1))
tail(cons(x0, x1))
sel(x0, x1)
take(x0, x1)
afterNth(x0, x1)


We use the subterm processor [20].


The following pairs can be oriented strictly and are deleted.


U(s(x_0)) → U(x_0)
U(natsFrom(x_0)) → U(x_0)
The remaining pairs can at least be oriented weakly.
none
Used ordering: Combined order from the following AFS and order.
U(x1)  =  x1

Subterm Order


↳ CSR
  ↳ CSRInnermostProof
    ↳ CSR
      ↳ CSDependencyPairsProof
        ↳ QCSDP
          ↳ QCSDependencyGraphProof
            ↳ AND
              ↳ QCSDP
                ↳ QCSDPSubtermProof
QCSDP
                    ↳ PIsEmptyProof
              ↳ QCSDP

Q-restricted context-sensitive dependency pair problem:
The symbols in {natsFrom, s, fst, pair, snd, splitAt, head, tail, sel, afterNth, take} are replacing on all positions.
For all symbols f in {cons, u} we have µ(f) = {1}.

The TRS P consists of the following rules:
none

The TRS R consists of the following rules:

natsFrom(N) → cons(N, natsFrom(s(N)))
fst(pair(XS, YS)) → XS
snd(pair(XS, YS)) → YS
splitAt(0, XS) → pair(nil, XS)
splitAt(s(N), cons(X, XS)) → u(splitAt(N, XS), N, X, XS)
u(pair(YS, ZS), N, X, XS) → pair(cons(X, YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → XS
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))

The set Q consists of the following terms:

natsFrom(x0)
fst(pair(x0, x1))
snd(pair(x0, x1))
splitAt(0, x0)
splitAt(s(x0), cons(x1, x2))
u(pair(x0, x1), x2, x3, x4)
head(cons(x0, x1))
tail(cons(x0, x1))
sel(x0, x1)
take(x0, x1)
afterNth(x0, x1)


The TRS P is empty. Hence, there is no (P,Q,R,µ)-chain.

↳ CSR
  ↳ CSRInnermostProof
    ↳ CSR
      ↳ CSDependencyPairsProof
        ↳ QCSDP
          ↳ QCSDependencyGraphProof
            ↳ AND
              ↳ QCSDP
QCSDP
                ↳ QCSDPSubtermProof

Q-restricted context-sensitive dependency pair problem:
The symbols in {natsFrom, s, fst, pair, snd, splitAt, head, tail, sel, afterNth, take, SPLITAT} are replacing on all positions.
For all symbols f in {cons, u} we have µ(f) = {1}.

The TRS P consists of the following rules:

SPLITAT(s(N), cons(X, XS)) → SPLITAT(N, XS)

The TRS R consists of the following rules:

natsFrom(N) → cons(N, natsFrom(s(N)))
fst(pair(XS, YS)) → XS
snd(pair(XS, YS)) → YS
splitAt(0, XS) → pair(nil, XS)
splitAt(s(N), cons(X, XS)) → u(splitAt(N, XS), N, X, XS)
u(pair(YS, ZS), N, X, XS) → pair(cons(X, YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → XS
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))

The set Q consists of the following terms:

natsFrom(x0)
fst(pair(x0, x1))
snd(pair(x0, x1))
splitAt(0, x0)
splitAt(s(x0), cons(x1, x2))
u(pair(x0, x1), x2, x3, x4)
head(cons(x0, x1))
tail(cons(x0, x1))
sel(x0, x1)
take(x0, x1)
afterNth(x0, x1)


We use the subterm processor [20].


The following pairs can be oriented strictly and are deleted.


SPLITAT(s(N), cons(X, XS)) → SPLITAT(N, XS)
The remaining pairs can at least be oriented weakly.
none
Used ordering: Combined order from the following AFS and order.
SPLITAT(x1, x2)  =  x1

Subterm Order


↳ CSR
  ↳ CSRInnermostProof
    ↳ CSR
      ↳ CSDependencyPairsProof
        ↳ QCSDP
          ↳ QCSDependencyGraphProof
            ↳ AND
              ↳ QCSDP
              ↳ QCSDP
                ↳ QCSDPSubtermProof
QCSDP
                    ↳ PIsEmptyProof

Q-restricted context-sensitive dependency pair problem:
The symbols in {natsFrom, s, fst, pair, snd, splitAt, head, tail, sel, afterNth, take} are replacing on all positions.
For all symbols f in {cons, u} we have µ(f) = {1}.

The TRS P consists of the following rules:
none

The TRS R consists of the following rules:

natsFrom(N) → cons(N, natsFrom(s(N)))
fst(pair(XS, YS)) → XS
snd(pair(XS, YS)) → YS
splitAt(0, XS) → pair(nil, XS)
splitAt(s(N), cons(X, XS)) → u(splitAt(N, XS), N, X, XS)
u(pair(YS, ZS), N, X, XS) → pair(cons(X, YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → XS
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))

The set Q consists of the following terms:

natsFrom(x0)
fst(pair(x0, x1))
snd(pair(x0, x1))
splitAt(0, x0)
splitAt(s(x0), cons(x1, x2))
u(pair(x0, x1), x2, x3, x4)
head(cons(x0, x1))
tail(cons(x0, x1))
sel(x0, x1)
take(x0, x1)
afterNth(x0, x1)


The TRS P is empty. Hence, there is no (P,Q,R,µ)-chain.