YES

We show the termination of the TRS R:

  app(nil(),k) -> k
  app(l,nil()) -> l
  app(cons(x,l),k) -> cons(x,app(l,k))
  sum(cons(x,nil())) -> cons(x,nil())
  sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l))
  a(h(),h(),x) -> s(x)
  a(x,s(y),h()) -> a(x,y,s(h()))
  a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z))
  a(s(x),h(),z) -> a(x,z,z)

-- SCC decomposition.

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

p1: app#(cons(x,l),k) -> app#(l,k)
p2: sum#(cons(x,cons(y,l))) -> sum#(cons(a(x,y,h()),l))
p3: sum#(cons(x,cons(y,l))) -> a#(x,y,h())
p4: a#(x,s(y),h()) -> a#(x,y,s(h()))
p5: a#(x,s(y),s(z)) -> a#(x,y,a(x,s(y),z))
p6: a#(x,s(y),s(z)) -> a#(x,s(y),z)
p7: a#(s(x),h(),z) -> a#(x,z,z)

and R consists of:

r1: app(nil(),k) -> k
r2: app(l,nil()) -> l
r3: app(cons(x,l),k) -> cons(x,app(l,k))
r4: sum(cons(x,nil())) -> cons(x,nil())
r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l))
r6: a(h(),h(),x) -> s(x)
r7: a(x,s(y),h()) -> a(x,y,s(h()))
r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z))
r9: a(s(x),h(),z) -> a(x,z,z)

The estimated dependency graph contains the following SCCs:

  {p1}
  {p2}
  {p4, p5, p6, p7}


-- Reduction pair.

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

p1: app#(cons(x,l),k) -> app#(l,k)

and R consists of:

r1: app(nil(),k) -> k
r2: app(l,nil()) -> l
r3: app(cons(x,l),k) -> cons(x,app(l,k))
r4: sum(cons(x,nil())) -> cons(x,nil())
r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l))
r6: a(h(),h(),x) -> s(x)
r7: a(x,s(y),h()) -> a(x,y,s(h()))
r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z))
r9: a(s(x),h(),z) -> a(x,z,z)

The set of usable rules consists of

  (no rules)

Take the reduction pair:

  lexicographic path order with precedence:
  
    precedence:
    
      cons > app#
    
    argument filter:
  
      pi(app#) = [1]
      pi(cons) = [1, 2]

The next rules are strictly ordered:

  p1

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

-- Reduction pair.

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

p1: sum#(cons(x,cons(y,l))) -> sum#(cons(a(x,y,h()),l))

and R consists of:

r1: app(nil(),k) -> k
r2: app(l,nil()) -> l
r3: app(cons(x,l),k) -> cons(x,app(l,k))
r4: sum(cons(x,nil())) -> cons(x,nil())
r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l))
r6: a(h(),h(),x) -> s(x)
r7: a(x,s(y),h()) -> a(x,y,s(h()))
r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z))
r9: a(s(x),h(),z) -> a(x,z,z)

The set of usable rules consists of

  r6, r7, r8, r9

Take the reduction pair:

  lexicographic path order with precedence:
  
    precedence:
    
      h > a > s > cons > sum#
    
    argument filter:
  
      pi(sum#) = [1]
      pi(cons) = [2]
      pi(a) = [1, 2, 3]
      pi(h) = []
      pi(s) = [1]

The next rules are strictly ordered:

  p1

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

-- Reduction pair.

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

p1: a#(x,s(y),h()) -> a#(x,y,s(h()))
p2: a#(s(x),h(),z) -> a#(x,z,z)
p3: a#(x,s(y),s(z)) -> a#(x,s(y),z)
p4: a#(x,s(y),s(z)) -> a#(x,y,a(x,s(y),z))

and R consists of:

r1: app(nil(),k) -> k
r2: app(l,nil()) -> l
r3: app(cons(x,l),k) -> cons(x,app(l,k))
r4: sum(cons(x,nil())) -> cons(x,nil())
r5: sum(cons(x,cons(y,l))) -> sum(cons(a(x,y,h()),l))
r6: a(h(),h(),x) -> s(x)
r7: a(x,s(y),h()) -> a(x,y,s(h()))
r8: a(x,s(y),s(z)) -> a(x,y,a(x,s(y),z))
r9: a(s(x),h(),z) -> a(x,z,z)

The set of usable rules consists of

  r6, r7, r8, r9

Take the monotone reduction pair:

  lexicographic path order with precedence:
  
    precedence:
    
      a# > a > h > s
    
    argument filter:
  
      pi(a#) = [1, 2, 3]
      pi(s) = [1]
      pi(h) = []
      pi(a) = [1, 2, 3]

The next rules are strictly ordered:

  p1, p2, p3, p4
  r1, r2, r3, r4, r5, r6, r7, r8, r9

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