(0) Obligation:
The Runtime Complexity (innermost) of the given
CpxTRS could be proven to be
BOUNDS(1, n^2).
The TRS R consists of the following rules:
first(0, X) → nil
first(s(X), cons(Y, Z)) → cons(Y, n__first(X, activate(Z)))
from(X) → cons(X, n__from(s(X)))
first(X1, X2) → n__first(X1, X2)
from(X) → n__from(X)
activate(n__first(X1, X2)) → first(X1, X2)
activate(n__from(X)) → from(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:
first(0, z0) → nil
first(s(z0), cons(z1, z2)) → cons(z1, n__first(z0, activate(z2)))
first(z0, z1) → n__first(z0, z1)
from(z0) → cons(z0, n__from(s(z0)))
from(z0) → n__from(z0)
activate(n__first(z0, z1)) → first(z0, z1)
activate(n__from(z0)) → from(z0)
activate(z0) → z0
Tuples:
FIRST(0, z0) → c
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
FIRST(z0, z1) → c2
FROM(z0) → c3
FROM(z0) → c4
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
ACTIVATE(n__from(z0)) → c6(FROM(z0))
ACTIVATE(z0) → c7
S tuples:
FIRST(0, z0) → c
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
FIRST(z0, z1) → c2
FROM(z0) → c3
FROM(z0) → c4
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
ACTIVATE(n__from(z0)) → c6(FROM(z0))
ACTIVATE(z0) → c7
K tuples:none
Defined Rule Symbols:
first, from, activate
Defined Pair Symbols:
FIRST, FROM, ACTIVATE
Compound Symbols:
c, c1, c2, c3, c4, c5, c6, c7
(3) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)
Removed 6 trailing nodes:
FIRST(z0, z1) → c2
ACTIVATE(z0) → c7
ACTIVATE(n__from(z0)) → c6(FROM(z0))
FROM(z0) → c4
FROM(z0) → c3
FIRST(0, z0) → c
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
first(0, z0) → nil
first(s(z0), cons(z1, z2)) → cons(z1, n__first(z0, activate(z2)))
first(z0, z1) → n__first(z0, z1)
from(z0) → cons(z0, n__from(s(z0)))
from(z0) → n__from(z0)
activate(n__first(z0, z1)) → first(z0, z1)
activate(n__from(z0)) → from(z0)
activate(z0) → z0
Tuples:
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
S tuples:
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
K tuples:none
Defined Rule Symbols:
first, from, activate
Defined Pair Symbols:
FIRST, ACTIVATE
Compound Symbols:
c1, c5
(5) CdtUsableRulesProof (EQUIVALENT transformation)
The following rules are not usable and were removed:
first(0, z0) → nil
first(s(z0), cons(z1, z2)) → cons(z1, n__first(z0, activate(z2)))
first(z0, z1) → n__first(z0, z1)
from(z0) → cons(z0, n__from(s(z0)))
from(z0) → n__from(z0)
activate(n__first(z0, z1)) → first(z0, z1)
activate(n__from(z0)) → from(z0)
activate(z0) → z0
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:none
Tuples:
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
S tuples:
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
K tuples:none
Defined Rule Symbols:none
Defined Pair Symbols:
FIRST, ACTIVATE
Compound Symbols:
c1, c5
(7) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
We considered the (Usable) Rules:none
And the Tuples:
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(ACTIVATE(x1)) = [2]x1 + [2]x12
POL(FIRST(x1, x2)) = [2] + x1 + x2 + [2]x22 + [2]x1·x2 + x12
POL(c1(x1)) = x1
POL(c5(x1)) = x1
POL(cons(x1, x2)) = x2
POL(n__first(x1, x2)) = [2] + x1 + x2
POL(s(x1)) = [2]
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:none
Tuples:
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
S tuples:none
K tuples:
FIRST(s(z0), cons(z1, z2)) → c1(ACTIVATE(z2))
ACTIVATE(n__first(z0, z1)) → c5(FIRST(z0, z1))
Defined Rule Symbols:none
Defined Pair Symbols:
FIRST, ACTIVATE
Compound Symbols:
c1, c5
(9) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)
The set S is empty
(10) BOUNDS(1, 1)