(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
natsFrom(N) → cons(N, n__natsFrom(n__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, activate(XS)), N, X, activate(XS))
u(pair(YS, ZS), N, X, XS) → pair(cons(activate(X), YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → activate(XS)
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))
natsFrom(X) → n__natsFrom(X)
s(X) → n__s(X)
activate(n__natsFrom(X)) → natsFrom(activate(X))
activate(n__s(X)) → s(activate(X))
activate(X) → X
Rewrite Strategy: INNERMOST
(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)
Converted Cpx (relative) TRS to CDT
(2) Obligation:
Complexity Dependency Tuples Problem
Rules:
natsFrom(z0) → cons(z0, n__natsFrom(n__s(z0)))
natsFrom(z0) → n__natsFrom(z0)
fst(pair(z0, z1)) → z0
snd(pair(z0, z1)) → z1
splitAt(0, z0) → pair(nil, z0)
splitAt(s(z0), cons(z1, z2)) → u(splitAt(z0, activate(z2)), z0, z1, activate(z2))
u(pair(z0, z1), z2, z3, z4) → pair(cons(activate(z3), z0), z1)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
sel(z0, z1) → head(afterNth(z0, z1))
take(z0, z1) → fst(splitAt(z0, z1))
afterNth(z0, z1) → snd(splitAt(z0, z1))
s(z0) → n__s(z0)
activate(n__natsFrom(z0)) → natsFrom(activate(z0))
activate(n__s(z0)) → s(activate(z0))
activate(z0) → z0
Tuples:
NATSFROM(z0) → c
NATSFROM(z0) → c1
FST(pair(z0, z1)) → c2
SND(pair(z0, z1)) → c3
SPLITAT(0, z0) → c4
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
U(pair(z0, z1), z2, z3, z4) → c6(ACTIVATE(z3))
HEAD(cons(z0, z1)) → c7
TAIL(cons(z0, z1)) → c8(ACTIVATE(z1))
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
S(z0) → c12
ACTIVATE(n__natsFrom(z0)) → c13(NATSFROM(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(z0) → c15
S tuples:
NATSFROM(z0) → c
NATSFROM(z0) → c1
FST(pair(z0, z1)) → c2
SND(pair(z0, z1)) → c3
SPLITAT(0, z0) → c4
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
U(pair(z0, z1), z2, z3, z4) → c6(ACTIVATE(z3))
HEAD(cons(z0, z1)) → c7
TAIL(cons(z0, z1)) → c8(ACTIVATE(z1))
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
S(z0) → c12
ACTIVATE(n__natsFrom(z0)) → c13(NATSFROM(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(z0) → c15
K tuples:none
Defined Rule Symbols:
natsFrom, fst, snd, splitAt, u, head, tail, sel, take, afterNth, s, activate
Defined Pair Symbols:
NATSFROM, FST, SND, SPLITAT, U, HEAD, TAIL, SEL, TAKE, AFTERNTH, S, ACTIVATE
Compound Symbols:
c, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15
(3) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)
Removed 3 leading nodes:
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
U(pair(z0, z1), z2, z3, z4) → c6(ACTIVATE(z3))
TAIL(cons(z0, z1)) → c8(ACTIVATE(z1))
Removed 11 trailing nodes:
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
NATSFROM(z0) → c
ACTIVATE(z0) → c15
NATSFROM(z0) → c1
FST(pair(z0, z1)) → c2
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
SND(pair(z0, z1)) → c3
SPLITAT(0, z0) → c4
S(z0) → c12
HEAD(cons(z0, z1)) → c7
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
natsFrom(z0) → cons(z0, n__natsFrom(n__s(z0)))
natsFrom(z0) → n__natsFrom(z0)
fst(pair(z0, z1)) → z0
snd(pair(z0, z1)) → z1
splitAt(0, z0) → pair(nil, z0)
splitAt(s(z0), cons(z1, z2)) → u(splitAt(z0, activate(z2)), z0, z1, activate(z2))
u(pair(z0, z1), z2, z3, z4) → pair(cons(activate(z3), z0), z1)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
sel(z0, z1) → head(afterNth(z0, z1))
take(z0, z1) → fst(splitAt(z0, z1))
afterNth(z0, z1) → snd(splitAt(z0, z1))
s(z0) → n__s(z0)
activate(n__natsFrom(z0)) → natsFrom(activate(z0))
activate(n__s(z0)) → s(activate(z0))
activate(z0) → z0
Tuples:
ACTIVATE(n__natsFrom(z0)) → c13(NATSFROM(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(S(activate(z0)), ACTIVATE(z0))
S tuples:
ACTIVATE(n__natsFrom(z0)) → c13(NATSFROM(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(S(activate(z0)), ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:
natsFrom, fst, snd, splitAt, u, head, tail, sel, take, afterNth, s, activate
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c13, c14
(5) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)
Removed 2 trailing tuple parts
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:
natsFrom(z0) → cons(z0, n__natsFrom(n__s(z0)))
natsFrom(z0) → n__natsFrom(z0)
fst(pair(z0, z1)) → z0
snd(pair(z0, z1)) → z1
splitAt(0, z0) → pair(nil, z0)
splitAt(s(z0), cons(z1, z2)) → u(splitAt(z0, activate(z2)), z0, z1, activate(z2))
u(pair(z0, z1), z2, z3, z4) → pair(cons(activate(z3), z0), z1)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
sel(z0, z1) → head(afterNth(z0, z1))
take(z0, z1) → fst(splitAt(z0, z1))
afterNth(z0, z1) → snd(splitAt(z0, z1))
s(z0) → n__s(z0)
activate(n__natsFrom(z0)) → natsFrom(activate(z0))
activate(n__s(z0)) → s(activate(z0))
activate(z0) → z0
Tuples:
ACTIVATE(n__natsFrom(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
S tuples:
ACTIVATE(n__natsFrom(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:
natsFrom, fst, snd, splitAt, u, head, tail, sel, take, afterNth, s, activate
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c13, c14
(7) CdtUsableRulesProof (EQUIVALENT transformation)
The following rules are not usable and were removed:
natsFrom(z0) → cons(z0, n__natsFrom(n__s(z0)))
natsFrom(z0) → n__natsFrom(z0)
fst(pair(z0, z1)) → z0
snd(pair(z0, z1)) → z1
splitAt(0, z0) → pair(nil, z0)
splitAt(s(z0), cons(z1, z2)) → u(splitAt(z0, activate(z2)), z0, z1, activate(z2))
u(pair(z0, z1), z2, z3, z4) → pair(cons(activate(z3), z0), z1)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
sel(z0, z1) → head(afterNth(z0, z1))
take(z0, z1) → fst(splitAt(z0, z1))
afterNth(z0, z1) → snd(splitAt(z0, z1))
s(z0) → n__s(z0)
activate(n__natsFrom(z0)) → natsFrom(activate(z0))
activate(n__s(z0)) → s(activate(z0))
activate(z0) → z0
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:none
Tuples:
ACTIVATE(n__natsFrom(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
S tuples:
ACTIVATE(n__natsFrom(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:none
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c13, c14
(9) CdtRuleRemovalProof (UPPER BOUND (ADD(O(n^1))) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
ACTIVATE(n__natsFrom(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
We considered the (Usable) Rules:none
And the Tuples:
ACTIVATE(n__natsFrom(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(ACTIVATE(x1)) = [4]x1
POL(c13(x1)) = x1
POL(c14(x1)) = x1
POL(n__natsFrom(x1)) = [1] + x1
POL(n__s(x1)) = [4] + x1
(10) Obligation:
Complexity Dependency Tuples Problem
Rules:none
Tuples:
ACTIVATE(n__natsFrom(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
S tuples:none
K tuples:
ACTIVATE(n__natsFrom(z0)) → c13(ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c14(ACTIVATE(z0))
Defined Rule Symbols:none
Defined Pair Symbols:
ACTIVATE
Compound Symbols:
c13, c14
(11) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)
The set S is empty
(12) BOUNDS(O(1), O(1))