YES We show the termination of the TRS R: plus(x,|0|()) -> x plus(|0|(),y) -> y plus(s(x),y) -> s(plus(x,y)) times(|0|(),y) -> |0|() times(s(|0|()),y) -> y times(s(x),y) -> plus(y,times(x,y)) div(|0|(),y) -> |0|() div(x,y) -> quot(x,y,y) quot(|0|(),s(y),z) -> |0|() quot(s(x),s(y),z) -> quot(x,y,z) quot(x,|0|(),s(z)) -> s(div(x,s(z))) div(div(x,y),z) -> div(x,times(y,z)) eq(|0|(),|0|()) -> true() eq(s(x),|0|()) -> false() eq(|0|(),s(y)) -> false() eq(s(x),s(y)) -> eq(x,y) divides(y,x) -> eq(x,times(div(x,y),y)) prime(s(s(x))) -> pr(s(s(x)),s(x)) pr(x,s(|0|())) -> true() pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) if(true(),x,y) -> false() if(false(),x,y) -> pr(x,y) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: plus#(s(x),y) -> plus#(x,y) p2: times#(s(x),y) -> plus#(y,times(x,y)) p3: times#(s(x),y) -> times#(x,y) p4: div#(x,y) -> quot#(x,y,y) p5: quot#(s(x),s(y),z) -> quot#(x,y,z) p6: quot#(x,|0|(),s(z)) -> div#(x,s(z)) p7: div#(div(x,y),z) -> div#(x,times(y,z)) p8: div#(div(x,y),z) -> times#(y,z) p9: eq#(s(x),s(y)) -> eq#(x,y) p10: divides#(y,x) -> eq#(x,times(div(x,y),y)) p11: divides#(y,x) -> times#(div(x,y),y) p12: divides#(y,x) -> div#(x,y) p13: prime#(s(s(x))) -> pr#(s(s(x)),s(x)) p14: pr#(x,s(s(y))) -> if#(divides(s(s(y)),x),x,s(y)) p15: pr#(x,s(s(y))) -> divides#(s(s(y)),x) p16: if#(false(),x,y) -> pr#(x,y) and R consists of: r1: plus(x,|0|()) -> x r2: plus(|0|(),y) -> y r3: plus(s(x),y) -> s(plus(x,y)) r4: times(|0|(),y) -> |0|() r5: times(s(|0|()),y) -> y r6: times(s(x),y) -> plus(y,times(x,y)) r7: div(|0|(),y) -> |0|() r8: div(x,y) -> quot(x,y,y) r9: quot(|0|(),s(y),z) -> |0|() r10: quot(s(x),s(y),z) -> quot(x,y,z) r11: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r12: div(div(x,y),z) -> div(x,times(y,z)) r13: eq(|0|(),|0|()) -> true() r14: eq(s(x),|0|()) -> false() r15: eq(|0|(),s(y)) -> false() r16: eq(s(x),s(y)) -> eq(x,y) r17: divides(y,x) -> eq(x,times(div(x,y),y)) r18: prime(s(s(x))) -> pr(s(s(x)),s(x)) r19: pr(x,s(|0|())) -> true() r20: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r21: if(true(),x,y) -> false() r22: if(false(),x,y) -> pr(x,y) The estimated dependency graph contains the following SCCs: {p14, p16} {p4, p5, p6, p7} {p3} {p1} {p9} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: if#(false(),x,y) -> pr#(x,y) p2: pr#(x,s(s(y))) -> if#(divides(s(s(y)),x),x,s(y)) and R consists of: r1: plus(x,|0|()) -> x r2: plus(|0|(),y) -> y r3: plus(s(x),y) -> s(plus(x,y)) r4: times(|0|(),y) -> |0|() r5: times(s(|0|()),y) -> y r6: times(s(x),y) -> plus(y,times(x,y)) r7: div(|0|(),y) -> |0|() r8: div(x,y) -> quot(x,y,y) r9: quot(|0|(),s(y),z) -> |0|() r10: quot(s(x),s(y),z) -> quot(x,y,z) r11: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r12: div(div(x,y),z) -> div(x,times(y,z)) r13: eq(|0|(),|0|()) -> true() r14: eq(s(x),|0|()) -> false() r15: eq(|0|(),s(y)) -> false() r16: eq(s(x),s(y)) -> eq(x,y) r17: divides(y,x) -> eq(x,times(div(x,y),y)) r18: prime(s(s(x))) -> pr(s(s(x)),s(x)) r19: pr(x,s(|0|())) -> true() r20: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r21: if(true(),x,y) -> false() r22: if(false(),x,y) -> pr(x,y) The set of usable rules consists of r1, r2, r4, r7 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: if#_A(x1,x2,x3) = x3 false_A() = 6 pr#_A(x1,x2) = x2 s_A(x1) = x1 + 2 divides_A(x1,x2) = 1 plus_A(x1,x2) = x1 + x2 + 3 |0|_A() = 3 times_A(x1,x2) = x1 + 2 div_A(x1,x2) = x1 + x2 + 1 if#!_A(x1,x2,x3) = 1 false!_A() = 3 pr#!_A(x1,x2) = 0 s!_A(x1) = 2 divides!_A(x1,x2) = x2 + 4 plus!_A(x1,x2) = x1 + 7 |0|!_A() = 6 times!_A(x1,x2) = x1 + 4 div!_A(x1,x2) = x1 + 5 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: if#_A(x1,x2,x3) = max{1, x2 - 1} false_A = 2 pr#_A(x1,x2) = max{1, x1 - 1} s_A(x1) = x1 + 9 divides_A(x1,x2) = max{0, x1 - 76, x2 - 58} plus_A(x1,x2) = max{12, x1 + 1, x2 + 10} |0|_A = 9 times_A(x1,x2) = max{x1 - 10, x2 + 11} div_A(x1,x2) = max{21, x1 - 37, x2 - 19} if#!_A(x1,x2,x3) = 14 false!_A = 21 pr#!_A(x1,x2) = 13 s!_A(x1) = max{18, x1 + 3} divides!_A(x1,x2) = max{x1 - 42, x2 + 38} plus!_A(x1,x2) = max{4, x1 - 4} |0|!_A = 40 times!_A(x1,x2) = max{40, x1 - 22, x2 + 8} div!_A(x1,x2) = max{39, x2 - 5} partial status: pi(if#) = [3] pi(false) = [] pi(pr#) = [2] pi(s) = [1] pi(divides) = [2] pi(plus) = [1, 2] pi(|0|) = [] pi(times) = [] pi(div) = [2] The following rules are removed: p1, p2 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: div#(div(x,y),z) -> div#(x,times(y,z)) p2: div#(x,y) -> quot#(x,y,y) p3: quot#(x,|0|(),s(z)) -> div#(x,s(z)) p4: quot#(s(x),s(y),z) -> quot#(x,y,z) and R consists of: r1: plus(x,|0|()) -> x r2: plus(|0|(),y) -> y r3: plus(s(x),y) -> s(plus(x,y)) r4: times(|0|(),y) -> |0|() r5: times(s(|0|()),y) -> y r6: times(s(x),y) -> plus(y,times(x,y)) r7: div(|0|(),y) -> |0|() r8: div(x,y) -> quot(x,y,y) r9: quot(|0|(),s(y),z) -> |0|() r10: quot(s(x),s(y),z) -> quot(x,y,z) r11: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r12: div(div(x,y),z) -> div(x,times(y,z)) r13: eq(|0|(),|0|()) -> true() r14: eq(s(x),|0|()) -> false() r15: eq(|0|(),s(y)) -> false() r16: eq(s(x),s(y)) -> eq(x,y) r17: divides(y,x) -> eq(x,times(div(x,y),y)) r18: prime(s(s(x))) -> pr(s(s(x)),s(x)) r19: pr(x,s(|0|())) -> true() r20: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r21: if(true(),x,y) -> false() r22: if(false(),x,y) -> pr(x,y) The set of usable rules consists of r1, r2, r5, r7 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: div#_A(x1,x2) = x1 div_A(x1,x2) = x1 + x2 + 4 times_A(x1,x2) = x1 + x2 + 5 quot#_A(x1,x2,x3) = x1 |0|_A() = 3 s_A(x1) = x1 + 1 plus_A(x1,x2) = x1 + x2 + 2 div#!_A(x1,x2) = x1 div!_A(x1,x2) = x1 + 2 times!_A(x1,x2) = 5 quot#!_A(x1,x2,x3) = x1 |0|!_A() = 3 s!_A(x1) = 4 plus!_A(x1,x2) = 4 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: div#_A(x1,x2) = max{1, x1 - 109} div_A(x1,x2) = max{108, x1 + 62, x2 + 62} times_A(x1,x2) = x2 + 4 quot#_A(x1,x2,x3) = max{1, x1 - 109} |0|_A = 51 s_A(x1) = max{44, x1 + 15} plus_A(x1,x2) = max{35, x1 + 5, x2 + 1} div#!_A(x1,x2) = x1 + 2 div!_A(x1,x2) = max{0, x1 - 61, x2 - 4} times!_A(x1,x2) = max{118, x1 + 68, x2 + 1} quot#!_A(x1,x2,x3) = x1 + 2 |0|!_A = 119 s!_A(x1) = max{39, x1 + 12} plus!_A(x1,x2) = 0 partial status: pi(div#) = [] pi(div) = [1] pi(times) = [1, 2] pi(quot#) = [] pi(|0|) = [] pi(s) = [1] pi(plus) = [1, 2] The following rules are removed: p1, p4 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: div#(x,y) -> quot#(x,y,y) p2: quot#(x,|0|(),s(z)) -> div#(x,s(z)) and R consists of: r1: plus(x,|0|()) -> x r2: plus(|0|(),y) -> y r3: plus(s(x),y) -> s(plus(x,y)) r4: times(|0|(),y) -> |0|() r5: times(s(|0|()),y) -> y r6: times(s(x),y) -> plus(y,times(x,y)) r7: div(|0|(),y) -> |0|() r8: div(x,y) -> quot(x,y,y) r9: quot(|0|(),s(y),z) -> |0|() r10: quot(s(x),s(y),z) -> quot(x,y,z) r11: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r12: div(div(x,y),z) -> div(x,times(y,z)) r13: eq(|0|(),|0|()) -> true() r14: eq(s(x),|0|()) -> false() r15: eq(|0|(),s(y)) -> false() r16: eq(s(x),s(y)) -> eq(x,y) r17: divides(y,x) -> eq(x,times(div(x,y),y)) r18: prime(s(s(x))) -> pr(s(s(x)),s(x)) r19: pr(x,s(|0|())) -> true() r20: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r21: if(true(),x,y) -> false() r22: if(false(),x,y) -> pr(x,y) The estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: div#(x,y) -> quot#(x,y,y) p2: quot#(x,|0|(),s(z)) -> div#(x,s(z)) and R consists of: r1: plus(x,|0|()) -> x r2: plus(|0|(),y) -> y r3: plus(s(x),y) -> s(plus(x,y)) r4: times(|0|(),y) -> |0|() r5: times(s(|0|()),y) -> y r6: times(s(x),y) -> plus(y,times(x,y)) r7: div(|0|(),y) -> |0|() r8: div(x,y) -> quot(x,y,y) r9: quot(|0|(),s(y),z) -> |0|() r10: quot(s(x),s(y),z) -> quot(x,y,z) r11: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r12: div(div(x,y),z) -> div(x,times(y,z)) r13: eq(|0|(),|0|()) -> true() r14: eq(s(x),|0|()) -> false() r15: eq(|0|(),s(y)) -> false() r16: eq(s(x),s(y)) -> eq(x,y) r17: divides(y,x) -> eq(x,times(div(x,y),y)) r18: prime(s(s(x))) -> pr(s(s(x)),s(x)) r19: pr(x,s(|0|())) -> true() r20: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r21: if(true(),x,y) -> false() r22: if(false(),x,y) -> pr(x,y) The set of usable rules consists of r4, 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: div#_A(x1,x2) = x2 quot#_A(x1,x2,x3) = x2 |0|_A() = 7 s_A(x1) = 2 times_A(x1,x2) = x1 + 1 quot_A(x1,x2,x3) = x1 + 1 div#!_A(x1,x2) = x2 + 7 quot#!_A(x1,x2,x3) = x3 + 6 |0|!_A() = 10 s!_A(x1) = 7 times!_A(x1,x2) = x1 + x2 + 5 quot!_A(x1,x2,x3) = x1 + x2 + 8 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: div#_A(x1,x2) = max{1, x1 - 2, x2 - 18} quot#_A(x1,x2,x3) = max{1, x1 - 2, x2 - 18} |0|_A = 0 s_A(x1) = 17 times_A(x1,x2) = x1 + 29 quot_A(x1,x2,x3) = max{x1 - 1, x2 - 18, x3 + 7} div#!_A(x1,x2) = max{17, x2 + 7} quot#!_A(x1,x2,x3) = max{16, x2 + 6, x3 - 1} |0|!_A = 25 s!_A(x1) = 15 times!_A(x1,x2) = x2 + 26 quot!_A(x1,x2,x3) = max{25, x2 + 7, x3 + 8} partial status: pi(div#) = [2] pi(quot#) = [2] pi(|0|) = [] pi(s) = [] pi(times) = [] pi(quot) = [1, 2, 3] The following rules are removed: p1, p2 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: times#(s(x),y) -> times#(x,y) and R consists of: r1: plus(x,|0|()) -> x r2: plus(|0|(),y) -> y r3: plus(s(x),y) -> s(plus(x,y)) r4: times(|0|(),y) -> |0|() r5: times(s(|0|()),y) -> y r6: times(s(x),y) -> plus(y,times(x,y)) r7: div(|0|(),y) -> |0|() r8: div(x,y) -> quot(x,y,y) r9: quot(|0|(),s(y),z) -> |0|() r10: quot(s(x),s(y),z) -> quot(x,y,z) r11: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r12: div(div(x,y),z) -> div(x,times(y,z)) r13: eq(|0|(),|0|()) -> true() r14: eq(s(x),|0|()) -> false() r15: eq(|0|(),s(y)) -> false() r16: eq(s(x),s(y)) -> eq(x,y) r17: divides(y,x) -> eq(x,times(div(x,y),y)) r18: prime(s(s(x))) -> pr(s(s(x)),s(x)) r19: pr(x,s(|0|())) -> true() r20: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r21: if(true(),x,y) -> false() r22: if(false(),x,y) -> pr(x,y) The set of usable rules consists of 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: times#_A(x1,x2) = x1 s_A(x1) = x1 + 2 quot_A(x1,x2,x3) = x1 + 2 |0|_A() = 3 times#!_A(x1,x2) = x1 + 8 s!_A(x1) = 7 quot!_A(x1,x2,x3) = 5 |0|!_A() = 3 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: times#_A(x1,x2) = 0 s_A(x1) = max{19, x1 + 7} quot_A(x1,x2,x3) = max{7, x1 - 6, x2 - 20, x3 - 25} |0|_A = 4 times#!_A(x1,x2) = max{12, x1 - 20, x2 - 1} s!_A(x1) = x1 + 11 quot!_A(x1,x2,x3) = max{12, x2 - 6} |0|!_A = 2 partial status: pi(times#) = [] pi(s) = [] pi(quot) = [3] 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#(x,y) and R consists of: r1: plus(x,|0|()) -> x r2: plus(|0|(),y) -> y r3: plus(s(x),y) -> s(plus(x,y)) r4: times(|0|(),y) -> |0|() r5: times(s(|0|()),y) -> y r6: times(s(x),y) -> plus(y,times(x,y)) r7: div(|0|(),y) -> |0|() r8: div(x,y) -> quot(x,y,y) r9: quot(|0|(),s(y),z) -> |0|() r10: quot(s(x),s(y),z) -> quot(x,y,z) r11: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r12: div(div(x,y),z) -> div(x,times(y,z)) r13: eq(|0|(),|0|()) -> true() r14: eq(s(x),|0|()) -> false() r15: eq(|0|(),s(y)) -> false() r16: eq(s(x),s(y)) -> eq(x,y) r17: divides(y,x) -> eq(x,times(div(x,y),y)) r18: prime(s(s(x))) -> pr(s(s(x)),s(x)) r19: pr(x,s(|0|())) -> true() r20: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r21: if(true(),x,y) -> false() r22: if(false(),x,y) -> pr(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: plus#_A(x1,x2) = x1 s_A(x1) = x1 + 4 plus#!_A(x1,x2) = x1 + 6 s!_A(x1) = 5 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = x1 s_A(x1) = x1 + 19 plus#!_A(x1,x2) = max{x1 - 1, x2 + 18} s!_A(x1) = max{47, x1 + 40} partial status: pi(plus#) = [] pi(s) = [] 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: eq#(s(x),s(y)) -> eq#(x,y) and R consists of: r1: plus(x,|0|()) -> x r2: plus(|0|(),y) -> y r3: plus(s(x),y) -> s(plus(x,y)) r4: times(|0|(),y) -> |0|() r5: times(s(|0|()),y) -> y r6: times(s(x),y) -> plus(y,times(x,y)) r7: div(|0|(),y) -> |0|() r8: div(x,y) -> quot(x,y,y) r9: quot(|0|(),s(y),z) -> |0|() r10: quot(s(x),s(y),z) -> quot(x,y,z) r11: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r12: div(div(x,y),z) -> div(x,times(y,z)) r13: eq(|0|(),|0|()) -> true() r14: eq(s(x),|0|()) -> false() r15: eq(|0|(),s(y)) -> false() r16: eq(s(x),s(y)) -> eq(x,y) r17: divides(y,x) -> eq(x,times(div(x,y),y)) r18: prime(s(s(x))) -> pr(s(s(x)),s(x)) r19: pr(x,s(|0|())) -> true() r20: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r21: if(true(),x,y) -> false() r22: if(false(),x,y) -> pr(x,y) The set of usable rules consists of r7 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: eq#_A(x1,x2) = x1 + x2 s_A(x1) = x1 + 2 div_A(x1,x2) = x1 + 7 |0|_A() = 8 eq#!_A(x1,x2) = x1 + 3 s!_A(x1) = x1 + 2 div!_A(x1,x2) = x1 + 1 |0|!_A() = 8 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: eq#_A(x1,x2) = max{x1, x2} s_A(x1) = x1 + 13 div_A(x1,x2) = 58 |0|_A = 7 eq#!_A(x1,x2) = max{65, x1 - 14, x2 + 57} s!_A(x1) = max{64, x1 + 56} div!_A(x1,x2) = max{x1 + 23, x2 + 18} |0|!_A = 29 partial status: pi(eq#) = [] pi(s) = [] pi(div) = [1] pi(|0|) = [] The following rules are removed: p1 Then no dependency pair remains.