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