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. weighted path order base order: max/plus interpretations on natural numbers: |sort|#_A(x1) = max{3, x1 + 2} cons_A(x1,x2) = max{1, x2} precedence: |sort|# = cons partial status: pi(|sort|#) = [1] pi(cons) = [2] 2. weighted path order base order: max/plus interpretations on natural numbers: |sort|#_A(x1) = max{3, x1 + 2} cons_A(x1,x2) = x2 + 1 precedence: |sort|# = cons partial status: pi(|sort|#) = [] pi(cons) = [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: 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. weighted path order base order: max/plus interpretations on natural numbers: insert#_A(x1,x2) = max{10, x2 - 1} cons_A(x1,x2) = max{x1 + 14, x2 + 16} choose#_A(x1,x2,x3,x4) = max{15, x2 - 2, x4 + 1} s_A(x1) = max{8, x1 + 7} |0|_A = 0 precedence: insert# > cons > choose# = |0| > s partial status: pi(insert#) = [] pi(cons) = [] pi(choose#) = [4] pi(s) = [1] pi(|0|) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: insert#_A(x1,x2) = 4 cons_A(x1,x2) = 2 choose#_A(x1,x2,x3,x4) = 3 s_A(x1) = x1 |0|_A = 4 precedence: insert# > cons = choose# = s = |0| partial status: pi(insert#) = [] pi(cons) = [] pi(choose#) = [] pi(s) = [1] pi(|0|) = [] The next rules are strictly ordered: p1, p2, p3 We remove them from the problem. Then no dependency pair remains.