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, r12, r13, r14, r15, r16, r17, r19, r20 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. 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) = 4 append_A(x1,x2) = x1 + 1 cons_A(x1,x2) = x2 + 1 min_A(x1) = 1 nil_A() = 1 false_A() = 4 replace_A(x1,x2,x3) = x3 + 1 head_A(x1) = x1 + 1 tail_A(x1) = x1 + 1 eq_A(x1,x2) = 3 |0|_A() = 1 true_A() = 3 if_replace_A(x1,x2,x3,x4) = x4 + 1 sortIter#!_A(x1,x2) = 1 if#!_A(x1,x2,x3,x4) = 1 empty!_A(x1) = 0 append!_A(x1,x2) = 9 cons!_A(x1,x2) = 5 min!_A(x1) = 2 nil!_A() = 4 false!_A() = 3 replace!_A(x1,x2,x3) = x3 + 6 head!_A(x1) = 3 tail!_A(x1) = 8 eq!_A(x1,x2) = 4 |0|!_A() = 4 true!_A() = 3 if_replace!_A(x1,x2,x3,x4) = x4 + 5 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sortIter#_A(x1,x2) = 1 if#_A(x1,x2,x3,x4) = 1 empty_A(x1) = max{0, x1 - 3} append_A(x1,x2) = 5 cons_A(x1,x2) = max{91, x2 + 33} min_A(x1) = 3 nil_A = 4 false_A = 49 replace_A(x1,x2,x3) = max{40, x3} head_A(x1) = max{4, x1 - 190} tail_A(x1) = max{4, x1 - 33} eq_A(x1,x2) = max{0, x1 - 90, x2 - 139} |0|_A = 91 true_A = 1 if_replace_A(x1,x2,x3,x4) = max{91, x4} sortIter#!_A(x1,x2) = max{x1 + 121, x2 + 114} if#!_A(x1,x2,x3,x4) = max{x1 + 113, x2 + 89, x4 + 115} empty!_A(x1) = 49 append!_A(x1,x2) = max{122, x1 + 8} cons!_A(x1,x2) = max{x1 + 152, x2 + 92} min!_A(x1) = max{47, x1 - 37} nil!_A = 8 false!_A = 50 replace!_A(x1,x2,x3) = max{49, x3 - 2} head!_A(x1) = max{4, x1 - 37} tail!_A(x1) = 6 eq!_A(x1,x2) = max{x1 - 90, x2 + 153} |0|!_A = 52 true!_A = 53 if_replace!_A(x1,x2,x3,x4) = max{x2 + 91, x3 + 153, x4 + 60} partial status: pi(sortIter#) = [] pi(if#) = [] pi(empty) = [1] pi(append) = [] pi(cons) = [2] pi(min) = [] pi(nil) = [] pi(false) = [] pi(replace) = [3] pi(head) = [] pi(tail) = [1] pi(eq) = [] pi(|0|) = [] pi(true) = [] 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 r1, r2, r3, r4 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. 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) = x4 false_A() = 3 cons_A(x1,x2) = x1 + x2 + 6 replace#_A(x1,x2,x3) = x3 eq_A(x1,x2) = x1 + 2 |0|_A() = 1 true_A() = 3 s_A(x1) = x1 + 1 if_replace#!_A(x1,x2,x3,x4) = x4 + 2 false!_A() = 4 cons!_A(x1,x2) = x1 + x2 + 5 replace#!_A(x1,x2,x3) = x3 + 3 eq!_A(x1,x2) = 8 |0|!_A() = 7 true!_A() = 6 s!_A(x1) = 7 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: if_replace#_A(x1,x2,x3,x4) = max{0, x1 - 61, x2 - 3, x3 - 3, x4 - 37} false_A = 1 cons_A(x1,x2) = max{35, x1 + 1, x2} replace#_A(x1,x2,x3) = max{0, x1 - 3, x2 - 3, x3 - 37} eq_A(x1,x2) = max{60, x1 - 19, x2 - 101} |0|_A = 4 true_A = 13 s_A(x1) = max{18, x1 + 1} if_replace#!_A(x1,x2,x3,x4) = max{46, x1 - 177, x2 - 197, x3 - 1, x4 - 233} false!_A = 13 cons!_A(x1,x2) = max{45, x1 + 11, x2 - 116} replace#!_A(x1,x2,x3) = max{47, x1 - 197, x3 - 116} eq!_A(x1,x2) = max{15, x1 - 2, x2 - 116} |0|!_A = 14 true!_A = 3 s!_A(x1) = x1 + 14 partial status: pi(if_replace#) = [] pi(false) = [] pi(cons) = [1] pi(replace#) = [] pi(eq) = [] pi(|0|) = [] pi(true) = [] pi(s) = [1] 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 (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. 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 + 2 eq#!_A(x1,x2) = x1 + x2 s!_A(x1) = x1 + 5 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: eq#_A(x1,x2) = 0 s_A(x1) = 4 eq#!_A(x1,x2) = max{2, x1 - 1, x2 - 7} s!_A(x1) = max{1, x1 - 6} partial status: pi(eq#) = [] pi(s) = [] 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 r5, r6, r7 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. 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() = 15 cons_A(x1,x2) = x1 + x2 + 7 min#_A(x1) = x1 le_A(x1,x2) = x1 + x2 + 8 true_A() = 14 |0|_A() = 6 s_A(x1) = x1 + 1 if_min#!_A(x1,x2) = x2 + 8 false!_A() = 20 cons!_A(x1,x2) = 23 min#!_A(x1) = x1 + 10 le!_A(x1,x2) = 22 true!_A() = 18 |0|!_A() = 21 s!_A(x1) = 21 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: if_min#_A(x1,x2) = max{0, x1 - 217, x2 - 63} false_A = 1 cons_A(x1,x2) = max{40, x1 + 24, x2 + 22} min#_A(x1) = max{0, x1 - 63} le_A(x1,x2) = max{x1 - 6, x2 + 200} true_A = 72 |0|_A = 0 s_A(x1) = x1 + 5 if_min#!_A(x1,x2) = max{x1 - 2, x2 + 30} false!_A = 110 cons!_A(x1,x2) = max{69, x1 + 48, x2 - 38} min#!_A(x1) = max{93, x1 + 69} le!_A(x1,x2) = max{3, x1 - 1, x2 - 15} true!_A = 87 |0|!_A = 111 s!_A(x1) = max{2, x1 - 16} partial status: pi(if_min#) = [2] pi(false) = [] pi(cons) = [] pi(min#) = [] pi(le) = [] pi(true) = [] pi(|0|) = [] pi(s) = [1] 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: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. 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) = x1 + x2 s!_A(x1) = 6 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: le#_A(x1,x2) = 0 s_A(x1) = 2 le#!_A(x1,x2) = 122 s!_A(x1) = max{121, x1 - 2} partial status: pi(le#) = [] pi(s) = [] The following rules are removed: p1 Then no dependency pair remains.