YES

We show the termination of the TRS R:

  -(x,|0|()) -> x
  -(s(x),s(y)) -> -(x,y)
  <=(|0|(),y) -> true()
  <=(s(x),|0|()) -> false()
  <=(s(x),s(y)) -> <=(x,y)
  if(true(),x,y) -> x
  if(false(),x,y) -> y
  perfectp(|0|()) -> false()
  perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x))
  f(|0|(),y,|0|(),u) -> true()
  f(|0|(),y,s(z),u) -> false()
  f(s(x),|0|(),z,u) -> f(x,u,-(z,s(x)),u)
  f(s(x),s(y),z,u) -> if(<=(x,y),f(s(x),-(y,x),z,u),f(x,u,z,u))

-- SCC decomposition.

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

p1: -#(s(x),s(y)) -> -#(x,y)
p2: <=#(s(x),s(y)) -> <=#(x,y)
p3: perfectp#(s(x)) -> f#(x,s(|0|()),s(x),s(x))
p4: f#(s(x),|0|(),z,u) -> f#(x,u,-(z,s(x)),u)
p5: f#(s(x),|0|(),z,u) -> -#(z,s(x))
p6: f#(s(x),s(y),z,u) -> if#(<=(x,y),f(s(x),-(y,x),z,u),f(x,u,z,u))
p7: f#(s(x),s(y),z,u) -> <=#(x,y)
p8: f#(s(x),s(y),z,u) -> f#(s(x),-(y,x),z,u)
p9: f#(s(x),s(y),z,u) -> -#(y,x)
p10: f#(s(x),s(y),z,u) -> f#(x,u,z,u)

and R consists of:

r1: -(x,|0|()) -> x
r2: -(s(x),s(y)) -> -(x,y)
r3: <=(|0|(),y) -> true()
r4: <=(s(x),|0|()) -> false()
r5: <=(s(x),s(y)) -> <=(x,y)
r6: if(true(),x,y) -> x
r7: if(false(),x,y) -> y
r8: perfectp(|0|()) -> false()
r9: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x))
r10: f(|0|(),y,|0|(),u) -> true()
r11: f(|0|(),y,s(z),u) -> false()
r12: f(s(x),|0|(),z,u) -> f(x,u,-(z,s(x)),u)
r13: f(s(x),s(y),z,u) -> if(<=(x,y),f(s(x),-(y,x),z,u),f(x,u,z,u))

The estimated dependency graph contains the following SCCs:

  {p4, p8, p10}
  {p1}
  {p2}


-- Reduction pair.

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

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

and R consists of:

r1: -(x,|0|()) -> x
r2: -(s(x),s(y)) -> -(x,y)
r3: <=(|0|(),y) -> true()
r4: <=(s(x),|0|()) -> false()
r5: <=(s(x),s(y)) -> <=(x,y)
r6: if(true(),x,y) -> x
r7: if(false(),x,y) -> y
r8: perfectp(|0|()) -> false()
r9: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x))
r10: f(|0|(),y,|0|(),u) -> true()
r11: f(|0|(),y,s(z),u) -> false()
r12: f(s(x),|0|(),z,u) -> f(x,u,-(z,s(x)),u)
r13: f(s(x),s(y),z,u) -> if(<=(x,y),f(s(x),-(y,x),z,u),f(x,u,z,u))

The set of usable rules consists of

  r1, r2

Take the reduction pair:

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

The next rules are strictly ordered:

  p1, p2

We remove them from the problem.

-- SCC decomposition.

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

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

and R consists of:

r1: -(x,|0|()) -> x
r2: -(s(x),s(y)) -> -(x,y)
r3: <=(|0|(),y) -> true()
r4: <=(s(x),|0|()) -> false()
r5: <=(s(x),s(y)) -> <=(x,y)
r6: if(true(),x,y) -> x
r7: if(false(),x,y) -> y
r8: perfectp(|0|()) -> false()
r9: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x))
r10: f(|0|(),y,|0|(),u) -> true()
r11: f(|0|(),y,s(z),u) -> false()
r12: f(s(x),|0|(),z,u) -> f(x,u,-(z,s(x)),u)
r13: f(s(x),s(y),z,u) -> if(<=(x,y),f(s(x),-(y,x),z,u),f(x,u,z,u))

The estimated dependency graph contains the following SCCs:

  {p1}


-- Reduction pair.

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

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

and R consists of:

r1: -(x,|0|()) -> x
r2: -(s(x),s(y)) -> -(x,y)
r3: <=(|0|(),y) -> true()
r4: <=(s(x),|0|()) -> false()
r5: <=(s(x),s(y)) -> <=(x,y)
r6: if(true(),x,y) -> x
r7: if(false(),x,y) -> y
r8: perfectp(|0|()) -> false()
r9: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x))
r10: f(|0|(),y,|0|(),u) -> true()
r11: f(|0|(),y,s(z),u) -> false()
r12: f(s(x),|0|(),z,u) -> f(x,u,-(z,s(x)),u)
r13: f(s(x),s(y),z,u) -> if(<=(x,y),f(s(x),-(y,x),z,u),f(x,u,z,u))

The set of usable rules consists of

  r1, r2

Take the reduction pair:

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

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

and R consists of:

r1: -(x,|0|()) -> x
r2: -(s(x),s(y)) -> -(x,y)
r3: <=(|0|(),y) -> true()
r4: <=(s(x),|0|()) -> false()
r5: <=(s(x),s(y)) -> <=(x,y)
r6: if(true(),x,y) -> x
r7: if(false(),x,y) -> y
r8: perfectp(|0|()) -> false()
r9: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x))
r10: f(|0|(),y,|0|(),u) -> true()
r11: f(|0|(),y,s(z),u) -> false()
r12: f(s(x),|0|(),z,u) -> f(x,u,-(z,s(x)),u)
r13: f(s(x),s(y),z,u) -> if(<=(x,y),f(s(x),-(y,x),z,u),f(x,u,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:
      
        s > -#
      
      argument filter:
    
        pi(-#) = [2]
        pi(s) = [1]
    
    2. lexicographic path order with precedence:
    
      precedence:
      
        s > -#
      
      argument filter:
    
        pi(-#) = [2]
        pi(s) = [1]
    

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

and R consists of:

r1: -(x,|0|()) -> x
r2: -(s(x),s(y)) -> -(x,y)
r3: <=(|0|(),y) -> true()
r4: <=(s(x),|0|()) -> false()
r5: <=(s(x),s(y)) -> <=(x,y)
r6: if(true(),x,y) -> x
r7: if(false(),x,y) -> y
r8: perfectp(|0|()) -> false()
r9: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x))
r10: f(|0|(),y,|0|(),u) -> true()
r11: f(|0|(),y,s(z),u) -> false()
r12: f(s(x),|0|(),z,u) -> f(x,u,-(z,s(x)),u)
r13: f(s(x),s(y),z,u) -> if(<=(x,y),f(s(x),-(y,x),z,u),f(x,u,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:
      
        s > <=#
      
      argument filter:
    
        pi(<=#) = [2]
        pi(s) = [1]
    
    2. lexicographic path order with precedence:
    
      precedence:
      
        s > <=#
      
      argument filter:
    
        pi(<=#) = [2]
        pi(s) = [1]
    

The next rules are strictly ordered:

  p1

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