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(add(n,x),y) -> add(n,app(x,y)) low(n,nil()) -> nil() low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) if_low(true(),n,add(m,x)) -> add(m,low(n,x)) if_low(false(),n,add(m,x)) -> low(n,x) high(n,nil()) -> nil() high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) if_high(true(),n,add(m,x)) -> high(n,x) if_high(false(),n,add(m,x)) -> add(m,high(n,x)) head(add(n,x)) -> n tail(add(n,x)) -> x isempty(nil()) -> true() isempty(add(n,x)) -> false() quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) if_qs(true(),x,n,y) -> nil() if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: le#(s(x),s(y)) -> le#(x,y) p2: app#(add(n,x),y) -> app#(x,y) p3: low#(n,add(m,x)) -> if_low#(le(m,n),n,add(m,x)) p4: low#(n,add(m,x)) -> le#(m,n) p5: if_low#(true(),n,add(m,x)) -> low#(n,x) p6: if_low#(false(),n,add(m,x)) -> low#(n,x) p7: high#(n,add(m,x)) -> if_high#(le(m,n),n,add(m,x)) p8: high#(n,add(m,x)) -> le#(m,n) p9: if_high#(true(),n,add(m,x)) -> high#(n,x) p10: if_high#(false(),n,add(m,x)) -> high#(n,x) p11: quicksort#(x) -> if_qs#(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) p12: quicksort#(x) -> isempty#(x) p13: quicksort#(x) -> low#(head(x),tail(x)) p14: quicksort#(x) -> head#(x) p15: quicksort#(x) -> tail#(x) p16: quicksort#(x) -> high#(head(x),tail(x)) p17: if_qs#(false(),x,n,y) -> app#(quicksort(x),add(n,quicksort(y))) p18: if_qs#(false(),x,n,y) -> quicksort#(x) p19: if_qs#(false(),x,n,y) -> quicksort#(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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The estimated dependency graph contains the following SCCs: {p11, p18, p19} {p7, p9, p10} {p3, p5, p6} {p1} {p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: if_qs#(false(),x,n,y) -> quicksort#(y) p2: quicksort#(x) -> if_qs#(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) p3: if_qs#(false(),x,n,y) -> quicksort#(x) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The set of usable rules consists of r1, r2, r3, r6, r7, r8, r9, r10, r11, r12, r13, r15, r16, r17, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: if_qs#_A(x1,x2,x3,x4) = max{x1 + 2, x2 + 28, x4 + 37} false_A = 110 quicksort#_A(x1) = max{111, x1 + 27} isempty_A(x1) = x1 + 24 low_A(x1,x2) = max{46, x2 + 1} head_A(x1) = 51 tail_A(x1) = max{47, x1 - 42} high_A(x1,x2) = max{49, x2 + 2} le_A(x1,x2) = max{108, x1 + 2} |0|_A = 108 true_A = 109 s_A(x1) = x1 + 111 nil_A = 86 add_A(x1,x2) = max{88, x1 - 15, x2 + 43} if_low_A(x1,x2,x3) = max{45, x1 - 21, x3 + 1} if_high_A(x1,x2,x3) = max{90, x1 - 18, x3 + 2} if_qs_A(x1,x2,x3,x4) = max{88, x1 - 62, x2 - 10, x3 - 1, x4 - 89} base order 2: precedence: if_qs > low = high = |0| = s = if_high > le = if_low > false = add > quicksort# > if_qs# = isempty = head = tail > true > nil partial status: pi(if_qs#) = [] pi(false) = [] pi(quicksort#) = [] pi(isempty) = [] pi(low) = [2] pi(head) = [] pi(tail) = [] pi(high) = [2] pi(le) = [1] pi(|0|) = [] pi(true) = [] pi(s) = [1] pi(nil) = [] pi(add) = [] pi(if_low) = [] pi(if_high) = [3] pi(if_qs) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: quicksort#(x) -> if_qs#(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) p2: if_qs#(false(),x,n,y) -> quicksort#(x) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: quicksort#(x) -> if_qs#(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) p2: if_qs#(false(),x,n,y) -> quicksort#(x) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The set of usable rules consists of r6, r7, r8, r9, r15, r16, r17, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: quicksort#_A(x1) = max{53, x1 + 32} if_qs#_A(x1,x2,x3,x4) = max{x1 + 18, x2 + 33} isempty_A(x1) = max{13, x1 - 3} low_A(x1,x2) = max{19, x2} head_A(x1) = 24 tail_A(x1) = max{0, x1 - 2} high_A(x1,x2) = max{45, x1 + 19} false_A = 36 nil_A = 18 add_A(x1,x2) = max{x1 + 44, x2 + 3} if_low_A(x1,x2,x3) = max{21, x3} le_A(x1,x2) = max{x1 - 2, x2 + 13} true_A = 14 if_qs_A(x1,x2,x3,x4) = max{37, x1 - 1, x3 - 25} base order 2: precedence: tail = high = if_qs > low = head = add = if_low = le > quicksort# > if_qs# = false > isempty > true > nil partial status: pi(quicksort#) = [1] pi(if_qs#) = [] pi(isempty) = [] pi(low) = [] pi(head) = [] pi(tail) = [] pi(high) = [] pi(false) = [] pi(nil) = [] pi(add) = [] pi(if_low) = [] pi(le) = [] pi(true) = [] pi(if_qs) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: if_qs#(false(),x,n,y) -> quicksort#(x) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The estimated dependency graph contains the following SCCs: (no SCCs) -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: if_high#(false(),n,add(m,x)) -> high#(n,x) p2: high#(n,add(m,x)) -> if_high#(le(m,n),n,add(m,x)) p3: if_high#(true(),n,add(m,x)) -> high#(n,x) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The set of usable rules consists of r1, r2, r3, r6, r10, r17, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: if_high#_A(x1,x2,x3) = max{65, x1 + 60, x2 + 62, x3 + 43} false_A = 74 add_A(x1,x2) = max{x1 + 59, x2 + 22} high#_A(x1,x2) = max{64, x1 + 62, x2 + 44} le_A(x1,x2) = max{3, x1, x2 + 1} true_A = 27 |0|_A = 75 s_A(x1) = x1 low_A(x1,x2) = max{x1 + 6, x2 - 42} nil_A = 5 high_A(x1,x2) = max{23, x1 - 23, x2 - 58} isempty_A(x1) = max{75, x1 - 78} if_qs_A(x1,x2,x3,x4) = max{x1 + 8, x2 - 12, x3 + 19, x4 + 2} base order 2: precedence: if_qs > if_high# = high# > add = low = isempty > |0| = high > false > le > true = s > nil partial status: pi(if_high#) = [3] pi(false) = [] pi(add) = [] pi(high#) = [2] pi(le) = [2] pi(true) = [] pi(|0|) = [] pi(s) = [1] pi(low) = [1] pi(nil) = [] pi(high) = [] pi(isempty) = [] pi(if_qs) = [] The following rules are removed: p3 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: if_high#(false(),n,add(m,x)) -> high#(n,x) p2: high#(n,add(m,x)) -> if_high#(le(m,n),n,add(m,x)) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: if_high#(false(),n,add(m,x)) -> high#(n,x) p2: high#(n,add(m,x)) -> if_high#(le(m,n),n,add(m,x)) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The set of usable rules consists of r1, r2, r3, r6, r10, r17, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: if_high#_A(x1,x2,x3) = max{26, x1, x3 - 22} false_A = 0 add_A(x1,x2) = max{x1 + 32, x2 + 25} high#_A(x1,x2) = max{1, x2 - 5} le_A(x1,x2) = max{0, x1 - 1} |0|_A = 13 true_A = 0 s_A(x1) = x1 + 13 low_A(x1,x2) = max{10, x1 - 13, x2} nil_A = 0 high_A(x1,x2) = max{32, x1 + 20, x2 - 23} isempty_A(x1) = max{0, x1 - 24} if_qs_A(x1,x2,x3,x4) = max{26, x1 - 15, x2 - 11, x3 - 2, x4 - 33} base order 2: precedence: if_qs > if_high# = le > add = |0| = s = low = isempty > high# = high > false = true > nil partial status: pi(if_high#) = [1] pi(false) = [] pi(add) = [2] pi(high#) = [] pi(le) = [] pi(|0|) = [] pi(true) = [] pi(s) = [] pi(low) = [2] pi(nil) = [] pi(high) = [] pi(isempty) = [] pi(if_qs) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: high#(n,add(m,x)) -> if_high#(le(m,n),n,add(m,x)) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The estimated dependency graph contains the following SCCs: (no SCCs) -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: if_low#(false(),n,add(m,x)) -> low#(n,x) p2: low#(n,add(m,x)) -> if_low#(le(m,n),n,add(m,x)) p3: if_low#(true(),n,add(m,x)) -> low#(n,x) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The set of usable rules consists of r1, r2, r3, r6, r10, r17, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: if_low#_A(x1,x2,x3) = max{x1 - 6, x2 + 42, x3 + 17} false_A = 45 add_A(x1,x2) = max{x1 - 5, x2 + 10} low#_A(x1,x2) = max{x1 + 42, x2 + 26} le_A(x1,x2) = x2 + 48 true_A = 47 |0|_A = 46 s_A(x1) = x1 + 49 low_A(x1,x2) = max{1, x1 - 21, x2 - 19} nil_A = 0 high_A(x1,x2) = max{43, x1 - 26, x2 + 4} isempty_A(x1) = max{56, x1 - 11} if_qs_A(x1,x2,x3,x4) = max{3, x1 - 57, x2 - 45, x3 - 53, x4 - 45} base order 2: precedence: if_qs > add > high > |0| > low = isempty > if_low# = low# = true > le = s = nil > false partial status: pi(if_low#) = [3] pi(false) = [] pi(add) = [] pi(low#) = [2] pi(le) = [] pi(true) = [] pi(|0|) = [] pi(s) = [1] pi(low) = [] pi(nil) = [] pi(high) = [] pi(isempty) = [] pi(if_qs) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: low#(n,add(m,x)) -> if_low#(le(m,n),n,add(m,x)) p2: if_low#(true(),n,add(m,x)) -> low#(n,x) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: low#(n,add(m,x)) -> if_low#(le(m,n),n,add(m,x)) p2: if_low#(true(),n,add(m,x)) -> low#(n,x) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The set of usable rules consists of r1, r2, r3, r6, r10, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: low#_A(x1,x2) = max{x1 + 37, x2 + 11} add_A(x1,x2) = max{13, x1 + 6, x2 + 9} if_low#_A(x1,x2,x3) = max{x1 - 1, x2 + 37, x3 + 3} le_A(x1,x2) = x2 + 36 true_A = 35 |0|_A = 14 s_A(x1) = max{14, x1 + 12} false_A = 13 low_A(x1,x2) = 11 nil_A = 0 high_A(x1,x2) = max{13, x2} if_qs_A(x1,x2,x3,x4) = max{14, x1 - 36, x2 - 23, x3 - 52, x4 - 50} base order 2: precedence: if_qs > add = |0| > low# = if_low# = s = high > le = true = false = low > nil partial status: pi(low#) = [2] pi(add) = [2] pi(if_low#) = [3] pi(le) = [] pi(true) = [] pi(|0|) = [] pi(s) = [1] pi(false) = [] pi(low) = [] pi(nil) = [] pi(high) = [2] pi(if_qs) = [] The following rules are removed: p2 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: low#(n,add(m,x)) -> if_low#(le(m,n),n,add(m,x)) 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The estimated dependency graph contains the following SCCs: (no SCCs) -- 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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The set of usable rules consists of r1, r2, r6, r10, r17, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: le#_A(x1,x2) = max{x1 - 1, x2 + 6} s_A(x1) = x1 + 5 le_A(x1,x2) = max{10, x1 - 6, x2 - 24} |0|_A = 5 true_A = 4 false_A = 4 low_A(x1,x2) = max{8, x1 - 23, x2 - 51} nil_A = 0 high_A(x1,x2) = max{5, x1 - 46, x2 - 46} isempty_A(x1) = max{5, x1 - 49} add_A(x1,x2) = max{7, x1 - 12, x2 - 21} if_qs_A(x1,x2,x3,x4) = max{21, x1 - 54, x2 - 34, x3 - 11, x4 - 11} base order 2: precedence: if_qs > le > le# = s = |0| = low = isempty = add > true > nil = high > false partial status: pi(le#) = [2] pi(s) = [1] pi(le) = [] pi(|0|) = [] pi(true) = [] pi(false) = [] pi(low) = [] pi(nil) = [] pi(high) = [] pi(isempty) = [] pi(add) = [] pi(if_qs) = [] The following rules are removed: p1 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: app#(add(n,x),y) -> app#(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(add(n,x),y) -> add(n,app(x,y)) r6: low(n,nil()) -> nil() r7: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r8: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r9: if_low(false(),n,add(m,x)) -> low(n,x) r10: high(n,nil()) -> nil() r11: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r12: if_high(true(),n,add(m,x)) -> high(n,x) r13: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r14: head(add(n,x)) -> n r15: tail(add(n,x)) -> x r16: isempty(nil()) -> true() r17: isempty(add(n,x)) -> false() r18: quicksort(x) -> if_qs(isempty(x),low(head(x),tail(x)),head(x),high(head(x),tail(x))) r19: if_qs(true(),x,n,y) -> nil() r20: if_qs(false(),x,n,y) -> app(quicksort(x),add(n,quicksort(y))) The set of usable rules consists of r1, r2, r6, r10, r17, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: app#_A(x1,x2) = max{27, x1 + 14, x2 + 1} add_A(x1,x2) = max{13, x1 - 13, x2 + 5} le_A(x1,x2) = max{8, x1 - 43, x2 - 27} |0|_A = 8 true_A = 7 s_A(x1) = max{7, x1 - 44} false_A = 6 low_A(x1,x2) = max{9, x1 - 26, x2 - 29} nil_A = 0 high_A(x1,x2) = max{11, x1 - 12, x2 - 15} isempty_A(x1) = max{8, x1 - 35} if_qs_A(x1,x2,x3,x4) = max{16, x1 - 11, x2 - 34, x3 - 12, x4 - 12} base order 2: precedence: if_qs > app# = add > high > low > le > |0| = s > false > isempty > true > nil partial status: pi(app#) = [1] pi(add) = [2] pi(le) = [] pi(|0|) = [] pi(true) = [] pi(s) = [] pi(false) = [] pi(low) = [] pi(nil) = [] pi(high) = [] pi(isempty) = [] pi(if_qs) = [] The following rules are removed: p1 Then no dependency pair remains.