YES We show the termination of the TRS R: times(x,|0|()) -> |0|() times(x,s(y)) -> plus(times(x,y),x) 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,s(y)) -> plus#(times(x,y),x) p2: times#(x,s(y)) -> times#(x,y) p3: plus#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p4: plus#(s(x),s(y)) -> if#(gt(x,y),x,y) p5: plus#(s(x),s(y)) -> gt#(x,y) p6: plus#(s(x),s(y)) -> if#(not(gt(x,y)),id(x),id(y)) p7: plus#(s(x),s(y)) -> not#(gt(x,y)) p8: plus#(s(x),s(y)) -> id#(x) p9: plus#(s(x),s(y)) -> id#(y) p10: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) p11: plus#(s(x),x) -> if#(gt(x,x),id(x),id(x)) p12: plus#(s(x),x) -> gt#(x,x) p13: plus#(s(x),x) -> id#(x) p14: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) p15: plus#(id(x),s(y)) -> if#(gt(s(y),y),y,s(y)) p16: plus#(id(x),s(y)) -> gt#(s(y),y) p17: not#(x) -> if#(x,false(),true()) p18: gt#(s(x),s(y)) -> gt#(x,y) and R consists of: r1: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: gt(s(x),s(y)) -> gt(x,y) The estimated dependency graph contains the following SCCs: {p2} {p3, p10, p14} {p18} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: times#(x,s(y)) -> times#(x,y) and R consists of: r1: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r11, r12 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: times#_A(x1,x2) = max{25, x2 - 1} s_A(x1) = max{27, x1 + 24} gt_A(x1,x2) = max{111, x1 - 40, x2 - 28} zero_A = 27 true_A = 26 false_A = 8 base order 2: precedence: s = gt = zero > times# = true = false partial status: pi(times#) = [] pi(s) = [1] pi(gt) = [] 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,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r7, r8, r9, r10, r11, r12, r13 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{x1 + 17, x2 + 16} s_A(x1) = max{315, x1 + 29} if_A(x1,x2,x3) = max{39, x1 - 64, x2 + 1, x3} gt_A(x1,x2) = max{36, x1 - 107, x2 - 353} not_A(x1) = max{47, x1 - 37} id_A(x1) = max{37, x1 + 14} true_A = 35 false_A = 0 zero_A = 36 base order 2: precedence: plus# > not > if > s = gt = zero > id = true = false 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: p3 -- 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,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: 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,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r7, r8, r9, r10, r11, r12, r13 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{27, x1 + 2, x2 - 32} s_A(x1) = max{36, x1 + 35} if_A(x1,x2,x3) = max{x1 - 68, x2 + 28, x3} gt_A(x1,x2) = max{26, x1 - 65, x2 - 76} not_A(x1) = max{67, x1 - 67} id_A(x1) = max{18, x1 + 1} true_A = 25 false_A = 0 zero_A = 26 base order 2: precedence: not > if > plus# = s = gt = zero > id = true = false partial status: pi(plus#) = [1] pi(s) = [1] pi(if) = [3] pi(gt) = [] pi(not) = [] pi(id) = [1] pi(true) = [] pi(false) = [] pi(zero) = [] The following rules are removed: p2 -- 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))) and R consists of: r1: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: 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#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) and R consists of: r1: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r7, r8, r9, r10, r11, r12, r13 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{1, x1, x2 - 55} s_A(x1) = max{108, x1 + 58} if_A(x1,x2,x3) = max{54, x1 - 102, x2 + 39, x3 + 1} gt_A(x1,x2) = max{4, x1 - 103, x2 - 42} not_A(x1) = max{84, x1 - 5} id_A(x1) = max{39, x1 + 1} true_A = 59 false_A = 0 zero_A = 102 base order 2: precedence: plus# = not > if > s = gt = zero > id = true = false partial status: pi(plus#) = [1] pi(s) = [1] pi(if) = [] pi(gt) = [] pi(not) = [] pi(id) = [1] 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,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r9, r11, r12 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{22, x2 + 20} s_A(x1) = max{70, x1 + 21} if_A(x1,x2,x3) = max{64, x1 - 2, x2 - 8, x3 + 34} false_A = 0 gt_A(x1,x2) = max{61, x1 - 71, x2 - 2} zero_A = 1 true_A = 0 base order 2: precedence: if > s = gt = zero > gt# = false = true partial status: pi(gt#) = [2] pi(s) = [1] pi(if) = [] pi(false) = [] pi(gt) = [] pi(zero) = [] pi(true) = [] The following rules are removed: p1 Then no dependency pair remains.