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, r9 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: sum#_A(x1) = x1 app_A(x1,x2) = x1 + x2 + 1 cons_A(x1,x2) = x2 + 6 sum_A(x1) = 7 nil_A() = 1 plus_A(x1,x2) = x1 + x2 + 1 zero_A() = 1 sum#!_A(x1) = x1 app!_A(x1,x2) = x1 + x2 + 4 cons!_A(x1,x2) = 9 sum!_A(x1) = 12 nil!_A() = 8 plus!_A(x1,x2) = x2 + 3 zero!_A() = 7 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1) = 0 app_A(x1,x2) = max{x1 + 3, x2 + 2} cons_A(x1,x2) = x2 sum_A(x1) = 0 nil_A = 0 plus_A(x1,x2) = max{2, x2} zero_A = 8 sum#!_A(x1) = x1 + 10 app!_A(x1,x2) = max{x1 + 14, x2 + 10} cons!_A(x1,x2) = x2 + 2 sum!_A(x1) = 0 nil!_A = 1 plus!_A(x1,x2) = max{8, x1 + 4, x2 - 32} zero!_A = 25 partial status: pi(sum#) = [1] pi(app) = [1, 2] pi(cons) = [] pi(sum) = [] pi(nil) = [] pi(plus) = [1, 2] 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: 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: 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!): 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) = x1 + 7 cons!_A(x1,x2) = x1 + 6 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: app#_A(x1,x2) = 0 cons_A(x1,x2) = max{x1 + 45, x2 - 14} app#!_A(x1,x2) = 77 cons!_A(x1,x2) = max{76, x1 - 13} partial status: pi(app#) = [2] 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 r1, r15, r16, r17 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: sum#_A(x1) = x1 cons_A(x1,x2) = x2 + 3 plus_A(x1,x2) = 1 app_A(x1,x2) = x1 + x2 + 1 nil_A() = 1 gt_A(x1,x2) = 1 s_A(x1) = 1 zero_A() = 1 true_A() = 1 false_A() = 1 sum#!_A(x1) = x1 cons!_A(x1,x2) = x2 + 1 plus!_A(x1,x2) = 7 app!_A(x1,x2) = 5 nil!_A() = 3 gt!_A(x1,x2) = 5 s!_A(x1) = 6 zero!_A() = 1 true!_A() = 0 false!_A() = 0 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: sum#_A(x1) = 0 cons_A(x1,x2) = max{45, x2 + 24} plus_A(x1,x2) = max{59, x1 + 24, x2 + 21} app_A(x1,x2) = max{70, x1 - 37, x2 + 24} nil_A = 56 gt_A(x1,x2) = max{56, x1 - 1, x2 - 30} s_A(x1) = x1 zero_A = 0 true_A = 3 false_A = 1 sum#!_A(x1) = max{1, x1 - 35} cons!_A(x1,x2) = 0 plus!_A(x1,x2) = x2 + 27 app!_A(x1,x2) = max{93, x1 - 47, x2 + 24} nil!_A = 1 gt!_A(x1,x2) = max{28, x1 - 27, x2 - 1} s!_A(x1) = max{26, x1 - 28} zero!_A = 1 true!_A = 0 false!_A = 0 partial status: pi(sum#) = [1] pi(cons) = [2] pi(plus) = [1, 2] pi(app) = [1, 2] pi(nil) = [] pi(gt) = [1] pi(s) = [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: 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: plus#_A(x1,x2) = 0 s_A(x1) = 2 if_A(x1,x2,x3) = x2 + x3 + 1 gt_A(x1,x2) = 1 not_A(x1) = 3 id_A(x1) = x1 + 5 true_A() = 1 false_A() = 1 zero_A() = 1 plus#!_A(x1,x2) = 9 s!_A(x1) = x1 + 10 if!_A(x1,x2,x3) = 17 gt!_A(x1,x2) = 8 not!_A(x1) = 18 id!_A(x1) = 14 true!_A() = 7 false!_A() = 7 zero!_A() = 8 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{x1 + 39, x2 + 37} s_A(x1) = x1 + 38 if_A(x1,x2,x3) = max{x2 + 18, x3} gt_A(x1,x2) = max{111, x1 - 150} not_A(x1) = max{37, x1 - 74} id_A(x1) = max{18, x1 + 13} true_A = 1 false_A = 1 zero_A = 1 plus#!_A(x1,x2) = max{x1 + 150, x2 + 146} s!_A(x1) = x1 + 2 if!_A(x1,x2,x3) = max{189, x3 - 14} gt!_A(x1,x2) = max{35, x1 - 2, x2 + 12} not!_A(x1) = max{9, x1 - 12} id!_A(x1) = max{0, x1 - 1} true!_A = 12 false!_A = 9 zero!_A = 13 partial status: pi(plus#) = [] pi(s) = [] pi(if) = [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: 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 r15, r16, r17 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: plus#_A(x1,x2) = x1 id_A(x1) = x1 + 1 s_A(x1) = x1 + 4 if_A(x1,x2,x3) = x2 + x3 + 1 gt_A(x1,x2) = x2 + 1 zero_A() = 1 true_A() = 1 false_A() = 1 plus#!_A(x1,x2) = 4 id!_A(x1) = 3 s!_A(x1) = x1 + 1 if!_A(x1,x2,x3) = 0 gt!_A(x1,x2) = 2 zero!_A() = 1 true!_A() = 0 false!_A() = 0 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 41} id_A(x1) = x1 + 40 s_A(x1) = max{42, x1 + 26} if_A(x1,x2,x3) = max{27, x1 + 25, x2 + 26, x3 - 2} gt_A(x1,x2) = max{1, x1 - 43, x2 - 21} zero_A = 37 true_A = 16 false_A = 1 plus#!_A(x1,x2) = max{126, x1 - 41} id!_A(x1) = 20 s!_A(x1) = max{125, x1 + 84} if!_A(x1,x2,x3) = max{21, x1 - 33, x2 - 41, x3 - 41} gt!_A(x1,x2) = max{127, x1 - 41, x2 + 86} zero!_A = 125 true!_A = 124 false!_A = 87 partial status: pi(plus#) = [1] pi(id) = [1] pi(s) = [1] pi(if) = [] pi(gt) = [] 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: 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 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: gt#_A(x1,x2) = x1 + x2 s_A(x1) = x1 + 6 if_A(x1,x2,x3) = x2 + x3 + 1 false_A() = 2 gt#!_A(x1,x2) = x1 s!_A(x1) = 18 if!_A(x1,x2,x3) = 14 false!_A() = 0 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = 0 s_A(x1) = max{26, x1 - 27} if_A(x1,x2,x3) = max{49, x1 + 32, x2 - 27, x3} false_A = 45 gt#!_A(x1,x2) = max{x1 - 27, x2 + 44} s!_A(x1) = max{48, x1 + 43} if!_A(x1,x2,x3) = max{47, x1 + 31, x2 - 46} false!_A = 0 partial status: pi(gt#) = [] pi(s) = [] pi(if) = [3] pi(false) = [] The following rules are removed: p1 Then no dependency pair remains.