YES We show the termination of the TRS R: p(|0|()) -> |0|() p(s(x)) -> x plus(x,|0|()) -> x plus(|0|(),y) -> y plus(s(x),y) -> s(plus(x,y)) plus(s(x),y) -> s(plus(p(s(x)),y)) plus(x,s(y)) -> s(plus(x,p(s(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(zero(y),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(zero(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) zero(div(x,x)) -> x zero(divides(x,x)) -> x zero(times(x,x)) -> x zero(quot(x,x,x)) -> x zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: plus#(s(x),y) -> plus#(x,y) p2: plus#(s(x),y) -> plus#(p(s(x)),y) p3: plus#(s(x),y) -> p#(s(x)) p4: plus#(x,s(y)) -> plus#(x,p(s(y))) p5: plus#(x,s(y)) -> p#(s(y)) p6: times#(s(x),y) -> plus#(y,times(x,y)) p7: times#(s(x),y) -> times#(x,y) p8: div#(x,y) -> quot#(x,y,y) p9: quot#(s(x),s(y),z) -> quot#(x,y,z) p10: quot#(x,|0|(),s(z)) -> div#(x,s(z)) p11: div#(div(x,y),z) -> div#(x,times(zero(y),z)) p12: div#(div(x,y),z) -> times#(zero(y),z) p13: div#(div(x,y),z) -> zero#(y) p14: eq#(s(x),s(y)) -> eq#(x,y) p15: divides#(y,x) -> eq#(x,times(div(x,y),y)) p16: divides#(y,x) -> times#(div(x,y),y) p17: divides#(y,x) -> div#(x,y) p18: prime#(s(s(x))) -> pr#(s(s(x)),s(x)) p19: pr#(x,s(s(y))) -> if#(divides(s(s(y)),x),x,s(y)) p20: pr#(x,s(s(y))) -> divides#(s(s(y)),x) p21: if#(false(),x,y) -> pr#(x,y) p22: zero#(s(x)) -> if#(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) p23: zero#(s(x)) -> eq#(x,s(|0|())) p24: zero#(s(x)) -> plus#(zero(|0|()),|0|()) p25: zero#(s(x)) -> zero#(|0|()) p26: zero#(s(x)) -> plus#(|0|(),zero(|0|())) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The estimated dependency graph contains the following SCCs: {p8, p9, p10, p11, p13, p17, p19, p20, p21, p22} {p7} {p1, p2, p4} {p14} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: pr#(x,s(s(y))) -> divides#(s(s(y)),x) p2: divides#(y,x) -> div#(x,y) p3: div#(div(x,y),z) -> zero#(y) p4: zero#(s(x)) -> if#(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) p5: if#(false(),x,y) -> pr#(x,y) p6: pr#(x,s(s(y))) -> if#(divides(s(s(y)),x),x,s(y)) p7: div#(div(x,y),z) -> div#(x,times(zero(y),z)) p8: div#(x,y) -> quot#(x,y,y) p9: quot#(x,|0|(),s(z)) -> div#(x,s(z)) p10: quot#(s(x),s(y),z) -> quot#(x,y,z) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The set of usable rules consists of r3, r11, r18, r19 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: pr#_A(x1,x2) = 1 s_A(x1) = 23 divides#_A(x1,x2) = max{1, x1 - 36} div#_A(x1,x2) = 1 div_A(x1,x2) = x1 + 29 zero#_A(x1) = 1 if#_A(x1,x2,x3) = 1 eq_A(x1,x2) = max{6, x1 - 1} |0|_A = 10 plus_A(x1,x2) = max{x1 + 7, x2 + 22} zero_A(x1) = max{22, x1 - 30} false_A = 7 divides_A(x1,x2) = 5 times_A(x1,x2) = 8 quot#_A(x1,x2,x3) = 1 pr#!_A(x1,x2) = 23 s!_A(x1) = 0 divides#!_A(x1,x2) = 1 div#!_A(x1,x2) = 0 div!_A(x1,x2) = max{34, x2 + 26} zero#!_A(x1) = max{25, x1 + 1} if#!_A(x1,x2,x3) = 23 eq!_A(x1,x2) = max{35, x1 - 2, x2 - 22} |0|!_A = 48 plus!_A(x1,x2) = max{x1 - 22, x2 + 6} zero!_A(x1) = max{25, x1} false!_A = 47 divides!_A(x1,x2) = max{x1 + 34, x2 + 33} times!_A(x1,x2) = max{49, x1 + 4, x2 - 22} quot#!_A(x1,x2,x3) = 0 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: pr#_A(x1,x2) = 1 s_A(x1) = x1 + 97 divides#_A(x1,x2) = 1 div#_A(x1,x2) = 1 div_A(x1,x2) = max{23, x1, x2 - 41} zero#_A(x1) = 1 if#_A(x1,x2,x3) = 1 eq_A(x1,x2) = max{285, x2 + 86} |0|_A = 94 plus_A(x1,x2) = x1 zero_A(x1) = max{87, x1 - 82} false_A = 277 divides_A(x1,x2) = max{549, x1 + 82} times_A(x1,x2) = max{295, x1 - 87, x2 + 65} quot#_A(x1,x2,x3) = 1 pr#!_A(x1,x2) = 0 s!_A(x1) = x1 + 196 divides#!_A(x1,x2) = max{x1 + 1, x2} div#!_A(x1,x2) = max{0, x1 - 61} div!_A(x1,x2) = max{x1, x2} zero#!_A(x1) = max{0, x1 - 101} if#!_A(x1,x2,x3) = 0 eq!_A(x1,x2) = max{x1 + 66, x2 - 65} |0|!_A = 218 plus!_A(x1,x2) = x2 zero!_A(x1) = max{0, x1 - 95} false!_A = 164 divides!_A(x1,x2) = max{294, x1 - 193, x2 + 65} times!_A(x1,x2) = max{295, x1 + 41, x2 - 97} quot#!_A(x1,x2,x3) = max{0, x1 - 61} partial status: pi(pr#) = [1] pi(s) = [1] pi(divides#) = [2] pi(div#) = [1] pi(div) = [1, 2] pi(zero#) = [1] pi(if#) = [2] pi(eq) = [1, 2] pi(|0|) = [] pi(plus) = [1] pi(zero) = [] pi(false) = [] pi(divides) = [2] pi(times) = [1] pi(quot#) = [1] The following rules are removed: p1, p2, p3, p4, p10 -- SCC decomposition. 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)) p3: div#(div(x,y),z) -> div#(x,times(zero(y),z)) p4: div#(x,y) -> quot#(x,y,y) p5: quot#(x,|0|(),s(z)) -> div#(x,s(z)) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The estimated dependency graph contains the following SCCs: {p1, p2} {p3, p4, p5} -- 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: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The set of usable rules consists of r8, r13, r17, r18, r19, r20, r21, r23, r25, r27, r30 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: if#_A(x1,x2,x3) = max{0, x1 - 52, x2 - 58, x3 - 107} false_A = 51 pr#_A(x1,x2) = max{0, x1 - 58, x2 - 131} s_A(x1) = max{51, x1 + 24} divides_A(x1,x2) = max{51, x1 - 81, x2 - 6} times_A(x1,x2) = max{0, x1 - 52} |0|_A = 0 quot_A(x1,x2,x3) = max{x1 + 53, x2 - 81, x3 - 81} zero_A(x1) = x1 + 80 eq_A(x1,x2) = max{51, x1 - 52} true_A = 51 div_A(x1,x2) = max{x1 + 52, x2 - 80} pr_A(x1,x2) = max{105, x1 - 82, x2 - 108} if_A(x1,x2,x3) = max{105, x1 - 51, x2 - 53, x3 - 83} if#!_A(x1,x2,x3) = max{56, x3 - 52} false!_A = 31 pr#!_A(x1,x2) = max{1, x2 - 80} s!_A(x1) = x1 + 33 divides!_A(x1,x2) = max{59, x1 - 81, x2 - 106} times!_A(x1,x2) = max{4, x1 - 156, x2 - 79} |0|!_A = 3 quot!_A(x1,x2,x3) = max{1, x1 - 82, x2 - 52, x3 - 81} zero!_A(x1) = x1 + 23 eq!_A(x1,x2) = 48 true!_A = 32 div!_A(x1,x2) = max{2, x1 - 81, x2 - 80} pr!_A(x1,x2) = max{58, x1 - 107, x2 - 82} if!_A(x1,x2,x3) = max{32, x1 - 24, x2 + 21, x3 - 83} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: if#_A(x1,x2,x3) = max{0, x1 - 2, x2 - 20, x3 - 127} false_A = 1 pr#_A(x1,x2) = max{0, x1 - 20, x2 - 135} s_A(x1) = max{123, x1 + 8} divides_A(x1,x2) = max{1, x1 - 140, x2 - 124} times_A(x1,x2) = 124 |0|_A = 115 quot_A(x1,x2,x3) = max{x1 + 145, x2 - 124, x3 - 124} zero_A(x1) = max{53, x1 - 145} eq_A(x1,x2) = max{1, x1 - 124} true_A = 1 div_A(x1,x2) = max{x1 + 35, x2 + 154} pr_A(x1,x2) = max{1, x1 - 135, x2 - 153} if_A(x1,x2,x3) = max{1, x1 - 13, x2 - 135, x3 - 144} if#!_A(x1,x2,x3) = max{0, x3 - 389} false!_A = 2 pr#!_A(x1,x2) = max{1, x2 - 15} s!_A(x1) = max{0, x1 - 273} divides!_A(x1,x2) = max{4, x1 - 132, x2 - 440} times!_A(x1,x2) = max{x1 + 143, x2 + 155} |0|!_A = 0 quot!_A(x1,x2,x3) = max{5, x1 - 156, x2 - 108, x3 - 1} zero!_A(x1) = max{5, x1 - 230} eq!_A(x1,x2) = max{5, x1 - 222} true!_A = 0 div!_A(x1,x2) = max{x1 - 155, x2 + 154} pr!_A(x1,x2) = max{3, x1 - 439, x2 - 272} if!_A(x1,x2,x3) = max{6, x1 - 97, x2 - 440, x3 - 561} partial status: pi(if#) = [3] pi(false) = [] pi(pr#) = [2] pi(s) = [1] pi(divides) = [] pi(times) = [] pi(|0|) = [] pi(quot) = [1, 2, 3] pi(zero) = [1] pi(eq) = [] pi(true) = [] pi(div) = [2] pi(pr) = [2] pi(if) = [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: div#(div(x,y),z) -> div#(x,times(zero(y),z)) p2: div#(x,y) -> quot#(x,y,y) p3: quot#(x,|0|(),s(z)) -> div#(x,s(z)) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The set of usable rules consists of r1, r5, r6, r7, r8, r11, r13, r27 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: div#_A(x1,x2) = max{1, x1 - 12} div_A(x1,x2) = max{11, x1 + 5, x2 + 10} times_A(x1,x2) = max{13, x1 - 52} zero_A(x1) = x1 + 42 quot#_A(x1,x2,x3) = max{1, x1 - 12} |0|_A = 0 s_A(x1) = 32 p_A(x1) = max{42, x1 - 32} plus_A(x1,x2) = max{x1 + 52, x2 + 10} quot_A(x1,x2,x3) = max{12, x2 - 43, x3 - 43} div#!_A(x1,x2) = max{52, x1 + 1} div!_A(x1,x2) = max{68, x1 - 2, x2 + 54} times!_A(x1,x2) = max{7, x1 - 43, x2 - 21} zero!_A(x1) = max{53, x1 - 36} quot#!_A(x1,x2,x3) = max{52, x1 + 1} |0|!_A = 4 s!_A(x1) = 5 p!_A(x1) = 10 plus!_A(x1,x2) = max{x1 - 47, x2 + 10} quot!_A(x1,x2,x3) = max{6, x2 - 33} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: div#_A(x1,x2) = max{1, x1 - 12} div_A(x1,x2) = max{x1 + 11, x2 - 20} times_A(x1,x2) = max{12, x1 - 20, x2 - 17} zero_A(x1) = x1 + 3 quot#_A(x1,x2,x3) = max{1, x1 - 12} |0|_A = 0 s_A(x1) = 0 p_A(x1) = max{3, x1 - 17} plus_A(x1,x2) = x1 quot_A(x1,x2,x3) = max{12, x1 - 20, x2 - 20, x3 - 20} div#!_A(x1,x2) = 0 div!_A(x1,x2) = max{17, x1 - 10, x2 - 20} times!_A(x1,x2) = max{18, x1 - 20} zero!_A(x1) = max{0, x1 - 20} quot#!_A(x1,x2,x3) = 0 |0|!_A = 15 s!_A(x1) = 2 p!_A(x1) = max{2, x1 - 20} plus!_A(x1,x2) = max{2, x1 - 20} quot!_A(x1,x2,x3) = max{16, x1 + 11, x2 - 20, x3 - 20} partial status: pi(div#) = [1] pi(div) = [1, 2] pi(times) = [] pi(zero) = [1] pi(quot#) = [1] pi(|0|) = [] pi(s) = [] pi(p) = [] pi(plus) = [1] pi(quot) = [1, 3] The following rules are removed: p1 -- 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: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) 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: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The set of usable rules consists of r1 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: div#_A(x1,x2) = max{3, x1 - 1, x2 - 4} quot#_A(x1,x2,x3) = max{3, x1 - 1, x2 - 31, x3 - 4} |0|_A = 30 s_A(x1) = 6 p_A(x1) = x1 + 31 div#!_A(x1,x2) = x2 + 24 quot#!_A(x1,x2,x3) = max{1, x2, x3 - 5} |0|!_A = 24 s!_A(x1) = 22 p!_A(x1) = max{21, x1 - 4} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: div#_A(x1,x2) = max{21, x1 - 1, x2 + 6} quot#_A(x1,x2,x3) = max{21, x1 - 1, x2 - 21, x3 + 6} |0|_A = 20 s_A(x1) = 14 p_A(x1) = max{60, x1 + 48} div#!_A(x1,x2) = max{151, x2 + 132} quot#!_A(x1,x2,x3) = max{145, x2 + 131} |0|!_A = 152 s!_A(x1) = max{150, x1 + 58} p!_A(x1) = max{153, x1 + 6} partial status: pi(div#) = [2] pi(quot#) = [2] pi(|0|) = [] pi(s) = [] pi(p) = [] 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: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The set of usable rules consists of r11 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 - 27} s_A(x1) = max{65, x1 + 26} div_A(x1,x2) = max{721, x1 - 1165, x2 - 92} |0|_A = 363 times#!_A(x1,x2) = max{1, x1 - 66, x2 - 1} s!_A(x1) = max{67, x1 + 52} div!_A(x1,x2) = max{54, x2 + 6} |0|!_A = 53 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: times#_A(x1,x2) = max{0, x1 - 20} s_A(x1) = max{48, x1 + 19} div_A(x1,x2) = max{668, x1 - 903, x2 - 68} |0|_A = 213 times#!_A(x1,x2) = max{10, x1 - 49, x2 - 1} s!_A(x1) = max{9, x1 + 5} div!_A(x1,x2) = max{2, x1 - 2863, x2 - 14} |0|!_A = 4 partial status: pi(times#) = [1] pi(s) = [1] pi(div) = [1, 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: plus#(s(x),y) -> plus#(x,y) p2: plus#(x,s(y)) -> plus#(x,p(s(y))) p3: plus#(s(x),y) -> plus#(p(s(x)),y) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The set of usable rules consists of r1, r2 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 - 33, x2 - 33} s_A(x1) = max{32, x1 + 16} p_A(x1) = max{17, x1 - 16} |0|_A = 6 plus#!_A(x1,x2) = max{1, x1 - 30} s!_A(x1) = max{12, x1 + 8} p!_A(x1) = max{0, x1 - 7} |0|!_A = 10 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 29, x2 - 29} s_A(x1) = x1 + 21 p_A(x1) = max{28, x1 - 10} |0|_A = 9 plus#!_A(x1,x2) = max{6, x1 - 29, x2 - 22} s!_A(x1) = max{5, x1 - 342} p!_A(x1) = max{0, x1 - 46} |0|!_A = 2 partial status: pi(plus#) = [] pi(s) = [1] pi(p) = [1] pi(|0|) = [] The following rules are removed: p1, p3 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: plus#(x,s(y)) -> plus#(x,p(s(y))) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The estimated dependency graph contains the following SCCs: {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: plus#(x,s(y)) -> plus#(x,p(s(y))) and R consists of: r1: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|0|())))) The set of usable rules consists of r2 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 - 17, x2 - 47} s_A(x1) = max{46, x1 + 16} p_A(x1) = max{31, x1 - 9} plus#!_A(x1,x2) = max{4, x2 - 40} s!_A(x1) = max{5, x1 - 434} p!_A(x1) = max{3, x1 - 431} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = max{0, x1 - 25, x2 - 24} s_A(x1) = x1 + 23 p_A(x1) = max{0, x1 - 9} plus#!_A(x1,x2) = max{7, x2 - 15} s!_A(x1) = max{0, x1 - 5} p!_A(x1) = max{126, x1 - 17} partial status: pi(plus#) = [] pi(s) = [1] pi(p) = [1] 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: p(|0|()) -> |0|() r2: p(s(x)) -> x r3: plus(x,|0|()) -> x r4: plus(|0|(),y) -> y r5: plus(s(x),y) -> s(plus(x,y)) r6: plus(s(x),y) -> s(plus(p(s(x)),y)) r7: plus(x,s(y)) -> s(plus(x,p(s(y)))) r8: times(|0|(),y) -> |0|() r9: times(s(|0|()),y) -> y r10: times(s(x),y) -> plus(y,times(x,y)) r11: div(|0|(),y) -> |0|() r12: div(x,y) -> quot(x,y,y) r13: quot(zero(y),s(y),z) -> |0|() r14: quot(s(x),s(y),z) -> quot(x,y,z) r15: quot(x,|0|(),s(z)) -> s(div(x,s(z))) r16: div(div(x,y),z) -> div(x,times(zero(y),z)) r17: eq(|0|(),|0|()) -> true() r18: eq(s(x),|0|()) -> false() r19: eq(|0|(),s(y)) -> false() r20: eq(s(x),s(y)) -> eq(x,y) r21: divides(y,x) -> eq(x,times(div(x,y),y)) r22: prime(s(s(x))) -> pr(s(s(x)),s(x)) r23: pr(x,s(|0|())) -> true() r24: pr(x,s(s(y))) -> if(divides(s(s(y)),x),x,s(y)) r25: if(true(),x,y) -> false() r26: if(false(),x,y) -> pr(x,y) r27: zero(div(x,x)) -> x r28: zero(divides(x,x)) -> x r29: zero(times(x,x)) -> x r30: zero(quot(x,x,x)) -> x r31: zero(s(x)) -> if(eq(x,s(|0|())),plus(zero(|0|()),|0|()),s(plus(|0|(),zero(|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: eq#_A(x1,x2) = max{0, x1 - 14, x2 - 14} s_A(x1) = max{41, x1 + 13} eq#!_A(x1,x2) = max{86, x1 - 83, x2 - 42} s!_A(x1) = max{85, x1 - 83} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: eq#_A(x1,x2) = max{0, x1 - 15, x2 - 15} s_A(x1) = max{44, x1 + 14} eq#!_A(x1,x2) = max{23, x1 - 226, x2 - 45} s!_A(x1) = max{22, x1 - 227} partial status: pi(eq#) = [1] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.