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. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: quicksort#_A(x1) = ((0,0),(1,0)) x1 + (1,1) cons_A(x1,x2) = ((1,0),(1,0)) x1 + ((1,0),(0,0)) x2 + (4,7) high_A(x1,x2) = x1 + ((1,0),(1,0)) x2 + (2,6) low_A(x1,x2) = x1 + ((1,0),(1,0)) x2 + (0,8) le_A(x1,x2) = ((1,0),(0,0)) x1 + x2 + (3,8) |0|_A() = (2,2) true_A() = (1,1) s_A(x1) = x1 + (2,1) false_A() = (1,3) iflow_A(x1,x2,x3) = x2 + x3 + (0,2) ifhigh_A(x1,x2,x3) = x2 + ((1,0),(1,0)) x3 + (2,4) nil_A() = (1,1) precedence: quicksort# = low = iflow > le > ifhigh > high = false > cons > nil > s > |0| = true partial status: pi(quicksort#) = [] pi(cons) = [] pi(high) = [] pi(low) = [1] pi(le) = [2] pi(|0|) = [] pi(true) = [] pi(s) = [] pi(false) = [] pi(iflow) = [] pi(ifhigh) = [2] pi(nil) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: quicksort#_A(x1) = (0,0) cons_A(x1,x2) = (0,4) high_A(x1,x2) = (2,2) low_A(x1,x2) = x1 + (4,6) le_A(x1,x2) = x2 + (5,7) |0|_A() = (1,1) true_A() = (1,0) s_A(x1) = (0,0) false_A() = (3,3) iflow_A(x1,x2,x3) = (0,5) ifhigh_A(x1,x2,x3) = ((1,0),(1,1)) x2 + (3,1) nil_A() = (0,1) precedence: high = ifhigh > cons > low > nil > le > s = false > |0| = true > quicksort# = iflow partial status: pi(quicksort#) = [] pi(cons) = [] pi(high) = [] pi(low) = [1] pi(le) = [2] pi(|0|) = [] pi(true) = [] pi(s) = [] pi(false) = [] pi(iflow) = [] pi(ifhigh) = [] pi(nil) = [] The next rules are strictly ordered: p1 We remove them from the problem. -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: 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 estimated dependency graph contains the following SCCs: {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: 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 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: quicksort#_A(x1) = ((0,0),(1,0)) x1 + (1,1) cons_A(x1,x2) = x1 + ((1,0),(0,0)) x2 + (4,7) low_A(x1,x2) = ((0,0),(1,0)) x1 + x2 + (0,6) le_A(x1,x2) = x1 + (2,0) |0|_A() = (2,7) true_A() = (3,5) s_A(x1) = x1 false_A() = (1,7) iflow_A(x1,x2,x3) = x3 + (0,1) nil_A() = (0,0) precedence: le = |0| > true > cons = s = false > low > nil > quicksort# = iflow partial status: pi(quicksort#) = [] pi(cons) = [] pi(low) = [] pi(le) = [1] pi(|0|) = [] pi(true) = [] pi(s) = [1] pi(false) = [] pi(iflow) = [3] pi(nil) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: quicksort#_A(x1) = (0,0) cons_A(x1,x2) = (2,2) low_A(x1,x2) = (2,2) le_A(x1,x2) = ((1,0),(1,1)) x1 + (0,3) |0|_A() = (1,2) true_A() = (0,1) s_A(x1) = (0,0) false_A() = (0,0) iflow_A(x1,x2,x3) = x3 nil_A() = (1,3) precedence: cons = low = iflow > nil > le > |0| = s = false > quicksort# = true partial status: pi(quicksort#) = [] pi(cons) = [] pi(low) = [] pi(le) = [] pi(|0|) = [] pi(true) = [] pi(s) = [] pi(false) = [] pi(iflow) = [] pi(nil) = [] 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: 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. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: ifhigh#_A(x1,x2,x3) = x2 + ((1,0),(0,0)) x3 + (1,2) false_A() = (3,1) cons_A(x1,x2) = ((1,0),(0,0)) x1 + ((1,0),(1,1)) x2 + (5,1) high#_A(x1,x2) = x1 + ((1,0),(0,0)) x2 + (4,2) le_A(x1,x2) = x1 + (1,3) true_A() = (1,1) |0|_A() = (2,2) s_A(x1) = x1 + (4,4) precedence: ifhigh# > false = cons = high# = s > le = true = |0| partial status: pi(ifhigh#) = [2] pi(false) = [] pi(cons) = [2] pi(high#) = [] pi(le) = [1] pi(true) = [] pi(|0|) = [] pi(s) = [1] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: ifhigh#_A(x1,x2,x3) = ((1,0),(0,0)) x2 + (1,1) false_A() = (1,1) cons_A(x1,x2) = x2 high#_A(x1,x2) = (0,0) le_A(x1,x2) = (0,0) true_A() = (1,1) |0|_A() = (2,2) s_A(x1) = (2,2) precedence: ifhigh# = false = cons = high# = le = true = |0| = s partial status: pi(ifhigh#) = [] pi(false) = [] pi(cons) = [] pi(high#) = [] pi(le) = [] pi(true) = [] pi(|0|) = [] pi(s) = [] 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. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: iflow#_A(x1,x2,x3) = x2 + x3 + (1,3) false_A() = (1,1) cons_A(x1,x2) = ((0,0),(1,0)) x1 + ((1,0),(1,1)) x2 + (3,1) low#_A(x1,x2) = x1 + x2 + (2,2) le_A(x1,x2) = x1 + (6,4) true_A() = (1,1) |0|_A() = (2,2) s_A(x1) = ((1,0),(1,1)) x1 + (7,5) precedence: iflow# = cons = low# > false = le = true = |0| = s partial status: pi(iflow#) = [2, 3] pi(false) = [] pi(cons) = [2] pi(low#) = [1, 2] pi(le) = [1] pi(true) = [] pi(|0|) = [] pi(s) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: iflow#_A(x1,x2,x3) = ((1,0),(0,0)) x2 + ((1,0),(1,1)) x3 + (3,1) false_A() = (1,1) cons_A(x1,x2) = x2 low#_A(x1,x2) = x1 + ((1,0),(1,1)) x2 + (2,2) le_A(x1,x2) = (0,0) true_A() = (1,1) |0|_A() = (2,2) s_A(x1) = (2,2) precedence: iflow# = false = cons = le = true = s > low# = |0| partial status: pi(iflow#) = [] pi(false) = [] pi(cons) = [] pi(low#) = [1] pi(le) = [] pi(true) = [] pi(|0|) = [] pi(s) = [] 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. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: le#_A(x1,x2) = ((1,0),(0,0)) x1 s_A(x1) = ((1,0),(0,0)) x1 + (1,1) precedence: le# > s partial status: pi(le#) = [] pi(s) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: le#_A(x1,x2) = (0,0) s_A(x1) = (1,1) precedence: le# = s partial status: pi(le#) = [] pi(s) = [] 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. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: app#_A(x1,x2) = ((1,0),(1,0)) x1 + ((1,0),(0,0)) x2 + (2,2) cons_A(x1,x2) = x1 + ((1,0),(0,0)) x2 + (1,1) precedence: app# = cons partial status: pi(app#) = [] pi(cons) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: app#_A(x1,x2) = (1,1) cons_A(x1,x2) = x1 + (2,2) precedence: app# = cons partial status: pi(app#) = [] pi(cons) = [] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.