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. matrix interpretations: carrier: N^2 order: standard order interpretations: ifselsort#_A(x1,x2) = ((0,1),(0,0)) x1 + x2 false_A() = (1,1) cons_A(x1,x2) = ((1,1),(1,0)) x1 + ((1,0),(1,0)) x2 + (3,1) selsort#_A(x1) = x1 + (2,0) replace_A(x1,x2,x3) = x1 + ((1,1),(1,1)) x2 + x3 + (1,1) min_A(x1) = ((0,1),(0,0)) x1 + (1,1) eq_A(x1,x2) = (2,1) true_A() = (1,1) le_A(x1,x2) = x2 + (2,1) |0|_A() = (1,1) s_A(x1) = x1 + (1,1) ifmin_A(x1,x2) = ((0,1),(0,0)) x2 + (0,1) ifrepl_A(x1,x2,x3,x4) = x2 + ((1,1),(1,1)) x3 + x4 + (1,1) nil_A() = (1,1) 2. matrix interpretations: carrier: N^2 order: standard order interpretations: ifselsort#_A(x1,x2) = ((0,0),(1,1)) x2 false_A() = (1,2) cons_A(x1,x2) = ((1,1),(0,0)) x1 + ((0,0),(1,0)) x2 + (1,1) selsort#_A(x1) = ((1,0),(1,0)) x1 + (1,3) replace_A(x1,x2,x3) = ((1,0),(1,0)) x2 + ((1,0),(1,1)) x3 + (2,1) min_A(x1) = (2,1) eq_A(x1,x2) = (2,1) true_A() = (3,2) le_A(x1,x2) = ((1,1),(0,0)) x2 + (1,1) |0|_A() = (3,2) s_A(x1) = ((1,1),(0,0)) x1 + (1,2) ifmin_A(x1,x2) = (1,0) ifrepl_A(x1,x2,x3,x4) = ((1,0),(1,0)) x3 + x4 + (1,2) nil_A() = (1,1) 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: 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. matrix interpretations: carrier: N^2 order: standard order interpretations: ifrepl#_A(x1,x2,x3,x4) = ((0,1),(0,0)) x1 + ((1,0),(1,1)) x4 false_A() = (1,1) cons_A(x1,x2) = ((1,1),(1,1)) x1 + ((1,1),(1,1)) x2 + (1,1) replace#_A(x1,x2,x3) = ((1,1),(1,1)) x3 + (1,0) eq_A(x1,x2) = ((0,1),(0,1)) x2 + (1,1) |0|_A() = (1,1) true_A() = (0,0) s_A(x1) = ((0,1),(1,1)) x1 + (1,1) 2. matrix interpretations: carrier: N^2 order: standard order interpretations: ifrepl#_A(x1,x2,x3,x4) = ((1,1),(0,1)) x4 + (0,1) false_A() = (2,2) cons_A(x1,x2) = ((1,0),(1,1)) x1 + ((0,1),(1,1)) x2 + (1,1) replace#_A(x1,x2,x3) = ((1,0),(1,0)) x3 eq_A(x1,x2) = (1,1) |0|_A() = (1,1) true_A() = (2,2) s_A(x1) = (1,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. matrix interpretations: carrier: N^2 order: standard order interpretations: eq#_A(x1,x2) = ((1,1),(0,0)) x1 + ((1,1),(1,1)) x2 s_A(x1) = ((1,1),(1,1)) x1 + (1,1) 2. matrix interpretations: carrier: N^2 order: standard order interpretations: eq#_A(x1,x2) = ((0,0),(1,1)) x1 + ((0,0),(1,1)) x2 s_A(x1) = ((0,1),(0,1)) x1 + (1,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. matrix interpretations: carrier: N^2 order: standard order interpretations: ifmin#_A(x1,x2) = ((0,1),(0,0)) x1 + ((1,0),(1,0)) x2 false_A() = (1,1) cons_A(x1,x2) = ((1,0),(1,0)) x1 + ((0,1),(1,1)) x2 + (1,1) min#_A(x1) = ((0,1),(0,1)) x1 + (1,1) le_A(x1,x2) = ((1,1),(0,0)) x1 + ((1,1),(1,0)) x2 + (1,1) true_A() = (1,1) |0|_A() = (1,1) s_A(x1) = ((1,0),(1,1)) x1 + (1,1) 2. matrix interpretations: carrier: N^2 order: standard order interpretations: ifmin#_A(x1,x2) = ((0,1),(0,0)) x2 + (0,1) false_A() = (6,6) cons_A(x1,x2) = ((0,0),(1,0)) x1 + (1,1) min#_A(x1) = (0,0) le_A(x1,x2) = ((1,1),(1,1)) x1 + ((1,1),(1,1)) x2 + (1,1) true_A() = (4,4) |0|_A() = (1,1) s_A(x1) = ((1,0),(1,0)) x1 + (1,1) 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. matrix interpretations: carrier: N^2 order: standard order interpretations: le#_A(x1,x2) = ((1,1),(1,0)) x1 + ((1,1),(0,0)) x2 s_A(x1) = ((1,1),(1,1)) x1 + (1,1) 2. matrix interpretations: carrier: N^2 order: standard order interpretations: le#_A(x1,x2) = ((1,1),(0,1)) x1 + ((0,0),(1,1)) x2 s_A(x1) = ((0,1),(1,1)) x1 + (1,1) The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.