YES We show the termination of the TRS R: eq(|0|(),|0|()) -> true() eq(|0|(),s(Y)) -> false() eq(s(X),|0|()) -> false() eq(s(X),s(Y)) -> eq(X,Y) le(|0|(),Y) -> true() le(s(X),|0|()) -> false() le(s(X),s(Y)) -> le(X,Y) min(cons(|0|(),nil())) -> |0|() min(cons(s(N),nil())) -> s(N) min(cons(N,cons(M,L))) -> ifmin(le(N,M),cons(N,cons(M,L))) ifmin(true(),cons(N,cons(M,L))) -> min(cons(N,L)) ifmin(false(),cons(N,cons(M,L))) -> min(cons(M,L)) replace(N,M,nil()) -> nil() replace(N,M,cons(K,L)) -> ifrepl(eq(N,K),N,M,cons(K,L)) ifrepl(true(),N,M,cons(K,L)) -> cons(M,L) ifrepl(false(),N,M,cons(K,L)) -> cons(K,replace(N,M,L)) selsort(nil()) -> nil() selsort(cons(N,L)) -> ifselsort(eq(N,min(cons(N,L))),cons(N,L)) ifselsort(true(),cons(N,L)) -> cons(N,selsort(L)) ifselsort(false(),cons(N,L)) -> cons(min(cons(N,L)),selsort(replace(min(cons(N,L)),N,L))) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: eq#(s(X),s(Y)) -> eq#(X,Y) p2: le#(s(X),s(Y)) -> le#(X,Y) p3: min#(cons(N,cons(M,L))) -> ifmin#(le(N,M),cons(N,cons(M,L))) p4: min#(cons(N,cons(M,L))) -> le#(N,M) p5: ifmin#(true(),cons(N,cons(M,L))) -> min#(cons(N,L)) p6: ifmin#(false(),cons(N,cons(M,L))) -> min#(cons(M,L)) p7: replace#(N,M,cons(K,L)) -> ifrepl#(eq(N,K),N,M,cons(K,L)) p8: replace#(N,M,cons(K,L)) -> eq#(N,K) p9: ifrepl#(false(),N,M,cons(K,L)) -> replace#(N,M,L) p10: selsort#(cons(N,L)) -> ifselsort#(eq(N,min(cons(N,L))),cons(N,L)) p11: selsort#(cons(N,L)) -> eq#(N,min(cons(N,L))) p12: selsort#(cons(N,L)) -> min#(cons(N,L)) p13: ifselsort#(true(),cons(N,L)) -> selsort#(L) p14: ifselsort#(false(),cons(N,L)) -> min#(cons(N,L)) p15: ifselsort#(false(),cons(N,L)) -> selsort#(replace(min(cons(N,L)),N,L)) p16: ifselsort#(false(),cons(N,L)) -> replace#(min(cons(N,L)),N,L) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(Y)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: le(|0|(),Y) -> true() r6: le(s(X),|0|()) -> false() r7: le(s(X),s(Y)) -> le(X,Y) r8: min(cons(|0|(),nil())) -> |0|() r9: min(cons(s(N),nil())) -> s(N) r10: min(cons(N,cons(M,L))) -> ifmin(le(N,M),cons(N,cons(M,L))) r11: ifmin(true(),cons(N,cons(M,L))) -> min(cons(N,L)) r12: ifmin(false(),cons(N,cons(M,L))) -> min(cons(M,L)) r13: replace(N,M,nil()) -> nil() r14: replace(N,M,cons(K,L)) -> ifrepl(eq(N,K),N,M,cons(K,L)) r15: ifrepl(true(),N,M,cons(K,L)) -> cons(M,L) r16: ifrepl(false(),N,M,cons(K,L)) -> cons(K,replace(N,M,L)) r17: selsort(nil()) -> nil() r18: selsort(cons(N,L)) -> ifselsort(eq(N,min(cons(N,L))),cons(N,L)) r19: ifselsort(true(),cons(N,L)) -> cons(N,selsort(L)) r20: ifselsort(false(),cons(N,L)) -> cons(min(cons(N,L)),selsort(replace(min(cons(N,L)),N,L))) The estimated dependency graph contains the following SCCs: {p10, p13, p15} {p7, p9} {p1} {p3, p5, p6} {p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: ifselsort#(false(),cons(N,L)) -> selsort#(replace(min(cons(N,L)),N,L)) p2: selsort#(cons(N,L)) -> ifselsort#(eq(N,min(cons(N,L))),cons(N,L)) p3: ifselsort#(true(),cons(N,L)) -> selsort#(L) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(Y)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: le(|0|(),Y) -> true() r6: le(s(X),|0|()) -> false() r7: le(s(X),s(Y)) -> le(X,Y) r8: min(cons(|0|(),nil())) -> |0|() r9: min(cons(s(N),nil())) -> s(N) r10: min(cons(N,cons(M,L))) -> ifmin(le(N,M),cons(N,cons(M,L))) r11: ifmin(true(),cons(N,cons(M,L))) -> min(cons(N,L)) r12: ifmin(false(),cons(N,cons(M,L))) -> min(cons(M,L)) r13: replace(N,M,nil()) -> nil() r14: replace(N,M,cons(K,L)) -> ifrepl(eq(N,K),N,M,cons(K,L)) r15: ifrepl(true(),N,M,cons(K,L)) -> cons(M,L) r16: ifrepl(false(),N,M,cons(K,L)) -> cons(K,replace(N,M,L)) r17: selsort(nil()) -> nil() r18: selsort(cons(N,L)) -> ifselsort(eq(N,min(cons(N,L))),cons(N,L)) r19: ifselsort(true(),cons(N,L)) -> cons(N,selsort(L)) r20: ifselsort(false(),cons(N,L)) -> cons(min(cons(N,L)),selsort(replace(min(cons(N,L)),N,L))) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: min > replace > nil > s > ifrepl > cons > |0| > ifmin > le > ifselsort# > selsort# > eq > true > false argument filter: pi(ifselsort#) = 2 pi(false) = [] pi(cons) = [2] pi(selsort#) = 1 pi(replace) = 3 pi(min) = 1 pi(eq) = [] pi(true) = [] pi(le) = [] pi(|0|) = [] pi(s) = [] pi(ifmin) = 2 pi(ifrepl) = 4 pi(nil) = [] 2. lexicographic path order with precedence: precedence: |0| > nil > false > eq > s > ifrepl > true > min > ifmin > le > replace > selsort# > cons > ifselsort# argument filter: pi(ifselsort#) = 2 pi(false) = [] pi(cons) = 2 pi(selsort#) = 1 pi(replace) = 3 pi(min) = [1] pi(eq) = [] pi(true) = [] pi(le) = [] pi(|0|) = [] pi(s) = [] pi(ifmin) = [] pi(ifrepl) = 4 pi(nil) = [] The next rules are strictly ordered: p1, p3 We remove them from the problem. -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: selsort#(cons(N,L)) -> ifselsort#(eq(N,min(cons(N,L))),cons(N,L)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(Y)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: le(|0|(),Y) -> true() r6: le(s(X),|0|()) -> false() r7: le(s(X),s(Y)) -> le(X,Y) r8: min(cons(|0|(),nil())) -> |0|() r9: min(cons(s(N),nil())) -> s(N) r10: min(cons(N,cons(M,L))) -> ifmin(le(N,M),cons(N,cons(M,L))) r11: ifmin(true(),cons(N,cons(M,L))) -> min(cons(N,L)) r12: ifmin(false(),cons(N,cons(M,L))) -> min(cons(M,L)) r13: replace(N,M,nil()) -> nil() r14: replace(N,M,cons(K,L)) -> ifrepl(eq(N,K),N,M,cons(K,L)) r15: ifrepl(true(),N,M,cons(K,L)) -> cons(M,L) r16: ifrepl(false(),N,M,cons(K,L)) -> cons(K,replace(N,M,L)) r17: selsort(nil()) -> nil() r18: selsort(cons(N,L)) -> ifselsort(eq(N,min(cons(N,L))),cons(N,L)) r19: ifselsort(true(),cons(N,L)) -> cons(N,selsort(L)) r20: ifselsort(false(),cons(N,L)) -> cons(min(cons(N,L)),selsort(replace(min(cons(N,L)),N,L))) The estimated dependency graph contains the following SCCs: (no SCCs) -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: ifrepl#(false(),N,M,cons(K,L)) -> replace#(N,M,L) p2: replace#(N,M,cons(K,L)) -> ifrepl#(eq(N,K),N,M,cons(K,L)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(Y)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: le(|0|(),Y) -> true() r6: le(s(X),|0|()) -> false() r7: le(s(X),s(Y)) -> le(X,Y) r8: min(cons(|0|(),nil())) -> |0|() r9: min(cons(s(N),nil())) -> s(N) r10: min(cons(N,cons(M,L))) -> ifmin(le(N,M),cons(N,cons(M,L))) r11: ifmin(true(),cons(N,cons(M,L))) -> min(cons(N,L)) r12: ifmin(false(),cons(N,cons(M,L))) -> min(cons(M,L)) r13: replace(N,M,nil()) -> nil() r14: replace(N,M,cons(K,L)) -> ifrepl(eq(N,K),N,M,cons(K,L)) r15: ifrepl(true(),N,M,cons(K,L)) -> cons(M,L) r16: ifrepl(false(),N,M,cons(K,L)) -> cons(K,replace(N,M,L)) r17: selsort(nil()) -> nil() r18: selsort(cons(N,L)) -> ifselsort(eq(N,min(cons(N,L))),cons(N,L)) r19: ifselsort(true(),cons(N,L)) -> cons(N,selsort(L)) r20: ifselsort(false(),cons(N,L)) -> cons(min(cons(N,L)),selsort(replace(min(cons(N,L)),N,L))) The set of usable rules consists of r1, r2, r3, r4 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: eq > false > s > true > |0| > replace# > ifrepl# > cons argument filter: pi(ifrepl#) = 4 pi(false) = [] pi(cons) = [2] pi(replace#) = 3 pi(eq) = [1, 2] pi(|0|) = [] pi(true) = [] pi(s) = [1] 2. lexicographic path order with precedence: precedence: false > eq > s > true > |0| > ifrepl# > replace# > cons argument filter: pi(ifrepl#) = 4 pi(false) = [] pi(cons) = 2 pi(replace#) = [3] pi(eq) = 2 pi(|0|) = [] pi(true) = [] pi(s) = [1] 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: eq#(s(X),s(Y)) -> eq#(X,Y) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(Y)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: le(|0|(),Y) -> true() r6: le(s(X),|0|()) -> false() r7: le(s(X),s(Y)) -> le(X,Y) r8: min(cons(|0|(),nil())) -> |0|() r9: min(cons(s(N),nil())) -> s(N) r10: min(cons(N,cons(M,L))) -> ifmin(le(N,M),cons(N,cons(M,L))) r11: ifmin(true(),cons(N,cons(M,L))) -> min(cons(N,L)) r12: ifmin(false(),cons(N,cons(M,L))) -> min(cons(M,L)) r13: replace(N,M,nil()) -> nil() r14: replace(N,M,cons(K,L)) -> ifrepl(eq(N,K),N,M,cons(K,L)) r15: ifrepl(true(),N,M,cons(K,L)) -> cons(M,L) r16: ifrepl(false(),N,M,cons(K,L)) -> cons(K,replace(N,M,L)) r17: selsort(nil()) -> nil() r18: selsort(cons(N,L)) -> ifselsort(eq(N,min(cons(N,L))),cons(N,L)) r19: ifselsort(true(),cons(N,L)) -> cons(N,selsort(L)) r20: ifselsort(false(),cons(N,L)) -> cons(min(cons(N,L)),selsort(replace(min(cons(N,L)),N,L))) The set of usable rules consists of (no rules) Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: s > eq# argument filter: pi(eq#) = [2] pi(s) = [1] 2. lexicographic path order with precedence: precedence: s > eq# argument filter: pi(eq#) = [2] pi(s) = [1] 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: ifmin#(false(),cons(N,cons(M,L))) -> min#(cons(M,L)) p2: min#(cons(N,cons(M,L))) -> ifmin#(le(N,M),cons(N,cons(M,L))) p3: ifmin#(true(),cons(N,cons(M,L))) -> min#(cons(N,L)) and R consists of: r1: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(Y)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: le(|0|(),Y) -> true() r6: le(s(X),|0|()) -> false() r7: le(s(X),s(Y)) -> le(X,Y) r8: min(cons(|0|(),nil())) -> |0|() r9: min(cons(s(N),nil())) -> s(N) r10: min(cons(N,cons(M,L))) -> ifmin(le(N,M),cons(N,cons(M,L))) r11: ifmin(true(),cons(N,cons(M,L))) -> min(cons(N,L)) r12: ifmin(false(),cons(N,cons(M,L))) -> min(cons(M,L)) r13: replace(N,M,nil()) -> nil() r14: replace(N,M,cons(K,L)) -> ifrepl(eq(N,K),N,M,cons(K,L)) r15: ifrepl(true(),N,M,cons(K,L)) -> cons(M,L) r16: ifrepl(false(),N,M,cons(K,L)) -> cons(K,replace(N,M,L)) r17: selsort(nil()) -> nil() r18: selsort(cons(N,L)) -> ifselsort(eq(N,min(cons(N,L))),cons(N,L)) r19: ifselsort(true(),cons(N,L)) -> cons(N,selsort(L)) r20: ifselsort(false(),cons(N,L)) -> cons(min(cons(N,L)),selsort(replace(min(cons(N,L)),N,L))) The set of usable rules consists of r5, r6, r7 Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: s > false > |0| > true > cons > min# > le > ifmin# argument filter: pi(ifmin#) = [1, 2] pi(false) = [] pi(cons) = [1, 2] pi(min#) = [1] pi(le) = [1] pi(true) = [] pi(|0|) = [] pi(s) = [1] 2. lexicographic path order with precedence: precedence: false > le > s > true > |0| > cons > ifmin# > min# argument filter: pi(ifmin#) = 2 pi(false) = [] pi(cons) = 1 pi(min#) = [1] 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: eq(|0|(),|0|()) -> true() r2: eq(|0|(),s(Y)) -> false() r3: eq(s(X),|0|()) -> false() r4: eq(s(X),s(Y)) -> eq(X,Y) r5: le(|0|(),Y) -> true() r6: le(s(X),|0|()) -> false() r7: le(s(X),s(Y)) -> le(X,Y) r8: min(cons(|0|(),nil())) -> |0|() r9: min(cons(s(N),nil())) -> s(N) r10: min(cons(N,cons(M,L))) -> ifmin(le(N,M),cons(N,cons(M,L))) r11: ifmin(true(),cons(N,cons(M,L))) -> min(cons(N,L)) r12: ifmin(false(),cons(N,cons(M,L))) -> min(cons(M,L)) r13: replace(N,M,nil()) -> nil() r14: replace(N,M,cons(K,L)) -> ifrepl(eq(N,K),N,M,cons(K,L)) r15: ifrepl(true(),N,M,cons(K,L)) -> cons(M,L) r16: ifrepl(false(),N,M,cons(K,L)) -> cons(K,replace(N,M,L)) r17: selsort(nil()) -> nil() r18: selsort(cons(N,L)) -> ifselsort(eq(N,min(cons(N,L))),cons(N,L)) r19: ifselsort(true(),cons(N,L)) -> cons(N,selsort(L)) r20: ifselsort(false(),cons(N,L)) -> cons(min(cons(N,L)),selsort(replace(min(cons(N,L)),N,L))) The set of usable rules consists of (no rules) Take the reduction pair: lexicographic combination of reduction pairs: 1. lexicographic path order with precedence: precedence: s > le# argument filter: pi(le#) = [2] pi(s) = [1] 2. lexicographic path order with precedence: precedence: s > le# argument filter: pi(le#) = [2] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.