Term Rewriting System R: [X, Y] p(0) -> 0 p(s(X)) -> X leq(0, Y) -> true leq(s(X), 0) -> false leq(s(X), s(Y)) -> leq(X, Y) if(true, X, Y) -> X if(false, X, Y) -> Y diff(X, Y) -> if(leq(X, Y), 0, s(diff(p(X), Y))) 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: DIFF(X, Y) -> IF(leq(X, Y), 0, s(diff(p(X), Y))) DIFF(X, Y) -> LEQ(X, Y) DIFF(X, Y) -> DIFF(p(X), Y) DIFF(X, Y) -> P(X) LEQ(s(X), s(Y)) -> LEQ(X, Y) Furthermore, R contains two SCCs. SCC1: LEQ(s(X), s(Y)) -> LEQ(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(LEQ(x_1, x_2)) = 1 + x_1 + x_2 The following Dependency Pairs can be deleted: LEQ(s(X), s(Y)) -> LEQ(X, Y) This transformation is resulting in no new subcycles. SCC2: DIFF(X, Y) -> DIFF(p(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(0) = 0 POL(p(x_1)) = x_1 POL(DIFF(x_1, x_2)) = 1 + x_1 + x_2 No Dependency Pairs can be deleted. The following rules of R can be deleted: p(s(X)) -> X This transformation is resulting in one new subcycle: SCC2.MRR1: DIFF(X, Y) -> DIFF(p(X), Y) Found an infinite P-chain over R: P = DIFF(X, Y) -> DIFF(p(X), Y) R = [p(0) -> 0] s = DIFF(X, Y) evaluates to t = DIFF(p(X), Y) Thus, s starts an infinite reduction as s matches t. Non-Termination of R could be shown. Duration: 0.602 seconds.