YES We show the termination of the TRS R: nonZero(|0|()) -> false() nonZero(s(x)) -> true() p(s(|0|())) -> |0|() p(s(s(x))) -> s(p(s(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: p#(s(s(x))) -> p#(s(x)) p2: random#(x) -> rand#(x,|0|()) p3: rand#(x,y) -> if#(nonZero(x),x,y) p4: rand#(x,y) -> nonZero#(x) p5: if#(true(),x,y) -> rand#(p(x),id_inc(y)) p6: if#(true(),x,y) -> p#(x) p7: if#(true(),x,y) -> id_inc#(y) and R consists of: r1: nonZero(|0|()) -> false() r2: nonZero(s(x)) -> true() r3: p(s(|0|())) -> |0|() r4: p(s(s(x))) -> s(p(s(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: {p3, p5} {p1} -- 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(s(|0|())) -> |0|() r4: p(s(s(x))) -> s(p(s(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 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: rand#_A(x1,x2) = max{1, x1 - 3} if#_A(x1,x2,x3) = max{1, x1 - 14, x2 - 3} nonZero_A(x1) = max{0, x1 - 2} true_A = 13 p_A(x1) = max{4, x1 - 6} id_inc_A(x1) = max{29, x1 + 17} |0|_A = 1 false_A = 0 s_A(x1) = x1 + 15 rand#!_A(x1,x2) = max{11, x1 + 5} if#!_A(x1,x2,x3) = max{10, x1 - 1, x2 + 4} nonZero!_A(x1) = max{4, x1 - 16} true!_A = 3 p!_A(x1) = max{14, x1 - 50} id_inc!_A(x1) = x1 + 15 |0|!_A = 13 false!_A = 5 s!_A(x1) = max{14, x1 - 16} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: rand#_A(x1,x2) = max{4, x1 - 12} if#_A(x1,x2,x3) = max{4, x1 - 2, x2 - 12} nonZero_A(x1) = 3 true_A = 1 p_A(x1) = max{16, x1 - 12} id_inc_A(x1) = x1 + 3 |0|_A = 2 false_A = 1 s_A(x1) = max{10, x1 - 17} rand#!_A(x1,x2) = 2 if#!_A(x1,x2,x3) = max{0, x1 - 4} nonZero!_A(x1) = max{3, x1 - 14} true!_A = 1 p!_A(x1) = max{6, x1 - 12} id_inc!_A(x1) = 2 |0|!_A = 5 false!_A = 4 s!_A(x1) = max{14, x1 - 3} partial status: pi(rand#) = [] pi(if#) = [] pi(nonZero) = [1] pi(true) = [] pi(p) = [1] pi(id_inc) = [1] pi(|0|) = [] pi(false) = [] pi(s) = [] The following rules are removed: p1, p2 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: p#(s(s(x))) -> p#(s(x)) and R consists of: r1: nonZero(|0|()) -> false() r2: nonZero(s(x)) -> true() r3: p(s(|0|())) -> |0|() r4: p(s(s(x))) -> s(p(s(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 (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: p#_A(x1) = 0 s_A(x1) = max{1, x1 - 8} p#!_A(x1) = max{1, x1 - 10} s!_A(x1) = max{5, x1 - 8} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: p#_A(x1) = 0 s_A(x1) = max{4, x1 - 9} p#!_A(x1) = max{1, x1 - 5} s!_A(x1) = 0 partial status: pi(p#) = [1] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.