YES We show the termination of the TRS R: plus(|0|(),x) -> x plus(s(x),y) -> s(plus(p(s(x)),y)) times(|0|(),y) -> |0|() times(s(x),y) -> plus(y,times(p(s(x)),y)) p(s(|0|())) -> |0|() p(s(s(x))) -> s(p(s(x))) fac(|0|(),x) -> x fac(s(x),y) -> fac(p(s(x)),times(s(x),y)) factorial(x) -> fac(x,s(|0|())) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: plus#(s(x),y) -> plus#(p(s(x)),y) p2: plus#(s(x),y) -> p#(s(x)) p3: times#(s(x),y) -> plus#(y,times(p(s(x)),y)) p4: times#(s(x),y) -> times#(p(s(x)),y) p5: times#(s(x),y) -> p#(s(x)) p6: p#(s(s(x))) -> p#(s(x)) p7: fac#(s(x),y) -> fac#(p(s(x)),times(s(x),y)) p8: fac#(s(x),y) -> p#(s(x)) p9: fac#(s(x),y) -> times#(s(x),y) p10: factorial#(x) -> fac#(x,s(|0|())) and R consists of: r1: plus(|0|(),x) -> x r2: plus(s(x),y) -> s(plus(p(s(x)),y)) r3: times(|0|(),y) -> |0|() r4: times(s(x),y) -> plus(y,times(p(s(x)),y)) r5: p(s(|0|())) -> |0|() r6: p(s(s(x))) -> s(p(s(x))) r7: fac(|0|(),x) -> x r8: fac(s(x),y) -> fac(p(s(x)),times(s(x),y)) r9: factorial(x) -> fac(x,s(|0|())) The estimated dependency graph contains the following SCCs: {p7} {p4} {p1} {p6} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: fac#(s(x),y) -> fac#(p(s(x)),times(s(x),y)) and R consists of: r1: plus(|0|(),x) -> x r2: plus(s(x),y) -> s(plus(p(s(x)),y)) r3: times(|0|(),y) -> |0|() r4: times(s(x),y) -> plus(y,times(p(s(x)),y)) r5: p(s(|0|())) -> |0|() r6: p(s(s(x))) -> s(p(s(x))) r7: fac(|0|(),x) -> x r8: fac(s(x),y) -> fac(p(s(x)),times(s(x),y)) r9: factorial(x) -> fac(x,s(|0|())) The set of usable rules consists of r1, r5, r6 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: fac#_A(x1,x2) = max{0, x1 - 29} s_A(x1) = x1 + 58 p_A(x1) = max{30, x1 - 1} times_A(x1,x2) = max{2, x1 - 70, x2 + 1} plus_A(x1,x2) = max{x1 - 38, x2 + 39} |0|_A = 2 fac#!_A(x1,x2) = max{17, x1 - 14} s!_A(x1) = max{4, x1 - 25} p!_A(x1) = 5 times!_A(x1,x2) = max{6, x1 - 56, x2 - 23} plus!_A(x1,x2) = max{x1 - 56, x2 + 26} |0|!_A = 1 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: fac#_A(x1,x2) = max{1, x1 - 5} s_A(x1) = max{4, x1 - 17} p_A(x1) = 6 times_A(x1,x2) = max{2, x1 - 8} plus_A(x1,x2) = max{3, x2 + 1} |0|_A = 6 fac#!_A(x1,x2) = 61 s!_A(x1) = max{58, x1 + 30} p!_A(x1) = 12 times!_A(x1,x2) = max{60, x1 - 7, x2 + 11} plus!_A(x1,x2) = max{61, x1 + 48, x2 + 55} |0|!_A = 37 partial status: pi(fac#) = [] pi(s) = [] pi(p) = [1] pi(times) = [] pi(plus) = [2] pi(|0|) = [] 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: times#(s(x),y) -> times#(p(s(x)),y) and R consists of: r1: plus(|0|(),x) -> x r2: plus(s(x),y) -> s(plus(p(s(x)),y)) r3: times(|0|(),y) -> |0|() r4: times(s(x),y) -> plus(y,times(p(s(x)),y)) r5: p(s(|0|())) -> |0|() r6: p(s(s(x))) -> s(p(s(x))) r7: fac(|0|(),x) -> x r8: fac(s(x),y) -> fac(p(s(x)),times(s(x),y)) r9: factorial(x) -> fac(x,s(|0|())) The set of usable rules consists of r5, r6 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, x1 - 50, x2 - 63} s_A(x1) = x1 + 49 p_A(x1) = max{16, x1 - 33} |0|_A = 17 times#!_A(x1,x2) = max{29, x1 - 19} s!_A(x1) = max{28, x1 + 9} p!_A(x1) = max{31, x1 + 26} |0|!_A = 25 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: times#_A(x1,x2) = max{0, x1 - 8, x2 - 3} s_A(x1) = max{7, x1 - 8} p_A(x1) = max{6, x1} |0|_A = 7 times#!_A(x1,x2) = x2 + 1 s!_A(x1) = max{2, x1 - 65} p!_A(x1) = 6 |0|!_A = 3 partial status: pi(times#) = [] pi(s) = [] pi(p) = [1] pi(|0|) = [] 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),y) -> plus#(p(s(x)),y) and R consists of: r1: plus(|0|(),x) -> x r2: plus(s(x),y) -> s(plus(p(s(x)),y)) r3: times(|0|(),y) -> |0|() r4: times(s(x),y) -> plus(y,times(p(s(x)),y)) r5: p(s(|0|())) -> |0|() r6: p(s(s(x))) -> s(p(s(x))) r7: fac(|0|(),x) -> x r8: fac(s(x),y) -> fac(p(s(x)),times(s(x),y)) r9: factorial(x) -> fac(x,s(|0|())) The set of usable rules consists of r5, r6 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 - 24, x2 - 16} s_A(x1) = max{23, x1 + 14} p_A(x1) = max{9, x1 - 14} |0|_A = 50 plus#!_A(x1,x2) = max{1, x1 - 10} s!_A(x1) = max{2, x1 - 66} p!_A(x1) = max{3, x1 - 65} |0|!_A = 0 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 5, x2 - 4} s_A(x1) = max{4, x1 - 6} p_A(x1) = max{2, x1} |0|_A = 3 plus#!_A(x1,x2) = 0 s!_A(x1) = 0 p!_A(x1) = 5 |0|!_A = 0 partial status: pi(plus#) = [] pi(s) = [] pi(p) = [1] pi(|0|) = [] 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: p#(s(s(x))) -> p#(s(x)) and R consists of: r1: plus(|0|(),x) -> x r2: plus(s(x),y) -> s(plus(p(s(x)),y)) r3: times(|0|(),y) -> |0|() r4: times(s(x),y) -> plus(y,times(p(s(x)),y)) r5: p(s(|0|())) -> |0|() r6: p(s(s(x))) -> s(p(s(x))) r7: fac(|0|(),x) -> x r8: fac(s(x),y) -> fac(p(s(x)),times(s(x),y)) r9: factorial(x) -> fac(x,s(|0|())) 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: p#_A(x1) = 0 s_A(x1) = max{2, x1 - 10} p#!_A(x1) = 1 s!_A(x1) = 3 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: p#_A(x1) = 0 s_A(x1) = max{12, x1 - 12} p#!_A(x1) = max{1, x1 - 126} s!_A(x1) = max{4, x1 - 101} partial status: pi(p#) = [1] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.