YES We show the termination of the TRS R: 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: perfectp#(s(x)) -> f#(x,s(|0|()),s(x),s(x)) p2: f#(s(x),|0|(),z,u) -> f#(x,u,minus(z,s(x)),u) p3: f#(s(x),s(y),z,u) -> f#(s(x),minus(y,x),z,u) p4: f#(s(x),s(y),z,u) -> f#(x,u,z,u) and R consists of: r1: perfectp(|0|()) -> false() r2: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x)) r3: f(|0|(),y,|0|(),u) -> true() r4: f(|0|(),y,s(z),u) -> false() r5: f(s(x),|0|(),z,u) -> f(x,u,minus(z,s(x)),u) r6: 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: {p2, p4} -- 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) and R consists of: r1: perfectp(|0|()) -> false() r2: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x)) r3: f(|0|(),y,|0|(),u) -> true() r4: f(|0|(),y,s(z),u) -> false() r5: f(s(x),|0|(),z,u) -> f(x,u,minus(z,s(x)),u) r6: 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 reduction pair: weighted path order base order: max/plus interpretations on natural numbers: f#_A(x1,x2,x3,x4) = x1 + 1 s_A(x1) = max{3, x1 + 1} |0|_A = 1 minus_A(x1,x2) = max{5, x1 - 3, x2 + 2} precedence: f# = s = |0| = minus partial status: pi(f#) = [] pi(s) = [1] pi(|0|) = [] pi(minus) = [] The next rules are strictly ordered: p2 We remove them from the problem. -- SCC decomposition. 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) and R consists of: r1: perfectp(|0|()) -> false() r2: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x)) r3: f(|0|(),y,|0|(),u) -> true() r4: f(|0|(),y,s(z),u) -> false() r5: f(s(x),|0|(),z,u) -> f(x,u,minus(z,s(x)),u) r6: 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: {p1} -- 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) and R consists of: r1: perfectp(|0|()) -> false() r2: perfectp(s(x)) -> f(x,s(|0|()),s(x),s(x)) r3: f(|0|(),y,|0|(),u) -> true() r4: f(|0|(),y,s(z),u) -> false() r5: f(s(x),|0|(),z,u) -> f(x,u,minus(z,s(x)),u) r6: 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 reduction pair: weighted path order base order: max/plus interpretations on natural numbers: f#_A(x1,x2,x3,x4) = max{x1 + 1, x2 + 1, x3 - 4, x4 + 1} s_A(x1) = max{3, x1 + 1} |0|_A = 0 minus_A(x1,x2) = max{5, x1, x2 + 2} precedence: f# = s = |0| = minus partial status: pi(f#) = [1, 2] pi(s) = [] pi(|0|) = [] pi(minus) = [] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.