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. max/plus interpretations on natural numbers: if#_A(x1,x2,x3) = max{x1 + 1, x2 + 4} false_A = 5 minus#_A(x1,x2) = x1 + 4 p_A(x1) = max{1, x1 - 1} le_A(x1,x2) = x1 + 2 |0|_A = 0 s_A(x1) = max{5, x1 + 4} true_A = 1 2. max/plus interpretations on natural numbers: if#_A(x1,x2,x3) = 0 false_A = 0 minus#_A(x1,x2) = 1 p_A(x1) = 0 le_A(x1,x2) = 1 |0|_A = 0 s_A(x1) = 0 true_A = 0 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. max/plus interpretations on natural numbers: le#_A(x1,x2) = max{x1, x2} s_A(x1) = max{2, x1 + 1} 2. max/plus interpretations on natural numbers: le#_A(x1,x2) = 0 s_A(x1) = 0 The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.