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: weighted path order base order: max/plus interpretations on natural numbers: times#_A(x1,x2) = max{x1 + 188, x2} plus_A(x1,x2) = max{185, x1 + 84, x2 + 90} |1|_A = 95 times_A(x1,x2) = 94 |0|_A = 93 id_A(x1) = max{12, x1 + 3} if_A(x1,x2,x3) = max{x1 - 19, x2, x3 + 2} true_A = 1 false_A = 23 not_A(x1) = x1 + 132 gt_A(x1,x2) = 24 s_A(x1) = max{0, x1 - 21} zero_A = 2 precedence: plus > |0| = id = gt = zero > times# = |1| = times = if = true = false = not = s partial status: pi(times#) = [2] pi(plus) = [2] pi(|1|) = [] pi(times) = [] pi(|0|) = [] pi(id) = [1] pi(if) = [2, 3] pi(true) = [] pi(false) = [] pi(not) = [] pi(gt) = [] pi(s) = [] pi(zero) = [] The next rules are strictly ordered: p1 We remove them from the problem. 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: weighted path order base order: max/plus interpretations on natural numbers: plus#_A(x1,x2) = max{19, x1 - 20, x2 - 33} s_A(x1) = x1 + 52 if_A(x1,x2,x3) = max{21, x1 - 50, x2 + 1, x3} gt_A(x1,x2) = max{76, x2 + 24} not_A(x1) = x1 + 25 id_A(x1) = max{37, x1 + 33} true_A = 21 false_A = 23 zero_A = 0 precedence: plus# = s = if = gt = not > id > true = false = zero partial status: pi(plus#) = [] pi(s) = [1] pi(if) = [2, 3] pi(gt) = [2] pi(not) = [] pi(id) = [] pi(true) = [] pi(false) = [] pi(zero) = [] The next rules are strictly ordered: p3 We remove them from the problem. -- SCC decomposition. 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))) 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, p2} -- 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))) 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: weighted path order base order: max/plus interpretations on natural numbers: plus#_A(x1,x2) = max{x1 + 13, x2 - 2} s_A(x1) = x1 + 36 if_A(x1,x2,x3) = max{10, x1 + 7, x2 + 1, x3} gt_A(x1,x2) = max{x1 - 37, x2 + 13} not_A(x1) = x1 + 14 id_A(x1) = x1 + 34 true_A = 12 false_A = 12 zero_A = 11 precedence: plus# = true = false = zero > s = if = gt = not = id partial status: pi(plus#) = [] pi(s) = [1] pi(if) = [1, 2, 3] pi(gt) = [2] pi(not) = [1] pi(id) = [1] pi(true) = [] pi(false) = [] pi(zero) = [] The next rules are strictly ordered: p1 We remove them from the problem. -- 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: weighted path order base order: max/plus interpretations on natural numbers: plus#_A(x1,x2) = max{0, x1 - 1} id_A(x1) = x1 + 5 s_A(x1) = max{10, x1 + 8} if_A(x1,x2,x3) = max{19, x1 + 2, x2 + 9, x3 + 9} gt_A(x1,x2) = 5 zero_A = 0 false_A = 4 true_A = 4 precedence: plus# > id = s = if = gt = zero = false = true partial status: pi(plus#) = [] pi(id) = [1] pi(s) = [1] pi(if) = [] pi(gt) = [] pi(zero) = [] pi(false) = [] pi(true) = [] The next rules are strictly ordered: p1 We remove them from the problem. 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 (no rules) Take the reduction pair: weighted path order base order: max/plus interpretations on natural numbers: gt#_A(x1,x2) = max{0, x1 - 2, x2 - 2} s_A(x1) = max{3, x1 + 1} precedence: gt# = s partial status: pi(gt#) = [] pi(s) = [] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.