YES We show the termination of the TRS R: half(|0|()) -> |0|() half(s(|0|())) -> |0|() half(s(s(x))) -> s(half(x)) lastbit(|0|()) -> |0|() lastbit(s(|0|())) -> s(|0|()) lastbit(s(s(x))) -> lastbit(x) zero(|0|()) -> true() zero(s(x)) -> false() conv(x) -> conviter(x,cons(|0|(),nil())) conviter(x,l) -> if(zero(x),x,l) if(true(),x,l) -> l if(false(),x,l) -> conviter(half(x),cons(lastbit(x),l)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: half#(s(s(x))) -> half#(x) p2: lastbit#(s(s(x))) -> lastbit#(x) p3: conv#(x) -> conviter#(x,cons(|0|(),nil())) p4: conviter#(x,l) -> if#(zero(x),x,l) p5: conviter#(x,l) -> zero#(x) p6: if#(false(),x,l) -> conviter#(half(x),cons(lastbit(x),l)) p7: if#(false(),x,l) -> half#(x) p8: if#(false(),x,l) -> lastbit#(x) and R consists of: r1: half(|0|()) -> |0|() r2: half(s(|0|())) -> |0|() r3: half(s(s(x))) -> s(half(x)) r4: lastbit(|0|()) -> |0|() r5: lastbit(s(|0|())) -> s(|0|()) r6: lastbit(s(s(x))) -> lastbit(x) r7: zero(|0|()) -> true() r8: zero(s(x)) -> false() r9: conv(x) -> conviter(x,cons(|0|(),nil())) r10: conviter(x,l) -> if(zero(x),x,l) r11: if(true(),x,l) -> l r12: if(false(),x,l) -> conviter(half(x),cons(lastbit(x),l)) The estimated dependency graph contains the following SCCs: {p4, p6} {p1} {p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: conviter#(x,l) -> if#(zero(x),x,l) p2: if#(false(),x,l) -> conviter#(half(x),cons(lastbit(x),l)) and R consists of: r1: half(|0|()) -> |0|() r2: half(s(|0|())) -> |0|() r3: half(s(s(x))) -> s(half(x)) r4: lastbit(|0|()) -> |0|() r5: lastbit(s(|0|())) -> s(|0|()) r6: lastbit(s(s(x))) -> lastbit(x) r7: zero(|0|()) -> true() r8: zero(s(x)) -> false() r9: conv(x) -> conviter(x,cons(|0|(),nil())) r10: conviter(x,l) -> if(zero(x),x,l) r11: if(true(),x,l) -> l r12: if(false(),x,l) -> conviter(half(x),cons(lastbit(x),l)) The set of usable rules consists of r1, r2, r3, 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: conviter#_A(x1,x2) = 1 if#_A(x1,x2,x3) = max{1, x1 - 36} zero_A(x1) = 37 false_A = 1 half_A(x1) = 47 cons_A(x1,x2) = max{7, x2 + 5} lastbit_A(x1) = max{28, x1} |0|_A = 4 s_A(x1) = 47 true_A = 1 conviter#!_A(x1,x2) = max{22, x1 - 48} if#!_A(x1,x2,x3) = max{22, x2 - 48} zero!_A(x1) = max{21, x1 - 26} false!_A = 20 half!_A(x1) = max{64, x1 + 13} cons!_A(x1,x2) = max{23, x1 - 5, x2 - 4} lastbit!_A(x1) = max{19, x1 + 15} |0|!_A = 18 s!_A(x1) = 63 true!_A = 0 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: conviter#_A(x1,x2) = max{70, x1 - 2} if#_A(x1,x2,x3) = max{70, x1 - 1, x2 - 2} zero_A(x1) = max{0, x1 - 5} false_A = 70 half_A(x1) = max{63, x1 - 20} cons_A(x1,x2) = 100 lastbit_A(x1) = 0 |0|_A = 4 s_A(x1) = max{102, x1 + 20} true_A = 0 conviter#!_A(x1,x2) = x1 + 5 if#!_A(x1,x2,x3) = max{x1 - 1, x2 + 4} zero!_A(x1) = 2 false!_A = 110 half!_A(x1) = 109 cons!_A(x1,x2) = max{78, x2 - 1} lastbit!_A(x1) = 80 |0|!_A = 108 s!_A(x1) = 1 true!_A = 1 partial status: pi(conviter#) = [] pi(if#) = [] pi(zero) = [1] pi(false) = [] pi(half) = [1] pi(cons) = [1] pi(lastbit) = [1] pi(|0|) = [] pi(s) = [] pi(true) = [] 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: 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: lastbit(|0|()) -> |0|() r5: lastbit(s(|0|())) -> s(|0|()) r6: lastbit(s(s(x))) -> lastbit(x) r7: zero(|0|()) -> true() r8: zero(s(x)) -> false() r9: conv(x) -> conviter(x,cons(|0|(),nil())) r10: conviter(x,l) -> if(zero(x),x,l) r11: if(true(),x,l) -> l r12: if(false(),x,l) -> conviter(half(x),cons(lastbit(x),l)) The set of usable rules consists of r1, r2 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{1, x1 - 6} half_A(x1) = max{5, x1 - 18} |0|_A = 1 half#!_A(x1) = max{6, x1 - 12} s!_A(x1) = max{6, x1 - 6} half!_A(x1) = max{6, x1 - 12} |0|!_A = 1 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: half#_A(x1) = 0 s_A(x1) = max{2, x1 - 7} half_A(x1) = max{6, x1 - 21} |0|_A = 2 half#!_A(x1) = max{3, x1 - 38} s!_A(x1) = max{3, x1 - 31} half!_A(x1) = max{3, x1 - 38} |0|!_A = 2 partial status: pi(half#) = [1] pi(s) = [1] pi(half) = [1] pi(|0|) = [] 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: lastbit#(s(s(x))) -> lastbit#(x) and R consists of: r1: half(|0|()) -> |0|() r2: half(s(|0|())) -> |0|() r3: half(s(s(x))) -> s(half(x)) r4: lastbit(|0|()) -> |0|() r5: lastbit(s(|0|())) -> s(|0|()) r6: lastbit(s(s(x))) -> lastbit(x) r7: zero(|0|()) -> true() r8: zero(s(x)) -> false() r9: conv(x) -> conviter(x,cons(|0|(),nil())) r10: conviter(x,l) -> if(zero(x),x,l) r11: if(true(),x,l) -> l r12: if(false(),x,l) -> conviter(half(x),cons(lastbit(x),l)) The set of usable rules consists of r1, r2 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: lastbit#_A(x1) = 0 s_A(x1) = max{1, x1 - 9} half_A(x1) = max{8, x1 - 5} |0|_A = 4 lastbit#!_A(x1) = max{6, x1 - 9} s!_A(x1) = max{6, x1 - 9} half!_A(x1) = max{6, x1 - 18} |0|!_A = 1 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: lastbit#_A(x1) = 0 s_A(x1) = max{1, x1 - 6} half_A(x1) = max{5, x1 - 19} |0|_A = 1 lastbit#!_A(x1) = max{3, x1 - 26} s!_A(x1) = max{3, x1 - 21} half!_A(x1) = max{3, x1 - 27} |0|!_A = 1 partial status: pi(lastbit#) = [1] pi(s) = [1] pi(half) = [] pi(|0|) = [] The following rules are removed: p1 Then no dependency pair remains.