YES We show the termination of the TRS R: le(|0|(),Y) -> true() le(s(X),|0|()) -> false() le(s(X),s(Y)) -> le(X,Y) app(nil(),Y) -> Y app(cons(N,L),Y) -> cons(N,app(L,Y)) low(N,nil()) -> nil() low(N,cons(M,L)) -> iflow(le(M,N),N,cons(M,L)) iflow(true(),N,cons(M,L)) -> cons(M,low(N,L)) iflow(false(),N,cons(M,L)) -> low(N,L) high(N,nil()) -> nil() high(N,cons(M,L)) -> ifhigh(le(M,N),N,cons(M,L)) ifhigh(true(),N,cons(M,L)) -> high(N,L) ifhigh(false(),N,cons(M,L)) -> cons(M,high(N,L)) quicksort(nil()) -> nil() quicksort(cons(N,L)) -> app(quicksort(low(N,L)),cons(N,quicksort(high(N,L)))) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: le#(s(X),s(Y)) -> le#(X,Y) p2: app#(cons(N,L),Y) -> app#(L,Y) p3: low#(N,cons(M,L)) -> iflow#(le(M,N),N,cons(M,L)) p4: low#(N,cons(M,L)) -> le#(M,N) p5: iflow#(true(),N,cons(M,L)) -> low#(N,L) p6: iflow#(false(),N,cons(M,L)) -> low#(N,L) p7: high#(N,cons(M,L)) -> ifhigh#(le(M,N),N,cons(M,L)) p8: high#(N,cons(M,L)) -> le#(M,N) p9: ifhigh#(true(),N,cons(M,L)) -> high#(N,L) p10: ifhigh#(false(),N,cons(M,L)) -> high#(N,L) p11: quicksort#(cons(N,L)) -> app#(quicksort(low(N,L)),cons(N,quicksort(high(N,L)))) p12: quicksort#(cons(N,L)) -> quicksort#(low(N,L)) p13: quicksort#(cons(N,L)) -> low#(N,L) p14: quicksort#(cons(N,L)) -> quicksort#(high(N,L)) p15: quicksort#(cons(N,L)) -> high#(N,L) and R consists of: r1: le(|0|(),Y) -> true() r2: le(s(X),|0|()) -> false() r3: le(s(X),s(Y)) -> le(X,Y) r4: app(nil(),Y) -> Y r5: app(cons(N,L),Y) -> cons(N,app(L,Y)) r6: low(N,nil()) -> nil() r7: low(N,cons(M,L)) -> iflow(le(M,N),N,cons(M,L)) r8: iflow(true(),N,cons(M,L)) -> cons(M,low(N,L)) r9: iflow(false(),N,cons(M,L)) -> low(N,L) r10: high(N,nil()) -> nil() r11: high(N,cons(M,L)) -> ifhigh(le(M,N),N,cons(M,L)) r12: ifhigh(true(),N,cons(M,L)) -> high(N,L) r13: ifhigh(false(),N,cons(M,L)) -> cons(M,high(N,L)) r14: quicksort(nil()) -> nil() r15: quicksort(cons(N,L)) -> app(quicksort(low(N,L)),cons(N,quicksort(high(N,L)))) The estimated dependency graph contains the following SCCs: {p12, p14} {p7, p9, p10} {p3, p5, p6} {p1} {p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: quicksort#(cons(N,L)) -> quicksort#(high(N,L)) p2: quicksort#(cons(N,L)) -> quicksort#(low(N,L)) and R consists of: r1: le(|0|(),Y) -> true() r2: le(s(X),|0|()) -> false() r3: le(s(X),s(Y)) -> le(X,Y) r4: app(nil(),Y) -> Y r5: app(cons(N,L),Y) -> cons(N,app(L,Y)) r6: low(N,nil()) -> nil() r7: low(N,cons(M,L)) -> iflow(le(M,N),N,cons(M,L)) r8: iflow(true(),N,cons(M,L)) -> cons(M,low(N,L)) r9: iflow(false(),N,cons(M,L)) -> low(N,L) r10: high(N,nil()) -> nil() r11: high(N,cons(M,L)) -> ifhigh(le(M,N),N,cons(M,L)) r12: ifhigh(true(),N,cons(M,L)) -> high(N,L) r13: ifhigh(false(),N,cons(M,L)) -> cons(M,high(N,L)) r14: quicksort(nil()) -> nil() r15: quicksort(cons(N,L)) -> app(quicksort(low(N,L)),cons(N,quicksort(high(N,L)))) The set of usable rules consists of r1, r2, r3, r6, r7, r8, r9, r10, r11, r12, r13 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: nil > high > ifhigh > low > iflow > le > cons > false > s > true > |0| > quicksort# argument filter: pi(quicksort#) = 1 pi(cons) = [2] pi(high) = 2 pi(low) = 2 pi(le) = [1, 2] pi(|0|) = [] pi(true) = [] pi(s) = [1] pi(false) = [] pi(iflow) = 3 pi(ifhigh) = 3 pi(nil) = [] 2. lexicographic path order with precedence: precedence: low > cons > iflow > ifhigh > false > high > le > nil > s > |0| > true > quicksort# argument filter: pi(quicksort#) = [] pi(cons) = 2 pi(high) = 2 pi(low) = 2 pi(le) = [1, 2] pi(|0|) = [] pi(true) = [] pi(s) = 1 pi(false) = [] pi(iflow) = 3 pi(ifhigh) = 3 pi(nil) = [] 3. lexicographic path order with precedence: precedence: |0| > quicksort# > true > false > high > ifhigh > low > nil > cons > iflow > s > le argument filter: pi(quicksort#) = [] pi(cons) = 2 pi(high) = 2 pi(low) = 2 pi(le) = [1, 2] pi(|0|) = [] pi(true) = [] pi(s) = 1 pi(false) = [] pi(iflow) = 3 pi(ifhigh) = 3 pi(nil) = [] The next rules are strictly ordered: p1, p2 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: ifhigh#(false(),N,cons(M,L)) -> high#(N,L) p2: high#(N,cons(M,L)) -> ifhigh#(le(M,N),N,cons(M,L)) p3: ifhigh#(true(),N,cons(M,L)) -> high#(N,L) and R consists of: r1: le(|0|(),Y) -> true() r2: le(s(X),|0|()) -> false() r3: le(s(X),s(Y)) -> le(X,Y) r4: app(nil(),Y) -> Y r5: app(cons(N,L),Y) -> cons(N,app(L,Y)) r6: low(N,nil()) -> nil() r7: low(N,cons(M,L)) -> iflow(le(M,N),N,cons(M,L)) r8: iflow(true(),N,cons(M,L)) -> cons(M,low(N,L)) r9: iflow(false(),N,cons(M,L)) -> low(N,L) r10: high(N,nil()) -> nil() r11: high(N,cons(M,L)) -> ifhigh(le(M,N),N,cons(M,L)) r12: ifhigh(true(),N,cons(M,L)) -> high(N,L) r13: ifhigh(false(),N,cons(M,L)) -> cons(M,high(N,L)) r14: quicksort(nil()) -> nil() r15: quicksort(cons(N,L)) -> app(quicksort(low(N,L)),cons(N,quicksort(high(N,L)))) The set of usable rules consists of r1, r2, r3 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: le > false > s > true > |0| > high# > ifhigh# > cons argument filter: pi(ifhigh#) = 3 pi(false) = [] pi(cons) = 2 pi(high#) = 2 pi(le) = [1] pi(true) = [] pi(|0|) = [] pi(s) = 1 2. lexicographic path order with precedence: precedence: false > le > s > true > |0| > high# > ifhigh# > cons argument filter: pi(ifhigh#) = 3 pi(false) = [] pi(cons) = [2] pi(high#) = 2 pi(le) = 1 pi(true) = [] pi(|0|) = [] pi(s) = 1 3. lexicographic path order with precedence: precedence: false > le > s > true > |0| > high# > ifhigh# > cons argument filter: pi(ifhigh#) = [] pi(false) = [] pi(cons) = [2] pi(high#) = [] pi(le) = 1 pi(true) = [] pi(|0|) = [] pi(s) = [1] The next rules are strictly ordered: p1, p2, p3 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: iflow#(false(),N,cons(M,L)) -> low#(N,L) p2: low#(N,cons(M,L)) -> iflow#(le(M,N),N,cons(M,L)) p3: iflow#(true(),N,cons(M,L)) -> low#(N,L) and R consists of: r1: le(|0|(),Y) -> true() r2: le(s(X),|0|()) -> false() r3: le(s(X),s(Y)) -> le(X,Y) r4: app(nil(),Y) -> Y r5: app(cons(N,L),Y) -> cons(N,app(L,Y)) r6: low(N,nil()) -> nil() r7: low(N,cons(M,L)) -> iflow(le(M,N),N,cons(M,L)) r8: iflow(true(),N,cons(M,L)) -> cons(M,low(N,L)) r9: iflow(false(),N,cons(M,L)) -> low(N,L) r10: high(N,nil()) -> nil() r11: high(N,cons(M,L)) -> ifhigh(le(M,N),N,cons(M,L)) r12: ifhigh(true(),N,cons(M,L)) -> high(N,L) r13: ifhigh(false(),N,cons(M,L)) -> cons(M,high(N,L)) r14: quicksort(nil()) -> nil() r15: quicksort(cons(N,L)) -> app(quicksort(low(N,L)),cons(N,quicksort(high(N,L)))) The set of usable rules consists of r1, r2, r3 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: le > false > s > true > |0| > low# > iflow# > cons argument filter: pi(iflow#) = 3 pi(false) = [] pi(cons) = 2 pi(low#) = 2 pi(le) = [1, 2] pi(true) = [] pi(|0|) = [] pi(s) = 1 2. lexicographic path order with precedence: precedence: false > le > s > true > |0| > iflow# > cons > low# argument filter: pi(iflow#) = 3 pi(false) = [] pi(cons) = [2] pi(low#) = [2] pi(le) = 1 pi(true) = [] pi(|0|) = [] pi(s) = 1 3. lexicographic path order with precedence: precedence: false > le > s > true > |0| > iflow# > cons > low# argument filter: pi(iflow#) = [3] pi(false) = [] pi(cons) = [2] pi(low#) = [2] pi(le) = 1 pi(true) = [] pi(|0|) = [] pi(s) = 1 The next rules are strictly ordered: p1, p2, p3 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: le#(s(X),s(Y)) -> le#(X,Y) and R consists of: r1: le(|0|(),Y) -> true() r2: le(s(X),|0|()) -> false() r3: le(s(X),s(Y)) -> le(X,Y) r4: app(nil(),Y) -> Y r5: app(cons(N,L),Y) -> cons(N,app(L,Y)) r6: low(N,nil()) -> nil() r7: low(N,cons(M,L)) -> iflow(le(M,N),N,cons(M,L)) r8: iflow(true(),N,cons(M,L)) -> cons(M,low(N,L)) r9: iflow(false(),N,cons(M,L)) -> low(N,L) r10: high(N,nil()) -> nil() r11: high(N,cons(M,L)) -> ifhigh(le(M,N),N,cons(M,L)) r12: ifhigh(true(),N,cons(M,L)) -> high(N,L) r13: ifhigh(false(),N,cons(M,L)) -> cons(M,high(N,L)) r14: quicksort(nil()) -> nil() r15: quicksort(cons(N,L)) -> app(quicksort(low(N,L)),cons(N,quicksort(high(N,L)))) 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 > le# argument filter: pi(le#) = 1 pi(s) = [1] 2. lexicographic path order with precedence: precedence: s > le# argument filter: pi(le#) = 1 pi(s) = 1 3. lexicographic path order with precedence: precedence: s > le# argument filter: pi(le#) = 1 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: app#(cons(N,L),Y) -> app#(L,Y) and R consists of: r1: le(|0|(),Y) -> true() r2: le(s(X),|0|()) -> false() r3: le(s(X),s(Y)) -> le(X,Y) r4: app(nil(),Y) -> Y r5: app(cons(N,L),Y) -> cons(N,app(L,Y)) r6: low(N,nil()) -> nil() r7: low(N,cons(M,L)) -> iflow(le(M,N),N,cons(M,L)) r8: iflow(true(),N,cons(M,L)) -> cons(M,low(N,L)) r9: iflow(false(),N,cons(M,L)) -> low(N,L) r10: high(N,nil()) -> nil() r11: high(N,cons(M,L)) -> ifhigh(le(M,N),N,cons(M,L)) r12: ifhigh(true(),N,cons(M,L)) -> high(N,L) r13: ifhigh(false(),N,cons(M,L)) -> cons(M,high(N,L)) r14: quicksort(nil()) -> nil() r15: quicksort(cons(N,L)) -> app(quicksort(low(N,L)),cons(N,quicksort(high(N,L)))) 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: cons > app# argument filter: pi(app#) = [1, 2] pi(cons) = [1, 2] 2. lexicographic path order with precedence: precedence: cons > app# argument filter: pi(app#) = [1] pi(cons) = [1, 2] 3. lexicographic path order with precedence: precedence: cons > app# argument filter: pi(app#) = [1] pi(cons) = [1, 2] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.