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!): max/plus interpretation on natural numbers: sortIter#_A(x1,x2) = max{193, x2 - 53} if#_A(x1,x2,x3,x4) = max{193, x3 - 53, x4 - 53} empty_A(x1) = max{0, x1 - 50} append_A(x1,x2) = max{246, x1} cons_A(x1,x2) = max{100, x2 + 49} min_A(x1) = 2 nil_A = 51 false_A = 31 replace_A(x1,x2,x3) = max{19, x3 + 17} head_A(x1) = max{73, x1 + 2} tail_A(x1) = max{56, x1 - 20} eq_A(x1,x2) = 30 |0|_A = 0 true_A = 1 if_replace_A(x1,x2,x3,x4) = max{67, x4 + 17} sortIter#!_A(x1,x2) = max{80, x1} if#!_A(x1,x2,x3,x4) = max{74, x1 + 50, x2 - 2} empty!_A(x1) = max{82, x1 - 101} append!_A(x1,x2) = 79 cons!_A(x1,x2) = 0 min!_A(x1) = max{82, x1 - 150} nil!_A = 76 false!_A = 81 replace!_A(x1,x2,x3) = max{75, x3 - 17} head!_A(x1) = max{84, x1 - 1} tail!_A(x1) = max{84, x1 - 52} eq!_A(x1,x2) = 83 |0|!_A = 82 true!_A = 77 if_replace!_A(x1,x2,x3,x4) = max{76, x4 - 49} 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) = 3 append_A(x1,x2) = x1 + 1 cons_A(x1,x2) = x2 + 1 min_A(x1) = 3 nil_A() = 1 false_A() = 3 replace_A(x1,x2,x3) = x3 + 1 head_A(x1) = 1 tail_A(x1) = x1 + 1 eq_A(x1,x2) = x1 + x2 |0|_A() = 1 true_A() = 0 if_replace_A(x1,x2,x3,x4) = x4 + 1 sortIter#!_A(x1,x2) = x1 + 11 if#!_A(x1,x2,x3,x4) = x2 + 10 empty!_A(x1) = 12 append!_A(x1,x2) = 4 cons!_A(x1,x2) = 6 min!_A(x1) = 4 nil!_A() = 1 false!_A() = 2 replace!_A(x1,x2,x3) = x3 + 8 head!_A(x1) = 3 tail!_A(x1) = 3 eq!_A(x1,x2) = 8 |0|!_A() = 8 true!_A() = 7 if_replace!_A(x1,x2,x3,x4) = x4 + 6 partial status: pi(sortIter#) = [] pi(if#) = [] pi(empty) = [] 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, r17 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!): max/plus interpretation on natural numbers: if_replace#_A(x1,x2,x3,x4) = max{0, x1 - 23, x2 - 8, x3 - 24, x4 - 13} false_A = 22 cons_A(x1,x2) = max{x1 + 2, x2 + 8} replace#_A(x1,x2,x3) = max{0, x1 - 8, x2 - 24, x3 - 9} eq_A(x1,x2) = max{x1 + 13, x2 - 39} |0|_A = 38 true_A = 51 s_A(x1) = max{9, x1 + 8} empty_A(x1) = x1 + 26 if_replace#!_A(x1,x2,x3,x4) = max{0, x4 - 9} false!_A = 0 cons!_A(x1,x2) = max{0, x1 - 8} replace#!_A(x1,x2,x3) = max{0, x3 - 1} eq!_A(x1,x2) = max{0, x2 - 8} |0|!_A = 1 true!_A = 0 s!_A(x1) = max{0, x1 - 9} empty!_A(x1) = max{1, x1 - 31} 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() = 4 cons_A(x1,x2) = x2 + 3 replace#_A(x1,x2,x3) = 0 eq_A(x1,x2) = 5 |0|_A() = 1 true_A() = 5 s_A(x1) = x1 + 1 empty_A(x1) = 4 if_replace#!_A(x1,x2,x3,x4) = x3 + x4 + 1 false!_A() = 1 cons!_A(x1,x2) = 2 replace#!_A(x1,x2,x3) = x2 + x3 + 3 eq!_A(x1,x2) = 0 |0|!_A() = 10 true!_A() = 9 s!_A(x1) = x1 + 11 empty!_A(x1) = 6 partial status: pi(if_replace#) = [] pi(false) = [] pi(cons) = [1] pi(replace#) = [] pi(eq) = [] pi(|0|) = [] pi(true) = [] pi(s) = [] pi(empty) = [] 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!): max/plus interpretation on natural numbers: eq#_A(x1,x2) = max{0, x1 - 4, x2 - 4} s_A(x1) = max{4, x1 + 3} eq#!_A(x1,x2) = max{1, x2 - 1} s!_A(x1) = max{36, x1 + 3} 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 eq#!_A(x1,x2) = x1 + x2 s!_A(x1) = 8 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!): max/plus interpretation on natural numbers: if_min#_A(x1,x2) = max{1, x1 - 7} false_A = 6 cons_A(x1,x2) = max{14, x1 - 44, x2} min#_A(x1) = 1 le_A(x1,x2) = 6 true_A = 6 |0|_A = 1 s_A(x1) = max{1, x1} if_min#!_A(x1,x2) = max{2, x1 - 1} false!_A = 4 cons!_A(x1,x2) = max{x1 + 1, x2 + 41} min#!_A(x1) = 5 le!_A(x1,x2) = max{x1 + 37, x2 + 35} true!_A = 9 |0|!_A = 10 s!_A(x1) = x1 + 36 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) = 0 false_A() = 4 cons_A(x1,x2) = x1 + x2 + 8 min#_A(x1) = 0 le_A(x1,x2) = x2 + 4 true_A() = 4 |0|_A() = 1 s_A(x1) = x1 + 1 if_min#!_A(x1,x2) = x2 false!_A() = 10 cons!_A(x1,x2) = x1 + x2 + 15 min#!_A(x1) = x1 + 1 le!_A(x1,x2) = x1 + x2 + 14 true!_A() = 10 |0|!_A() = 11 s!_A(x1) = 15 partial status: pi(if_min#) = [] pi(false) = [] pi(cons) = [] pi(min#) = [] pi(le) = [1, 2] 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!): max/plus interpretation on natural numbers: le#_A(x1,x2) = max{0, x1 - 2, x2 - 2} s_A(x1) = max{12, x1 + 1} le#!_A(x1,x2) = max{45, x2 - 2} s!_A(x1) = x1 + 44 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) = x1 + x2 + 2 s!_A(x1) = 3 partial status: pi(le#) = [] pi(s) = [] The following rules are removed: p1 Then no dependency pair remains.