YES We show the termination of the TRS R: check(|0|()) -> zero() check(s(|0|())) -> odd() check(s(s(|0|()))) -> even() check(s(s(s(x)))) -> check(s(x)) half(|0|()) -> |0|() half(s(|0|())) -> |0|() half(s(s(x))) -> s(half(x)) plus(|0|(),y) -> y plus(s(x),y) -> s(plus(x,y)) times(x,y) -> timesIter(x,y,|0|()) timesIter(x,y,z) -> if(check(x),x,y,z,plus(z,y)) p(s(x)) -> x p(|0|()) -> |0|() if(zero(),x,y,z,u) -> z if(odd(),x,y,z,u) -> timesIter(p(x),y,u) if(even(),x,y,z,u) -> plus(timesIter(half(x),y,half(z)),timesIter(half(x),y,half(s(z)))) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: check#(s(s(s(x)))) -> check#(s(x)) p2: half#(s(s(x))) -> half#(x) p3: plus#(s(x),y) -> plus#(x,y) p4: times#(x,y) -> timesIter#(x,y,|0|()) p5: timesIter#(x,y,z) -> if#(check(x),x,y,z,plus(z,y)) p6: timesIter#(x,y,z) -> check#(x) p7: timesIter#(x,y,z) -> plus#(z,y) p8: if#(odd(),x,y,z,u) -> timesIter#(p(x),y,u) p9: if#(odd(),x,y,z,u) -> p#(x) p10: if#(even(),x,y,z,u) -> plus#(timesIter(half(x),y,half(z)),timesIter(half(x),y,half(s(z)))) p11: if#(even(),x,y,z,u) -> timesIter#(half(x),y,half(z)) p12: if#(even(),x,y,z,u) -> half#(x) p13: if#(even(),x,y,z,u) -> half#(z) p14: if#(even(),x,y,z,u) -> timesIter#(half(x),y,half(s(z))) p15: if#(even(),x,y,z,u) -> half#(s(z)) and R consists of: r1: check(|0|()) -> zero() r2: check(s(|0|())) -> odd() r3: check(s(s(|0|()))) -> even() r4: check(s(s(s(x)))) -> check(s(x)) r5: half(|0|()) -> |0|() r6: half(s(|0|())) -> |0|() r7: half(s(s(x))) -> s(half(x)) r8: plus(|0|(),y) -> y r9: plus(s(x),y) -> s(plus(x,y)) r10: times(x,y) -> timesIter(x,y,|0|()) r11: timesIter(x,y,z) -> if(check(x),x,y,z,plus(z,y)) r12: p(s(x)) -> x r13: p(|0|()) -> |0|() r14: if(zero(),x,y,z,u) -> z r15: if(odd(),x,y,z,u) -> timesIter(p(x),y,u) r16: if(even(),x,y,z,u) -> plus(timesIter(half(x),y,half(z)),timesIter(half(x),y,half(s(z)))) The estimated dependency graph contains the following SCCs: {p5, p8, p11, p14} {p1} {p2} {p3} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: if#(even(),x,y,z,u) -> timesIter#(half(x),y,half(s(z))) p2: timesIter#(x,y,z) -> if#(check(x),x,y,z,plus(z,y)) p3: if#(even(),x,y,z,u) -> timesIter#(half(x),y,half(z)) p4: if#(odd(),x,y,z,u) -> timesIter#(p(x),y,u) and R consists of: r1: check(|0|()) -> zero() r2: check(s(|0|())) -> odd() r3: check(s(s(|0|()))) -> even() r4: check(s(s(s(x)))) -> check(s(x)) r5: half(|0|()) -> |0|() r6: half(s(|0|())) -> |0|() r7: half(s(s(x))) -> s(half(x)) r8: plus(|0|(),y) -> y r9: plus(s(x),y) -> s(plus(x,y)) r10: times(x,y) -> timesIter(x,y,|0|()) r11: timesIter(x,y,z) -> if(check(x),x,y,z,plus(z,y)) r12: p(s(x)) -> x r13: p(|0|()) -> |0|() r14: if(zero(),x,y,z,u) -> z r15: if(odd(),x,y,z,u) -> timesIter(p(x),y,u) r16: if(even(),x,y,z,u) -> plus(timesIter(half(x),y,half(z)),timesIter(half(x),y,half(s(z)))) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r12, r13 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: if#_A(x1,x2,x3,x4,x5) = max{7, x2 - 1, x3 - 1} even_A = 16 timesIter#_A(x1,x2,x3) = max{7, x1, x2 - 1} half_A(x1) = max{7, x1 - 7} s_A(x1) = x1 + 14 check_A(x1) = max{8, x1 - 5} plus_A(x1,x2) = max{5, x1 - 15} odd_A = 9 p_A(x1) = max{0, x1 - 6} |0|_A = 0 zero_A = 0 if#!_A(x1,x2,x3,x4,x5) = 0 even!_A = 45 timesIter#!_A(x1,x2,x3) = 0 half!_A(x1) = max{48, x1 - 48} s!_A(x1) = 46 check!_A(x1) = x1 + 3 plus!_A(x1,x2) = max{50, x1 - 15, x2 - 31} odd!_A = 0 p!_A(x1) = max{48, x1 - 1} |0|!_A = 47 zero!_A = 2 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: if#_A(x1,x2,x3,x4,x5) = max{1, x3 - 1} even_A = 105 timesIter#_A(x1,x2,x3) = max{1, x2 - 1} half_A(x1) = max{20, x1 - 22} s_A(x1) = x1 + 58 check_A(x1) = max{56, x1} plus_A(x1,x2) = max{1, x1 - 59} odd_A = 59 p_A(x1) = max{1, x1 - 57} |0|_A = 1 zero_A = 2 if#!_A(x1,x2,x3,x4,x5) = max{x1 - 1, x2 + 55} even!_A = 9 timesIter#!_A(x1,x2,x3) = x1 + 56 half!_A(x1) = max{13, x1 - 63} s!_A(x1) = 11 check!_A(x1) = max{53, x1 - 9} plus!_A(x1,x2) = max{10, x1 - 48, x2 + 2} odd!_A = 51 p!_A(x1) = max{59, x1 - 2} |0|!_A = 12 zero!_A = 0 partial status: pi(if#) = [] pi(even) = [] pi(timesIter#) = [] pi(half) = [] pi(s) = [1] pi(check) = [1] pi(plus) = [1, 2] pi(odd) = [] pi(p) = [1] pi(|0|) = [] pi(zero) = [] The following rules are removed: p1, p2, p3, p4 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: check#(s(s(s(x)))) -> check#(s(x)) and R consists of: r1: check(|0|()) -> zero() r2: check(s(|0|())) -> odd() r3: check(s(s(|0|()))) -> even() r4: check(s(s(s(x)))) -> check(s(x)) r5: half(|0|()) -> |0|() r6: half(s(|0|())) -> |0|() r7: half(s(s(x))) -> s(half(x)) r8: plus(|0|(),y) -> y r9: plus(s(x),y) -> s(plus(x,y)) r10: times(x,y) -> timesIter(x,y,|0|()) r11: timesIter(x,y,z) -> if(check(x),x,y,z,plus(z,y)) r12: p(s(x)) -> x r13: p(|0|()) -> |0|() r14: if(zero(),x,y,z,u) -> z r15: if(odd(),x,y,z,u) -> timesIter(p(x),y,u) r16: if(even(),x,y,z,u) -> plus(timesIter(half(x),y,half(z)),timesIter(half(x),y,half(s(z)))) The set of usable rules consists of r3 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: check#_A(x1) = 0 s_A(x1) = max{6, x1 - 37} check_A(x1) = max{9, x1 - 7} |0|_A = 6 even_A = 1 check#!_A(x1) = max{4, x1 - 45} s!_A(x1) = max{4, x1 - 45} check!_A(x1) = max{8, x1 - 7} |0|!_A = 3 even!_A = 2 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: check#_A(x1) = 0 s_A(x1) = max{10, x1 - 8} check_A(x1) = max{20, x1 - 17} |0|_A = 16 even_A = 1 check#!_A(x1) = max{3, x1 - 73} s!_A(x1) = max{3, x1 - 65} check!_A(x1) = max{7, x1 - 42} |0|!_A = 3 even!_A = 2 partial status: pi(check#) = [1] pi(s) = [1] pi(check) = [] pi(|0|) = [] pi(even) = [] 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: half#(s(s(x))) -> half#(x) and R consists of: r1: check(|0|()) -> zero() r2: check(s(|0|())) -> odd() r3: check(s(s(|0|()))) -> even() r4: check(s(s(s(x)))) -> check(s(x)) r5: half(|0|()) -> |0|() r6: half(s(|0|())) -> |0|() r7: half(s(s(x))) -> s(half(x)) r8: plus(|0|(),y) -> y r9: plus(s(x),y) -> s(plus(x,y)) r10: times(x,y) -> timesIter(x,y,|0|()) r11: timesIter(x,y,z) -> if(check(x),x,y,z,plus(z,y)) r12: p(s(x)) -> x r13: p(|0|()) -> |0|() r14: if(zero(),x,y,z,u) -> z r15: if(odd(),x,y,z,u) -> timesIter(p(x),y,u) r16: if(even(),x,y,z,u) -> plus(timesIter(half(x),y,half(z)),timesIter(half(x),y,half(s(z)))) The set of usable rules consists of r3 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: half#_A(x1) = 0 s_A(x1) = max{7, x1 - 7} check_A(x1) = max{7, x1 - 8} |0|_A = 7 even_A = 1 half#!_A(x1) = max{6, x1 - 34} s!_A(x1) = max{6, x1 - 28} check!_A(x1) = max{7, x1 - 8} |0|!_A = 3 even!_A = 2 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: half#_A(x1) = 0 s_A(x1) = max{31, x1 - 23} check_A(x1) = max{23, x1 - 32} |0|_A = 8 even_A = 1 half#!_A(x1) = max{4, x1 - 103} s!_A(x1) = max{4, x1 - 102} check!_A(x1) = max{5, x1 - 32} |0|!_A = 0 even!_A = 1 partial status: pi(half#) = [1] pi(s) = [1] pi(check) = [] pi(|0|) = [] pi(even) = [] 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: plus#(s(x),y) -> plus#(x,y) and R consists of: r1: check(|0|()) -> zero() r2: check(s(|0|())) -> odd() r3: check(s(s(|0|()))) -> even() r4: check(s(s(s(x)))) -> check(s(x)) r5: half(|0|()) -> |0|() r6: half(s(|0|())) -> |0|() r7: half(s(s(x))) -> s(half(x)) r8: plus(|0|(),y) -> y r9: plus(s(x),y) -> s(plus(x,y)) r10: times(x,y) -> timesIter(x,y,|0|()) r11: timesIter(x,y,z) -> if(check(x),x,y,z,plus(z,y)) r12: p(s(x)) -> x r13: p(|0|()) -> |0|() r14: if(zero(),x,y,z,u) -> z r15: if(odd(),x,y,z,u) -> timesIter(p(x),y,u) r16: if(even(),x,y,z,u) -> plus(timesIter(half(x),y,half(z)),timesIter(half(x),y,half(s(z)))) 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: plus#_A(x1,x2) = 0 s_A(x1) = max{17, x1 - 8} plus#!_A(x1,x2) = max{8, x2 - 1} s!_A(x1) = max{7, x1 - 84} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = 0 s_A(x1) = max{22, x1 - 69} plus#!_A(x1,x2) = max{8, x2 + 1} s!_A(x1) = max{7, x1 - 93} partial status: pi(plus#) = [1] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.