YES

We show the termination of the TRS R:

  f(|0|(),y) -> y
  f(x,|0|()) -> x
  f(i(x),y) -> i(x)
  f(f(x,y),z) -> f(x,f(y,z))
  f(g(x,y),z) -> g(f(x,z),f(y,z))
  f(|1|(),g(x,y)) -> x
  f(|2|(),g(x,y)) -> y

-- SCC decomposition.

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

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

and R consists of:

r1: f(|0|(),y) -> y
r2: f(x,|0|()) -> x
r3: f(i(x),y) -> i(x)
r4: f(f(x,y),z) -> f(x,f(y,z))
r5: f(g(x,y),z) -> g(f(x,z),f(y,z))
r6: f(|1|(),g(x,y)) -> x
r7: f(|2|(),g(x,y)) -> y

The estimated dependency graph contains the following SCCs:

  {p1, p2, p3, p4}


-- Reduction pair.

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

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

and R consists of:

r1: f(|0|(),y) -> y
r2: f(x,|0|()) -> x
r3: f(i(x),y) -> i(x)
r4: f(f(x,y),z) -> f(x,f(y,z))
r5: f(g(x,y),z) -> g(f(x,z),f(y,z))
r6: f(|1|(),g(x,y)) -> x
r7: f(|2|(),g(x,y)) -> y

The set of usable rules consists of

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

Take the reduction pair:

  lexicographic combination of reduction pairs:
  
    1. lexicographic path order with precedence:
    
      precedence:
      
        |2| > |1| > i > |0| > f# > f > g
      
      argument filter:
    
        pi(f#) = [1]
        pi(f) = [1, 2]
        pi(g) = [1, 2]
        pi(|0|) = []
        pi(i) = 1
        pi(|1|) = []
        pi(|2|) = []
    
    2. lexicographic path order with precedence:
    
      precedence:
      
        |2| > |1| > i > |0| > f > f# > g
      
      argument filter:
    
        pi(f#) = []
        pi(f) = [1, 2]
        pi(g) = []
        pi(|0|) = []
        pi(i) = 1
        pi(|1|) = []
        pi(|2|) = []
    

The next rules are strictly ordered:

  p1, p2, p3, p4

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