YES We show the termination of the TRS R: p(|0|()) -> |0|() p(s(x)) -> x le(|0|(),y) -> true() le(s(x),|0|()) -> false() le(s(x),s(y)) -> le(x,y) minus(x,y) -> if(le(x,y),x,y) if(true(),x,y) -> |0|() if(false(),x,y) -> s(minus(p(x),y)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: le#(s(x),s(y)) -> le#(x,y) p2: minus#(x,y) -> if#(le(x,y),x,y) p3: minus#(x,y) -> le#(x,y) p4: if#(false(),x,y) -> minus#(p(x),y) p5: if#(false(),x,y) -> p#(x) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: le(|0|(),y) -> true() r4: le(s(x),|0|()) -> false() r5: le(s(x),s(y)) -> le(x,y) r6: minus(x,y) -> if(le(x,y),x,y) r7: if(true(),x,y) -> |0|() r8: if(false(),x,y) -> s(minus(p(x),y)) The estimated dependency graph contains the following SCCs: {p2, p4} {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: if#(false(),x,y) -> minus#(p(x),y) p2: minus#(x,y) -> if#(le(x,y),x,y) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: le(|0|(),y) -> true() r4: le(s(x),|0|()) -> false() r5: le(s(x),s(y)) -> le(x,y) r6: minus(x,y) -> if(le(x,y),x,y) r7: if(true(),x,y) -> |0|() r8: if(false(),x,y) -> s(minus(p(x),y)) The set of usable rules consists of r1, r2, r3, r4, r5 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: if#_A(x1,x2,x3) = max{x1 + 14, x2 + 9} false_A = 6 minus#_A(x1,x2) = max{20, x1 + 10} p_A(x1) = max{8, x1 - 2} le_A(x1,x2) = max{0, x1 - 5} |0|_A = 7 s_A(x1) = max{13, x1 + 12} true_A = 1 precedence: p > le > if# = false = |0| = true > minus# = s partial status: pi(if#) = [1] pi(false) = [] pi(minus#) = [1] pi(p) = [] pi(le) = [] pi(|0|) = [] pi(s) = [1] pi(true) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: if#_A(x1,x2,x3) = max{3, x1 - 1} false_A = 5 minus#_A(x1,x2) = max{3, x1 + 1} p_A(x1) = 1 le_A(x1,x2) = 0 |0|_A = 0 s_A(x1) = x1 + 6 true_A = 1 precedence: if# = false = minus# = p = s = true > le = |0| partial status: pi(if#) = [] pi(false) = [] pi(minus#) = [1] pi(p) = [] pi(le) = [] pi(|0|) = [] pi(s) = [1] pi(true) = [] 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: le#(s(x),s(y)) -> le#(x,y) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: le(|0|(),y) -> true() r4: le(s(x),|0|()) -> false() r5: le(s(x),s(y)) -> le(x,y) r6: minus(x,y) -> if(le(x,y),x,y) r7: if(true(),x,y) -> |0|() r8: if(false(),x,y) -> s(minus(p(x),y)) 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.