YES

We show the termination of the TRS R:

  and(true(),X) -> activate(X)
  and(false(),Y) -> false()
  if(true(),X,Y) -> activate(X)
  if(false(),X,Y) -> activate(Y)
  add(|0|(),X) -> activate(X)
  add(s(X),Y) -> s(n__add(activate(X),activate(Y)))
  first(|0|(),X) -> nil()
  first(s(X),cons(Y,Z)) -> cons(activate(Y),n__first(activate(X),activate(Z)))
  from(X) -> cons(activate(X),n__from(n__s(activate(X))))
  add(X1,X2) -> n__add(X1,X2)
  first(X1,X2) -> n__first(X1,X2)
  from(X) -> n__from(X)
  s(X) -> n__s(X)
  activate(n__add(X1,X2)) -> add(X1,X2)
  activate(n__first(X1,X2)) -> first(X1,X2)
  activate(n__from(X)) -> from(X)
  activate(n__s(X)) -> s(X)
  activate(X) -> X

-- SCC decomposition.

Consider the dependency pair problem (P, R), where P consists of

p1: and#(true(),X) -> activate#(X)
p2: if#(true(),X,Y) -> activate#(X)
p3: if#(false(),X,Y) -> activate#(Y)
p4: add#(|0|(),X) -> activate#(X)
p5: add#(s(X),Y) -> s#(n__add(activate(X),activate(Y)))
p6: add#(s(X),Y) -> activate#(X)
p7: add#(s(X),Y) -> activate#(Y)
p8: first#(s(X),cons(Y,Z)) -> activate#(Y)
p9: first#(s(X),cons(Y,Z)) -> activate#(X)
p10: first#(s(X),cons(Y,Z)) -> activate#(Z)
p11: from#(X) -> activate#(X)
p12: activate#(n__add(X1,X2)) -> add#(X1,X2)
p13: activate#(n__first(X1,X2)) -> first#(X1,X2)
p14: activate#(n__from(X)) -> from#(X)
p15: activate#(n__s(X)) -> s#(X)

and R consists of:

r1: and(true(),X) -> activate(X)
r2: and(false(),Y) -> false()
r3: if(true(),X,Y) -> activate(X)
r4: if(false(),X,Y) -> activate(Y)
r5: add(|0|(),X) -> activate(X)
r6: add(s(X),Y) -> s(n__add(activate(X),activate(Y)))
r7: first(|0|(),X) -> nil()
r8: first(s(X),cons(Y,Z)) -> cons(activate(Y),n__first(activate(X),activate(Z)))
r9: from(X) -> cons(activate(X),n__from(n__s(activate(X))))
r10: add(X1,X2) -> n__add(X1,X2)
r11: first(X1,X2) -> n__first(X1,X2)
r12: from(X) -> n__from(X)
r13: s(X) -> n__s(X)
r14: activate(n__add(X1,X2)) -> add(X1,X2)
r15: activate(n__first(X1,X2)) -> first(X1,X2)
r16: activate(n__from(X)) -> from(X)
r17: activate(n__s(X)) -> s(X)
r18: activate(X) -> X

The estimated dependency graph contains the following SCCs:

  {p4, p6, p7, p8, p9, p10, p11, p12, p13, p14}


-- Reduction pair.

Consider the dependency pair problem (P, R), where P consists of

p1: activate#(n__add(X1,X2)) -> add#(X1,X2)
p2: add#(s(X),Y) -> activate#(Y)
p3: activate#(n__from(X)) -> from#(X)
p4: from#(X) -> activate#(X)
p5: activate#(n__first(X1,X2)) -> first#(X1,X2)
p6: first#(s(X),cons(Y,Z)) -> activate#(Z)
p7: first#(s(X),cons(Y,Z)) -> activate#(X)
p8: first#(s(X),cons(Y,Z)) -> activate#(Y)
p9: add#(s(X),Y) -> activate#(X)
p10: add#(|0|(),X) -> activate#(X)

and R consists of:

r1: and(true(),X) -> activate(X)
r2: and(false(),Y) -> false()
r3: if(true(),X,Y) -> activate(X)
r4: if(false(),X,Y) -> activate(Y)
r5: add(|0|(),X) -> activate(X)
r6: add(s(X),Y) -> s(n__add(activate(X),activate(Y)))
r7: first(|0|(),X) -> nil()
r8: first(s(X),cons(Y,Z)) -> cons(activate(Y),n__first(activate(X),activate(Z)))
r9: from(X) -> cons(activate(X),n__from(n__s(activate(X))))
r10: add(X1,X2) -> n__add(X1,X2)
r11: first(X1,X2) -> n__first(X1,X2)
r12: from(X) -> n__from(X)
r13: s(X) -> n__s(X)
r14: activate(n__add(X1,X2)) -> add(X1,X2)
r15: activate(n__first(X1,X2)) -> first(X1,X2)
r16: activate(n__from(X)) -> from(X)
r17: activate(n__s(X)) -> s(X)
r18: activate(X) -> X

The set of usable rules consists of

  (no rules)

Take the reduction pair:

  lexicographic combination of reduction pairs:
  
    1. matrix interpretations:
    
      carrier: N^1
      order: standard order
      interpretations:
        activate#_A(x1) = x1
        n__add_A(x1,x2) = x1 + x2 + 1
        add#_A(x1,x2) = x1 + x2
        s_A(x1) = x1 + 1
        n__from_A(x1) = x1 + 2
        from#_A(x1) = x1 + 1
        n__first_A(x1,x2) = x1 + x2 + 1
        first#_A(x1,x2) = x1 + x2
        cons_A(x1,x2) = x1 + x2 + 1
        |0|_A() = 1
    
    2. matrix interpretations:
    
      carrier: N^1
      order: standard order
      interpretations:
        activate#_A(x1) = x1
        n__add_A(x1,x2) = x1 + x2 + 1
        add#_A(x1,x2) = x1 + 2
        s_A(x1) = x1 + 1
        n__from_A(x1) = x1 + 1
        from#_A(x1) = 2
        n__first_A(x1,x2) = x1 + x2 + 1
        first#_A(x1,x2) = x1 + x2 + 2
        cons_A(x1,x2) = x1 + x2 + 1
        |0|_A() = 1
    

The next rules are strictly ordered:

  p1, p2, p3, p4, p5, p6, p7, p8, p9, p10

We remove them from the problem.  Then no dependency pair remains.