YES

We show the termination of the TRS R:

  f(a()) -> b()
  f(c()) -> d()
  f(g(x,y)) -> g(f(x),f(y))
  f(h(x,y)) -> g(h(y,f(x)),h(x,f(y)))
  g(x,x) -> h(e(),x)

-- SCC decomposition.

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

p1: f#(g(x,y)) -> g#(f(x),f(y))
p2: f#(g(x,y)) -> f#(x)
p3: f#(g(x,y)) -> f#(y)
p4: f#(h(x,y)) -> g#(h(y,f(x)),h(x,f(y)))
p5: f#(h(x,y)) -> f#(x)
p6: f#(h(x,y)) -> f#(y)

and R consists of:

r1: f(a()) -> b()
r2: f(c()) -> d()
r3: f(g(x,y)) -> g(f(x),f(y))
r4: f(h(x,y)) -> g(h(y,f(x)),h(x,f(y)))
r5: g(x,x) -> h(e(),x)

The estimated dependency graph contains the following SCCs:

  {p2, p3, p5, p6}


-- Reduction pair.

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

p1: f#(g(x,y)) -> f#(x)
p2: f#(h(x,y)) -> f#(y)
p3: f#(h(x,y)) -> f#(x)
p4: f#(g(x,y)) -> f#(y)

and R consists of:

r1: f(a()) -> b()
r2: f(c()) -> d()
r3: f(g(x,y)) -> g(f(x),f(y))
r4: f(h(x,y)) -> g(h(y,f(x)),h(x,f(y)))
r5: g(x,x) -> h(e(),x)

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

  lexicographic combination of reduction pairs:
  
    1. matrix interpretations:
    
      carrier: N^1
      order: standard order
      interpretations:
        f#_A(x1) = x1
        g_A(x1,x2) = x1 + x2 + 1
        h_A(x1,x2) = x1 + x2 + 1
    
    2. lexicographic path order with precedence:
    
      precedence:
      
        f# > h > g
      
      argument filter:
    
        pi(f#) = 1
        pi(g) = [1, 2]
        pi(h) = [1, 2]
    

The next rules are strictly ordered:

  p1, p2, p3, p4
  r1, r2, r3, r4, r5

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