YES We show the termination of the TRS R: minus(|0|(),y) -> |0|() minus(s(x),|0|()) -> s(x) minus(s(x),s(y)) -> minus(x,y) le(|0|(),y) -> true() le(s(x),|0|()) -> false() le(s(x),s(y)) -> le(x,y) if(true(),x,y) -> x if(false(),x,y) -> y perfectp(|0|()) -> false() perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x)) f(|0|(),y,|0|(),u) -> true() f(|0|(),y,s(z),u) -> false() f(s(x),|0|(),z,u) -> f(x,u,minus(z,s(x)),u) f(s(x),s(y),z,u) -> if(le(x,y),f(s(x),minus(y,x),z,u),f(x,u,z,u)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: minus#(s(x),s(y)) -> minus#(x,y) p2: le#(s(x),s(y)) -> le#(x,y) p3: perfectp#(s(x)) -> f#(x,s(|0|()),s(x),s(x)) p4: f#(s(x),|0|(),z,u) -> f#(x,u,minus(z,s(x)),u) p5: f#(s(x),|0|(),z,u) -> minus#(z,s(x)) p6: f#(s(x),s(y),z,u) -> if#(le(x,y),f(s(x),minus(y,x),z,u),f(x,u,z,u)) p7: f#(s(x),s(y),z,u) -> le#(x,y) p8: f#(s(x),s(y),z,u) -> f#(s(x),minus(y,x),z,u) p9: f#(s(x),s(y),z,u) -> minus#(y,x) p10: f#(s(x),s(y),z,u) -> f#(x,u,z,u) and R consists of: r1: minus(|0|(),y) -> |0|() r2: minus(s(x),|0|()) -> s(x) r3: minus(s(x),s(y)) -> minus(x,y) r4: le(|0|(),y) -> true() r5: le(s(x),|0|()) -> false() r6: le(s(x),s(y)) -> le(x,y) r7: if(true(),x,y) -> x r8: if(false(),x,y) -> y r9: perfectp(|0|()) -> false() r10: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x)) r11: f(|0|(),y,|0|(),u) -> true() r12: f(|0|(),y,s(z),u) -> false() r13: f(s(x),|0|(),z,u) -> f(x,u,minus(z,s(x)),u) r14: f(s(x),s(y),z,u) -> if(le(x,y),f(s(x),minus(y,x),z,u),f(x,u,z,u)) The estimated dependency graph contains the following SCCs: {p4, p8, p10} {p1} {p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: f#(s(x),|0|(),z,u) -> f#(x,u,minus(z,s(x)),u) p2: f#(s(x),s(y),z,u) -> f#(x,u,z,u) p3: f#(s(x),s(y),z,u) -> f#(s(x),minus(y,x),z,u) and R consists of: r1: minus(|0|(),y) -> |0|() r2: minus(s(x),|0|()) -> s(x) r3: minus(s(x),s(y)) -> minus(x,y) r4: le(|0|(),y) -> true() r5: le(s(x),|0|()) -> false() r6: le(s(x),s(y)) -> le(x,y) r7: if(true(),x,y) -> x r8: if(false(),x,y) -> y r9: perfectp(|0|()) -> false() r10: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x)) r11: f(|0|(),y,|0|(),u) -> true() r12: f(|0|(),y,s(z),u) -> false() r13: f(s(x),|0|(),z,u) -> f(x,u,minus(z,s(x)),u) r14: f(s(x),s(y),z,u) -> if(le(x,y),f(s(x),minus(y,x),z,u),f(x,u,z,u)) The set of usable rules consists of r1, r2, r3 Take the reduction pair: matrix interpretations: carrier: N^4 order: lexicographic order interpretations: f#_A(x1,x2,x3,x4) = ((1,0,0,0),(1,1,0,0),(0,0,1,0),(1,1,1,1)) x1 + ((0,0,0,0),(1,0,0,0),(0,1,0,0),(1,1,1,0)) x2 + ((1,0,0,0),(0,0,0,0),(0,1,0,0),(0,1,1,0)) x4 s_A(x1) = x1 + (2,2,3,1) |0|_A() = (1,2,1,2) minus_A(x1,x2) = x1 + ((0,0,0,0),(0,0,0,0),(0,0,0,0),(1,0,0,0)) x2 + (1,1,2,1) The next rules are strictly ordered: p1, p2, p3 We remove them from the problem. Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: minus#(s(x),s(y)) -> minus#(x,y) and R consists of: r1: minus(|0|(),y) -> |0|() r2: minus(s(x),|0|()) -> s(x) r3: minus(s(x),s(y)) -> minus(x,y) r4: le(|0|(),y) -> true() r5: le(s(x),|0|()) -> false() r6: le(s(x),s(y)) -> le(x,y) r7: if(true(),x,y) -> x r8: if(false(),x,y) -> y r9: perfectp(|0|()) -> false() r10: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x)) r11: f(|0|(),y,|0|(),u) -> true() r12: f(|0|(),y,s(z),u) -> false() r13: f(s(x),|0|(),z,u) -> f(x,u,minus(z,s(x)),u) r14: f(s(x),s(y),z,u) -> if(le(x,y),f(s(x),minus(y,x),z,u),f(x,u,z,u)) The set of usable rules consists of (no rules) Take the monotone reduction pair: matrix interpretations: carrier: N^4 order: lexicographic order interpretations: minus#_A(x1,x2) = ((1,0,0,0),(1,1,0,0),(0,0,1,0),(1,1,0,1)) x1 + ((1,0,0,0),(0,1,0,0),(1,1,1,0),(1,0,1,1)) x2 s_A(x1) = ((1,0,0,0),(1,1,0,0),(1,1,1,0),(1,1,1,1)) x1 + (1,1,1,1) The next rules are strictly ordered: p1 r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14 We remove them from the problem. Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: le#(s(x),s(y)) -> le#(x,y) and R consists of: r1: minus(|0|(),y) -> |0|() r2: minus(s(x),|0|()) -> s(x) r3: minus(s(x),s(y)) -> minus(x,y) r4: le(|0|(),y) -> true() r5: le(s(x),|0|()) -> false() r6: le(s(x),s(y)) -> le(x,y) r7: if(true(),x,y) -> x r8: if(false(),x,y) -> y r9: perfectp(|0|()) -> false() r10: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x)) r11: f(|0|(),y,|0|(),u) -> true() r12: f(|0|(),y,s(z),u) -> false() r13: f(s(x),|0|(),z,u) -> f(x,u,minus(z,s(x)),u) r14: f(s(x),s(y),z,u) -> if(le(x,y),f(s(x),minus(y,x),z,u),f(x,u,z,u)) The set of usable rules consists of (no rules) Take the monotone reduction pair: matrix interpretations: carrier: N^4 order: lexicographic order interpretations: le#_A(x1,x2) = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(1,1,0,1)) x1 + ((1,0,0,0),(1,1,0,0),(1,1,1,0),(1,0,1,1)) x2 s_A(x1) = ((1,0,0,0),(1,1,0,0),(1,0,1,0),(1,1,1,1)) x1 + (1,1,1,1) The next rules are strictly ordered: p1 r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14 We remove them from the problem. Then no dependency pair remains.