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, r12, r13, r14, r15, r16, r17, r19, r20 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: sortIter#_A(x1,x2) = x1 + 18 if#_A(x1,x2,x3,x4) = max{x1 - 4, x2 + 17} empty_A(x1) = x1 + 5 append_A(x1,x2) = max{59, x1 + 58, x2 + 4} cons_A(x1,x2) = max{53, x2 + 39} min_A(x1) = 2 nil_A = 15 false_A = 45 replace_A(x1,x2,x3) = x3 + 1 head_A(x1) = 18 tail_A(x1) = max{15, x1 - 38} eq_A(x1,x2) = 48 |0|_A = 49 true_A = 4 s_A(x1) = x1 + 49 if_replace_A(x1,x2,x3,x4) = max{54, x1 - 46, x4 + 1} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: sortIter#_A(x1,x2) = 0 if#_A(x1,x2,x3,x4) = 0 empty_A(x1) = x1 + 1 append_A(x1,x2) = x1 + 1 cons_A(x1,x2) = x2 + 2 min_A(x1) = 1 nil_A() = 1 false_A() = 3 replace_A(x1,x2,x3) = x3 + 3 head_A(x1) = x1 + 1 tail_A(x1) = x1 eq_A(x1,x2) = 3 |0|_A() = 0 true_A() = 2 s_A(x1) = x1 + 1 if_replace_A(x1,x2,x3,x4) = x1 + x4 sortIter#!_A(x1,x2) = x2 + 2 if#!_A(x1,x2,x3,x4) = x1 empty!_A(x1) = 1 append!_A(x1,x2) = 0 cons!_A(x1,x2) = 6 min!_A(x1) = 4 nil!_A() = 6 false!_A() = 10 replace!_A(x1,x2,x3) = 8 head!_A(x1) = 2 tail!_A(x1) = 9 eq!_A(x1,x2) = x1 + x2 + 4 |0|!_A() = 11 true!_A() = 5 s!_A(x1) = x1 + 10 if_replace!_A(x1,x2,x3,x4) = 7 partial status: pi(sortIter#) = [] pi(if#) = [] pi(empty) = [] pi(append) = [] pi(cons) = [] pi(min) = [] pi(nil) = [] pi(false) = [] pi(replace) = [] pi(head) = [] pi(tail) = [] pi(eq) = [] pi(|0|) = [] pi(true) = [] pi(s) = [1] pi(if_replace) = [4] The following rules are removed: p1, p2 Then no dependency pair remains. -- 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 r3 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: if_replace#_A(x1,x2,x3,x4) = max{2, x4 - 14} false_A = 14 cons_A(x1,x2) = max{14, x1 + 5, x2 + 4} replace#_A(x1,x2,x3) = max{1, x3 - 11} eq_A(x1,x2) = max{14, x1 - 2} s_A(x1) = x1 + 52 |0|_A = 15 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: if_replace#_A(x1,x2,x3,x4) = 0 false_A() = 5 cons_A(x1,x2) = x1 + x2 replace#_A(x1,x2,x3) = 0 eq_A(x1,x2) = x2 + 3 s_A(x1) = x1 + 1 |0|_A() = 2 if_replace#!_A(x1,x2,x3,x4) = x2 + x3 + x4 + 5 false!_A() = 3 cons!_A(x1,x2) = x2 + 4 replace#!_A(x1,x2,x3) = x3 + 1 eq!_A(x1,x2) = x2 s!_A(x1) = 1 |0|!_A() = 4 partial status: pi(if_replace#) = [] pi(false) = [] pi(cons) = [1] pi(replace#) = [] pi(eq) = [] pi(s) = [1] pi(|0|) = [] The following rules are removed: p1, p2 Then no dependency pair remains. -- 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 r8 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: eq#_A(x1,x2) = max{31, x2 - 1} s_A(x1) = max{35, x1 + 33} min_A(x1) = max{30, x1 + 24} cons_A(x1,x2) = max{x1 + 36, x2 - 7} nil_A = 3 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: eq#_A(x1,x2) = x1 + x2 s_A(x1) = x1 + 1 min_A(x1) = x1 + 1 cons_A(x1,x2) = x1 + 3 nil_A() = 2 eq#!_A(x1,x2) = x2 s!_A(x1) = x1 + 9 min!_A(x1) = 7 cons!_A(x1,x2) = x1 + 9 nil!_A() = 2 partial status: pi(eq#) = [] pi(s) = [1] pi(min) = [1] pi(cons) = [1] pi(nil) = [] 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 r12 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: if_min#_A(x1,x2) = max{0, x2 - 7} false_A = 0 cons_A(x1,x2) = 6 min#_A(x1) = 0 le_A(x1,x2) = 0 true_A = 0 replace_A(x1,x2,x3) = max{8, x1 - 4, x2 - 9} nil_A = 4 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: if_min#_A(x1,x2) = x2 false_A() = 4 cons_A(x1,x2) = x1 + x2 + 4 min#_A(x1) = x1 le_A(x1,x2) = 1 true_A() = 4 replace_A(x1,x2,x3) = x1 + x2 + x3 + 4 nil_A() = 2 if_min#!_A(x1,x2) = x2 false!_A() = 7 cons!_A(x1,x2) = x1 + x2 + 5 min#!_A(x1) = x1 + 2 le!_A(x1,x2) = x1 + 9 true!_A() = 7 replace!_A(x1,x2,x3) = x2 + 9 nil!_A() = 8 partial status: pi(if_min#) = [] pi(false) = [] pi(cons) = [] pi(min#) = [] pi(le) = [] pi(true) = [] pi(replace) = [] pi(nil) = [] The following rules are removed: p1, p2, p3 Then no dependency pair remains. -- 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 (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: le#_A(x1,x2) = max{25, x2 - 1} s_A(x1) = max{27, x1 + 24} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: le#_A(x1,x2) = x1 + x2 s_A(x1) = x1 + 1 le#!_A(x1,x2) = 0 s!_A(x1) = x1 + 12 partial status: pi(le#) = [] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.