YES We show the termination of the TRS R: minus(x,|0|()) -> x minus(s(x),s(y)) -> minus(x,y) quot(|0|(),s(y)) -> |0|() quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) minus(minus(x,y),z) -> minus(x,plus(y,z)) 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: quot#(s(x),s(y)) -> quot#(minus(x,y),s(y)) p3: quot#(s(x),s(y)) -> minus#(x,y) p4: minus#(minus(x,y),z) -> minus#(x,plus(y,z)) p5: minus#(minus(x,y),z) -> plus#(y,z) p6: plus#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p7: plus#(s(x),s(y)) -> if#(gt(x,y),x,y) p8: plus#(s(x),s(y)) -> gt#(x,y) p9: plus#(s(x),s(y)) -> if#(not(gt(x,y)),id(x),id(y)) p10: plus#(s(x),s(y)) -> not#(gt(x,y)) p11: plus#(s(x),s(y)) -> id#(x) p12: plus#(s(x),s(y)) -> id#(y) p13: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) p14: plus#(s(x),x) -> if#(gt(x,x),id(x),id(x)) p15: plus#(s(x),x) -> gt#(x,x) p16: plus#(s(x),x) -> id#(x) p17: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) p18: plus#(id(x),s(y)) -> if#(gt(s(y),y),y,s(y)) p19: plus#(id(x),s(y)) -> gt#(s(y),y) p20: not#(x) -> if#(x,false(),true()) p21: 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: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: gt(s(x),s(y)) -> gt(x,y) The estimated dependency graph contains the following SCCs: {p2} {p1, p4} {p6, p13, p17} {p21} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: quot#(s(x),s(y)) -> quot#(minus(x,y),s(y)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r1, r2, r5, r8, r14, r15, r16 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: quot#_A(x1,x2) = max{x1 + 4, x2 - 1} s_A(x1) = x1 + 8 minus_A(x1,x2) = x1 |0|_A = 0 plus_A(x1,x2) = max{28, x1 - 2, x2} zero_A = 9 gt_A(x1,x2) = max{7, x1 - 18, x2 - 10} true_A = 6 false_A = 4 base order 2: precedence: plus > minus > quot# = s = zero = gt > |0| = true = false partial status: pi(quot#) = [1] pi(s) = [1] pi(minus) = [1] pi(|0|) = [] pi(plus) = [2] pi(zero) = [] pi(gt) = [] 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: minus#(s(x),s(y)) -> minus#(x,y) p2: minus#(minus(x,y),z) -> minus#(x,plus(y,z)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r1, r3, r14, r15 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: minus#_A(x1,x2) = max{92, x1 + 1} s_A(x1) = max{97, x1 + 18} minus_A(x1,x2) = max{x1 + 9, x2 + 93} plus_A(x1,x2) = max{1, x1 - 122, x2 - 94} |0|_A = 9 quot_A(x1,x2) = max{98, x1 - 10, x2 - 116} gt_A(x1,x2) = max{72, x1 - 100, x2 - 103} zero_A = 72 true_A = 71 false_A = 71 base order 2: precedence: minus > quot > s = plus = gt = zero > minus# = |0| = true = false partial status: pi(minus#) = [1] pi(s) = [1] pi(minus) = [2] pi(plus) = [] pi(|0|) = [] pi(quot) = [] pi(gt) = [] pi(zero) = [] pi(true) = [] pi(false) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: minus#(minus(x,y),z) -> minus#(x,plus(y,z)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: 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: minus#(minus(x,y),z) -> minus#(x,plus(y,z)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r1, r3, r14, r15 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: minus#_A(x1,x2) = x1 + 98 minus_A(x1,x2) = max{x1 + 99, x2 - 95} plus_A(x1,x2) = max{5, x1 - 227, x2 - 96} |0|_A = 45 quot_A(x1,x2) = max{51, x1 - 144, x2 - 284} s_A(x1) = max{50, x1 + 44} gt_A(x1,x2) = max{4, x1 - 97, x2 - 184} zero_A = 96 true_A = 3 false_A = 3 base order 2: precedence: minus = plus > quot > s = gt = zero > minus# = |0| = true = false partial status: pi(minus#) = [1] pi(minus) = [1] pi(plus) = [] pi(|0|) = [] pi(quot) = [] 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: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r3, r10, r11, r12, r13, r14, r15, r16 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 + 82, x2 + 65} s_A(x1) = max{86, x1 + 64} if_A(x1,x2,x3) = max{x1 - 308, x2 + 60, x3} gt_A(x1,x2) = max{168, x1 - 87, x2 - 87} not_A(x1) = max{242, x1 - 307} id_A(x1) = max{12, x1 + 3} quot_A(x1,x2) = max{66, x2 - 268} |0|_A = 65 true_A = 65 false_A = 0 zero_A = 66 base order 2: precedence: not > if > plus# > gt = zero > s = id = quot = false > |0| = true partial status: pi(plus#) = [] pi(s) = [1] pi(if) = [3] pi(gt) = [] pi(not) = [] pi(id) = [1] pi(quot) = [] pi(|0|) = [] 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r3, r10, r11, r12, r13, r14, r15, r16 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 + 16, x2 - 19} s_A(x1) = max{186, x1 + 54} if_A(x1,x2,x3) = max{18, x1 - 235, x2 + 4, x3} gt_A(x1,x2) = max{406, x1 - 229, x2 - 230} not_A(x1) = max{201, x1 - 234} id_A(x1) = x1 + 3 quot_A(x1,x2) = max{187, x1 - 94, x2 - 108} |0|_A = 79 true_A = 55 false_A = 0 zero_A = 56 base order 2: precedence: not > if > quot > gt = zero > plus# = s = id = false > |0| = true partial status: pi(plus#) = [1] pi(s) = [1] pi(if) = [3] pi(gt) = [] pi(not) = [] pi(id) = [1] pi(quot) = [] pi(|0|) = [] 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r3, r10, r11, r12, r13, r14, r15, r16 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{4, x1 - 37, x2 - 41} s_A(x1) = max{103, x1 + 64} if_A(x1,x2,x3) = max{x1 - 93, x2 + 25, x3 + 21} gt_A(x1,x2) = max{5, x1 - 96, x2 - 133} not_A(x1) = max{28, x1 - 6} id_A(x1) = max{19, x1 + 1} quot_A(x1,x2) = max{63, x1 - 105, x2 - 168} |0|_A = 62 true_A = 6 false_A = 0 zero_A = 7 base order 2: precedence: plus# > not > if > s = quot > gt = zero > id = |0| = true = false partial status: pi(plus#) = [] pi(s) = [] pi(if) = [] pi(gt) = [] pi(not) = [] pi(id) = [] pi(quot) = [] pi(|0|) = [] 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: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: minus(minus(x,y),z) -> minus(x,plus(y,z)) r6: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r7: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r8: plus(zero(),y) -> y r9: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r10: id(x) -> x r11: if(true(),x,y) -> x r12: if(false(),x,y) -> y r13: not(x) -> if(x,false(),true()) r14: gt(s(x),zero()) -> true() r15: gt(zero(),y) -> false() r16: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r3, r14, r15 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 + 11} s_A(x1) = max{39, x1 + 10} quot_A(x1,x2) = max{8, x1 - 51, x2 - 109} |0|_A = 7 gt_A(x1,x2) = max{1, x1 - 50, x2 - 37} zero_A = 49 true_A = 11 false_A = 0 base order 2: precedence: quot > gt# = s = gt = zero > |0| = true = false partial status: pi(gt#) = [2] pi(s) = [1] pi(quot) = [] pi(|0|) = [] pi(gt) = [] pi(zero) = [] pi(true) = [] pi(false) = [] The following rules are removed: p1 Then no dependency pair remains.