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(|0|(),nil())) -> |0|() min(cons(s(n),nil())) -> s(n) 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)) |sort|(nil()) -> nil() |sort|(cons(n,x)) -> cons(min(cons(n,x)),|sort|(replace(min(cons(n,x)),n,x))) -- 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|#(cons(n,x)) -> min#(cons(n,x)) p11: |sort|#(cons(n,x)) -> |sort|#(replace(min(cons(n,x)),n,x)) p12: |sort|#(cons(n,x)) -> replace#(min(cons(n,x)),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(|0|(),nil())) -> |0|() r9: min(cons(s(n),nil())) -> s(n) r10: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r11: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r12: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r13: replace(n,m,nil()) -> nil() r14: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r15: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r16: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r17: |sort|(nil()) -> nil() r18: |sort|(cons(n,x)) -> cons(min(cons(n,x)),|sort|(replace(min(cons(n,x)),n,x))) The estimated dependency graph contains the following SCCs: {p11} {p7, p9} {p1} {p3, p5, p6} {p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: |sort|#(cons(n,x)) -> |sort|#(replace(min(cons(n,x)),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(|0|(),nil())) -> |0|() r9: min(cons(s(n),nil())) -> s(n) r10: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r11: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r12: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r13: replace(n,m,nil()) -> nil() r14: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r15: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r16: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r17: |sort|(nil()) -> nil() r18: |sort|(cons(n,x)) -> cons(min(cons(n,x)),|sort|(replace(min(cons(n,x)),n,x))) 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. weighted path order base order: max/plus interpretations on natural numbers: |sort|#_A(x1) = max{6, x1 - 34} cons_A(x1,x2) = max{124, x2 + 41} replace_A(x1,x2,x3) = max{89, x3 + 8} min_A(x1) = max{186, x1 + 64} eq_A(x1,x2) = 132 |0|_A = 189 true_A = 125 s_A(x1) = 128 false_A = 125 le_A(x1,x2) = 126 if_min_A(x1,x2) = max{x1 + 102, x2 + 23} if_replace_A(x1,x2,x3,x4) = max{132, x1, x4 + 8} nil_A = 88 precedence: true > |sort|# = cons = replace = eq = |0| = s = false = le = if_min = if_replace > min = nil partial status: pi(|sort|#) = [] pi(cons) = [] pi(replace) = [3] pi(min) = [1] pi(eq) = [] pi(|0|) = [] pi(true) = [] pi(s) = [] pi(false) = [] pi(le) = [] pi(if_min) = [] pi(if_replace) = [4] pi(nil) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: |sort|#_A(x1) = 16 cons_A(x1,x2) = 18 replace_A(x1,x2,x3) = x3 + 15 min_A(x1) = 17 eq_A(x1,x2) = 34 |0|_A = 19 true_A = 35 s_A(x1) = 10 false_A = 11 le_A(x1,x2) = 19 if_min_A(x1,x2) = 19 if_replace_A(x1,x2,x3,x4) = x4 + 15 nil_A = 15 precedence: true > false = le = nil > |sort|# = cons = replace = eq = s = if_min = if_replace > |0| > min partial status: pi(|sort|#) = [] pi(cons) = [] pi(replace) = [3] pi(min) = [] pi(eq) = [] pi(|0|) = [] pi(true) = [] pi(s) = [] pi(false) = [] pi(le) = [] pi(if_min) = [] pi(if_replace) = [] pi(nil) = [] 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: 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(|0|(),nil())) -> |0|() r9: min(cons(s(n),nil())) -> s(n) r10: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r11: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r12: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r13: replace(n,m,nil()) -> nil() r14: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r15: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r16: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r17: |sort|(nil()) -> nil() r18: |sort|(cons(n,x)) -> cons(min(cons(n,x)),|sort|(replace(min(cons(n,x)),n,x))) The set of usable rules consists of r1, r2, r3, r4 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: if_replace#_A(x1,x2,x3,x4) = max{x2 + 9, x3 + 11, x4} false_A = 7 cons_A(x1,x2) = max{12, x1 + 9, x2 + 7} replace#_A(x1,x2,x3) = max{x1 + 9, x2 + 11, x3} eq_A(x1,x2) = max{6, x1 + 1, x2 + 1} |0|_A = 8 true_A = 7 s_A(x1) = max{9, x1 + 8} precedence: if_replace# = replace# > |0| = true > cons = eq > false = s partial status: pi(if_replace#) = [2, 4] pi(false) = [] pi(cons) = [2] pi(replace#) = [1, 3] pi(eq) = [2] pi(|0|) = [] pi(true) = [] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: if_replace#_A(x1,x2,x3,x4) = max{x2 + 2, x4} false_A = 8 cons_A(x1,x2) = max{3, x2 + 2} replace#_A(x1,x2,x3) = max{x1 + 2, x3} eq_A(x1,x2) = 4 |0|_A = 9 true_A = 10 s_A(x1) = x1 + 9 precedence: cons = replace# = true = s > if_replace# = false = eq = |0| partial status: pi(if_replace#) = [4] pi(false) = [] pi(cons) = [2] pi(replace#) = [3] pi(eq) = [] 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(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(|0|(),nil())) -> |0|() r9: min(cons(s(n),nil())) -> s(n) r10: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r11: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r12: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r13: replace(n,m,nil()) -> nil() r14: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r15: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r16: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r17: |sort|(nil()) -> nil() r18: |sort|(cons(n,x)) -> cons(min(cons(n,x)),|sort|(replace(min(cons(n,x)),n,x))) The set of usable rules consists of (no rules) Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: eq#_A(x1,x2) = max{2, x1 - 1, x2 + 1} s_A(x1) = max{1, x1} precedence: eq# = s partial status: pi(eq#) = [2] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: eq#_A(x1,x2) = 0 s_A(x1) = max{2, x1} precedence: eq# = s partial status: pi(eq#) = [] 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: 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(|0|(),nil())) -> |0|() r9: min(cons(s(n),nil())) -> s(n) r10: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r11: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r12: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r13: replace(n,m,nil()) -> nil() r14: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r15: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r16: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r17: |sort|(nil()) -> nil() r18: |sort|(cons(n,x)) -> cons(min(cons(n,x)),|sort|(replace(min(cons(n,x)),n,x))) The set of usable rules consists of r5, r6, r7 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: if_min#_A(x1,x2) = max{10, x1 + 1, x2} false_A = 11 cons_A(x1,x2) = max{x1 + 6, x2 + 4} min#_A(x1) = max{7, x1} le_A(x1,x2) = x2 + 9 true_A = 8 |0|_A = 12 s_A(x1) = x1 + 12 precedence: cons = le > false > |0| > min# = true > if_min# = s partial status: pi(if_min#) = [1, 2] pi(false) = [] pi(cons) = [1, 2] pi(min#) = [1] pi(le) = [] pi(true) = [] pi(|0|) = [] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: if_min#_A(x1,x2) = max{x1 + 7, x2} false_A = 1 cons_A(x1,x2) = max{x1 + 10, x2 + 4} min#_A(x1) = max{6, x1} le_A(x1,x2) = 0 true_A = 1 |0|_A = 0 s_A(x1) = x1 + 2 precedence: true > false = cons = le = |0| > if_min# = min# = s partial status: pi(if_min#) = [1, 2] pi(false) = [] pi(cons) = [1, 2] pi(min#) = [1] pi(le) = [] pi(true) = [] pi(|0|) = [] pi(s) = [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(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(|0|(),nil())) -> |0|() r9: min(cons(s(n),nil())) -> s(n) r10: min(cons(n,cons(m,x))) -> if_min(le(n,m),cons(n,cons(m,x))) r11: if_min(true(),cons(n,cons(m,x))) -> min(cons(n,x)) r12: if_min(false(),cons(n,cons(m,x))) -> min(cons(m,x)) r13: replace(n,m,nil()) -> nil() r14: replace(n,m,cons(k,x)) -> if_replace(eq(n,k),n,m,cons(k,x)) r15: if_replace(true(),n,m,cons(k,x)) -> cons(m,x) r16: if_replace(false(),n,m,cons(k,x)) -> cons(k,replace(n,m,x)) r17: |sort|(nil()) -> nil() r18: |sort|(cons(n,x)) -> cons(min(cons(n,x)),|sort|(replace(min(cons(n,x)),n,x))) The set of usable rules consists of (no rules) Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: le#_A(x1,x2) = max{2, x1 - 1, x2 + 1} s_A(x1) = max{1, x1} precedence: le# = s partial status: pi(le#) = [2] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: le#_A(x1,x2) = 0 s_A(x1) = max{2, x1} precedence: le# = s partial status: pi(le#) = [] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.