YES

We show the termination of the TRS R:

  a(f(),a(f(),x)) -> a(x,x)
  a(h(),x) -> a(f(),a(g(),a(f(),x)))

-- SCC decomposition.

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

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

and R consists of:

r1: a(f(),a(f(),x)) -> a(x,x)
r2: a(h(),x) -> a(f(),a(g(),a(f(),x)))

The estimated dependency graph contains the following SCCs:

  {p1, p4}


-- Reduction pair.

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

p1: a#(f(),a(f(),x)) -> a#(x,x)
p2: a#(h(),x) -> a#(f(),x)

and R consists of:

r1: a(f(),a(f(),x)) -> a(x,x)
r2: a(h(),x) -> a(f(),a(g(),a(f(),x)))

The set of usable rules consists of

  (no rules)

Take the reduction pair:

  lexicographic combination of reduction pairs:
  
    1. matrix interpretations:
    
      carrier: N^2
      order: standard order
      interpretations:
        a#_A(x1,x2) = ((1,0),(1,1)) x2
        f_A() = (1,1)
        a_A(x1,x2) = ((0,1),(0,1)) x1 + ((1,0),(1,1)) x2
        h_A() = (1,1)
    
    2. matrix interpretations:
    
      carrier: N^2
      order: standard order
      interpretations:
        a#_A(x1,x2) = (0,0)
        f_A() = (1,1)
        a_A(x1,x2) = x2 + (1,1)
        h_A() = (1,1)
    

The next rules are strictly ordered:

  p1

We remove them from the problem.

-- SCC decomposition.

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

p1: a#(h(),x) -> a#(f(),x)

and R consists of:

r1: a(f(),a(f(),x)) -> a(x,x)
r2: a(h(),x) -> a(f(),a(g(),a(f(),x)))

The estimated dependency graph contains the following SCCs:

  (no SCCs)