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 (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 - 25, x2 - 25} s_A(x1) = x1 + 24 minus#!_A(x1,x2) = max{2, x1 - 21, x2 - 161} s!_A(x1) = max{1, x1 - 162} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: minus#_A(x1,x2) = max{0, x1 - 6, x2 - 6} s_A(x1) = max{32, x1 + 5} minus#!_A(x1,x2) = max{4, x1 - 33} s!_A(x1) = max{3, x1 - 165} 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: 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 (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: double#_A(x1) = max{0, x1 - 23} s_A(x1) = max{42, x1 + 22} double#!_A(x1) = max{1, x1 - 40} s!_A(x1) = x1 + 121 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: double#_A(x1) = max{0, x1 - 8} s_A(x1) = x1 + 7 double#!_A(x1) = max{1, x1 - 8} s!_A(x1) = 0 partial status: pi(double#) = [] 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: 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, >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{x1, x2 - 8} s_A(x1) = x1 + 9 if_A(x1,x2,x3) = max{x1, x2, x3} gt_A(x1,x2) = max{x1 - 26, x2} not_A(x1) = max{7, x1} id_A(x1) = x1 true_A = 0 false_A = 0 zero_A = 0 plus#!_A(x1,x2) = max{0, x1 - 4, x2 - 12} s!_A(x1) = max{27, x1 + 23} if!_A(x1,x2,x3) = max{x1 + 24, x3 + 36} gt!_A(x1,x2) = max{28, x1 - 13, x2 - 13} not!_A(x1) = max{37, x1 + 25} id!_A(x1) = max{11, x1 - 15} true!_A = 26 false!_A = 26 zero!_A = 27 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 92, x2 - 102} s_A(x1) = x1 + 41 if_A(x1,x2,x3) = max{90, x1 + 11, x2 + 1, x3} gt_A(x1,x2) = max{21, x1 - 42, x2 - 72} not_A(x1) = max{90, x1 + 20} id_A(x1) = max{79, x1 + 35} true_A = 21 false_A = 21 zero_A = 0 plus#!_A(x1,x2) = max{49, x1 - 446, x2 - 447} s!_A(x1) = max{48, x1 - 97} if!_A(x1,x2,x3) = max{51, x1 - 332, x2 - 483, x3 - 496} gt!_A(x1,x2) = max{51, x1 - 96, x2 - 322} not!_A(x1) = max{52, x1 - 24} id!_A(x1) = max{50, x1 - 96} true!_A = 0 false!_A = 0 zero!_A = 1 partial status: pi(plus#) = [] 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, 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: 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 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 - 40, x2 - 22} id_A(x1) = x1 s_A(x1) = max{14, x1 + 12} if_A(x1,x2,x3) = max{16, x1 - 1, x2 + 12, x3} gt_A(x1,x2) = max{22, x1 - 30, x2 - 18} true_A = 14 false_A = 2 zero_A = 0 plus#!_A(x1,x2) = max{39, x1 - 72, x2 - 54} id!_A(x1) = max{40, x1 - 73} s!_A(x1) = 40 if!_A(x1,x2,x3) = max{29, x1 - 23, x2 - 3, x3 - 15} gt!_A(x1,x2) = max{29, x1 - 88, x2 - 15} true!_A = 1 false!_A = 0 zero!_A = 2 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 91, x2 - 60} id_A(x1) = max{28, x1 + 15} s_A(x1) = max{26, x1 + 16} if_A(x1,x2,x3) = max{33, x1 - 1, x2 + 16, x3} gt_A(x1,x2) = max{60, x1 - 27, x2 - 17} true_A = 60 false_A = 60 zero_A = 0 plus#!_A(x1,x2) = max{3, x1 - 117, x2 - 60} id!_A(x1) = max{1, x1 - 89} s!_A(x1) = max{5, x1 - 121} if!_A(x1,x2,x3) = max{2, x1 - 95, x2 - 122, x3 - 114} gt!_A(x1,x2) = max{4, x1 - 114, x2 - 27} 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) = [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: 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 (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 - 62, x2 - 62} s_A(x1) = x1 + 61 gt#!_A(x1,x2) = max{4, x1 - 62, x2 - 94} s!_A(x1) = max{3, x1 - 94} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{0, x1 - 19, x2 - 19} s_A(x1) = x1 + 18 gt#!_A(x1,x2) = max{1, x1 - 16, x2 - 99} s!_A(x1) = max{2, x1 - 98} partial status: pi(gt#) = [] pi(s) = [] The following rules are removed: p1 Then no dependency pair remains.