YES

We show the termination of the TRS R:

  f(x,nil()) -> g(nil(),x)
  f(x,g(y,z)) -> g(f(x,y),z)
  ++(x,nil()) -> x
  ++(x,g(y,z)) -> g(++(x,y),z)
  null(nil()) -> true()
  null(g(x,y)) -> false()
  mem(nil(),y) -> false()
  mem(g(x,y),z) -> or(=(y,z),mem(x,z))
  mem(x,max(x)) -> not(null(x))
  max(g(g(nil(),x),y)) -> |max'|(x,y)
  max(g(g(g(x,y),z),u())) -> |max'|(max(g(g(x,y),z)),u())

-- SCC decomposition.

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

p1: f#(x,g(y,z)) -> f#(x,y)
p2: ++#(x,g(y,z)) -> ++#(x,y)
p3: mem#(g(x,y),z) -> mem#(x,z)
p4: mem#(x,max(x)) -> null#(x)
p5: max#(g(g(g(x,y),z),u())) -> max#(g(g(x,y),z))

and R consists of:

r1: f(x,nil()) -> g(nil(),x)
r2: f(x,g(y,z)) -> g(f(x,y),z)
r3: ++(x,nil()) -> x
r4: ++(x,g(y,z)) -> g(++(x,y),z)
r5: null(nil()) -> true()
r6: null(g(x,y)) -> false()
r7: mem(nil(),y) -> false()
r8: mem(g(x,y),z) -> or(=(y,z),mem(x,z))
r9: mem(x,max(x)) -> not(null(x))
r10: max(g(g(nil(),x),y)) -> |max'|(x,y)
r11: max(g(g(g(x,y),z),u())) -> |max'|(max(g(g(x,y),z)),u())

The estimated dependency graph contains the following SCCs:

  {p1}
  {p2}
  {p3}
  {p5}


-- Reduction pair.

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

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

and R consists of:

r1: f(x,nil()) -> g(nil(),x)
r2: f(x,g(y,z)) -> g(f(x,y),z)
r3: ++(x,nil()) -> x
r4: ++(x,g(y,z)) -> g(++(x,y),z)
r5: null(nil()) -> true()
r6: null(g(x,y)) -> false()
r7: mem(nil(),y) -> false()
r8: mem(g(x,y),z) -> or(=(y,z),mem(x,z))
r9: mem(x,max(x)) -> not(null(x))
r10: max(g(g(nil(),x),y)) -> |max'|(x,y)
r11: max(g(g(g(x,y),z),u())) -> |max'|(max(g(g(x,y),z)),u())

The set of usable rules consists of

  (no rules)

Take the reduction pair:

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

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: ++#(x,g(y,z)) -> ++#(x,y)

and R consists of:

r1: f(x,nil()) -> g(nil(),x)
r2: f(x,g(y,z)) -> g(f(x,y),z)
r3: ++(x,nil()) -> x
r4: ++(x,g(y,z)) -> g(++(x,y),z)
r5: null(nil()) -> true()
r6: null(g(x,y)) -> false()
r7: mem(nil(),y) -> false()
r8: mem(g(x,y),z) -> or(=(y,z),mem(x,z))
r9: mem(x,max(x)) -> not(null(x))
r10: max(g(g(nil(),x),y)) -> |max'|(x,y)
r11: max(g(g(g(x,y),z),u())) -> |max'|(max(g(g(x,y),z)),u())

The set of usable rules consists of

  (no rules)

Take the reduction pair:

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

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: mem#(g(x,y),z) -> mem#(x,z)

and R consists of:

r1: f(x,nil()) -> g(nil(),x)
r2: f(x,g(y,z)) -> g(f(x,y),z)
r3: ++(x,nil()) -> x
r4: ++(x,g(y,z)) -> g(++(x,y),z)
r5: null(nil()) -> true()
r6: null(g(x,y)) -> false()
r7: mem(nil(),y) -> false()
r8: mem(g(x,y),z) -> or(=(y,z),mem(x,z))
r9: mem(x,max(x)) -> not(null(x))
r10: max(g(g(nil(),x),y)) -> |max'|(x,y)
r11: max(g(g(g(x,y),z),u())) -> |max'|(max(g(g(x,y),z)),u())

The set of usable rules consists of

  (no rules)

Take the reduction pair:

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

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: max#(g(g(g(x,y),z),u())) -> max#(g(g(x,y),z))

and R consists of:

r1: f(x,nil()) -> g(nil(),x)
r2: f(x,g(y,z)) -> g(f(x,y),z)
r3: ++(x,nil()) -> x
r4: ++(x,g(y,z)) -> g(++(x,y),z)
r5: null(nil()) -> true()
r6: null(g(x,y)) -> false()
r7: mem(nil(),y) -> false()
r8: mem(g(x,y),z) -> or(=(y,z),mem(x,z))
r9: mem(x,max(x)) -> not(null(x))
r10: max(g(g(nil(),x),y)) -> |max'|(x,y)
r11: max(g(g(g(x,y),z),u())) -> |max'|(max(g(g(x,y),z)),u())

The set of usable rules consists of

  (no rules)

Take the reduction pair:

  lexicographic combination of reduction pairs:
  
    1. lexicographic path order with precedence:
    
      precedence:
      
        g > u > max#
      
      argument filter:
    
        pi(max#) = 1
        pi(g) = 1
        pi(u) = []
    
    2. lexicographic path order with precedence:
    
      precedence:
      
        max# > g > u
      
      argument filter:
    
        pi(max#) = 1
        pi(g) = [1]
        pi(u) = []
    

The next rules are strictly ordered:

  p1

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