Consider the TRS R consisting of the rewrite rules 1: le(0,y) -> true 2: le(s(x),0) -> false 3: le(s(x),s(y)) -> le(x,y) 4: minus(0,y) -> 0 5: minus(s(x),y) -> if_minus(le(s(x),y),s(x),y) 6: if_minus(true,s(x),y) -> 0 7: if_minus(false,s(x),y) -> s(minus(x,y)) 8: gcd(0,y) -> y 9: gcd(s(x),0) -> s(x) 10: gcd(s(x),s(y)) -> if_gcd(le(y,x),s(x),s(y)) 11: if_gcd(true,s(x),s(y)) -> gcd(minus(x,y),s(y)) 12: if_gcd(false,s(x),s(y)) -> gcd(minus(y,x),s(x)) There are 10 dependency pairs: 13: LE(s(x),s(y)) -> LE(x,y) 14: MINUS(s(x),y) -> IF_MINUS(le(s(x),y),s(x),y) 15: MINUS(s(x),y) -> LE(s(x),y) 16: IF_MINUS(false,s(x),y) -> MINUS(x,y) 17: GCD(s(x),s(y)) -> IF_GCD(le(y,x),s(x),s(y)) 18: GCD(s(x),s(y)) -> LE(y,x) 19: IF_GCD(true,s(x),s(y)) -> GCD(minus(x,y),s(y)) 20: IF_GCD(true,s(x),s(y)) -> MINUS(x,y) 21: IF_GCD(false,s(x),s(y)) -> GCD(minus(y,x),s(x)) 22: IF_GCD(false,s(x),s(y)) -> MINUS(y,x) The approximated dependency graph contains 3 SCCs: {13}, {14,16} and {17,19,21}. - Consider the SCC {13}. There are no usable rules. By taking the polynomial interpretation [s](x) = x + 1 and [LE](x,y) = x + y + 1, rule 13 is strictly decreasing. - Consider the SCC {14,16}. The usable rules are {1-3}. By taking the polynomial interpretation [0] = [false] = [true] = 1, [s](x) = x + 1, [le](x,y) = [MINUS](x,y) = x + y + 1 and [IF_MINUS](x,y,z) = y + z + 1, rule 14 is weakly decreasing and the rules in {1-3,16} are strictly decreasing. - Consider the SCC {17,19,21}. The usable rules are {1-7}. By taking the polynomial interpretation [0] = [false] = [true] = 1, [minus](x,y) = x, [s](x) = x + 1, [GCD](x,y) = [le](x,y) = x + y + 1, [if_minus](x,y,z) = y and [IF_GCD](x,y,z) = y + z + 1, the rules in {4-7,17} are weakly decreasing and the rules in {1-3,19,21} are strictly decreasing. Hence the TRS is terminating.