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, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: sum#_A(x1) = x1 app_A(x1,x2) = x1 + x2 + 6 cons_A(x1,x2) = 5 sum_A(x1) = 5 nil_A() = 5 plus_A(x1,x2) = x2 + 4 s_A(x1) = 0 if_A(x1,x2,x3) = x2 + x3 + 5 gt_A(x1,x2) = 2 not_A(x1) = x1 + 8 id_A(x1) = x1 + 3 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 app_A(x1,x2) = max{x1 + 76, x2 + 4} cons_A(x1,x2) = max{25, x2} sum_A(x1) = max{46, x1 - 14} nil_A = 20 plus_A(x1,x2) = max{49, x1, x2} s_A(x1) = max{42, x1} if_A(x1,x2,x3) = max{49, x1 - 12, x2, x3} gt_A(x1,x2) = max{1, x1 - 43, x2 - 43} not_A(x1) = max{54, x1} id_A(x1) = max{48, x1} zero_A = 21 true_A = 1 false_A = 1 sum#!_A(x1) = 57 app!_A(x1,x2) = max{x1 + 58, x2 + 9} cons!_A(x1,x2) = max{2, x2 - 14} sum!_A(x1) = max{1, x1 - 17} nil!_A = 7 plus!_A(x1,x2) = max{59, x1 + 10, x2 + 17} s!_A(x1) = 2 if!_A(x1,x2,x3) = 1 gt!_A(x1,x2) = max{x1 - 1, x2 + 18} not!_A(x1) = max{41, x1 - 2} id!_A(x1) = x1 + 3 zero!_A = 41 true!_A = 40 false!_A = 19 partial status: pi(sum#) = [1] pi(app) = [1, 2] pi(cons) = [] pi(sum) = [] pi(nil) = [] pi(plus) = [] pi(s) = [] pi(if) = [] pi(gt) = [] pi(not) = [1] 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: 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: 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 + 3 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: app#_A(x1,x2) = 0 cons_A(x1,x2) = max{5, x1 - 239, x2 - 9} app#!_A(x1,x2) = max{109, x1 - 142, x2 - 1} cons!_A(x1,x2) = max{108, x1 - 384, x2 - 143} 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 r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: sum#_A(x1) = 1 cons_A(x1,x2) = 2 plus_A(x1,x2) = x2 + 5 s_A(x1) = 0 if_A(x1,x2,x3) = x2 + x3 + 6 gt_A(x1,x2) = 2 not_A(x1) = x1 + 9 id_A(x1) = x1 + 1 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) = max{0, x1 - 143} cons_A(x1,x2) = max{84, x2 + 58} plus_A(x1,x2) = max{x1, x2} s_A(x1) = max{11, x1} if_A(x1,x2,x3) = max{8, x1 - 30, x2, x3} gt_A(x1,x2) = max{12, x1 - 13, x2 - 18} not_A(x1) = max{26, x1 - 30} id_A(x1) = max{6, x1} zero_A = 0 true_A = 1 false_A = 1 sum#!_A(x1) = max{54, x1 - 29} cons!_A(x1,x2) = max{0, x2 - 29} plus!_A(x1,x2) = max{24, x1 + 17, x2 + 2} s!_A(x1) = x1 + 3 if!_A(x1,x2,x3) = max{30, x1 + 17, x2 - 2, x3 - 7} gt!_A(x1,x2) = max{27, x1 + 14, x2 - 12} not!_A(x1) = max{29, x1 - 13} id!_A(x1) = max{16, x1 - 31} zero!_A = 16 true!_A = 4 false!_A = 15 partial status: pi(sum#) = [] pi(cons) = [] pi(plus) = [] pi(s) = [] pi(if) = [2, 3] pi(gt) = [] pi(not) = [1] pi(id) = [1] 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: matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: plus#_A(x1,x2) = 22 s_A(x1) = 24 if_A(x1,x2,x3) = x2 + x3 + 9 gt_A(x1,x2) = 9 not_A(x1) = x1 + 12 id_A(x1) = x1 + 7 true_A() = 1 false_A() = 1 zero_A() = 2 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = 0 s_A(x1) = x1 + 30 if_A(x1,x2,x3) = max{x1 + 24, x2 + 4, x3} gt_A(x1,x2) = max{3, x1 - 36, x2 - 36} not_A(x1) = x1 + 30 id_A(x1) = x1 + 22 true_A = 3 false_A = 3 zero_A = 35 plus#!_A(x1,x2) = max{x1 + 40, x2 + 11} s!_A(x1) = 24 if!_A(x1,x2,x3) = max{70, x1 - 34, x2 + 25, x3 - 34} gt!_A(x1,x2) = max{x1 - 34, x2 + 41} not!_A(x1) = max{37, x1 - 4} id!_A(x1) = max{9, x1 - 6} true!_A = 23 false!_A = 0 zero!_A = 24 partial status: pi(plus#) = [] pi(s) = [] pi(if) = [3] pi(gt) = [] pi(not) = [1] 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: matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: plus#_A(x1,x2) = x1 + 4 id_A(x1) = x1 + 8 s_A(x1) = x1 + 3 if_A(x1,x2,x3) = x2 + x3 + 10 gt_A(x1,x2) = x2 + 2 true_A() = 1 false_A() = 1 zero_A() = 2 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 386, x2 - 167} id_A(x1) = x1 + 82 s_A(x1) = x1 + 110 if_A(x1,x2,x3) = max{154, x1 - 21, x2 + 84, x3} gt_A(x1,x2) = max{187, x1 - 170, x2 - 170} true_A = 110 false_A = 172 zero_A = 169 plus#!_A(x1,x2) = max{390, x1 - 193, x2 - 284} id!_A(x1) = 0 s!_A(x1) = x1 + 388 if!_A(x1,x2,x3) = max{389, x2 - 173, x3 - 111} gt!_A(x1,x2) = max{0, x1 - 167, x2 - 167} true!_A = 1 false!_A = 1 zero!_A = 2 partial status: pi(plus#) = [1] pi(id) = [1] pi(s) = [] pi(if) = [] 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: matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: gt#_A(x1,x2) = x1 + x2 s_A(x1) = x1 + 3 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{0, x1 - 56, x2 - 56} s_A(x1) = max{138, x1 + 55} gt#!_A(x1,x2) = max{12, x1 - 139, x2 - 139} s!_A(x1) = max{11, x1 + 1} partial status: pi(gt#) = [1] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.