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))) 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: plus#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p5: plus#(s(x),s(y)) -> if#(gt(x,y),x,y) p6: plus#(s(x),s(y)) -> gt#(x,y) p7: plus#(s(x),s(y)) -> if#(not(gt(x,y)),id(x),id(y)) p8: plus#(s(x),s(y)) -> not#(gt(x,y)) p9: plus#(s(x),s(y)) -> id#(x) p10: plus#(s(x),s(y)) -> id#(y) p11: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) p12: plus#(s(x),x) -> if#(gt(x,x),id(x),id(x)) p13: plus#(s(x),x) -> gt#(x,x) p14: plus#(s(x),x) -> id#(x) p15: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) p16: plus#(id(x),s(y)) -> if#(gt(s(y),y),y,s(y)) p17: plus#(id(x),s(y)) -> gt#(s(y),y) p18: not#(x) -> if#(x,false(),true()) p19: 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: 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: {p2} {p1} {p4, p11, p15} {p19} -- 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: 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 r1, r2 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) = max{0, x1 - 5, x2 - 9} s_A(x1) = x1 + 4 minus_A(x1,x2) = max{x1 + 1, x2 - 5} |0|_A = 2 quot#!_A(x1,x2) = max{1, x1 - 5, x2 - 7} s!_A(x1) = 28 minus!_A(x1,x2) = 0 |0|!_A = 1 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: quot#_A(x1,x2) = max{0, x1 - 23, x2 - 45} s_A(x1) = x1 + 22 minus_A(x1,x2) = max{x1 + 1, x2 - 23} |0|_A = 20 quot#!_A(x1,x2) = max{4, x1 - 23, x2 - 68} s!_A(x1) = 3 minus!_A(x1,x2) = max{2, x1 - 23, x2 - 47} |0|!_A = 3 partial status: pi(quot#) = [1] pi(s) = [1] pi(minus) = [1] pi(|0|) = [] 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) 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: 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 (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) = max{0, x1 - 74, x2 - 74} s_A(x1) = x1 + 73 minus#!_A(x1,x2) = max{6, x1 - 74, x2 - 66} s!_A(x1) = x1 + 5 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: minus#_A(x1,x2) = max{0, x1 - 23, x2 - 23} s_A(x1) = max{25, x1 + 22} minus#!_A(x1,x2) = max{3, x1 - 26, x2 - 103} s!_A(x1) = max{2, x1 - 104} partial status: pi(minus#) = [] pi(s) = [] 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: 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, >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 - 59, x2 - 59} s_A(x1) = max{58, x1 + 17} if_A(x1,x2,x3) = max{43, x1 - 60, x2, x3} gt_A(x1,x2) = max{18, x1 - 59, x2 - 112} not_A(x1) = max{103, x1 - 60} id_A(x1) = max{30, x1} true_A = 18 false_A = 1 zero_A = 58 plus#!_A(x1,x2) = max{1, x1 - 56, x2 - 70} s!_A(x1) = max{165, x1 + 162} if!_A(x1,x2,x3) = max{166, x2 - 36} gt!_A(x1,x2) = max{3, x1 - 71, x2 - 71} not!_A(x1) = max{167, x1 - 72} id!_A(x1) = max{165, x1 - 132} true!_A = 163 false!_A = 4 zero!_A = 164 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 13, x2 - 14} s_A(x1) = x1 + 8 if_A(x1,x2,x3) = max{x1 - 10, x2, x3} gt_A(x1,x2) = max{1, x1 - 17, x2 - 9} not_A(x1) = max{20, x1 - 10} id_A(x1) = max{12, x1 + 2} true_A = 1 false_A = 1 zero_A = 0 plus#!_A(x1,x2) = max{14, x1 - 95, x2 - 49} s!_A(x1) = 8 if!_A(x1,x2,x3) = max{12, x1 - 21, x2 - 3, x3 - 100} gt!_A(x1,x2) = max{2, x1 - 9, x2 - 9} not!_A(x1) = max{13, x1 - 20} id!_A(x1) = max{15, x1 - 19} true!_A = 1 false!_A = 3 zero!_A = 4 partial status: pi(plus#) = [] pi(s) = [1] pi(if) = [1, 2, 3] pi(gt) = [1] pi(not) = [1] pi(id) = [1] pi(true) = [] pi(false) = [] pi(zero) = [] The following rules are removed: p1, p3 -- 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: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) 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: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) 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 r10, r11, r13, 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: plus#_A(x1,x2) = max{0, x1 - 211, x2 - 129} id_A(x1) = max{79, x1 + 33} s_A(x1) = max{41, x1 + 34} if_A(x1,x2,x3) = max{126, x1 - 1, x2 + 34, x3} gt_A(x1,x2) = max{129, x1 - 42, x2 - 35} true_A = 129 false_A = 3 zero_A = 34 plus#!_A(x1,x2) = max{36, x1 - 163, x2 - 211} id!_A(x1) = max{1, x1 - 171} s!_A(x1) = x1 + 35 if!_A(x1,x2,x3) = max{38, x1 - 130, x2 - 80, x3 - 207} gt!_A(x1,x2) = max{2, x1 - 175, x2 - 176} true!_A = 0 false!_A = 0 zero!_A = 1 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 59, x2 - 20} id_A(x1) = max{19, x1 + 18} s_A(x1) = max{19, x1} if_A(x1,x2,x3) = max{19, x1 - 13, x2, x3} gt_A(x1,x2) = max{32, x1 - 25, x2 - 10} true_A = 19 false_A = 32 zero_A = 9 plus#!_A(x1,x2) = max{1, x1 - 21, x2 - 79} id!_A(x1) = max{0, x1 - 22} s!_A(x1) = 0 if!_A(x1,x2,x3) = max{2, x1 - 53, x2 - 43, x3 - 20} gt!_A(x1,x2) = max{0, x1 - 38, x2 - 23} true!_A = 0 false!_A = 0 zero!_A = 1 partial status: pi(plus#) = [1] pi(id) = [1] pi(s) = [1] pi(if) = [2, 3] pi(gt) = [1, 2] 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: 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 (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 - 30, x2 - 30} s_A(x1) = max{33, x1 + 29} gt#!_A(x1,x2) = max{2, x1 - 30, x2 - 34} s!_A(x1) = max{1, x1 - 185} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{0, x1 - 28, x2 - 28} s_A(x1) = max{30, x1 + 27} gt#!_A(x1,x2) = max{1, x1 - 31, x2 - 31} s!_A(x1) = max{2, x1 - 126} partial status: pi(gt#) = [] pi(s) = [] The following rules are removed: p1 Then no dependency pair remains.