YES We show the termination of the TRS R: times(x,|0|()) -> |0|() times(x,s(y)) -> plus(times(x,y),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: times#(x,s(y)) -> plus#(times(x,y),x) p2: times#(x,s(y)) -> times#(x,y) 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: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: gt(s(x),s(y)) -> gt(x,y) The estimated dependency graph contains the following SCCs: {p2} {p3, p10, p14} {p18} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: times#(x,s(y)) -> times#(x,y) and R consists of: r1: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: 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: times#_A(x1,x2) = max{0, x2 - 26} s_A(x1) = x1 + 25 times#!_A(x1,x2) = max{2, x1 - 1, x2 - 171} s!_A(x1) = max{1, x1 - 170} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: times#_A(x1,x2) = max{0, x2 - 11} s_A(x1) = max{17, x1 + 10} times#!_A(x1,x2) = max{1, x1 - 1, x2 - 49} s!_A(x1) = max{32, x1 - 50} partial status: pi(times#) = [2] pi(s) = [1] 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: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r7, r8, r9, r10, r11, r12, r13 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 - 99, x2 - 99} s_A(x1) = max{23, x1 + 1} if_A(x1,x2,x3) = max{27, x1 - 7, x2, x3} gt_A(x1,x2) = max{105, x1 - 24, x2 - 2} not_A(x1) = max{32, x1 - 7} id_A(x1) = max{68, x1} true_A = 32 false_A = 32 zero_A = 1 plus#!_A(x1,x2) = max{8, x1 - 141, x2 - 142} s!_A(x1) = x1 + 7 if!_A(x1,x2,x3) = max{0, x1 - 119, x2 - 139, x3 - 146} gt!_A(x1,x2) = max{3, x1 - 139, x2 - 131} not!_A(x1) = max{9, x1 - 115} id!_A(x1) = max{4, x1 - 139} true!_A = 2 false!_A = 0 zero!_A = 3 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 155, x2 - 155} s_A(x1) = max{154, x1 + 43} if_A(x1,x2,x3) = max{83, x1 - 2, x2, x3} gt_A(x1,x2) = max{101, x1 - 155, x2 - 44} not_A(x1) = max{99, x1 - 2} id_A(x1) = max{44, x1} true_A = 1 false_A = 99 zero_A = 0 plus#!_A(x1,x2) = max{1, x1 - 152, x2 - 190} s!_A(x1) = max{54, x1 + 45} if!_A(x1,x2,x3) = max{55, x1 - 304, x2 - 360, x3 - 56} gt!_A(x1,x2) = max{54, x1 - 315, x2 - 189} not!_A(x1) = max{56, x1 - 102} id!_A(x1) = max{53, x1 - 100} true!_A = 46 false!_A = 0 zero!_A = 47 partial status: pi(plus#) = [] pi(s) = [1] pi(if) = [1, 2, 3] pi(gt) = [] 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: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: 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: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r8, r9, r11, r12, r13 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 - 51, x2 - 42} id_A(x1) = max{6, x1} s_A(x1) = x1 + 20 if_A(x1,x2,x3) = max{41, x1 - 1, x2 + 5, x3} gt_A(x1,x2) = max{21, x1 - 21, x2 - 21} true_A = 10 false_A = 17 zero_A = 20 plus#!_A(x1,x2) = max{2, x1 - 8, x2 - 42} id!_A(x1) = max{4, x1 - 10} s!_A(x1) = max{3, x1 - 131} if!_A(x1,x2,x3) = max{5, x2 - 18, x3 - 31} gt!_A(x1,x2) = max{5, x1 - 29, x2 - 21} 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 - 35, x2 - 27} id_A(x1) = max{1, x1} s_A(x1) = max{26, x1} if_A(x1,x2,x3) = max{14, x1 - 5, x2, x3} gt_A(x1,x2) = max{4, x1 - 27, x2 - 18} true_A = 3 false_A = 3 zero_A = 17 plus#!_A(x1,x2) = max{15, x1 - 58, x2 - 50} id!_A(x1) = max{10, x1 - 59} s!_A(x1) = max{14, x1 + 12} if!_A(x1,x2,x3) = max{x1 + 17, x2 - 24, x3 - 27} gt!_A(x1,x2) = max{0, x2 - 49} true!_A = 13 false!_A = 0 zero!_A = 14 partial status: pi(plus#) = [1] pi(id) = [1] pi(s) = [1] pi(if) = [1, 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: times(x,|0|()) -> |0|() r2: times(x,s(y)) -> plus(times(x,y),x) r3: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r4: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r5: plus(zero(),y) -> y r6: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r7: id(x) -> x r8: if(true(),x,y) -> x r9: if(false(),x,y) -> y r10: not(x) -> if(x,false(),true()) r11: gt(s(x),zero()) -> true() r12: gt(zero(),y) -> false() r13: 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 - 63, x2 - 63} s_A(x1) = x1 + 62 gt#!_A(x1,x2) = max{7, x1 - 63, x2 - 102} s!_A(x1) = max{6, x1 - 103} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{0, x1 - 10, x2 - 10} s_A(x1) = x1 + 9 gt#!_A(x1,x2) = max{1, x1 - 10, x2 - 10} s!_A(x1) = 0 partial status: pi(gt#) = [2] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.