Term Rewriting System R: [X, Y] 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)) Termination of R to be shown. This program has no overlaps, so it is sufficient to show innermost termination. R contains the following Dependency Pairs: GCD(s(X), s(Y)) -> IF(le(Y, X), s(X), s(Y)) GCD(s(X), s(Y)) -> LE(Y, X) IF(false, s(X), s(Y)) -> GCD(minus(Y, X), s(X)) IF(false, s(X), s(Y)) -> MINUS(Y, X) IF(true, s(X), s(Y)) -> GCD(minus(X, Y), s(Y)) IF(true, s(X), s(Y)) -> MINUS(X, Y) LE(s(X), s(Y)) -> LE(X, Y) MINUS(X, s(Y)) -> PRED(minus(X, Y)) MINUS(X, s(Y)) -> MINUS(X, Y) Furthermore, R contains three SCCs. SCC1: LE(s(X), s(Y)) -> LE(X, Y) Removing rules from R by ordering and analyzing Dependency Pairs, Usable Rules, and Usable Equations. This is possible by using the following (C_E-compatible) Polynomial ordering. Polynomial interpretation: POL(LE(x_1, x_2)) = 1 + x_1 + x_2 POL(s(x_1)) = 1 + x_1 The following Dependency Pairs can be deleted: LE(s(X), s(Y)) -> LE(X, Y) This transformation is resulting in no new subcycles. SCC2: MINUS(X, s(Y)) -> MINUS(X, Y) Removing rules from R by ordering and analyzing Dependency Pairs, Usable Rules, and Usable Equations. This is possible by using the following (C_E-compatible) Polynomial ordering. Polynomial interpretation: POL(s(x_1)) = 1 + x_1 POL(MINUS(x_1, x_2)) = 1 + x_1 + x_2 The following Dependency Pairs can be deleted: MINUS(X, s(Y)) -> MINUS(X, Y) This transformation is resulting in no new subcycles. SCC3: IF(true, s(X), s(Y)) -> GCD(minus(X, Y), s(Y)) IF(false, s(X), s(Y)) -> GCD(minus(Y, X), s(X)) GCD(s(X), s(Y)) -> IF(le(Y, X), s(X), s(Y)) By using a polynomial ordering, at least one Dependency Pair of this SCC can be strictly oriented. Additionally, the following rules can be oriented: minus(X, 0) -> X minus(X, s(Y)) -> pred(minus(X, Y)) pred(s(X)) -> X Used ordering: Polynomial ordering with Polynomial interpretation: POL(s(x_1)) = 1 + x_1 POL(le(x_1, x_2)) = 0 POL(minus(x_1, x_2)) = x_1 POL(pred(x_1)) = x_1 POL(true) = 0 POL(GCD(x_1, x_2)) = x_1 + x_2 POL(0) = 0 POL(false) = 0 POL(IF(x_1, x_2, x_3)) = x_2 + x_3 resulting in no subcycles. Termination of R successfully shown. Duration: 0.949 seconds.