YES We show the termination of the TRS R: minus(x,|0|()) -> x minus(s(x),s(y)) -> minus(x,y) quot(|0|(),s(y)) -> |0|() quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) 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)) quicksort(nil()) -> nil() quicksort(add(n,x)) -> app(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: minus#(s(x),s(y)) -> minus#(x,y) p2: quot#(s(x),s(y)) -> quot#(minus(x,y),s(y)) p3: quot#(s(x),s(y)) -> minus#(x,y) p4: le#(s(x),s(y)) -> le#(x,y) p5: app#(add(n,x),y) -> app#(x,y) p6: low#(n,add(m,x)) -> if_low#(le(m,n),n,add(m,x)) p7: low#(n,add(m,x)) -> le#(m,n) p8: if_low#(true(),n,add(m,x)) -> low#(n,x) p9: if_low#(false(),n,add(m,x)) -> low#(n,x) p10: high#(n,add(m,x)) -> if_high#(le(m,n),n,add(m,x)) p11: high#(n,add(m,x)) -> le#(m,n) p12: if_high#(true(),n,add(m,x)) -> high#(n,x) p13: if_high#(false(),n,add(m,x)) -> high#(n,x) p14: quicksort#(add(n,x)) -> app#(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) p15: quicksort#(add(n,x)) -> quicksort#(low(n,x)) p16: quicksort#(add(n,x)) -> low#(n,x) p17: quicksort#(add(n,x)) -> quicksort#(high(n,x)) p18: quicksort#(add(n,x)) -> high#(n,x) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: le(|0|(),y) -> true() r6: le(s(x),|0|()) -> false() r7: le(s(x),s(y)) -> le(x,y) r8: app(nil(),y) -> y r9: app(add(n,x),y) -> add(n,app(x,y)) r10: low(n,nil()) -> nil() r11: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r12: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r13: if_low(false(),n,add(m,x)) -> low(n,x) r14: high(n,nil()) -> nil() r15: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r16: if_high(true(),n,add(m,x)) -> high(n,x) r17: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r18: quicksort(nil()) -> nil() r19: quicksort(add(n,x)) -> app(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) The estimated dependency graph contains the following SCCs: {p2} {p1} {p15, p17} {p10, p12, p13} {p6, p8, p9} {p4} {p5} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: quot#(s(x),s(y)) -> quot#(minus(x,y),s(y)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: le(|0|(),y) -> true() r6: le(s(x),|0|()) -> false() r7: le(s(x),s(y)) -> le(x,y) r8: app(nil(),y) -> y r9: app(add(n,x),y) -> add(n,app(x,y)) r10: low(n,nil()) -> nil() r11: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r12: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r13: if_low(false(),n,add(m,x)) -> low(n,x) r14: high(n,nil()) -> nil() r15: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r16: if_high(true(),n,add(m,x)) -> high(n,x) r17: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r18: quicksort(nil()) -> nil() r19: quicksort(add(n,x)) -> app(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) The set of usable rules consists of r1, r2 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: quot#_A(x1,x2) = x1 + x2 s_A(x1) = x1 + (1,0) minus_A(x1,x2) = ((1,0),(0,0)) x1 + (1,0) |0|_A() = (0,1) precedence: quot# = s = minus = |0| partial status: pi(quot#) = [] pi(s) = [] pi(minus) = [] pi(|0|) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: quot#_A(x1,x2) = ((1,0),(0,0)) x1 + ((1,0),(1,1)) x2 s_A(x1) = (2,0) minus_A(x1,x2) = (1,2) |0|_A() = (1,1) precedence: |0| > quot# = s = minus partial status: pi(quot#) = [2] pi(s) = [] pi(minus) = [] pi(|0|) = [] 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: minus#(s(x),s(y)) -> minus#(x,y) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: le(|0|(),y) -> true() r6: le(s(x),|0|()) -> false() r7: le(s(x),s(y)) -> le(x,y) r8: app(nil(),y) -> y r9: app(add(n,x),y) -> add(n,app(x,y)) r10: low(n,nil()) -> nil() r11: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r12: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r13: if_low(false(),n,add(m,x)) -> low(n,x) r14: high(n,nil()) -> nil() r15: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r16: if_high(true(),n,add(m,x)) -> high(n,x) r17: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r18: quicksort(nil()) -> nil() r19: quicksort(add(n,x)) -> app(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) 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: minus#_A(x1,x2) = ((1,0),(0,0)) x1 s_A(x1) = ((1,0),(0,0)) x1 + (1,1) precedence: minus# > s partial status: pi(minus#) = [] pi(s) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: minus#_A(x1,x2) = (0,0) s_A(x1) = (1,1) precedence: minus# = s partial status: pi(minus#) = [] 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: quicksort#(add(n,x)) -> quicksort#(high(n,x)) p2: quicksort#(add(n,x)) -> quicksort#(low(n,x)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: le(|0|(),y) -> true() r6: le(s(x),|0|()) -> false() r7: le(s(x),s(y)) -> le(x,y) r8: app(nil(),y) -> y r9: app(add(n,x),y) -> add(n,app(x,y)) r10: low(n,nil()) -> nil() r11: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r12: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r13: if_low(false(),n,add(m,x)) -> low(n,x) r14: high(n,nil()) -> nil() r15: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r16: if_high(true(),n,add(m,x)) -> high(n,x) r17: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r18: quicksort(nil()) -> nil() r19: quicksort(add(n,x)) -> app(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) The set of usable rules consists of r5, r6, r7, r10, r11, r12, r13, r14, r15, r16, r17 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) = ((1,0),(0,0)) x1 add_A(x1,x2) = ((1,0),(0,0)) x1 + ((1,0),(0,0)) x2 + (3,5) high_A(x1,x2) = ((0,0),(1,0)) x1 + ((1,0),(1,0)) x2 + (0,3) low_A(x1,x2) = ((1,0),(1,0)) x1 + ((1,0),(1,1)) x2 + (2,0) le_A(x1,x2) = ((1,0),(1,1)) x1 + x2 + (0,9) |0|_A() = (7,1) true_A() = (6,4) s_A(x1) = x1 + (5,0) false_A() = (4,2) if_low_A(x1,x2,x3) = ((1,0),(1,0)) x2 + ((1,0),(1,0)) x3 + (2,3) if_high_A(x1,x2,x3) = ((0,0),(1,0)) x1 + x3 nil_A() = (1,1) precedence: quicksort# = add = high = low = le = |0| = true = s = false = if_low = if_high = nil partial status: pi(quicksort#) = [] pi(add) = [] pi(high) = [] pi(low) = [] pi(le) = [] pi(|0|) = [] pi(true) = [] pi(s) = [] pi(false) = [] pi(if_low) = [] pi(if_high) = [] pi(nil) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: quicksort#_A(x1) = (0,0) add_A(x1,x2) = (2,3) high_A(x1,x2) = (2,1) low_A(x1,x2) = (3,4) le_A(x1,x2) = ((0,0),(1,0)) x1 + ((1,0),(1,1)) x2 + (5,5) |0|_A() = (0,1) true_A() = (4,0) s_A(x1) = x1 false_A() = (4,2) if_low_A(x1,x2,x3) = (3,4) if_high_A(x1,x2,x3) = ((1,0),(1,1)) x3 + (0,1) nil_A() = (1,5) precedence: nil > add = high > if_high > le > low = |0| = true = false = if_low > s > quicksort# partial status: pi(quicksort#) = [] pi(add) = [] pi(high) = [] pi(low) = [] pi(le) = [] pi(|0|) = [] pi(true) = [] pi(s) = [1] pi(false) = [] pi(if_low) = [] pi(if_high) = [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: 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: le(|0|(),y) -> true() r6: le(s(x),|0|()) -> false() r7: le(s(x),s(y)) -> le(x,y) r8: app(nil(),y) -> y r9: app(add(n,x),y) -> add(n,app(x,y)) r10: low(n,nil()) -> nil() r11: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r12: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r13: if_low(false(),n,add(m,x)) -> low(n,x) r14: high(n,nil()) -> nil() r15: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r16: if_high(true(),n,add(m,x)) -> high(n,x) r17: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r18: quicksort(nil()) -> nil() r19: quicksort(add(n,x)) -> app(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) The set of usable rules consists of r5, r6, r7 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: if_high#_A(x1,x2,x3) = ((1,0),(1,1)) x2 + ((1,0),(1,1)) x3 + (1,1) false_A() = (3,1) add_A(x1,x2) = ((1,0),(0,0)) x1 + ((1,0),(0,0)) x2 + (3,2) high#_A(x1,x2) = ((1,0),(1,1)) x1 + ((1,0),(1,0)) x2 + (2,4) le_A(x1,x2) = ((1,0),(1,0)) x1 + (2,1) true_A() = (3,5) |0|_A() = (5,6) s_A(x1) = x1 + (4,2) precedence: le > true = |0| > false = s > if_high# = add = high# partial status: pi(if_high#) = [2, 3] pi(false) = [] pi(add) = [] pi(high#) = [] pi(le) = [] pi(true) = [] pi(|0|) = [] pi(s) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: if_high#_A(x1,x2,x3) = x2 + x3 + (1,1) false_A() = (1,3) add_A(x1,x2) = (0,0) high#_A(x1,x2) = (0,0) le_A(x1,x2) = (2,2) true_A() = (1,1) |0|_A() = (2,4) s_A(x1) = (3,4) precedence: s > le > |0| > if_high# = add = high# > false > true partial status: pi(if_high#) = [2, 3] pi(false) = [] pi(add) = [] 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: 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: le(|0|(),y) -> true() r6: le(s(x),|0|()) -> false() r7: le(s(x),s(y)) -> le(x,y) r8: app(nil(),y) -> y r9: app(add(n,x),y) -> add(n,app(x,y)) r10: low(n,nil()) -> nil() r11: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r12: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r13: if_low(false(),n,add(m,x)) -> low(n,x) r14: high(n,nil()) -> nil() r15: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r16: if_high(true(),n,add(m,x)) -> high(n,x) r17: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r18: quicksort(nil()) -> nil() r19: quicksort(add(n,x)) -> app(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) The set of usable rules consists of r5, r6, r7 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: if_low#_A(x1,x2,x3) = ((1,0),(1,1)) x2 + x3 + (2,3) false_A() = (5,1) add_A(x1,x2) = ((1,0),(1,1)) x1 + ((1,0),(1,1)) x2 + (3,1) low#_A(x1,x2) = x1 + x2 + (4,2) le_A(x1,x2) = ((0,0),(1,0)) x1 + (6,4) true_A() = (1,3) |0|_A() = (6,4) s_A(x1) = x1 + (7,5) precedence: if_low# = false = add = low# = le = true = |0| = s partial status: pi(if_low#) = [] pi(false) = [] pi(add) = [] pi(low#) = [] pi(le) = [] pi(true) = [] pi(|0|) = [] pi(s) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: if_low#_A(x1,x2,x3) = x2 + x3 + (2,3) false_A() = (0,0) add_A(x1,x2) = ((0,0),(1,0)) x1 + ((1,0),(1,1)) x2 + (2,1) low#_A(x1,x2) = ((1,0),(0,0)) x1 + ((1,0),(1,1)) x2 + (3,0) le_A(x1,x2) = (0,0) true_A() = (3,1) |0|_A() = (4,2) s_A(x1) = (1,1) precedence: add = low# = |0| > if_low# = true = s > false = le partial status: pi(if_low#) = [2, 3] pi(false) = [] pi(add) = [] pi(low#) = [2] 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: le(|0|(),y) -> true() r6: le(s(x),|0|()) -> false() r7: le(s(x),s(y)) -> le(x,y) r8: app(nil(),y) -> y r9: app(add(n,x),y) -> add(n,app(x,y)) r10: low(n,nil()) -> nil() r11: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r12: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r13: if_low(false(),n,add(m,x)) -> low(n,x) r14: high(n,nil()) -> nil() r15: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r16: if_high(true(),n,add(m,x)) -> high(n,x) r17: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r18: quicksort(nil()) -> nil() r19: quicksort(add(n,x)) -> app(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) 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#(add(n,x),y) -> app#(x,y) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: le(|0|(),y) -> true() r6: le(s(x),|0|()) -> false() r7: le(s(x),s(y)) -> le(x,y) r8: app(nil(),y) -> y r9: app(add(n,x),y) -> add(n,app(x,y)) r10: low(n,nil()) -> nil() r11: low(n,add(m,x)) -> if_low(le(m,n),n,add(m,x)) r12: if_low(true(),n,add(m,x)) -> add(m,low(n,x)) r13: if_low(false(),n,add(m,x)) -> low(n,x) r14: high(n,nil()) -> nil() r15: high(n,add(m,x)) -> if_high(le(m,n),n,add(m,x)) r16: if_high(true(),n,add(m,x)) -> high(n,x) r17: if_high(false(),n,add(m,x)) -> add(m,high(n,x)) r18: quicksort(nil()) -> nil() r19: quicksort(add(n,x)) -> app(quicksort(low(n,x)),add(n,quicksort(high(n,x)))) 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) add_A(x1,x2) = x1 + ((1,0),(0,0)) x2 + (1,1) precedence: app# = add partial status: pi(app#) = [] pi(add) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: app#_A(x1,x2) = (1,1) add_A(x1,x2) = x1 + (2,2) precedence: app# = add partial status: pi(app#) = [] pi(add) = [1] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.