YES

We show the termination of the TRS R:

  f(f(x)) -> f(c(f(x)))
  f(f(x)) -> f(d(f(x)))
  g(c(x)) -> x
  g(d(x)) -> x
  g(c(h(|0|()))) -> g(d(|1|()))
  g(c(|1|())) -> g(d(h(|0|())))
  g(h(x)) -> g(x)

-- SCC decomposition.

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

p1: f#(f(x)) -> f#(c(f(x)))
p2: f#(f(x)) -> f#(d(f(x)))
p3: g#(c(h(|0|()))) -> g#(d(|1|()))
p4: g#(c(|1|())) -> g#(d(h(|0|())))
p5: g#(h(x)) -> g#(x)

and R consists of:

r1: f(f(x)) -> f(c(f(x)))
r2: f(f(x)) -> f(d(f(x)))
r3: g(c(x)) -> x
r4: g(d(x)) -> x
r5: g(c(h(|0|()))) -> g(d(|1|()))
r6: g(c(|1|())) -> g(d(h(|0|())))
r7: g(h(x)) -> g(x)

The estimated dependency graph contains the following SCCs:

  {p5}


-- Reduction pair.

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

p1: g#(h(x)) -> g#(x)

and R consists of:

r1: f(f(x)) -> f(c(f(x)))
r2: f(f(x)) -> f(d(f(x)))
r3: g(c(x)) -> x
r4: g(d(x)) -> x
r5: g(c(h(|0|()))) -> g(d(|1|()))
r6: g(c(|1|())) -> g(d(h(|0|())))
r7: g(h(x)) -> g(x)

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

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

The next rules are strictly ordered:

  p1
  r1, r2, r3, r4, r5, r6, r7

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