YES We show the termination of the TRS R: minus(X,s(Y)) -> pred(minus(X,Y)) minus(X,|0|()) -> X pred(s(X)) -> X le(s(X),s(Y)) -> le(X,Y) le(s(X),|0|()) -> false() le(|0|(),Y) -> true() gcd(|0|(),Y) -> |0|() gcd(s(X),|0|()) -> s(X) gcd(s(X),s(Y)) -> if(le(Y,X),s(X),s(Y)) if(true(),s(X),s(Y)) -> gcd(minus(X,Y),s(Y)) if(false(),s(X),s(Y)) -> gcd(minus(Y,X),s(X)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: minus#(X,s(Y)) -> pred#(minus(X,Y)) p2: minus#(X,s(Y)) -> minus#(X,Y) p3: le#(s(X),s(Y)) -> le#(X,Y) p4: gcd#(s(X),s(Y)) -> if#(le(Y,X),s(X),s(Y)) p5: gcd#(s(X),s(Y)) -> le#(Y,X) p6: if#(true(),s(X),s(Y)) -> gcd#(minus(X,Y),s(Y)) p7: if#(true(),s(X),s(Y)) -> minus#(X,Y) p8: if#(false(),s(X),s(Y)) -> gcd#(minus(Y,X),s(X)) p9: if#(false(),s(X),s(Y)) -> minus#(Y,X) and R consists of: r1: minus(X,s(Y)) -> pred(minus(X,Y)) r2: minus(X,|0|()) -> X r3: pred(s(X)) -> X r4: le(s(X),s(Y)) -> le(X,Y) r5: le(s(X),|0|()) -> false() r6: le(|0|(),Y) -> true() r7: gcd(|0|(),Y) -> |0|() r8: gcd(s(X),|0|()) -> s(X) r9: gcd(s(X),s(Y)) -> if(le(Y,X),s(X),s(Y)) r10: if(true(),s(X),s(Y)) -> gcd(minus(X,Y),s(Y)) r11: if(false(),s(X),s(Y)) -> gcd(minus(Y,X),s(X)) The estimated dependency graph contains the following SCCs: {p4, p6, p8} {p2} {p3} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: gcd#(s(X),s(Y)) -> if#(le(Y,X),s(X),s(Y)) p2: if#(false(),s(X),s(Y)) -> gcd#(minus(Y,X),s(X)) p3: if#(true(),s(X),s(Y)) -> gcd#(minus(X,Y),s(Y)) and R consists of: r1: minus(X,s(Y)) -> pred(minus(X,Y)) r2: minus(X,|0|()) -> X r3: pred(s(X)) -> X r4: le(s(X),s(Y)) -> le(X,Y) r5: le(s(X),|0|()) -> false() r6: le(|0|(),Y) -> true() r7: gcd(|0|(),Y) -> |0|() r8: gcd(s(X),|0|()) -> s(X) r9: gcd(s(X),s(Y)) -> if(le(Y,X),s(X),s(Y)) r10: if(true(),s(X),s(Y)) -> gcd(minus(X,Y),s(Y)) r11: if(false(),s(X),s(Y)) -> gcd(minus(Y,X),s(X)) The set of usable rules consists of r1, r2, r3, r4, r5, r6 Take the reduction pair: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: gcd#_A(x1,x2) = x1 + ((1,0),(1,0)) x2 + (1,0) s_A(x1) = x1 + (3,1) if#_A(x1,x2,x3) = x1 + x2 + x3 le_A(x1,x2) = ((0,0),(1,0)) x1 + (1,1) false_A() = (1,1) minus_A(x1,x2) = ((1,0),(1,1)) x1 + ((0,0),(1,0)) x2 + (1,1) true_A() = (0,3) pred_A(x1) = x1 |0|_A() = (1,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#(X,s(Y)) -> minus#(X,Y) and R consists of: r1: minus(X,s(Y)) -> pred(minus(X,Y)) r2: minus(X,|0|()) -> X r3: pred(s(X)) -> X r4: le(s(X),s(Y)) -> le(X,Y) r5: le(s(X),|0|()) -> false() r6: le(|0|(),Y) -> true() r7: gcd(|0|(),Y) -> |0|() r8: gcd(s(X),|0|()) -> s(X) r9: gcd(s(X),s(Y)) -> if(le(Y,X),s(X),s(Y)) r10: if(true(),s(X),s(Y)) -> gcd(minus(X,Y),s(Y)) r11: if(false(),s(X),s(Y)) -> gcd(minus(Y,X),s(X)) The set of usable rules consists of (no rules) Take the reduction pair: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: minus#_A(x1,x2) = ((1,0),(1,0)) x2 s_A(x1) = ((1,0),(1,1)) x1 + (1,1) The next rules are strictly ordered: p1 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(X,s(Y)) -> pred(minus(X,Y)) r2: minus(X,|0|()) -> X r3: pred(s(X)) -> X r4: le(s(X),s(Y)) -> le(X,Y) r5: le(s(X),|0|()) -> false() r6: le(|0|(),Y) -> true() r7: gcd(|0|(),Y) -> |0|() r8: gcd(s(X),|0|()) -> s(X) r9: gcd(s(X),s(Y)) -> if(le(Y,X),s(X),s(Y)) r10: if(true(),s(X),s(Y)) -> gcd(minus(X,Y),s(Y)) r11: if(false(),s(X),s(Y)) -> gcd(minus(Y,X),s(X)) The set of usable rules consists of (no rules) Take the monotone reduction pair: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: le#_A(x1,x2) = ((1,0),(1,1)) x1 + ((1,0),(1,1)) x2 s_A(x1) = ((1,0),(1,1)) x1 + (1,1) The next rules are strictly ordered: p1 r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11 We remove them from the problem. Then no dependency pair remains.