We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^3)).

Strict Trs:
  { terms(N) -> cons(recip(sqr(N)), n__terms(s(N)))
  , terms(X) -> n__terms(X)
  , sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0()
  , first(X1, X2) -> n__first(X1, X2)
  , first(s(X), cons(Y, Z)) -> cons(Y, n__first(X, activate(Z)))
  , first(0(), X) -> nil()
  , activate(X) -> X
  , activate(n__terms(X)) -> terms(X)
  , activate(n__first(X1, X2)) -> first(X1, X2) }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(n^3))

We add the following dependency tuples:

Strict DPs:
  { terms^#(N) -> c_1(sqr^#(N))
  , terms^#(X) -> c_2()
  , sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
  , sqr^#(0()) -> c_4()
  , add^#(s(X), Y) -> c_5(add^#(X, Y))
  , add^#(0(), X) -> c_6()
  , dbl^#(s(X)) -> c_7(dbl^#(X))
  , dbl^#(0()) -> c_8()
  , first^#(X1, X2) -> c_9()
  , first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
  , first^#(0(), X) -> c_11()
  , activate^#(X) -> c_12()
  , activate^#(n__terms(X)) -> c_13(terms^#(X))
  , activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }

and mark the set of starting terms.

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^3)).

Strict DPs:
  { terms^#(N) -> c_1(sqr^#(N))
  , terms^#(X) -> c_2()
  , sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
  , sqr^#(0()) -> c_4()
  , add^#(s(X), Y) -> c_5(add^#(X, Y))
  , add^#(0(), X) -> c_6()
  , dbl^#(s(X)) -> c_7(dbl^#(X))
  , dbl^#(0()) -> c_8()
  , first^#(X1, X2) -> c_9()
  , first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
  , first^#(0(), X) -> c_11()
  , activate^#(X) -> c_12()
  , activate^#(n__terms(X)) -> c_13(terms^#(X))
  , activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }
Weak Trs:
  { terms(N) -> cons(recip(sqr(N)), n__terms(s(N)))
  , terms(X) -> n__terms(X)
  , sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0()
  , first(X1, X2) -> n__first(X1, X2)
  , first(s(X), cons(Y, Z)) -> cons(Y, n__first(X, activate(Z)))
  , first(0(), X) -> nil()
  , activate(X) -> X
  , activate(n__terms(X)) -> terms(X)
  , activate(n__first(X1, X2)) -> first(X1, X2) }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(n^3))

We estimate the number of application of {2,4,6,8,9,11,12} by
applications of Pre({2,4,6,8,9,11,12}) = {1,3,5,7,10,13,14}. Here
rules are labeled as follows:

  DPs:
    { 1: terms^#(N) -> c_1(sqr^#(N))
    , 2: terms^#(X) -> c_2()
    , 3: sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
    , 4: sqr^#(0()) -> c_4()
    , 5: add^#(s(X), Y) -> c_5(add^#(X, Y))
    , 6: add^#(0(), X) -> c_6()
    , 7: dbl^#(s(X)) -> c_7(dbl^#(X))
    , 8: dbl^#(0()) -> c_8()
    , 9: first^#(X1, X2) -> c_9()
    , 10: first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
    , 11: first^#(0(), X) -> c_11()
    , 12: activate^#(X) -> c_12()
    , 13: activate^#(n__terms(X)) -> c_13(terms^#(X))
    , 14: activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^3)).

Strict DPs:
  { terms^#(N) -> c_1(sqr^#(N))
  , sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
  , add^#(s(X), Y) -> c_5(add^#(X, Y))
  , dbl^#(s(X)) -> c_7(dbl^#(X))
  , first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
  , activate^#(n__terms(X)) -> c_13(terms^#(X))
  , activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }
Weak DPs:
  { terms^#(X) -> c_2()
  , sqr^#(0()) -> c_4()
  , add^#(0(), X) -> c_6()
  , dbl^#(0()) -> c_8()
  , first^#(X1, X2) -> c_9()
  , first^#(0(), X) -> c_11()
  , activate^#(X) -> c_12() }
Weak Trs:
  { terms(N) -> cons(recip(sqr(N)), n__terms(s(N)))
  , terms(X) -> n__terms(X)
  , sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0()
  , first(X1, X2) -> n__first(X1, X2)
  , first(s(X), cons(Y, Z)) -> cons(Y, n__first(X, activate(Z)))
  , first(0(), X) -> nil()
  , activate(X) -> X
  , activate(n__terms(X)) -> terms(X)
  , activate(n__first(X1, X2)) -> first(X1, X2) }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(n^3))

The following weak DPs constitute a sub-graph of the DG that is
closed under successors. The DPs are removed.

{ terms^#(X) -> c_2()
, sqr^#(0()) -> c_4()
, add^#(0(), X) -> c_6()
, dbl^#(0()) -> c_8()
, first^#(X1, X2) -> c_9()
, first^#(0(), X) -> c_11()
, activate^#(X) -> c_12() }

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^3)).

Strict DPs:
  { terms^#(N) -> c_1(sqr^#(N))
  , sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
  , add^#(s(X), Y) -> c_5(add^#(X, Y))
  , dbl^#(s(X)) -> c_7(dbl^#(X))
  , first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
  , activate^#(n__terms(X)) -> c_13(terms^#(X))
  , activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }
Weak Trs:
  { terms(N) -> cons(recip(sqr(N)), n__terms(s(N)))
  , terms(X) -> n__terms(X)
  , sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0()
  , first(X1, X2) -> n__first(X1, X2)
  , first(s(X), cons(Y, Z)) -> cons(Y, n__first(X, activate(Z)))
  , first(0(), X) -> nil()
  , activate(X) -> X
  , activate(n__terms(X)) -> terms(X)
  , activate(n__first(X1, X2)) -> first(X1, X2) }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(n^3))

We replace rewrite rules by usable rules:

  Weak Usable Rules:
    { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
    , sqr(0()) -> 0()
    , add(s(X), Y) -> s(add(X, Y))
    , add(0(), X) -> X
    , dbl(s(X)) -> s(s(dbl(X)))
    , dbl(0()) -> 0() }

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^3)).

Strict DPs:
  { terms^#(N) -> c_1(sqr^#(N))
  , sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
  , add^#(s(X), Y) -> c_5(add^#(X, Y))
  , dbl^#(s(X)) -> c_7(dbl^#(X))
  , first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
  , activate^#(n__terms(X)) -> c_13(terms^#(X))
  , activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }
Weak Trs:
  { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0() }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(n^3))

We decompose the input problem according to the dependency graph
into the upper component

  { terms^#(N) -> c_1(sqr^#(N))
  , sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
  , first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
  , activate^#(n__terms(X)) -> c_13(terms^#(X))
  , activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }

and lower component

  { add^#(s(X), Y) -> c_5(add^#(X, Y))
  , dbl^#(s(X)) -> c_7(dbl^#(X)) }

Further, following extension rules are added to the lower
component.

{ terms^#(N) -> sqr^#(N)
, sqr^#(s(X)) -> sqr^#(X)
, sqr^#(s(X)) -> add^#(sqr(X), dbl(X))
, sqr^#(s(X)) -> dbl^#(X)
, first^#(s(X), cons(Y, Z)) -> activate^#(Z)
, activate^#(n__terms(X)) -> terms^#(X)
, activate^#(n__first(X1, X2)) -> first^#(X1, X2) }

TcT solves the upper component with certificate YES(O(1),O(n^1)).

Sub-proof:
----------
  We are left with following problem, upon which TcT provides the
  certificate YES(O(1),O(n^1)).
  
  Strict DPs:
    { terms^#(N) -> c_1(sqr^#(N))
    , sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
    , first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
    , activate^#(n__terms(X)) -> c_13(terms^#(X))
    , activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }
  Weak Trs:
    { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
    , sqr(0()) -> 0()
    , add(s(X), Y) -> s(add(X, Y))
    , add(0(), X) -> X
    , dbl(s(X)) -> s(s(dbl(X)))
    , dbl(0()) -> 0() }
  Obligation:
    innermost runtime complexity
  Answer:
    YES(O(1),O(n^1))
  
  We use the processor 'matrix interpretation of dimension 1' to
  orient following rules strictly.
  
  DPs:
    { 2: sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
    , 3: first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
    , 4: activate^#(n__terms(X)) -> c_13(terms^#(X))
    , 5: activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }
  Trs:
    { sqr(0()) -> 0()
    , dbl(0()) -> 0() }
  
  Sub-proof:
  ----------
    The following argument positions are usable:
      Uargs(c_1) = {1}, Uargs(c_3) = {1, 2}, Uargs(c_10) = {1},
      Uargs(c_13) = {1}, Uargs(c_14) = {1}
    
    TcT has computed the following constructor-based matrix
    interpretation satisfying not(EDA).
    
          [cons](x1, x2) = [1] x2 + [2]                  
                                                         
               [sqr](x1) = [1]                           
                                                         
          [n__terms](x1) = [1] x1 + [2]                  
                                                         
                 [s](x1) = [1] x1 + [5]                  
                                                         
                     [0] = [0]                           
                                                         
           [add](x1, x2) = [2] x2 + [0]                  
                                                         
               [dbl](x1) = [1]                           
                                                         
      [n__first](x1, x2) = [1] x1 + [1] x2 + [2]         
                                                         
           [terms^#](x1) = [1] x1 + [0]                  
                                                         
               [c_1](x1) = [1] x1 + [0]                  
                                                         
             [sqr^#](x1) = [1] x1 + [0]                  
                                                         
       [c_3](x1, x2, x3) = [1] x1 + [1] x2 + [1] x3 + [0]
                                                         
         [add^#](x1, x2) = [1]                           
                                                         
             [dbl^#](x1) = [3]                           
                                                         
       [first^#](x1, x2) = [4] x2 + [0]                  
                                                         
              [c_10](x1) = [1] x1 + [1]                  
                                                         
        [activate^#](x1) = [4] x1 + [0]                  
                                                         
              [c_13](x1) = [1] x1 + [1]                  
                                                         
              [c_14](x1) = [1] x1 + [1]                  
    
    The order satisfies the following ordering constraints:
    
                         [sqr(s(X))] =  [1]                                             
                                     ?  [7]                                             
                                     =  [s(add(sqr(X), dbl(X)))]                        
                                                                                        
                          [sqr(0())] =  [1]                                             
                                     >  [0]                                             
                                     =  [0()]                                           
                                                                                        
                      [add(s(X), Y)] =  [2] Y + [0]                                     
                                     ?  [2] Y + [5]                                     
                                     =  [s(add(X, Y))]                                  
                                                                                        
                       [add(0(), X)] =  [2] X + [0]                                     
                                     >= [1] X + [0]                                     
                                     =  [X]                                             
                                                                                        
                         [dbl(s(X))] =  [1]                                             
                                     ?  [11]                                            
                                     =  [s(s(dbl(X)))]                                  
                                                                                        
                          [dbl(0())] =  [1]                                             
                                     >  [0]                                             
                                     =  [0()]                                           
                                                                                        
                        [terms^#(N)] =  [1] N + [0]                                     
                                     >= [1] N + [0]                                     
                                     =  [c_1(sqr^#(N))]                                 
                                                                                        
                       [sqr^#(s(X))] =  [1] X + [5]                                     
                                     >  [1] X + [4]                                     
                                     =  [c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))]
                                                                                        
         [first^#(s(X), cons(Y, Z))] =  [4] Z + [8]                                     
                                     >  [4] Z + [1]                                     
                                     =  [c_10(activate^#(Z))]                           
                                                                                        
           [activate^#(n__terms(X))] =  [4] X + [8]                                     
                                     >  [1] X + [1]                                     
                                     =  [c_13(terms^#(X))]                              
                                                                                        
      [activate^#(n__first(X1, X2))] =  [4] X1 + [4] X2 + [8]                           
                                     >  [4] X2 + [1]                                    
                                     =  [c_14(first^#(X1, X2))]                         
                                                                                        
  
  We return to the main proof. Consider the set of all dependency
  pairs
  
  :
    { 1: terms^#(N) -> c_1(sqr^#(N))
    , 2: sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
    , 3: first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
    , 4: activate^#(n__terms(X)) -> c_13(terms^#(X))
    , 5: activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }
  
  Processor 'matrix interpretation of dimension 1' induces the
  complexity certificate YES(?,O(n^1)) on application of dependency
  pairs {2,3,4,5}. These cover all (indirect) predecessors of
  dependency pairs {1,2,3,4,5}, their number of application is
  equally bounded. The dependency pairs are shifted into the weak
  component.
  
  We are left with following problem, upon which TcT provides the
  certificate YES(O(1),O(1)).
  
  Weak DPs:
    { terms^#(N) -> c_1(sqr^#(N))
    , sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
    , first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
    , activate^#(n__terms(X)) -> c_13(terms^#(X))
    , activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }
  Weak Trs:
    { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
    , sqr(0()) -> 0()
    , add(s(X), Y) -> s(add(X, Y))
    , add(0(), X) -> X
    , dbl(s(X)) -> s(s(dbl(X)))
    , dbl(0()) -> 0() }
  Obligation:
    innermost runtime complexity
  Answer:
    YES(O(1),O(1))
  
  The following weak DPs constitute a sub-graph of the DG that is
  closed under successors. The DPs are removed.
  
  { terms^#(N) -> c_1(sqr^#(N))
  , sqr^#(s(X)) -> c_3(add^#(sqr(X), dbl(X)), sqr^#(X), dbl^#(X))
  , first^#(s(X), cons(Y, Z)) -> c_10(activate^#(Z))
  , activate^#(n__terms(X)) -> c_13(terms^#(X))
  , activate^#(n__first(X1, X2)) -> c_14(first^#(X1, X2)) }
  
  We are left with following problem, upon which TcT provides the
  certificate YES(O(1),O(1)).
  
  Weak Trs:
    { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
    , sqr(0()) -> 0()
    , add(s(X), Y) -> s(add(X, Y))
    , add(0(), X) -> X
    , dbl(s(X)) -> s(s(dbl(X)))
    , dbl(0()) -> 0() }
  Obligation:
    innermost runtime complexity
  Answer:
    YES(O(1),O(1))
  
  No rule is usable, rules are removed from the input problem.
  
  We are left with following problem, upon which TcT provides the
  certificate YES(O(1),O(1)).
  
  Rules: Empty
  Obligation:
    innermost runtime complexity
  Answer:
    YES(O(1),O(1))
  
  Empty rules are trivially bounded

We return to the main proof.

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).

Strict DPs:
  { add^#(s(X), Y) -> c_5(add^#(X, Y))
  , dbl^#(s(X)) -> c_7(dbl^#(X)) }
Weak DPs:
  { terms^#(N) -> sqr^#(N)
  , sqr^#(s(X)) -> sqr^#(X)
  , sqr^#(s(X)) -> add^#(sqr(X), dbl(X))
  , sqr^#(s(X)) -> dbl^#(X)
  , first^#(s(X), cons(Y, Z)) -> activate^#(Z)
  , activate^#(n__terms(X)) -> terms^#(X)
  , activate^#(n__first(X1, X2)) -> first^#(X1, X2) }
Weak Trs:
  { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0() }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(n^2))

We use the processor 'matrix interpretation of dimension 1' to
orient following rules strictly.

DPs:
  { 2: dbl^#(s(X)) -> c_7(dbl^#(X))
  , 3: terms^#(N) -> sqr^#(N)
  , 4: sqr^#(s(X)) -> sqr^#(X)
  , 5: sqr^#(s(X)) -> add^#(sqr(X), dbl(X))
  , 6: sqr^#(s(X)) -> dbl^#(X)
  , 7: first^#(s(X), cons(Y, Z)) -> activate^#(Z)
  , 8: activate^#(n__terms(X)) -> terms^#(X)
  , 9: activate^#(n__first(X1, X2)) -> first^#(X1, X2) }

Sub-proof:
----------
  The following argument positions are usable:
    Uargs(c_5) = {1}, Uargs(c_7) = {1}
  
  TcT has computed the following constructor-based matrix
  interpretation satisfying not(EDA).
  
        [cons](x1, x2) = [1] x2 + [2]         
                                              
             [sqr](x1) = [0]                  
                                              
        [n__terms](x1) = [1] x1 + [2]         
                                              
               [s](x1) = [1] x1 + [7]         
                                              
                   [0] = [0]                  
                                              
         [add](x1, x2) = [1]                  
                                              
             [dbl](x1) = [0]                  
                                              
    [n__first](x1, x2) = [1] x1 + [1] x2 + [2]
                                              
         [terms^#](x1) = [4] x1 + [5]         
                                              
           [sqr^#](x1) = [2] x1 + [0]         
                                              
       [add^#](x1, x2) = [0]                  
                                              
           [dbl^#](x1) = [2] x1 + [0]         
                                              
             [c_5](x1) = [4] x1 + [0]         
                                              
             [c_7](x1) = [1] x1 + [1]         
                                              
     [first^#](x1, x2) = [4] x2 + [0]         
                                              
      [activate^#](x1) = [4] x1 + [0]         
  
  The order satisfies the following ordering constraints:
  
                       [sqr(s(X))] =  [0]                     
                                   ?  [8]                     
                                   =  [s(add(sqr(X), dbl(X)))]
                                                              
                        [sqr(0())] =  [0]                     
                                   >= [0]                     
                                   =  [0()]                   
                                                              
                    [add(s(X), Y)] =  [1]                     
                                   ?  [8]                     
                                   =  [s(add(X, Y))]          
                                                              
                     [add(0(), X)] =  [1]                     
                                   ?  [1] X + [0]             
                                   =  [X]                     
                                                              
                       [dbl(s(X))] =  [0]                     
                                   ?  [14]                    
                                   =  [s(s(dbl(X)))]          
                                                              
                        [dbl(0())] =  [0]                     
                                   >= [0]                     
                                   =  [0()]                   
                                                              
                      [terms^#(N)] =  [4] N + [5]             
                                   >  [2] N + [0]             
                                   =  [sqr^#(N)]              
                                                              
                     [sqr^#(s(X))] =  [2] X + [14]            
                                   >  [2] X + [0]             
                                   =  [sqr^#(X)]              
                                                              
                     [sqr^#(s(X))] =  [2] X + [14]            
                                   >  [0]                     
                                   =  [add^#(sqr(X), dbl(X))] 
                                                              
                     [sqr^#(s(X))] =  [2] X + [14]            
                                   >  [2] X + [0]             
                                   =  [dbl^#(X)]              
                                                              
                  [add^#(s(X), Y)] =  [0]                     
                                   >= [0]                     
                                   =  [c_5(add^#(X, Y))]      
                                                              
                     [dbl^#(s(X))] =  [2] X + [14]            
                                   >  [2] X + [1]             
                                   =  [c_7(dbl^#(X))]         
                                                              
       [first^#(s(X), cons(Y, Z))] =  [4] Z + [8]             
                                   >  [4] Z + [0]             
                                   =  [activate^#(Z)]         
                                                              
         [activate^#(n__terms(X))] =  [4] X + [8]             
                                   >  [4] X + [5]             
                                   =  [terms^#(X)]            
                                                              
    [activate^#(n__first(X1, X2))] =  [4] X1 + [4] X2 + [8]   
                                   >  [4] X2 + [0]            
                                   =  [first^#(X1, X2)]       
                                                              

The strictly oriented rules are moved into the weak component.

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).

Strict DPs: { add^#(s(X), Y) -> c_5(add^#(X, Y)) }
Weak DPs:
  { terms^#(N) -> sqr^#(N)
  , sqr^#(s(X)) -> sqr^#(X)
  , sqr^#(s(X)) -> add^#(sqr(X), dbl(X))
  , sqr^#(s(X)) -> dbl^#(X)
  , dbl^#(s(X)) -> c_7(dbl^#(X))
  , first^#(s(X), cons(Y, Z)) -> activate^#(Z)
  , activate^#(n__terms(X)) -> terms^#(X)
  , activate^#(n__first(X1, X2)) -> first^#(X1, X2) }
Weak Trs:
  { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0() }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(n^2))

The following weak DPs constitute a sub-graph of the DG that is
closed under successors. The DPs are removed.

{ sqr^#(s(X)) -> dbl^#(X)
, dbl^#(s(X)) -> c_7(dbl^#(X)) }

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).

Strict DPs: { add^#(s(X), Y) -> c_5(add^#(X, Y)) }
Weak DPs:
  { terms^#(N) -> sqr^#(N)
  , sqr^#(s(X)) -> sqr^#(X)
  , sqr^#(s(X)) -> add^#(sqr(X), dbl(X))
  , first^#(s(X), cons(Y, Z)) -> activate^#(Z)
  , activate^#(n__terms(X)) -> terms^#(X)
  , activate^#(n__first(X1, X2)) -> first^#(X1, X2) }
Weak Trs:
  { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0() }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(n^2))

We use the processor 'custom shape polynomial interpretation' to
orient following rules strictly.

DPs:
  { 1: add^#(s(X), Y) -> c_5(add^#(X, Y))
  , 3: sqr^#(s(X)) -> sqr^#(X)
  , 4: sqr^#(s(X)) -> add^#(sqr(X), dbl(X)) }
Trs:
  { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(0(), X) -> X
  , dbl(0()) -> 0() }

Sub-proof:
----------
  The following argument positions are considered usable:
    Uargs(c_5) = {1}
  TcT has computed the following constructor-restricted polynomial
  interpretation.
      [cons](x1, x2) = x2        
                                 
           [sqr](x1) = x1 + x1^2 
                                 
      [n__terms](x1) = x1        
                                 
             [s](x1) = 1 + x1    
                                 
               [0]() = 1         
                                 
       [add](x1, x2) = x1 + x2   
                                 
           [dbl](x1) = 2*x1      
                                 
  [n__first](x1, x2) = x2        
                                 
       [terms^#](x1) = 1 + 2*x1^2
                                 
         [sqr^#](x1) = 1 + 2*x1^2
                                 
     [add^#](x1, x2) = 2 + x1    
                                 
         [dbl^#](x1) = 0         
                                 
           [c_5](x1) = x1        
                                 
           [c_7](x1) = 0         
                                 
   [first^#](x1, x2) = 1 + 2*x2^2
                                 
    [activate^#](x1) = 1 + 2*x1^2
                                 
  
  This order satisfies the following ordering constraints.
  
                       [sqr(s(X))] =  2 + 3*X + X^2           
                                   >  1 + 3*X + X^2           
                                   =  [s(add(sqr(X), dbl(X)))]
                                                              
                        [sqr(0())] =  2                       
                                   >  1                       
                                   =  [0()]                   
                                                              
                    [add(s(X), Y)] =  1 + X + Y               
                                   >= 1 + X + Y               
                                   =  [s(add(X, Y))]          
                                                              
                     [add(0(), X)] =  1 + X                   
                                   >  X                       
                                   =  [X]                     
                                                              
                       [dbl(s(X))] =  2 + 2*X                 
                                   >= 2 + 2*X                 
                                   =  [s(s(dbl(X)))]          
                                                              
                        [dbl(0())] =  2                       
                                   >  1                       
                                   =  [0()]                   
                                                              
                      [terms^#(N)] =  1 + 2*N^2               
                                   >= 1 + 2*N^2               
                                   =  [sqr^#(N)]              
                                                              
                     [sqr^#(s(X))] =  3 + 4*X + 2*X^2         
                                   >  1 + 2*X^2               
                                   =  [sqr^#(X)]              
                                                              
                     [sqr^#(s(X))] =  3 + 4*X + 2*X^2         
                                   >  2 + X + X^2             
                                   =  [add^#(sqr(X), dbl(X))] 
                                                              
                  [add^#(s(X), Y)] =  3 + X                   
                                   >  2 + X                   
                                   =  [c_5(add^#(X, Y))]      
                                                              
       [first^#(s(X), cons(Y, Z))] =  1 + 2*Z^2               
                                   >= 1 + 2*Z^2               
                                   =  [activate^#(Z)]         
                                                              
         [activate^#(n__terms(X))] =  1 + 2*X^2               
                                   >= 1 + 2*X^2               
                                   =  [terms^#(X)]            
                                                              
    [activate^#(n__first(X1, X2))] =  1 + 2*X2^2              
                                   >= 1 + 2*X2^2              
                                   =  [first^#(X1, X2)]       
                                                              

The strictly oriented rules are moved into the weak component.

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(1)).

Weak DPs:
  { terms^#(N) -> sqr^#(N)
  , sqr^#(s(X)) -> sqr^#(X)
  , sqr^#(s(X)) -> add^#(sqr(X), dbl(X))
  , add^#(s(X), Y) -> c_5(add^#(X, Y))
  , first^#(s(X), cons(Y, Z)) -> activate^#(Z)
  , activate^#(n__terms(X)) -> terms^#(X)
  , activate^#(n__first(X1, X2)) -> first^#(X1, X2) }
Weak Trs:
  { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0() }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(1))

The following weak DPs constitute a sub-graph of the DG that is
closed under successors. The DPs are removed.

{ terms^#(N) -> sqr^#(N)
, sqr^#(s(X)) -> sqr^#(X)
, sqr^#(s(X)) -> add^#(sqr(X), dbl(X))
, add^#(s(X), Y) -> c_5(add^#(X, Y))
, first^#(s(X), cons(Y, Z)) -> activate^#(Z)
, activate^#(n__terms(X)) -> terms^#(X)
, activate^#(n__first(X1, X2)) -> first^#(X1, X2) }

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(1)).

Weak Trs:
  { sqr(s(X)) -> s(add(sqr(X), dbl(X)))
  , sqr(0()) -> 0()
  , add(s(X), Y) -> s(add(X, Y))
  , add(0(), X) -> X
  , dbl(s(X)) -> s(s(dbl(X)))
  , dbl(0()) -> 0() }
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(1))

No rule is usable, rules are removed from the input problem.

We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(1)).

Rules: Empty
Obligation:
  innermost runtime complexity
Answer:
  YES(O(1),O(1))

Empty rules are trivially bounded

Hurray, we answered YES(O(1),O(n^3))