YES

We show the termination of the TRS R:

  or(true(),y) -> true()
  or(x,true()) -> true()
  or(false(),false()) -> false()
  mem(x,nil()) -> false()
  mem(x,set(y)) -> =(x,y)
  mem(x,union(y,z)) -> or(mem(x,y),mem(x,z))

-- SCC decomposition.

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

p1: mem#(x,union(y,z)) -> or#(mem(x,y),mem(x,z))
p2: mem#(x,union(y,z)) -> mem#(x,y)
p3: mem#(x,union(y,z)) -> mem#(x,z)

and R consists of:

r1: or(true(),y) -> true()
r2: or(x,true()) -> true()
r3: or(false(),false()) -> false()
r4: mem(x,nil()) -> false()
r5: mem(x,set(y)) -> =(x,y)
r6: mem(x,union(y,z)) -> or(mem(x,y),mem(x,z))

The estimated dependency graph contains the following SCCs:

  {p2, p3}


-- Reduction pair.

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

p1: mem#(x,union(y,z)) -> mem#(x,y)
p2: mem#(x,union(y,z)) -> mem#(x,z)

and R consists of:

r1: or(true(),y) -> true()
r2: or(x,true()) -> true()
r3: or(false(),false()) -> false()
r4: mem(x,nil()) -> false()
r5: mem(x,set(y)) -> =(x,y)
r6: mem(x,union(y,z)) -> or(mem(x,y),mem(x,z))

The set of usable rules consists of

  (no rules)

Take the reduction pair:

  matrix interpretations:
  
    carrier: N^4
    order: lexicographic order
    interpretations:
      mem#_A(x1,x2) = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,1,1,1)) x1 + ((1,0,0,0),(0,1,0,0),(1,1,1,0),(1,1,1,1)) x2
      union_A(x1,x2) = ((1,0,0,0),(1,0,0,0),(0,1,0,0),(1,1,1,0)) x1 + ((1,0,0,0),(0,1,0,0),(1,0,1,0),(1,1,1,0)) x2 + (1,0,1,1)

The next rules are strictly ordered:

  p1, p2

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