YES We show the termination of the TRS R: cond1(true(),x) -> cond2(even(x),x) cond2(true(),x) -> cond1(neq(x,|0|()),div2(x)) cond2(false(),x) -> cond1(neq(x,|0|()),p(x)) neq(|0|(),|0|()) -> false() neq(|0|(),s(x)) -> true() neq(s(x),|0|()) -> true() neq(s(x),s(y())) -> neq(x,y()) even(|0|()) -> true() even(s(|0|())) -> false() even(s(s(x))) -> even(x) div2(|0|()) -> |0|() div2(s(|0|())) -> |0|() div2(s(s(x))) -> s(div2(x)) p(|0|()) -> |0|() p(s(x)) -> x -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: cond1#(true(),x) -> cond2#(even(x),x) p2: cond1#(true(),x) -> even#(x) p3: cond2#(true(),x) -> cond1#(neq(x,|0|()),div2(x)) p4: cond2#(true(),x) -> neq#(x,|0|()) p5: cond2#(true(),x) -> div2#(x) p6: cond2#(false(),x) -> cond1#(neq(x,|0|()),p(x)) p7: cond2#(false(),x) -> neq#(x,|0|()) p8: cond2#(false(),x) -> p#(x) p9: neq#(s(x),s(y())) -> neq#(x,y()) p10: even#(s(s(x))) -> even#(x) p11: div2#(s(s(x))) -> div2#(x) and R consists of: r1: cond1(true(),x) -> cond2(even(x),x) r2: cond2(true(),x) -> cond1(neq(x,|0|()),div2(x)) r3: cond2(false(),x) -> cond1(neq(x,|0|()),p(x)) r4: neq(|0|(),|0|()) -> false() r5: neq(|0|(),s(x)) -> true() r6: neq(s(x),|0|()) -> true() r7: neq(s(x),s(y())) -> neq(x,y()) r8: even(|0|()) -> true() r9: even(s(|0|())) -> false() r10: even(s(s(x))) -> even(x) r11: div2(|0|()) -> |0|() r12: div2(s(|0|())) -> |0|() r13: div2(s(s(x))) -> s(div2(x)) r14: p(|0|()) -> |0|() r15: p(s(x)) -> x The estimated dependency graph contains the following SCCs: {p1, p3, p6} {p10} {p11} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: cond1#(true(),x) -> cond2#(even(x),x) p2: cond2#(false(),x) -> cond1#(neq(x,|0|()),p(x)) p3: cond2#(true(),x) -> cond1#(neq(x,|0|()),div2(x)) and R consists of: r1: cond1(true(),x) -> cond2(even(x),x) r2: cond2(true(),x) -> cond1(neq(x,|0|()),div2(x)) r3: cond2(false(),x) -> cond1(neq(x,|0|()),p(x)) r4: neq(|0|(),|0|()) -> false() r5: neq(|0|(),s(x)) -> true() r6: neq(s(x),|0|()) -> true() r7: neq(s(x),s(y())) -> neq(x,y()) r8: even(|0|()) -> true() r9: even(s(|0|())) -> false() r10: even(s(s(x))) -> even(x) r11: div2(|0|()) -> |0|() r12: div2(s(|0|())) -> |0|() r13: div2(s(s(x))) -> s(div2(x)) r14: p(|0|()) -> |0|() r15: p(s(x)) -> x The set of usable rules consists of r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15 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) = max{1, x2 - 15} true_A = 1 cond2#_A(x1,x2) = max{1, x1 - 15, x2 - 16} even_A(x1) = max{1, x1 - 2} false_A = 14 neq_A(x1,x2) = 13 |0|_A = 0 p_A(x1) = max{12, x1 - 7} div2_A(x1) = max{0, x1 - 15} s_A(x1) = max{25, x1 + 15} y_A = 67 cond1#!_A(x1,x2) = x2 + 14 true!_A = 5 cond2#!_A(x1,x2) = max{x1 + 13, x2 + 8} even!_A(x1) = max{6, x1 - 24} false!_A = 2 neq!_A(x1,x2) = max{9, x1 - 26, x2 - 125} |0|!_A = 28 p!_A(x1) = max{3, x1 - 1} div2!_A(x1) = max{13, x1 - 41} s!_A(x1) = max{13, x1 - 57} y!_A = 11 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: cond1#_A(x1,x2) = max{25, x2 + 10} true_A = 2 cond2#_A(x1,x2) = max{25, x1, x2 + 10} even_A(x1) = x1 + 3 false_A = 24 neq_A(x1,x2) = max{2, x2 - 10} |0|_A = 12 p_A(x1) = max{15, x1 - 5} div2_A(x1) = x1 s_A(x1) = x1 + 9 y_A = 3 cond1#!_A(x1,x2) = x2 + 6 true!_A = 3 cond2#!_A(x1,x2) = max{x1 + 3, x2 + 6} even!_A(x1) = max{19, x1 - 13} false!_A = 18 neq!_A(x1,x2) = max{19, x1 + 6, x2 - 13} |0|!_A = 28 p!_A(x1) = max{1, x1 - 13} div2!_A(x1) = 28 s!_A(x1) = 18 y!_A = 20 partial status: pi(cond1#) = [] pi(true) = [] pi(cond2#) = [] pi(even) = [] pi(false) = [] pi(neq) = [] pi(|0|) = [] pi(p) = [1] pi(div2) = [1] pi(s) = [1] pi(y) = [] The following rules are removed: p2 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: cond1#(true(),x) -> cond2#(even(x),x) p2: cond2#(true(),x) -> cond1#(neq(x,|0|()),div2(x)) and R consists of: r1: cond1(true(),x) -> cond2(even(x),x) r2: cond2(true(),x) -> cond1(neq(x,|0|()),div2(x)) r3: cond2(false(),x) -> cond1(neq(x,|0|()),p(x)) r4: neq(|0|(),|0|()) -> false() r5: neq(|0|(),s(x)) -> true() r6: neq(s(x),|0|()) -> true() r7: neq(s(x),s(y())) -> neq(x,y()) r8: even(|0|()) -> true() r9: even(s(|0|())) -> false() r10: even(s(s(x))) -> even(x) r11: div2(|0|()) -> |0|() r12: div2(s(|0|())) -> |0|() r13: div2(s(s(x))) -> s(div2(x)) r14: p(|0|()) -> |0|() r15: 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) -> cond2#(even(x),x) p2: cond2#(true(),x) -> cond1#(neq(x,|0|()),div2(x)) and R consists of: r1: cond1(true(),x) -> cond2(even(x),x) r2: cond2(true(),x) -> cond1(neq(x,|0|()),div2(x)) r3: cond2(false(),x) -> cond1(neq(x,|0|()),p(x)) r4: neq(|0|(),|0|()) -> false() r5: neq(|0|(),s(x)) -> true() r6: neq(s(x),|0|()) -> true() r7: neq(s(x),s(y())) -> neq(x,y()) r8: even(|0|()) -> true() r9: even(s(|0|())) -> false() r10: even(s(s(x))) -> even(x) r11: div2(|0|()) -> |0|() r12: div2(s(|0|())) -> |0|() r13: div2(s(s(x))) -> s(div2(x)) r14: p(|0|()) -> |0|() r15: p(s(x)) -> x The set of usable rules consists of r4, r6, r8, r9, r10, r11, r12, r13, r14, r15 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) = 1 true_A = 44 cond2#_A(x1,x2) = 1 even_A(x1) = max{50, x1 + 33} neq_A(x1,x2) = max{3, x1, x2 - 9} |0|_A = 10 div2_A(x1) = max{13, x1 - 24} false_A = 2 s_A(x1) = x1 + 44 p_A(x1) = max{10, x1 - 25} cond1#!_A(x1,x2) = max{x1 - 4, x2 + 25} true!_A = 40 cond2#!_A(x1,x2) = max{39, x2 + 24} even!_A(x1) = 0 neq!_A(x1,x2) = max{23, x2 - 45} |0|!_A = 41 div2!_A(x1) = max{43, x1 + 36} false!_A = 1 s!_A(x1) = 42 p!_A(x1) = max{42, x1 - 11} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: cond1#_A(x1,x2) = max{14, x1 + 4, x2 + 1} true_A = 9 cond2#_A(x1,x2) = max{14, x2 + 1} even_A(x1) = x1 + 7 neq_A(x1,x2) = max{1, x1 - 3} |0|_A = 2 div2_A(x1) = max{4, x1 - 12} false_A = 1 s_A(x1) = x1 + 16 p_A(x1) = max{2, x1 - 16} cond1#!_A(x1,x2) = max{x1 + 7, x2 + 10} true!_A = 18 cond2#!_A(x1,x2) = max{15, x1 - 7, x2 + 9} even!_A(x1) = 17 neq!_A(x1,x2) = max{x1 + 8, x2 + 19} |0|!_A = 19 div2!_A(x1) = max{45, x1 - 17} false!_A = 30 s!_A(x1) = x1 + 28 p!_A(x1) = max{46, x1 - 3} partial status: pi(cond1#) = [] pi(true) = [] pi(cond2#) = [] pi(even) = [1] pi(neq) = [1, 2] pi(|0|) = [] pi(div2) = [1] pi(false) = [] pi(s) = [1] pi(p) = [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: even#(s(s(x))) -> even#(x) and R consists of: r1: cond1(true(),x) -> cond2(even(x),x) r2: cond2(true(),x) -> cond1(neq(x,|0|()),div2(x)) r3: cond2(false(),x) -> cond1(neq(x,|0|()),p(x)) r4: neq(|0|(),|0|()) -> false() r5: neq(|0|(),s(x)) -> true() r6: neq(s(x),|0|()) -> true() r7: neq(s(x),s(y())) -> neq(x,y()) r8: even(|0|()) -> true() r9: even(s(|0|())) -> false() r10: even(s(s(x))) -> even(x) r11: div2(|0|()) -> |0|() r12: div2(s(|0|())) -> |0|() r13: div2(s(s(x))) -> s(div2(x)) r14: p(|0|()) -> |0|() r15: 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: even#_A(x1) = 0 s_A(x1) = max{8, x1 - 8} even#!_A(x1) = max{29, x1 - 30} s!_A(x1) = max{29, x1 - 22} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: even#_A(x1) = 0 s_A(x1) = max{4, x1 - 4} even#!_A(x1) = 6 s!_A(x1) = max{6, x1 - 17} partial status: pi(even#) = [1] 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: div2#(s(s(x))) -> div2#(x) and R consists of: r1: cond1(true(),x) -> cond2(even(x),x) r2: cond2(true(),x) -> cond1(neq(x,|0|()),div2(x)) r3: cond2(false(),x) -> cond1(neq(x,|0|()),p(x)) r4: neq(|0|(),|0|()) -> false() r5: neq(|0|(),s(x)) -> true() r6: neq(s(x),|0|()) -> true() r7: neq(s(x),s(y())) -> neq(x,y()) r8: even(|0|()) -> true() r9: even(s(|0|())) -> false() r10: even(s(s(x))) -> even(x) r11: div2(|0|()) -> |0|() r12: div2(s(|0|())) -> |0|() r13: div2(s(s(x))) -> s(div2(x)) r14: p(|0|()) -> |0|() r15: 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: div2#_A(x1) = 0 s_A(x1) = max{4, x1 - 4} div2#!_A(x1) = max{14, x1 - 12} s!_A(x1) = max{14, x1 - 7} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: div2#_A(x1) = 0 s_A(x1) = max{4, x1 - 6} div2#!_A(x1) = 5 s!_A(x1) = max{5, x1 - 9} partial status: pi(div2#) = [1] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.