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, r14, r15 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: quot#_A(x1,x2) = 0 s_A(x1) = x1 + 51 minus_A(x1,x2) = x1 + 12 |0|_A = 13 plus_A(x1,x2) = 1 gt_A(x1,x2) = max{1, x1 - 4} zero_A = 3 true_A = 10 false_A = 1 quot#!_A(x1,x2) = x1 + 56 s!_A(x1) = 68 minus!_A(x1,x2) = 0 |0|!_A = 2 plus!_A(x1,x2) = max{28, x1 + 16, x2 + 19} gt!_A(x1,x2) = max{33, x1 - 52} zero!_A = 2 true!_A = 1 false!_A = 1 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: quot#_A(x1,x2) = max{0, x2 - 28} s_A(x1) = max{51, x1 + 28} minus_A(x1,x2) = x1 + 50 |0|_A = 2 plus_A(x1,x2) = max{1, x2 - 49} gt_A(x1,x2) = max{40, x1 - 16, x2 + 34} zero_A = 0 true_A = 36 false_A = 35 quot#!_A(x1,x2) = 1 s!_A(x1) = 0 minus!_A(x1,x2) = max{27, x1 - 49} |0|!_A = 73 plus!_A(x1,x2) = max{72, x1 + 3, x2 - 25} gt!_A(x1,x2) = max{73, x2 + 23} zero!_A = 25 true!_A = 0 false!_A = 24 partial status: pi(quot#) = [] pi(s) = [1] pi(minus) = [1] pi(|0|) = [] pi(plus) = [1, 2] 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: 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 (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: minus#_A(x1,x2) = 0 s_A(x1) = max{25, x1 + 6} minus_A(x1,x2) = x2 + 2 plus_A(x1,x2) = max{103, x1 + 36, x2 - 6} minus#!_A(x1,x2) = max{3, x1 + 1} s!_A(x1) = max{59, x1 - 42} minus!_A(x1,x2) = x1 + 41 plus!_A(x1,x2) = 101 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: minus#_A(x1,x2) = 0 s_A(x1) = 85 minus_A(x1,x2) = 1 plus_A(x1,x2) = x1 + 42 minus#!_A(x1,x2) = 1 s!_A(x1) = x1 + 11 minus!_A(x1,x2) = max{2, x1 - 72, x2 - 187} plus!_A(x1,x2) = max{56, x1 + 51, x2 - 87} partial status: pi(minus#) = [1] pi(s) = [1] pi(minus) = [1] pi(plus) = [] The following rules are removed: p1, p2 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 r10, r11, r12, r13, r14, r15, r16 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = 0 s_A(x1) = 7 if_A(x1,x2,x3) = max{14, x1 - 18, x2, x3 + 10} gt_A(x1,x2) = 18 not_A(x1) = max{14, x1} id_A(x1) = x1 true_A = 1 false_A = 1 zero_A = 0 plus#!_A(x1,x2) = 0 s!_A(x1) = max{22, x1 + 4} if!_A(x1,x2,x3) = max{5, x1 - 18, x2 - 3, x3 - 4} gt!_A(x1,x2) = max{7, x2} not!_A(x1) = max{23, x1 - 16} id!_A(x1) = 0 true!_A = 5 false!_A = 1 zero!_A = 6 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 87, x2 - 87} s_A(x1) = x1 + 16 if_A(x1,x2,x3) = max{2, x1 - 31, x2, x3} gt_A(x1,x2) = x2 + 44 not_A(x1) = max{50, x1 + 3} id_A(x1) = max{1, x1} true_A = 27 false_A = 4 zero_A = 0 plus#!_A(x1,x2) = max{x1 + 6, x2 + 3} s!_A(x1) = max{50, x1 - 29} if!_A(x1,x2,x3) = max{51, x1 - 1, x2 - 63, x3 - 28} gt!_A(x1,x2) = max{50, x1 - 45, x2 - 56} not!_A(x1) = max{1, x1 - 102} id!_A(x1) = max{23, x1 - 1} true!_A = 50 false!_A = 52 zero!_A = 51 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 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 r10, r11, r12, r13, r14, r15, r16 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 113, x2 - 111} s_A(x1) = max{44, x1 + 31} if_A(x1,x2,x3) = max{77, x1 - 78, x2 + 29, x3} gt_A(x1,x2) = max{188, x1 - 45, x2 - 119} not_A(x1) = max{139, x1 - 78} id_A(x1) = max{45, x1} true_A = 1 false_A = 0 zero_A = 0 plus#!_A(x1,x2) = max{353, x1 + 231, x2 + 200} s!_A(x1) = max{191, x1 + 33} if!_A(x1,x2,x3) = max{352, x1 + 2, x2 - 95, x3 - 45} gt!_A(x1,x2) = max{230, x1 - 45, x2 - 85} not!_A(x1) = max{354, x1 + 351} id!_A(x1) = 0 true!_A = 190 false!_A = 229 zero!_A = 230 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 62, x2 - 42} s_A(x1) = x1 + 22 if_A(x1,x2,x3) = max{x1 - 34, x2, x3} gt_A(x1,x2) = max{11, x1 - 45, x2 - 23} not_A(x1) = max{13, x1 - 34} id_A(x1) = max{41, x1} true_A = 11 false_A = 1 zero_A = 0 plus#!_A(x1,x2) = max{79, x1 + 58, x2 + 37} s!_A(x1) = 101 if!_A(x1,x2,x3) = max{98, x1 - 14, x2 - 2, x3 - 23} gt!_A(x1,x2) = max{100, x1 - 1, x2 - 71} not!_A(x1) = max{100, x1 - 13} id!_A(x1) = max{1, x1 - 71} true!_A = 22 false!_A = 0 zero!_A = 23 partial status: pi(plus#) = [1, 2] pi(s) = [1] pi(if) = [2, 3] pi(gt) = [2] pi(not) = [1] pi(id) = [1] pi(true) = [] pi(false) = [] pi(zero) = [] The following rules are removed: p1, p2 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 (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{0, x1 - 1, x2 - 1} s_A(x1) = max{18, x1} gt#!_A(x1,x2) = max{1, x1 - 19, x2 - 19} s!_A(x1) = max{3, x1 - 50} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{0, x1 - 1, x2 - 1} s_A(x1) = max{5, x1} gt#!_A(x1,x2) = max{1, x1 - 6, x2 - 6} s!_A(x1) = 0 partial status: pi(gt#) = [1] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.