YES We show the termination of the TRS R: cond1(true(),x,y,z) -> cond2(gr(y,z),x,y,z) cond2(true(),x,y,z) -> cond2(gr(y,z),x,p(y),z) cond2(false(),x,y,z) -> cond1(gr(x,z),p(x),y,z) 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,z) -> cond2#(gr(y,z),x,y,z) p2: cond1#(true(),x,y,z) -> gr#(y,z) p3: cond2#(true(),x,y,z) -> cond2#(gr(y,z),x,p(y),z) p4: cond2#(true(),x,y,z) -> gr#(y,z) p5: cond2#(true(),x,y,z) -> p#(y) p6: cond2#(false(),x,y,z) -> cond1#(gr(x,z),p(x),y,z) p7: cond2#(false(),x,y,z) -> gr#(x,z) p8: cond2#(false(),x,y,z) -> p#(x) p9: gr#(s(x),s(y)) -> gr#(x,y) and R consists of: r1: cond1(true(),x,y,z) -> cond2(gr(y,z),x,y,z) r2: cond2(true(),x,y,z) -> cond2(gr(y,z),x,p(y),z) r3: cond2(false(),x,y,z) -> cond1(gr(x,z),p(x),y,z) 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,z) -> cond2#(gr(y,z),x,y,z) p2: cond2#(false(),x,y,z) -> cond1#(gr(x,z),p(x),y,z) p3: cond2#(true(),x,y,z) -> cond2#(gr(y,z),x,p(y),z) and R consists of: r1: cond1(true(),x,y,z) -> cond2(gr(y,z),x,y,z) r2: cond2(true(),x,y,z) -> cond2(gr(y,z),x,p(y),z) r3: cond2(false(),x,y,z) -> cond1(gr(x,z),p(x),y,z) 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: 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: cond1#_A(x1,x2,x3,x4) = max{0, x1 - 26, x2 - 17, x3 - 17, x4 - 14} true_A = 25 cond2#_A(x1,x2,x3,x4) = max{0, x1 - 27, x2 - 17, x3 - 17, x4 - 14} gr_A(x1,x2) = max{14, x1 - 34} false_A = 14 p_A(x1) = max{16, x1 - 17} |0|_A = 16 s_A(x1) = max{59, x1 + 33} cond1#!_A(x1,x2,x3,x4) = max{x1 + 14, x2 + 12, x3 - 8, x4 + 9} true!_A = 52 cond2#!_A(x1,x2,x3,x4) = max{x1 + 25, x2 + 11, x3 - 8, x4 + 9} gr!_A(x1,x2) = max{51, x2 + 37} false!_A = 36 p!_A(x1) = max{38, x1 - 17} |0|!_A = 53 s!_A(x1) = max{53, x1 - 1} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: cond1#_A(x1,x2,x3,x4) = max{0, x1 - 33, x2 - 34, x3 - 34, x4 - 18} true_A = 15 cond2#_A(x1,x2,x3,x4) = max{0, x1 - 17, x2 - 34, x3 - 34, x4 - 18} gr_A(x1,x2) = max{0, x1 - 31} false_A = 2 p_A(x1) = max{33, x1 - 34} |0|_A = 33 s_A(x1) = max{46, x1 + 34} cond1#!_A(x1,x2,x3,x4) = max{x1 + 30, x2 + 8} true!_A = 0 cond2#!_A(x1,x2,x3,x4) = max{44, x2 + 7} gr!_A(x1,x2) = 44 false!_A = 42 p!_A(x1) = max{6, x1 - 34} |0|!_A = 43 s!_A(x1) = max{0, x1 - 1} partial status: pi(cond1#) = [4] pi(true) = [] pi(cond2#) = [4] pi(gr) = [] pi(false) = [] pi(p) = [1] pi(|0|) = [] pi(s) = [1] The following rules are removed: p1, p2 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: cond2#(true(),x,y,z) -> cond2#(gr(y,z),x,p(y),z) and R consists of: r1: cond1(true(),x,y,z) -> cond2(gr(y,z),x,y,z) r2: cond2(true(),x,y,z) -> cond2(gr(y,z),x,p(y),z) r3: cond2(false(),x,y,z) -> cond1(gr(x,z),p(x),y,z) 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} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: cond2#(true(),x,y,z) -> cond2#(gr(y,z),x,p(y),z) and R consists of: r1: cond1(true(),x,y,z) -> cond2(gr(y,z),x,y,z) r2: cond2(true(),x,y,z) -> cond2(gr(y,z),x,p(y),z) r3: cond2(false(),x,y,z) -> cond1(gr(x,z),p(x),y,z) 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: 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: cond2#_A(x1,x2,x3,x4) = max{0, x1 - 4, x2 - 3, x3 - 9, x4 - 3} true_A = 2 gr_A(x1,x2) = max{2, x1 - 9, x2 - 5} p_A(x1) = max{8, x1 - 1} |0|_A = 0 false_A = 0 s_A(x1) = max{8, x1 + 7} cond2#!_A(x1,x2,x3,x4) = max{x1 + 10, x2 + 11, x3 + 2, x4 + 11} true!_A = 14 gr!_A(x1,x2) = 13 p!_A(x1) = max{15, x1 - 12} |0|!_A = 16 false!_A = 14 s!_A(x1) = x1 + 14 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: cond2#_A(x1,x2,x3,x4) = max{0, x1 - 22, x2 - 11, x3 - 11, x4 - 11} true_A = 21 gr_A(x1,x2) = max{12, x1 - 17} p_A(x1) = max{5, x1 - 12} |0|_A = 0 false_A = 1 s_A(x1) = max{38, x1 + 16} cond2#!_A(x1,x2,x3,x4) = max{7, x1 - 13, x3 + 1} true!_A = 15 gr!_A(x1,x2) = max{13, x1 - 2} p!_A(x1) = max{9, x1 - 32} |0|!_A = 16 false!_A = 14 s!_A(x1) = max{16, x1 - 1} partial status: pi(cond2#) = [2] pi(true) = [] pi(gr) = [1, 2] pi(p) = [1] pi(|0|) = [] pi(false) = [] pi(s) = [1] The following rules are removed: p1 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,z) -> cond2(gr(y,z),x,y,z) r2: cond2(true(),x,y,z) -> cond2(gr(y,z),x,p(y),z) r3: cond2(false(),x,y,z) -> cond1(gr(x,z),p(x),y,z) 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: 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: gr#_A(x1,x2) = max{x1, x2} s_A(x1) = max{5, x1} gr#!_A(x1,x2) = max{3, x1 - 7, x2 - 6} s!_A(x1) = max{2, x1 - 7} 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{2, x1} gr#!_A(x1,x2) = max{3, x1 - 15, x2 - 15} s!_A(x1) = max{2, x1 - 14} partial status: pi(gr#) = [1] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.