YES

We show the termination of the TRS R:

  |sort|(nil()) -> nil()
  |sort|(cons(x,y)) -> insert(x,|sort|(y))
  insert(x,nil()) -> cons(x,nil())
  insert(x,cons(v,w)) -> choose(x,cons(v,w),x,v)
  choose(x,cons(v,w),y,|0|()) -> cons(x,cons(v,w))
  choose(x,cons(v,w),|0|(),s(z)) -> cons(v,insert(x,w))
  choose(x,cons(v,w),s(y),s(z)) -> choose(x,cons(v,w),y,z)

-- SCC decomposition.

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

p1: |sort|#(cons(x,y)) -> insert#(x,|sort|(y))
p2: |sort|#(cons(x,y)) -> |sort|#(y)
p3: insert#(x,cons(v,w)) -> choose#(x,cons(v,w),x,v)
p4: choose#(x,cons(v,w),|0|(),s(z)) -> insert#(x,w)
p5: choose#(x,cons(v,w),s(y),s(z)) -> choose#(x,cons(v,w),y,z)

and R consists of:

r1: |sort|(nil()) -> nil()
r2: |sort|(cons(x,y)) -> insert(x,|sort|(y))
r3: insert(x,nil()) -> cons(x,nil())
r4: insert(x,cons(v,w)) -> choose(x,cons(v,w),x,v)
r5: choose(x,cons(v,w),y,|0|()) -> cons(x,cons(v,w))
r6: choose(x,cons(v,w),|0|(),s(z)) -> cons(v,insert(x,w))
r7: choose(x,cons(v,w),s(y),s(z)) -> choose(x,cons(v,w),y,z)

The estimated dependency graph contains the following SCCs:

  {p2}
  {p3, p4, p5}


-- Reduction pair.

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

p1: |sort|#(cons(x,y)) -> |sort|#(y)

and R consists of:

r1: |sort|(nil()) -> nil()
r2: |sort|(cons(x,y)) -> insert(x,|sort|(y))
r3: insert(x,nil()) -> cons(x,nil())
r4: insert(x,cons(v,w)) -> choose(x,cons(v,w),x,v)
r5: choose(x,cons(v,w),y,|0|()) -> cons(x,cons(v,w))
r6: choose(x,cons(v,w),|0|(),s(z)) -> cons(v,insert(x,w))
r7: choose(x,cons(v,w),s(y),s(z)) -> choose(x,cons(v,w),y,z)

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:
        |sort|#_A(x1) = ((1,1),(0,1)) x1
        cons_A(x1,x2) = ((1,1),(1,1)) x1 + ((1,1),(1,1)) x2 + (1,1)
    
    2. matrix interpretations:
    
      carrier: N^2
      order: standard order
      interpretations:
        |sort|#_A(x1) = ((0,1),(1,0)) x1
        cons_A(x1,x2) = ((1,1),(0,1)) x1 + ((1,0),(1,1)) x2 + (1,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: insert#(x,cons(v,w)) -> choose#(x,cons(v,w),x,v)
p2: choose#(x,cons(v,w),s(y),s(z)) -> choose#(x,cons(v,w),y,z)
p3: choose#(x,cons(v,w),|0|(),s(z)) -> insert#(x,w)

and R consists of:

r1: |sort|(nil()) -> nil()
r2: |sort|(cons(x,y)) -> insert(x,|sort|(y))
r3: insert(x,nil()) -> cons(x,nil())
r4: insert(x,cons(v,w)) -> choose(x,cons(v,w),x,v)
r5: choose(x,cons(v,w),y,|0|()) -> cons(x,cons(v,w))
r6: choose(x,cons(v,w),|0|(),s(z)) -> cons(v,insert(x,w))
r7: choose(x,cons(v,w),s(y),s(z)) -> choose(x,cons(v,w),y,z)

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:
        insert#_A(x1,x2) = x1 + ((1,0),(1,0)) x2 + (1,0)
        cons_A(x1,x2) = ((0,0),(1,1)) x1 + ((1,1),(1,1)) x2 + (2,1)
        choose#_A(x1,x2,x3,x4) = x1 + ((1,0),(1,0)) x2
        s_A(x1) = ((1,1),(1,1)) x1 + (1,1)
        |0|_A() = (1,1)
    
    2. matrix interpretations:
    
      carrier: N^2
      order: standard order
      interpretations:
        insert#_A(x1,x2) = ((0,1),(1,0)) x1 + ((0,1),(1,1)) x2 + (1,0)
        cons_A(x1,x2) = ((1,1),(0,1)) x2 + (1,2)
        choose#_A(x1,x2,x3,x4) = ((0,1),(1,0)) x1 + ((0,1),(1,1)) x2
        s_A(x1) = ((1,1),(0,0)) x1 + (0,1)
        |0|_A() = (1,1)
    

The next rules are strictly ordered:

  p1, p3

We remove them from the problem.

-- SCC decomposition.

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

p1: choose#(x,cons(v,w),s(y),s(z)) -> choose#(x,cons(v,w),y,z)

and R consists of:

r1: |sort|(nil()) -> nil()
r2: |sort|(cons(x,y)) -> insert(x,|sort|(y))
r3: insert(x,nil()) -> cons(x,nil())
r4: insert(x,cons(v,w)) -> choose(x,cons(v,w),x,v)
r5: choose(x,cons(v,w),y,|0|()) -> cons(x,cons(v,w))
r6: choose(x,cons(v,w),|0|(),s(z)) -> cons(v,insert(x,w))
r7: choose(x,cons(v,w),s(y),s(z)) -> choose(x,cons(v,w),y,z)

The estimated dependency graph contains the following SCCs:

  {p1}


-- Reduction pair.

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

p1: choose#(x,cons(v,w),s(y),s(z)) -> choose#(x,cons(v,w),y,z)

and R consists of:

r1: |sort|(nil()) -> nil()
r2: |sort|(cons(x,y)) -> insert(x,|sort|(y))
r3: insert(x,nil()) -> cons(x,nil())
r4: insert(x,cons(v,w)) -> choose(x,cons(v,w),x,v)
r5: choose(x,cons(v,w),y,|0|()) -> cons(x,cons(v,w))
r6: choose(x,cons(v,w),|0|(),s(z)) -> cons(v,insert(x,w))
r7: choose(x,cons(v,w),s(y),s(z)) -> choose(x,cons(v,w),y,z)

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

  lexicographic combination of reduction pairs:
  
    1. matrix interpretations:
    
      carrier: N^2
      order: standard order
      interpretations:
        choose#_A(x1,x2,x3,x4) = x1 + x2 + ((1,1),(1,1)) x3 + ((1,1),(1,1)) x4
        cons_A(x1,x2) = x1 + x2
        s_A(x1) = ((1,1),(1,1)) x1 + (1,1)
    
    2. matrix interpretations:
    
      carrier: N^2
      order: standard order
      interpretations:
        choose#_A(x1,x2,x3,x4) = x1 + x2 + ((1,1),(1,0)) x3 + ((1,0),(1,0)) x4
        cons_A(x1,x2) = x1 + x2
        s_A(x1) = ((1,1),(1,0)) x1 + (1,1)
    

The next rules are strictly ordered:

  p1
  r1, r2, r3, r4, r5, r6, r7

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