YES We show the termination of the TRS R: eq(|0|(),|0|()) -> true() eq(|0|(),s(m)) -> false() eq(s(n),|0|()) -> false() eq(s(n),s(m)) -> eq(n,m) le(|0|(),m) -> true() le(s(n),|0|()) -> false() le(s(n),s(m)) -> le(n,m) min(cons(x,nil())) -> x min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) replace(n,m,nil()) -> nil() replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) if_replace(true(),n,m,cons(k,x)) -> cons(m,x) if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) empty(nil()) -> true() empty(cons(n,x)) -> false() head(cons(n,x)) -> n tail(nil()) -> nil() tail(cons(n,x)) -> x |sort|(x) -> sortIter(x,nil()) sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) if(true(),x,y,z) -> y if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: eq#(s(n),s(m)) -> eq#(n,m) p2: le#(s(n),s(m)) -> le#(n,m) p3: min#(cons(n,cons(m,x))) -> if_min#(le(n,m),cons(n,cons(m,x))) p4: min#(cons(n,cons(m,x))) -> le#(n,m) p5: if_min#(true(),cons(n,cons(m,x))) -> min#(cons(n,x)) p6: if_min#(false(),cons(n,cons(m,x))) -> min#(cons(m,x)) p7: replace#(n,m,cons(k,x)) -> if_replace#(eq(n,k),n,m,cons(k,x)) p8: replace#(n,m,cons(k,x)) -> eq#(n,k) p9: if_replace#(false(),n,m,cons(k,x)) -> replace#(n,m,x) p10: |sort|#(x) -> sortIter#(x,nil()) p11: sortIter#(x,y) -> if#(empty(x),x,y,append(y,cons(min(x),nil()))) p12: sortIter#(x,y) -> empty#(x) p13: sortIter#(x,y) -> min#(x) p14: if#(false(),x,y,z) -> sortIter#(replace(min(x),head(x),tail(x)),z) p15: if#(false(),x,y,z) -> replace#(min(x),head(x),tail(x)) p16: if#(false(),x,y,z) -> min#(x) p17: if#(false(),x,y,z) -> head#(x) p18: if#(false(),x,y,z) -> tail#(x) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) The estimated dependency graph contains the following SCCs: {p11, p14} {p7, p9} {p1} {p3, p5, p6} {p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: sortIter#(x,y) -> if#(empty(x),x,y,append(y,cons(min(x),nil()))) p2: if#(false(),x,y,z) -> sortIter#(replace(min(x),head(x),tail(x)),z) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r12, r13, r14, r15, r16, r17, r19, r20 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: sortIter#_A(x1,x2) = max{x1 + 33, x2 + 6} if#_A(x1,x2,x3,x4) = max{x1 - 3, x2 + 27, x3 + 5, x4 + 11} empty_A(x1) = max{23, x1 + 2} append_A(x1,x2) = max{7, x2 - 81} cons_A(x1,x2) = x2 + 74 min_A(x1) = 71 nil_A = 25 false_A = 72 replace_A(x1,x2,x3) = x3 + 9 head_A(x1) = 73 tail_A(x1) = max{26, x1 - 25} eq_A(x1,x2) = 73 |0|_A = 0 true_A = 24 s_A(x1) = x1 le_A(x1,x2) = max{309, x1 + 86} if_replace_A(x1,x2,x3,x4) = max{x1 - 1, x4 + 9} base order 2: precedence: |0| > min > if# = empty = append = head = s > sortIter# = le > false > replace = tail > nil = if_replace > cons > eq > true partial status: pi(sortIter#) = [] pi(if#) = [] pi(empty) = [1] pi(append) = [] pi(cons) = [] pi(min) = [] pi(nil) = [] pi(false) = [] pi(replace) = [3] pi(head) = [] pi(tail) = [] pi(eq) = [] pi(|0|) = [] pi(true) = [] pi(s) = [1] pi(le) = [1] pi(if_replace) = [] The following rules are removed: p2 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: sortIter#(x,y) -> if#(empty(x),x,y,append(y,cons(min(x),nil()))) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) 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_replace#(false(),n,m,cons(k,x)) -> replace#(n,m,x) p2: replace#(n,m,cons(k,x)) -> if_replace#(eq(n,k),n,m,cons(k,x)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r12, r14, r17, r19, r20 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: if_replace#_A(x1,x2,x3,x4) = max{x2 + 23, x3 + 23, x4 + 19} false_A = 18 cons_A(x1,x2) = max{x1 + 21, x2 + 8} replace#_A(x1,x2,x3) = max{x1 + 23, x2 + 23, x3 + 20} eq_A(x1,x2) = max{20, x1 - 4, x2 - 4} |0|_A = 18 true_A = 0 s_A(x1) = max{21, x1 + 5} le_A(x1,x2) = 51 replace_A(x1,x2,x3) = 17 nil_A = 3 if_replace_A(x1,x2,x3,x4) = max{x2 - 1, x3 + 22, x4 + 3} empty_A(x1) = 32 tail_A(x1) = max{31, x1 + 3} base order 2: precedence: if_replace# = replace# = |0| = s = empty = tail > false = if_replace > replace > cons > eq = le > nil > true partial status: pi(if_replace#) = [4] pi(false) = [] pi(cons) = [1] pi(replace#) = [3] pi(eq) = [] pi(|0|) = [] pi(true) = [] pi(s) = [1] pi(le) = [] pi(replace) = [] pi(nil) = [] pi(if_replace) = [3, 4] pi(empty) = [] pi(tail) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: replace#(n,m,cons(k,x)) -> if_replace#(eq(n,k),n,m,cons(k,x)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) The estimated dependency graph contains the following SCCs: (no SCCs) -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: eq#(s(n),s(m)) -> eq#(n,m) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) The set of usable rules consists of r1, r2, r3, r5, r6, r12, r17, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: eq#_A(x1,x2) = max{x1 + 2, x2 - 1} s_A(x1) = max{6, x1 + 3} eq_A(x1,x2) = max{10, x1 - 7, x2 - 7} |0|_A = 6 true_A = 5 false_A = 5 le_A(x1,x2) = max{7, x1 - 7, x2 - 7} replace_A(x1,x2,x3) = max{9, x2 - 8, x3 - 23} nil_A = 6 empty_A(x1) = max{23, x1 - 7} cons_A(x1,x2) = max{6, x1 + 4, x2 - 12} tail_A(x1) = max{7, x1 - 7} base order 2: precedence: eq = le > replace = cons > |0| = empty > eq# = tail > s = false = nil > true partial status: pi(eq#) = [1] pi(s) = [1] pi(eq) = [] pi(|0|) = [] pi(true) = [] pi(false) = [] pi(le) = [] pi(replace) = [] pi(nil) = [] pi(empty) = [] pi(cons) = [] pi(tail) = [] 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: if_min#(false(),cons(n,cons(m,x))) -> min#(cons(m,x)) p2: min#(cons(n,cons(m,x))) -> if_min#(le(n,m),cons(n,cons(m,x))) p3: if_min#(true(),cons(n,cons(m,x))) -> min#(cons(n,x)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) The set of usable rules consists of r1, r2, r3, r4, r6, r12, r14, r17, r19 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: if_min#_A(x1,x2) = max{4, x2} false_A = 0 cons_A(x1,x2) = x2 min#_A(x1) = max{4, x1} le_A(x1,x2) = max{x1, x2 + 1} true_A = 3 eq_A(x1,x2) = max{x1 - 2, x2 + 9} |0|_A = 1 s_A(x1) = x1 replace_A(x1,x2,x3) = 7 nil_A = 4 if_replace_A(x1,x2,x3,x4) = max{x1 - 10, x2 - 14, x3 - 2, x4 + 5} empty_A(x1) = max{5, x1 - 11} tail_A(x1) = max{5, x1 - 5} base order 2: precedence: empty = tail > false = |0| > if_min# = min# = nil > true > cons = le = eq = s > replace = if_replace partial status: pi(if_min#) = [2] pi(false) = [] pi(cons) = [2] pi(min#) = [1] pi(le) = [] pi(true) = [] pi(eq) = [] pi(|0|) = [] pi(s) = [1] pi(replace) = [] pi(nil) = [] pi(if_replace) = [] pi(empty) = [] pi(tail) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: min#(cons(n,cons(m,x))) -> if_min#(le(n,m),cons(n,cons(m,x))) p2: if_min#(true(),cons(n,cons(m,x))) -> min#(cons(n,x)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) The estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: min#(cons(n,cons(m,x))) -> if_min#(le(n,m),cons(n,cons(m,x))) p2: if_min#(true(),cons(n,cons(m,x))) -> min#(cons(n,x)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) The set of usable rules consists of r1, r2, r3, r5, r6, r12, r17, r19, r20 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: min#_A(x1) = x1 + 16 cons_A(x1,x2) = x2 + 42 if_min#_A(x1,x2) = x2 + 7 le_A(x1,x2) = max{x1 - 7, x2 + 44} true_A = 5 eq_A(x1,x2) = max{6, x1 - 7, x2 - 7} |0|_A = 6 s_A(x1) = max{3, x1 - 45} false_A = 2 replace_A(x1,x2,x3) = max{16, x1 - 17, x2 - 2, x3 + 15} nil_A = 6 empty_A(x1) = max{50, x1 - 43} tail_A(x1) = max{7, x1 - 41} base order 2: precedence: if_min# = |0| > min# = tail > cons = eq = replace = empty > nil > le > true = s > false partial status: pi(min#) = [1] pi(cons) = [] pi(if_min#) = [2] pi(le) = [] pi(true) = [] pi(eq) = [] pi(|0|) = [] pi(s) = [] pi(false) = [] pi(replace) = [3] pi(nil) = [] pi(empty) = [] pi(tail) = [] The following rules are removed: p2 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: min#(cons(n,cons(m,x))) -> if_min#(le(n,m),cons(n,cons(m,x))) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) 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(n),s(m)) -> le#(n,m) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(m)) -> false() r3: eq(s(n),|0|()) -> false() r4: eq(s(n),s(m)) -> eq(n,m) r5: le(|0|(),m) -> true() r6: le(s(n),|0|()) -> false() r7: le(s(n),s(m)) -> le(n,m) r8: min(cons(x,nil())) -> x r9: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r10: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r11: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r12: replace(n,m,nil()) -> nil() r13: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r14: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r15: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r16: empty(nil()) -> true() r17: empty(cons(n,x)) -> false() r18: head(cons(n,x)) -> n r19: tail(nil()) -> nil() r20: tail(cons(n,x)) -> x r21: |sort|(x) -> sortIter(x,nil()) r22: sortIter(x,y) -> if(empty(x),x,y,append(y,cons(min(x),nil()))) r23: if(true(),x,y,z) -> y r24: if(false(),x,y,z) -> sortIter(replace(min(x),head(x),tail(x)),z) The set of usable rules consists of r1, r2, r3, r5, r6, r12, 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 + 7, x2 - 1} s_A(x1) = x1 + 6 eq_A(x1,x2) = max{9, x1 - 7, x2 - 7} |0|_A = 6 true_A = 5 false_A = 5 le_A(x1,x2) = max{8, x1 - 7, x2 - 7} replace_A(x1,x2,x3) = max{8, x2 - 38, x3 - 24} nil_A = 7 empty_A(x1) = max{6, x1 - 8} cons_A(x1,x2) = max{7, x1 + 4, x2 - 12} tail_A(x1) = max{23, x1 - 8} base order 2: precedence: eq > replace > |0| > le = tail > le# = s = empty = cons > nil > true = false partial status: pi(le#) = [1] pi(s) = [1] pi(eq) = [] pi(|0|) = [] pi(true) = [] pi(false) = [] pi(le) = [] pi(replace) = [] pi(nil) = [] pi(empty) = [] pi(cons) = [] pi(tail) = [] The following rules are removed: p1 Then no dependency pair remains.