YES We show the termination of the TRS R: minus(x,|0|()) -> x minus(s(x),s(y)) -> minus(x,y) double(|0|()) -> |0|() double(s(x)) -> s(s(double(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: minus#(s(x),s(y)) -> minus#(x,y) p2: double#(s(x)) -> double#(x) 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: double(|0|()) -> |0|() r4: double(s(x)) -> s(s(double(x))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The estimated dependency graph contains the following SCCs: {p1} {p2} {p3, p10, p14} {p18} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: minus#(s(x),s(y)) -> minus#(x,y) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: double(|0|()) -> |0|() r4: double(s(x)) -> s(s(double(x))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r13, r14 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: minus#_A(x1,x2) = max{x1 - 1, x2 + 15} s_A(x1) = x1 + 15 gt_A(x1,x2) = max{5, x1 - 23, x2 - 5} zero_A = 4 true_A = 3 false_A = 3 base order 2: precedence: minus# > s = gt = zero > true = false partial status: pi(minus#) = [2] 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: double#(s(x)) -> double#(x) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: double(|0|()) -> |0|() r4: double(s(x)) -> s(s(double(x))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r13, r14 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: double#_A(x1) = max{8, x1 - 1} s_A(x1) = x1 + 43 gt_A(x1,x2) = max{65, x1 - 44, x2 - 59} zero_A = 43 true_A = 11 false_A = 0 base order 2: precedence: gt = zero > s = false > double# = true partial status: pi(double#) = [] 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: double(|0|()) -> |0|() r4: double(s(x)) -> s(s(double(x))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r9, r10, r11, r12, r13, r14, r15 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{34, x1 - 42, x2 - 47} s_A(x1) = x1 + 82 if_A(x1,x2,x3) = max{32, x1 - 34, x2 + 21, x3} gt_A(x1,x2) = max{30, x1 - 207, x2 - 207} not_A(x1) = max{33, x1 - 31} id_A(x1) = max{20, x1 + 1} true_A = 29 false_A = 11 zero_A = 30 base order 2: precedence: not > if > plus# = 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: p1 -- 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))) p2: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: double(|0|()) -> |0|() r4: double(s(x)) -> s(s(double(x))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: 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#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) p2: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: double(|0|()) -> |0|() r4: double(s(x)) -> s(s(double(x))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r9, r10, r11, r13, r14, r15 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{8, x1 + 4} id_A(x1) = max{9, x1 + 5} s_A(x1) = x1 + 63 if_A(x1,x2,x3) = max{7, x1 - 41, x2 + 1, x3 + 1} gt_A(x1,x2) = max{6, x1 - 201, x2 - 138} true_A = 0 false_A = 0 zero_A = 1 base order 2: precedence: if > id = s > plus# = gt = zero > true = false partial status: pi(plus#) = [1] pi(id) = [1] pi(s) = [1] pi(if) = [] pi(gt) = [] 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#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: double(|0|()) -> |0|() r4: double(s(x)) -> s(s(double(x))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: double(|0|()) -> |0|() r4: double(s(x)) -> s(s(double(x))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r13, r14 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = x1 + 1 id_A(x1) = max{4, x1 + 2} s_A(x1) = max{22, x1 - 33} if_A(x1,x2,x3) = max{11, x1 - 40, x2 - 119, x3 - 86} gt_A(x1,x2) = max{6, x1 - 46, x2 - 79} zero_A = 6 true_A = 5 false_A = 0 base order 2: precedence: plus# = id = s > if = gt = zero > true = false partial status: pi(plus#) = [1] pi(id) = [] pi(s) = [] pi(if) = [] 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: gt#(s(x),s(y)) -> gt#(x,y) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: double(|0|()) -> |0|() r4: double(s(x)) -> s(s(double(x))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r13, r14 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{x1 - 1, x2 + 62} s_A(x1) = max{69, x1 + 62} gt_A(x1,x2) = max{68, x1 - 70, x2 - 72} zero_A = 64 true_A = 63 false_A = 33 base order 2: precedence: gt# > s > gt = zero > true = false partial status: pi(gt#) = [2] pi(s) = [] pi(gt) = [] pi(zero) = [] pi(true) = [] pi(false) = [] The following rules are removed: p1 Then no dependency pair remains.