YES We show the termination of the TRS R: half(|0|()) -> |0|() half(s(|0|())) -> |0|() half(s(s(x))) -> s(half(x)) inc(|0|()) -> |0|() inc(s(x)) -> s(inc(x)) zero(|0|()) -> true() zero(s(x)) -> false() p(|0|()) -> |0|() p(s(x)) -> x bits(x) -> bitIter(x,|0|()) bitIter(x,y) -> if(zero(x),x,inc(y)) if(true(),x,y) -> p(y) if(false(),x,y) -> bitIter(half(x),y) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: half#(s(s(x))) -> half#(x) p2: inc#(s(x)) -> inc#(x) p3: bits#(x) -> bitIter#(x,|0|()) p4: bitIter#(x,y) -> if#(zero(x),x,inc(y)) p5: bitIter#(x,y) -> zero#(x) p6: bitIter#(x,y) -> inc#(y) p7: if#(true(),x,y) -> p#(y) p8: if#(false(),x,y) -> bitIter#(half(x),y) p9: if#(false(),x,y) -> half#(x) and R consists of: r1: half(|0|()) -> |0|() r2: half(s(|0|())) -> |0|() r3: half(s(s(x))) -> s(half(x)) r4: inc(|0|()) -> |0|() r5: inc(s(x)) -> s(inc(x)) r6: zero(|0|()) -> true() r7: zero(s(x)) -> false() r8: p(|0|()) -> |0|() r9: p(s(x)) -> x r10: bits(x) -> bitIter(x,|0|()) r11: bitIter(x,y) -> if(zero(x),x,inc(y)) r12: if(true(),x,y) -> p(y) r13: if(false(),x,y) -> bitIter(half(x),y) The estimated dependency graph contains the following SCCs: {p4, p8} {p1} {p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: bitIter#(x,y) -> if#(zero(x),x,inc(y)) p2: if#(false(),x,y) -> bitIter#(half(x),y) and R consists of: r1: half(|0|()) -> |0|() r2: half(s(|0|())) -> |0|() r3: half(s(s(x))) -> s(half(x)) r4: inc(|0|()) -> |0|() r5: inc(s(x)) -> s(inc(x)) r6: zero(|0|()) -> true() r7: zero(s(x)) -> false() r8: p(|0|()) -> |0|() r9: p(s(x)) -> x r10: bits(x) -> bitIter(x,|0|()) r11: bitIter(x,y) -> if(zero(x),x,inc(y)) r12: if(true(),x,y) -> p(y) r13: if(false(),x,y) -> bitIter(half(x),y) The set of usable rules consists of r1, r2, r3, r6, r7, r8, r9, r12 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: bitIter#_A(x1,x2) = x1 + 15 if#_A(x1,x2,x3) = max{14, x1 - 13, x2 + 11} zero_A(x1) = max{12, x1 - 16} inc_A(x1) = 14 false_A = 38 half_A(x1) = max{10, x1 - 7} |0|_A = 9 s_A(x1) = x1 + 55 true_A = 11 p_A(x1) = max{10, x1 - 16} if_A(x1,x2,x3) = max{40, x1 - 39, x2 + 9, x3 - 15} base order 2: precedence: bitIter# = if# = s = if > half > zero = false > inc = p > |0| > true partial status: pi(bitIter#) = [] pi(if#) = [] pi(zero) = [] pi(inc) = [] pi(false) = [] pi(half) = [] pi(|0|) = [] pi(s) = [] pi(true) = [] pi(p) = [] pi(if) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: if#(false(),x,y) -> bitIter#(half(x),y) and R consists of: r1: half(|0|()) -> |0|() r2: half(s(|0|())) -> |0|() r3: half(s(s(x))) -> s(half(x)) r4: inc(|0|()) -> |0|() r5: inc(s(x)) -> s(inc(x)) r6: zero(|0|()) -> true() r7: zero(s(x)) -> false() r8: p(|0|()) -> |0|() r9: p(s(x)) -> x r10: bits(x) -> bitIter(x,|0|()) r11: bitIter(x,y) -> if(zero(x),x,inc(y)) r12: if(true(),x,y) -> p(y) r13: if(false(),x,y) -> bitIter(half(x),y) The estimated dependency graph contains the following SCCs: (no SCCs) -- 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: half(|0|()) -> |0|() r2: half(s(|0|())) -> |0|() r3: half(s(s(x))) -> s(half(x)) r4: inc(|0|()) -> |0|() r5: inc(s(x)) -> s(inc(x)) r6: zero(|0|()) -> true() r7: zero(s(x)) -> false() r8: p(|0|()) -> |0|() r9: p(s(x)) -> x r10: bits(x) -> bitIter(x,|0|()) r11: bitIter(x,y) -> if(zero(x),x,inc(y)) r12: if(true(),x,y) -> p(y) r13: if(false(),x,y) -> bitIter(half(x),y) The set of usable rules consists of r1, r2, r6, r7, r8, r9, r12 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: half#_A(x1) = max{6, x1 - 1} s_A(x1) = x1 + 11 half_A(x1) = max{10, x1 - 23} |0|_A = 6 zero_A(x1) = max{10, x1 - 18} true_A = 1 false_A = 9 p_A(x1) = max{12, x1 - 8} if_A(x1,x2,x3) = max{12, x2 - 16, x3 - 8} base order 2: precedence: s = if > half = p > |0| > half# > zero > true = false partial status: pi(half#) = [] pi(s) = [1] pi(half) = [] pi(|0|) = [] pi(zero) = [] pi(true) = [] pi(false) = [] pi(p) = [] pi(if) = [] 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: inc#(s(x)) -> inc#(x) and R consists of: r1: half(|0|()) -> |0|() r2: half(s(|0|())) -> |0|() r3: half(s(s(x))) -> s(half(x)) r4: inc(|0|()) -> |0|() r5: inc(s(x)) -> s(inc(x)) r6: zero(|0|()) -> true() r7: zero(s(x)) -> false() r8: p(|0|()) -> |0|() r9: p(s(x)) -> x r10: bits(x) -> bitIter(x,|0|()) r11: bitIter(x,y) -> if(zero(x),x,inc(y)) r12: if(true(),x,y) -> p(y) r13: if(false(),x,y) -> bitIter(half(x),y) The set of usable rules consists of r1, r2, r7, r8, r9, r12 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: inc#_A(x1) = max{4, x1 - 1} s_A(x1) = max{10, x1 + 6} half_A(x1) = max{5, x1 - 17} |0|_A = 2 zero_A(x1) = max{2, x1 - 11} false_A = 1 p_A(x1) = max{6, x1 - 4} if_A(x1,x2,x3) = max{6, x1 - 3, x2 - 2, x3 - 4} true_A = 1 base order 2: precedence: if > half > inc# = s > zero = p > |0| = false > true partial status: pi(inc#) = [] pi(s) = [1] pi(half) = [] pi(|0|) = [] pi(zero) = [] pi(false) = [] pi(p) = [] pi(if) = [] pi(true) = [] The following rules are removed: p1 Then no dependency pair remains.