YES

We show the termination of the TRS R:

  f(x,|0|()) -> s(|0|())
  f(s(x),s(y)) -> s(f(x,y))
  g(|0|(),x) -> g(f(x,x),x)

-- SCC decomposition.

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

p1: f#(s(x),s(y)) -> f#(x,y)
p2: g#(|0|(),x) -> g#(f(x,x),x)
p3: g#(|0|(),x) -> f#(x,x)

and R consists of:

r1: f(x,|0|()) -> s(|0|())
r2: f(s(x),s(y)) -> s(f(x,y))
r3: g(|0|(),x) -> g(f(x,x),x)

The estimated dependency graph contains the following SCCs:

  {p2}
  {p1}


-- Reduction pair.

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

p1: g#(|0|(),x) -> g#(f(x,x),x)

and R consists of:

r1: f(x,|0|()) -> s(|0|())
r2: f(s(x),s(y)) -> s(f(x,y))
r3: g(|0|(),x) -> g(f(x,x),x)

The set of usable rules consists of

  r1, r2

Take the reduction pair:

  lexicographic path order with precedence:
  
    precedence:
    
      |0| > f > s > g#
    
    argument filter:
  
      pi(g#) = 1
      pi(|0|) = []
      pi(f) = []
      pi(s) = []

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: f#(s(x),s(y)) -> f#(x,y)

and R consists of:

r1: f(x,|0|()) -> s(|0|())
r2: f(s(x),s(y)) -> s(f(x,y))
r3: g(|0|(),x) -> g(f(x,x),x)

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

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

The next rules are strictly ordered:

  p1
  r1, r2, r3

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