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, r6, r7, r10, r12 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: sum#_A(x1) = 1 app_A(x1,x2) = max{25, x1 + 15, x2 + 1} cons_A(x1,x2) = 10 sum_A(x1) = 12 nil_A = 2 plus_A(x1,x2) = max{2, x2 - 10} s_A(x1) = 0 if_A(x1,x2,x3) = max{13, x1 - 4, x2 + 10, x3 + 10} gt_A(x1,x2) = max{18, x1 + 14, x2 + 14} not_A(x1) = max{3, x1 - 19} id_A(x1) = max{1, x1 - 11} true_A = 0 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: sum#_A(x1) = 0 app_A(x1,x2) = x1 + x2 + 2 cons_A(x1,x2) = x2 + 4 sum_A(x1) = 5 nil_A() = 1 plus_A(x1,x2) = x2 + 1 s_A(x1) = 4 if_A(x1,x2,x3) = x2 gt_A(x1,x2) = x2 + 1 not_A(x1) = 1 id_A(x1) = x1 + 1 true_A() = 3 sum#!_A(x1) = x1 + 1 app!_A(x1,x2) = x1 + x2 cons!_A(x1,x2) = x2 + 2 sum!_A(x1) = 7 nil!_A() = 0 plus!_A(x1,x2) = x1 + 8 s!_A(x1) = 10 if!_A(x1,x2,x3) = x2 + x3 + 13 gt!_A(x1,x2) = 13 not!_A(x1) = x1 + 12 id!_A(x1) = 11 true!_A() = 0 partial status: pi(sum#) = [] pi(app) = [1] pi(cons) = [] pi(sum) = [] pi(nil) = [] pi(plus) = [] pi(s) = [] pi(if) = [] pi(gt) = [1] pi(not) = [] pi(id) = [] pi(true) = [] 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) = max{2, x1 - 2} cons_A(x1,x2) = max{8, x1 + 5, x2 + 1} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: app#_A(x1,x2) = x1 cons_A(x1,x2) = x1 + x2 + 2 app#!_A(x1,x2) = 0 cons!_A(x1,x2) = x1 + x2 + 6 partial status: pi(app#) = [] pi(cons) = [2] 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 r4, r7, r8, r9, r10, 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) = x1 + 2 cons_A(x1,x2) = max{x1 + 15, x2 + 21} plus_A(x1,x2) = max{24, x2 + 11} sum_A(x1) = max{42, x1 + 38} nil_A = 54 s_A(x1) = 3 if_A(x1,x2,x3) = max{14, x1 - 16, x2 - 14} gt_A(x1,x2) = 27 not_A(x1) = max{2, x1 - 28} id_A(x1) = 0 zero_A = 3 true_A = 1 false_A = 1 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: sum#_A(x1) = 0 cons_A(x1,x2) = x1 + 2 plus_A(x1,x2) = x2 + 1 sum_A(x1) = x1 + 2 nil_A() = 1 s_A(x1) = 0 if_A(x1,x2,x3) = 2 gt_A(x1,x2) = 1 not_A(x1) = 1 id_A(x1) = x1 + 1 zero_A() = 1 true_A() = 1 false_A() = 1 sum#!_A(x1) = 2 cons!_A(x1,x2) = 5 plus!_A(x1,x2) = 3 sum!_A(x1) = 3 nil!_A() = 0 s!_A(x1) = 5 if!_A(x1,x2,x3) = 4 gt!_A(x1,x2) = 6 not!_A(x1) = 2 id!_A(x1) = 2 zero!_A() = 1 true!_A() = 0 false!_A() = 0 partial status: pi(sum#) = [1] pi(cons) = [2] pi(plus) = [] pi(sum) = [1] pi(nil) = [] 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, 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{x1 + 6, x2 + 4} s_A(x1) = max{54, x1 + 27} if_A(x1,x2,x3) = max{53, x2 + 25, x3} gt_A(x1,x2) = max{8, x1 - 46, x2 - 100} not_A(x1) = 8 id_A(x1) = x1 + 1 true_A = 7 false_A = 1 zero_A = 8 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: plus#_A(x1,x2) = 0 s_A(x1) = 7 if_A(x1,x2,x3) = x2 + x3 + 4 gt_A(x1,x2) = 1 not_A(x1) = 1 id_A(x1) = x1 + 1 true_A() = 1 false_A() = 1 zero_A() = 1 plus#!_A(x1,x2) = x1 + 10 s!_A(x1) = 4 if!_A(x1,x2,x3) = 10 gt!_A(x1,x2) = 3 not!_A(x1) = 9 id!_A(x1) = x1 + 9 true!_A() = 0 false!_A() = 0 zero!_A() = 1 partial status: pi(plus#) = [] pi(s) = [] pi(if) = [2, 3] pi(gt) = [] pi(not) = [] pi(id) = [] pi(true) = [] pi(false) = [] pi(zero) = [] The following rules are removed: p1, p2, p3 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) = max{1, x1 - 34, x2 - 34} s_A(x1) = max{33, x1 + 5} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: gt#_A(x1,x2) = x1 + x2 s_A(x1) = x1 + 1 gt#!_A(x1,x2) = x1 + x2 + 6 s!_A(x1) = x1 + 5 partial status: pi(gt#) = [] pi(s) = [] The following rules are removed: p1 Then no dependency pair remains.