YES We show the termination of the TRS R: times(x,plus(y,|1|())) -> plus(times(x,plus(y,times(|1|(),|0|()))),x) times(x,|1|()) -> x times(x,|0|()) -> |0|() plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) plus(zero(),y) -> y plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) id(x) -> x if(true(),x,y) -> x if(false(),x,y) -> y not(x) -> if(x,false(),true()) gt(s(x),zero()) -> true() gt(zero(),y) -> false() gt(s(x),s(y)) -> gt(x,y) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: times#(x,plus(y,|1|())) -> plus#(times(x,plus(y,times(|1|(),|0|()))),x) p2: times#(x,plus(y,|1|())) -> times#(x,plus(y,times(|1|(),|0|()))) p3: times#(x,plus(y,|1|())) -> plus#(y,times(|1|(),|0|())) p4: times#(x,plus(y,|1|())) -> times#(|1|(),|0|()) p5: plus#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p6: plus#(s(x),s(y)) -> if#(gt(x,y),x,y) p7: plus#(s(x),s(y)) -> gt#(x,y) p8: plus#(s(x),s(y)) -> if#(not(gt(x,y)),id(x),id(y)) p9: plus#(s(x),s(y)) -> not#(gt(x,y)) p10: plus#(s(x),s(y)) -> id#(x) p11: plus#(s(x),s(y)) -> id#(y) p12: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) p13: plus#(s(x),x) -> if#(gt(x,x),id(x),id(x)) p14: plus#(s(x),x) -> gt#(x,x) p15: plus#(s(x),x) -> id#(x) p16: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) p17: plus#(id(x),s(y)) -> if#(gt(s(y),y),y,s(y)) p18: plus#(id(x),s(y)) -> gt#(s(y),y) p19: not#(x) -> if#(x,false(),true()) p20: gt#(s(x),s(y)) -> gt#(x,y) and R consists of: r1: times(x,plus(y,|1|())) -> plus(times(x,plus(y,times(|1|(),|0|()))),x) r2: times(x,|1|()) -> x r3: times(x,|0|()) -> |0|() r4: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r5: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r6: plus(zero(),y) -> y r7: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r8: id(x) -> x r9: if(true(),x,y) -> x r10: if(false(),x,y) -> y r11: not(x) -> if(x,false(),true()) r12: gt(s(x),zero()) -> true() r13: gt(zero(),y) -> false() r14: gt(s(x),s(y)) -> gt(x,y) The estimated dependency graph contains the following SCCs: {p2} {p5, p12, p16} {p20} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: times#(x,plus(y,|1|())) -> times#(x,plus(y,times(|1|(),|0|()))) and R consists of: r1: times(x,plus(y,|1|())) -> plus(times(x,plus(y,times(|1|(),|0|()))),x) r2: times(x,|1|()) -> x r3: times(x,|0|()) -> |0|() r4: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r5: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r6: plus(zero(),y) -> y r7: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r8: id(x) -> x r9: if(true(),x,y) -> x r10: if(false(),x,y) -> y r11: not(x) -> if(x,false(),true()) r12: gt(s(x),zero()) -> true() r13: gt(zero(),y) -> false() r14: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: times#_A(x1,x2) = max{94, x1 + 16, x2 - 40} plus_A(x1,x2) = max{17, x1 + 10, x2 + 10} |1|_A = 29 times_A(x1,x2) = max{70, x1 - 92, x2 + 42} |0|_A = 51 s_A(x1) = max{3, x1} if_A(x1,x2,x3) = max{7, x1 - 5, x2, x3} gt_A(x1,x2) = max{3, x1 - 9, x2 - 4} not_A(x1) = x1 + 8 id_A(x1) = max{4, x1} zero_A = 3 true_A = 2 false_A = 2 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: times#_A(x1,x2) = max{0, x1 - 93, x2 - 72} plus_A(x1,x2) = max{69, x2 + 1} |1|_A = 70 times_A(x1,x2) = max{x1 - 91, x2 + 42} |0|_A = 24 s_A(x1) = 19 if_A(x1,x2,x3) = max{x1 - 9, x2 + 25, x3 + 22} gt_A(x1,x2) = 34 not_A(x1) = max{34, x1} id_A(x1) = x1 + 22 zero_A = 16 true_A = 12 false_A = 9 times#!_A(x1,x2) = max{2, x2 - 68} plus!_A(x1,x2) = 0 |1|!_A = 0 times!_A(x1,x2) = max{0, x1 - 74, x2 - 72} |0|!_A = 4 s!_A(x1) = 0 if!_A(x1,x2,x3) = max{2, x2 - 23, x3 - 23} gt!_A(x1,x2) = 0 not!_A(x1) = max{1, x1 - 15} id!_A(x1) = max{0, x1 - 5} zero!_A = 1 true!_A = 0 false!_A = 0 partial status: pi(times#) = [1] pi(plus) = [] pi(|1|) = [] pi(times) = [2] pi(|0|) = [] pi(s) = [] pi(if) = [2, 3] pi(gt) = [] pi(not) = [] pi(id) = [1] pi(zero) = [] pi(true) = [] pi(false) = [] 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),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p2: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) p3: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) and R consists of: r1: times(x,plus(y,|1|())) -> plus(times(x,plus(y,times(|1|(),|0|()))),x) r2: times(x,|1|()) -> x r3: times(x,|0|()) -> |0|() r4: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r5: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r6: plus(zero(),y) -> y r7: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r8: id(x) -> x r9: if(true(),x,y) -> x r10: if(false(),x,y) -> y r11: not(x) -> if(x,false(),true()) r12: gt(s(x),zero()) -> true() r13: gt(zero(),y) -> false() r14: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r8, r9, r10, r11, r12, r13, r14 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{1, x1 - 204, x2 - 210} s_A(x1) = max{28, x1 + 6} if_A(x1,x2,x3) = max{66, x1 - 68, x2 + 4, x3} gt_A(x1,x2) = max{66, x1 - 39, x2 - 68} not_A(x1) = max{67, x1 - 67} id_A(x1) = max{50, x1 + 2} true_A = 7 false_A = 0 zero_A = 38 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 114, x2 - 114} s_A(x1) = x1 + 92 if_A(x1,x2,x3) = max{43, x1 - 39, x2, x3} gt_A(x1,x2) = max{82, x1 - 93, x2 - 93} not_A(x1) = max{152, x1 + 40} id_A(x1) = max{69, x1} true_A = 82 false_A = 82 zero_A = 0 plus#!_A(x1,x2) = max{1, x1 - 90, x2 - 114} s!_A(x1) = max{2, x1 - 1818} if!_A(x1,x2,x3) = max{3, x1 - 173, x2 - 184, x3 - 2396} gt!_A(x1,x2) = max{2, x1 - 2528, x2 - 2395} not!_A(x1) = max{4, x1 - 103} id!_A(x1) = max{2, x1 - 2459} true!_A = 0 false!_A = 0 zero!_A = 1 partial status: pi(plus#) = [] pi(s) = [1] pi(if) = [3] pi(gt) = [] pi(not) = [] pi(id) = [1] pi(true) = [] pi(false) = [] pi(zero) = [] The following rules are removed: p1, p3 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) and R consists of: r1: times(x,plus(y,|1|())) -> plus(times(x,plus(y,times(|1|(),|0|()))),x) r2: times(x,|1|()) -> x r3: times(x,|0|()) -> |0|() r4: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r5: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r6: plus(zero(),y) -> y r7: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r8: id(x) -> x r9: if(true(),x,y) -> x r10: if(false(),x,y) -> y r11: not(x) -> if(x,false(),true()) r12: gt(s(x),zero()) -> true() r13: gt(zero(),y) -> false() r14: gt(s(x),s(y)) -> gt(x,y) The estimated dependency graph contains the following SCCs: {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) and R consists of: r1: times(x,plus(y,|1|())) -> plus(times(x,plus(y,times(|1|(),|0|()))),x) r2: times(x,|1|()) -> x r3: times(x,|0|()) -> |0|() r4: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r5: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r6: plus(zero(),y) -> y r7: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r8: id(x) -> x r9: if(true(),x,y) -> x r10: if(false(),x,y) -> y r11: not(x) -> if(x,false(),true()) r12: gt(s(x),zero()) -> true() r13: gt(zero(),y) -> false() r14: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r9, r10, r12, r13, r14 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = x1 + 2 id_A(x1) = max{2, x1} s_A(x1) = x1 if_A(x1,x2,x3) = max{x2 + 7, x3} gt_A(x1,x2) = max{5, x1 - 3, x2 - 3} true_A = 1 false_A = 0 zero_A = 2 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 268, x2 - 65} id_A(x1) = max{21, x1 + 18} s_A(x1) = max{20, x1 + 18} if_A(x1,x2,x3) = max{19, x1 - 1, x2 + 18, x3} gt_A(x1,x2) = max{65, x1 - 200, x2 - 19} true_A = 65 false_A = 20 zero_A = 0 plus#!_A(x1,x2) = max{46, x1 - 197, x2 - 239} id!_A(x1) = max{58, x1 - 421} s!_A(x1) = max{57, x1 + 19} if!_A(x1,x2,x3) = max{18, x1 - 18, x2 - 200, x3 - 200} gt!_A(x1,x2) = max{0, x1 - 220, x2 - 220} true!_A = 58 false!_A = 0 zero!_A = 59 partial status: pi(plus#) = [1] pi(id) = [1] pi(s) = [] pi(if) = [2, 3] pi(gt) = [] pi(true) = [] pi(false) = [] pi(zero) = [] 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: gt#(s(x),s(y)) -> gt#(x,y) and R consists of: r1: times(x,plus(y,|1|())) -> plus(times(x,plus(y,times(|1|(),|0|()))),x) r2: times(x,|1|()) -> x r3: times(x,|0|()) -> |0|() r4: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r5: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r6: plus(zero(),y) -> y r7: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r8: id(x) -> x r9: if(true(),x,y) -> x r10: if(false(),x,y) -> y r11: not(x) -> if(x,false(),true()) r12: gt(s(x),zero()) -> true() r13: gt(zero(),y) -> false() r14: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r9, r10, r12, r13, r14 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{57, x1 - 57, x2 - 57} s_A(x1) = max{56, x1 + 9} if_A(x1,x2,x3) = max{141, x1 - 22, x2 + 16, x3 + 10} true_A = 5 false_A = 5 gt_A(x1,x2) = max{6, x1 - 72, x2 - 143} zero_A = 71 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{0, x1 - 31, x2 - 31} s_A(x1) = x1 + 30 if_A(x1,x2,x3) = max{41, x1 - 1, x2 + 10, x3 + 7} true_A = 31 false_A = 31 gt_A(x1,x2) = max{41, x1 - 55, x2 - 31} zero_A = 0 gt#!_A(x1,x2) = max{3, x1 - 693, x2 - 26} s!_A(x1) = max{2, x1 - 693} if!_A(x1,x2,x3) = 2 true!_A = 0 false!_A = 0 gt!_A(x1,x2) = max{3, x1 - 562, x2 - 563} zero!_A = 1 partial status: pi(gt#) = [] pi(s) = [] pi(if) = [] pi(true) = [] pi(false) = [] pi(gt) = [] pi(zero) = [] The following rules are removed: p1 Then no dependency pair remains.