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, r6, r7, r8 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: cond1#_A(x1,x2,x3) = max{8, x3 + 1} true_A = 20 cond2#_A(x1,x2,x3) = max{8, x1 - 10, x3 + 1} gr_A(x1,x2) = max{9, x1 - 14, x2 - 35} |0|_A = 2 false_A = 3 p_A(x1) = max{6, x1 - 3} s_A(x1) = x1 + 34 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: cond1#_A(x1,x2,x3) = max{1, x1 - 10, x2 - 13, x3 - 11} true_A = 0 cond2#_A(x1,x2,x3) = max{1, x1 - 8, x2 - 13, x3 - 11} gr_A(x1,x2) = max{7, x1 - 12, x2 - 1} |0|_A = 10 false_A = 4 p_A(x1) = max{10, x1 - 11} s_A(x1) = x1 + 11 cond1#!_A(x1,x2,x3) = max{18, x2 + 5, x3 - 12} true!_A = 1 cond2#!_A(x1,x2,x3) = max{18, x1 - 1, x2 + 5, x3 - 12} gr!_A(x1,x2) = max{17, x1 - 12, x2 - 33} |0|!_A = 2 false!_A = 16 p!_A(x1) = max{19, x1 - 23} s!_A(x1) = max{2, x1 - 34} partial status: pi(cond1#) = [] pi(true) = [] pi(cond2#) = [] pi(gr) = [] pi(|0|) = [] pi(false) = [] pi(p) = [] pi(s) = [1] The following rules are removed: p3 -- 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, r6, r7, r8 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: cond1#_A(x1,x2,x3) = max{x1 - 25, x2 + 4} true_A = 38 cond2#_A(x1,x2,x3) = max{12, x2 + 3} gr_A(x1,x2) = max{x1 + 4, x2 + 22} |0|_A = 2 false_A = 21 p_A(x1) = max{7, x1 - 21} s_A(x1) = x1 + 39 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: cond1#_A(x1,x2,x3) = max{34, x1 + 14, x2 - 1, x3 - 20} true_A = 0 cond2#_A(x1,x2,x3) = max{34, x1 - 6, x2 - 1, x3 - 20} gr_A(x1,x2) = max{20, x1 - 25, x2 - 17} |0|_A = 4 false_A = 5 p_A(x1) = max{4, x1 - 7} s_A(x1) = max{24, x1 + 17} cond1#!_A(x1,x2,x3) = max{x1 + 12, x2 + 6, x3 - 1} true!_A = 7 cond2#!_A(x1,x2,x3) = 11 gr!_A(x1,x2) = max{23, x1 - 16, x2 - 1} |0|!_A = 7 false!_A = 9 p!_A(x1) = 8 s!_A(x1) = 7 partial status: pi(cond1#) = [2] pi(true) = [] pi(cond2#) = [] pi(gr) = [1, 2] pi(|0|) = [] pi(false) = [] pi(p) = [] pi(s) = [1] 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: 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: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: gr#_A(x1,x2) = 1 s_A(x1) = max{2, x1 - 14} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gr#_A(x1,x2) = max{x1, x2} s_A(x1) = max{11, x1 + 6} gr#!_A(x1,x2) = max{3, x1 - 7, x2 - 12} s!_A(x1) = max{2, x1 - 30} partial status: pi(gr#) = [] pi(s) = [] The following rules are removed: p1 Then no dependency pair remains.