YES We show the termination of the TRS R: app(nil(),k) -> k app(l,nil()) -> l app(cons(x,l),k) -> cons(x,app(l,k)) sum(cons(x,nil())) -> cons(x,nil()) sum(cons(x,cons(y,l))) -> sum(cons(plus(x,y),l)) sum(app(l,cons(x,cons(y,k)))) -> sum(app(l,sum(cons(x,cons(y,k))))) 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: app#(cons(x,l),k) -> app#(l,k) p2: sum#(cons(x,cons(y,l))) -> sum#(cons(plus(x,y),l)) p3: sum#(cons(x,cons(y,l))) -> plus#(x,y) p4: sum#(app(l,cons(x,cons(y,k)))) -> sum#(app(l,sum(cons(x,cons(y,k))))) p5: sum#(app(l,cons(x,cons(y,k)))) -> app#(l,sum(cons(x,cons(y,k)))) p6: sum#(app(l,cons(x,cons(y,k)))) -> sum#(cons(x,cons(y,k))) p7: plus#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p8: plus#(s(x),s(y)) -> if#(gt(x,y),x,y) p9: plus#(s(x),s(y)) -> gt#(x,y) p10: plus#(s(x),s(y)) -> if#(not(gt(x,y)),id(x),id(y)) p11: plus#(s(x),s(y)) -> not#(gt(x,y)) p12: plus#(s(x),s(y)) -> id#(x) p13: plus#(s(x),s(y)) -> id#(y) p14: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) p15: plus#(s(x),x) -> if#(gt(x,x),id(x),id(x)) p16: plus#(s(x),x) -> gt#(x,x) p17: plus#(s(x),x) -> id#(x) p18: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) p19: plus#(id(x),s(y)) -> if#(gt(s(y),y),y,s(y)) p20: plus#(id(x),s(y)) -> gt#(s(y),y) p21: not#(x) -> if#(x,false(),true()) p22: gt#(s(x),s(y)) -> gt#(x,y) and R consists of: r1: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(plus(x,y),l)) r6: sum(app(l,cons(x,cons(y,k)))) -> sum(app(l,sum(cons(x,cons(y,k))))) r7: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r8: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r9: plus(zero(),y) -> y r10: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r11: id(x) -> x r12: if(true(),x,y) -> x r13: if(false(),x,y) -> y r14: not(x) -> if(x,false(),true()) r15: gt(s(x),zero()) -> true() r16: gt(zero(),y) -> false() r17: gt(s(x),s(y)) -> gt(x,y) The estimated dependency graph contains the following SCCs: {p4} {p1} {p2} {p7, p14, p18} {p22} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: sum#(app(l,cons(x,cons(y,k)))) -> sum#(app(l,sum(cons(x,cons(y,k))))) and R consists of: r1: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(plus(x,y),l)) r6: sum(app(l,cons(x,cons(y,k)))) -> sum(app(l,sum(cons(x,cons(y,k))))) r7: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r8: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r9: plus(zero(),y) -> y r10: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r11: id(x) -> x r12: if(true(),x,y) -> x r13: if(false(),x,y) -> y r14: not(x) -> if(x,false(),true()) r15: gt(s(x),zero()) -> true() r16: gt(zero(),y) -> false() r17: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r1, r2, r3, r4, r5, r15, r16 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: sum#_A(x1) = max{3, x1} app_A(x1,x2) = max{101, x1 + 50, x2 + 98} cons_A(x1,x2) = 2 sum_A(x1) = 2 nil_A = 2 plus_A(x1,x2) = max{x1 + 78, x2 + 48} gt_A(x1,x2) = max{3, x1 - 27} s_A(x1) = x1 + 28 zero_A = 95 true_A = 2 false_A = 68 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1) = x1 + 9 app_A(x1,x2) = max{12, x1 + 9, x2 + 7} cons_A(x1,x2) = max{10, x2} sum_A(x1) = max{10, x1 - 18} nil_A = 1 plus_A(x1,x2) = 16 gt_A(x1,x2) = 0 s_A(x1) = 63 zero_A = 0 true_A = 0 false_A = 0 sum#!_A(x1) = 20 app!_A(x1,x2) = 21 cons!_A(x1,x2) = x2 + 10 sum!_A(x1) = 12 nil!_A = 11 plus!_A(x1,x2) = 0 gt!_A(x1,x2) = max{95, x1 - 64, x2 + 32} s!_A(x1) = x1 + 31 zero!_A = 34 true!_A = 33 false!_A = 33 partial status: pi(sum#) = [1] pi(app) = [2] pi(cons) = [] pi(sum) = [] pi(nil) = [] pi(plus) = [] pi(gt) = [] pi(s) = [] 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: app#(cons(x,l),k) -> app#(l,k) and R consists of: r1: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(plus(x,y),l)) r6: sum(app(l,cons(x,cons(y,k)))) -> sum(app(l,sum(cons(x,cons(y,k))))) r7: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r8: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r9: plus(zero(),y) -> y r10: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r11: id(x) -> x r12: if(true(),x,y) -> x r13: if(false(),x,y) -> y r14: not(x) -> if(x,false(),true()) r15: gt(s(x),zero()) -> true() r16: gt(zero(),y) -> false() r17: 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: max/plus interpretation on natural numbers: app#_A(x1,x2) = x2 + 183 cons_A(x1,x2) = max{181, x1 - 359, x2 - 421} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: app#_A(x1,x2) = max{0, x1 - 6} cons_A(x1,x2) = max{8, x1 - 39, x2 + 5} app#!_A(x1,x2) = max{1, x1 - 6} cons!_A(x1,x2) = max{0, x2 - 710} partial status: pi(app#) = [] pi(cons) = [] 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: sum#(cons(x,cons(y,l))) -> sum#(cons(plus(x,y),l)) and R consists of: r1: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(plus(x,y),l)) r6: sum(app(l,cons(x,cons(y,k)))) -> sum(app(l,sum(cons(x,cons(y,k))))) r7: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r8: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r9: plus(zero(),y) -> y r10: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r11: id(x) -> x r12: if(true(),x,y) -> x r13: if(false(),x,y) -> y r14: not(x) -> if(x,false(),true()) r15: gt(s(x),zero()) -> true() r16: gt(zero(),y) -> false() r17: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: sum#_A(x1) = max{67, x1 + 11} cons_A(x1,x2) = max{x1 + 247, x2 + 33} plus_A(x1,x2) = max{21, x2 + 7} s_A(x1) = 7 if_A(x1,x2,x3) = max{12, x1 - 14, x2 + 5, x3 + 7} gt_A(x1,x2) = 15 not_A(x1) = max{13, x1 - 7} id_A(x1) = max{11, x1 + 2} zero_A = 2 true_A = 1 false_A = 1 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1) = 0 cons_A(x1,x2) = max{52, x1 - 1, x2 - 15} plus_A(x1,x2) = max{64, x1 + 8, x2 + 8} s_A(x1) = max{29, x1} if_A(x1,x2,x3) = max{28, x1 - 9, x2, x3} gt_A(x1,x2) = max{36, x2 - 24} not_A(x1) = x1 + 29 id_A(x1) = max{56, x1} zero_A = 1 true_A = 29 false_A = 29 sum#!_A(x1) = x1 + 32 cons!_A(x1,x2) = max{0, x2 - 57} plus!_A(x1,x2) = max{0, x2 - 59} s!_A(x1) = max{0, x1 - 64} if!_A(x1,x2,x3) = max{2, x1 - 29, x2 - 59, x3 - 60} gt!_A(x1,x2) = max{0, x1 - 59, x2 - 59} not!_A(x1) = max{1, x1 - 37} id!_A(x1) = max{0, x1 - 60} zero!_A = 1 true!_A = 0 false!_A = 0 partial status: pi(sum#) = [1] pi(cons) = [2] pi(plus) = [] pi(s) = [] pi(if) = [] pi(gt) = [] pi(not) = [] pi(id) = [] 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: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(plus(x,y),l)) r6: sum(app(l,cons(x,cons(y,k)))) -> sum(app(l,sum(cons(x,cons(y,k))))) r7: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r8: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r9: plus(zero(),y) -> y r10: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r11: id(x) -> x r12: if(true(),x,y) -> x r13: if(false(),x,y) -> y r14: not(x) -> if(x,false(),true()) r15: gt(s(x),zero()) -> true() r16: gt(zero(),y) -> false() r17: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r11, r12, r13, r14, r15, r16, r17 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{57, x1 + 2, x2 - 8} s_A(x1) = max{83, x1 + 13} if_A(x1,x2,x3) = max{x2 + 6, x3} gt_A(x1,x2) = max{17, x1 - 66, x2 - 84} not_A(x1) = 17 id_A(x1) = max{48, x1 + 1} true_A = 16 false_A = 1 zero_A = 65 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 19, x2 - 19} s_A(x1) = x1 + 17 if_A(x1,x2,x3) = max{x1 - 17, x2 + 17, x3} gt_A(x1,x2) = max{19, x1 - 35, x2 - 18} not_A(x1) = max{34, x1 - 2} id_A(x1) = max{1, x1} true_A = 1 false_A = 0 zero_A = 0 plus#!_A(x1,x2) = 0 s!_A(x1) = 0 if!_A(x1,x2,x3) = max{53, x1 + 17, x2 + 4} gt!_A(x1,x2) = max{4, x1 - 22, x2 - 22} not!_A(x1) = max{4, x1 - 1} id!_A(x1) = 0 true!_A = 0 false!_A = 0 zero!_A = 1 partial status: pi(plus#) = [1] pi(s) = [1] pi(if) = [3] pi(gt) = [] pi(not) = [] pi(id) = [] 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: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(plus(x,y),l)) r6: sum(app(l,cons(x,cons(y,k)))) -> sum(app(l,sum(cons(x,cons(y,k))))) r7: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r8: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r9: plus(zero(),y) -> y r10: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r11: id(x) -> x r12: if(true(),x,y) -> x r13: if(false(),x,y) -> y r14: not(x) -> if(x,false(),true()) r15: gt(s(x),zero()) -> true() r16: gt(zero(),y) -> false() r17: 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: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(plus(x,y),l)) r6: sum(app(l,cons(x,cons(y,k)))) -> sum(app(l,sum(cons(x,cons(y,k))))) r7: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r8: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r9: plus(zero(),y) -> y r10: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r11: id(x) -> x r12: if(true(),x,y) -> x r13: if(false(),x,y) -> y r14: not(x) -> if(x,false(),true()) r15: gt(s(x),zero()) -> true() r16: gt(zero(),y) -> false() r17: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r12, r13, r15, r16, r17 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: plus#_A(x1,x2) = 1 id_A(x1) = max{2, x1 - 883} s_A(x1) = x1 + 112 if_A(x1,x2,x3) = max{162, x1 - 164, x2 + 56, x3 + 56} gt_A(x1,x2) = max{102, x1 - 388, x2 - 275} true_A = 0 false_A = 0 zero_A = 276 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 69, x2 - 7} id_A(x1) = max{15, x1 + 3} s_A(x1) = x1 + 6 if_A(x1,x2,x3) = max{x1 - 17, x2 + 3, x3} gt_A(x1,x2) = max{20, x1 - 32, x2 - 7} true_A = 20 false_A = 20 zero_A = 0 plus#!_A(x1,x2) = x1 + 2 id!_A(x1) = 8 s!_A(x1) = 18 if!_A(x1,x2,x3) = max{19, x1 - 22, x2 - 40, x3 + 4} gt!_A(x1,x2) = max{2, x1 - 55, x2 - 55} true!_A = 1 false!_A = 0 zero!_A = 2 partial status: pi(plus#) = [] pi(id) = [] pi(s) = [] pi(if) = [2] pi(gt) = [] 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: app(nil(),k) -> k r2: app(l,nil()) -> l r3: app(cons(x,l),k) -> cons(x,app(l,k)) r4: sum(cons(x,nil())) -> cons(x,nil()) r5: sum(cons(x,cons(y,l))) -> sum(cons(plus(x,y),l)) r6: sum(app(l,cons(x,cons(y,k)))) -> sum(app(l,sum(cons(x,cons(y,k))))) r7: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r8: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r9: plus(zero(),y) -> y r10: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r11: id(x) -> x r12: if(true(),x,y) -> x r13: if(false(),x,y) -> y r14: not(x) -> if(x,false(),true()) r15: gt(s(x),zero()) -> true() r16: gt(zero(),y) -> false() r17: 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: max/plus interpretation on natural numbers: gt#_A(x1,x2) = 0 s_A(x1) = max{1, x1 - 26} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{0, x1 - 248, x2 - 248} s_A(x1) = max{266, x1 + 247} gt#!_A(x1,x2) = max{4, x2 - 242} s!_A(x1) = max{3, x1 - 686} partial status: pi(gt#) = [] pi(s) = [] The following rules are removed: p1 Then no dependency pair remains.