YES We show the termination of the TRS R: nonZero(|0|()) -> false() nonZero(s(x)) -> true() p(|0|()) -> |0|() p(s(x)) -> x id_inc(x) -> x id_inc(x) -> s(x) random(x) -> rand(x,|0|()) rand(x,y) -> if(nonZero(x),x,y) if(false(),x,y) -> y if(true(),x,y) -> rand(p(x),id_inc(y)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: random#(x) -> rand#(x,|0|()) p2: rand#(x,y) -> if#(nonZero(x),x,y) p3: rand#(x,y) -> nonZero#(x) p4: if#(true(),x,y) -> rand#(p(x),id_inc(y)) p5: if#(true(),x,y) -> p#(x) p6: if#(true(),x,y) -> id_inc#(y) and R consists of: r1: nonZero(|0|()) -> false() r2: nonZero(s(x)) -> true() r3: p(|0|()) -> |0|() r4: p(s(x)) -> x r5: id_inc(x) -> x r6: id_inc(x) -> s(x) r7: random(x) -> rand(x,|0|()) r8: rand(x,y) -> if(nonZero(x),x,y) r9: if(false(),x,y) -> y r10: if(true(),x,y) -> rand(p(x),id_inc(y)) The estimated dependency graph contains the following SCCs: {p2, p4} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: rand#(x,y) -> if#(nonZero(x),x,y) p2: if#(true(),x,y) -> rand#(p(x),id_inc(y)) and R consists of: r1: nonZero(|0|()) -> false() r2: nonZero(s(x)) -> true() r3: p(|0|()) -> |0|() r4: p(s(x)) -> x r5: id_inc(x) -> x r6: id_inc(x) -> s(x) r7: random(x) -> rand(x,|0|()) r8: rand(x,y) -> if(nonZero(x),x,y) r9: if(false(),x,y) -> y r10: if(true(),x,y) -> rand(p(x),id_inc(y)) The set of usable rules consists of r1, r2, r3, r4, r5, r6 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: rand#_A(x1,x2) = max{5, x1 + 3} if#_A(x1,x2,x3) = max{x1 + 2, x2 - 1} nonZero_A(x1) = max{2, x1} true_A = 6 p_A(x1) = max{5, x1 - 4} id_inc_A(x1) = x1 + 11 |0|_A = 4 false_A = 3 s_A(x1) = max{10, x1 + 7} precedence: if# > id_inc = |0| > rand# = nonZero = true = p = false = s partial status: pi(rand#) = [] pi(if#) = [1] pi(nonZero) = [1] pi(true) = [] pi(p) = [] pi(id_inc) = [1] pi(|0|) = [] pi(false) = [] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: rand#_A(x1,x2) = 5 if#_A(x1,x2,x3) = x1 nonZero_A(x1) = 4 true_A = 8 p_A(x1) = 2 id_inc_A(x1) = 5 |0|_A = 2 false_A = 4 s_A(x1) = max{6, x1 - 6} precedence: true > rand# = if# = nonZero = p = id_inc > |0| = false = s partial status: pi(rand#) = [] pi(if#) = [1] pi(nonZero) = [] pi(true) = [] pi(p) = [] pi(id_inc) = [] pi(|0|) = [] pi(false) = [] pi(s) = [] The next rules are strictly ordered: p1, p2 We remove them from the problem. Then no dependency pair remains.