YES

We show the termination of the TRS R:

  prime(|0|()) -> false()
  prime(s(|0|())) -> false()
  prime(s(s(x))) -> prime1(s(s(x)),s(x))
  prime1(x,|0|()) -> false()
  prime1(x,s(|0|())) -> true()
  prime1(x,s(s(y))) -> and(not(divp(s(s(y)),x)),prime1(x,s(y)))
  divp(x,y) -> =(rem(x,y),|0|())

-- SCC decomposition.

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

p1: prime#(s(s(x))) -> prime1#(s(s(x)),s(x))
p2: prime1#(x,s(s(y))) -> divp#(s(s(y)),x)
p3: prime1#(x,s(s(y))) -> prime1#(x,s(y))

and R consists of:

r1: prime(|0|()) -> false()
r2: prime(s(|0|())) -> false()
r3: prime(s(s(x))) -> prime1(s(s(x)),s(x))
r4: prime1(x,|0|()) -> false()
r5: prime1(x,s(|0|())) -> true()
r6: prime1(x,s(s(y))) -> and(not(divp(s(s(y)),x)),prime1(x,s(y)))
r7: divp(x,y) -> =(rem(x,y),|0|())

The estimated dependency graph contains the following SCCs:

  {p3}


-- Reduction pair.

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

p1: prime1#(x,s(s(y))) -> prime1#(x,s(y))

and R consists of:

r1: prime(|0|()) -> false()
r2: prime(s(|0|())) -> false()
r3: prime(s(s(x))) -> prime1(s(s(x)),s(x))
r4: prime1(x,|0|()) -> false()
r5: prime1(x,s(|0|())) -> true()
r6: prime1(x,s(s(y))) -> and(not(divp(s(s(y)),x)),prime1(x,s(y)))
r7: divp(x,y) -> =(rem(x,y),|0|())

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:
      
        prime1# > s
      
      argument filter:
    
        pi(prime1#) = 2
        pi(s) = [1]
    
    2. lexicographic path order with precedence:
    
      precedence:
      
        s > prime1#
      
      argument filter:
    
        pi(prime1#) = [2]
        pi(s) = 1
    
    3. lexicographic path order with precedence:
    
      precedence:
      
        s > prime1#
      
      argument filter:
    
        pi(prime1#) = []
        pi(s) = [1]
    

The next rules are strictly ordered:

  p1

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