Term Rewriting System R: [X, Y, N, M] eq(0, 0) -> true eq(0, s(X)) -> false eq(s(X), 0) -> false eq(s(X), s(Y)) -> eq(X, Y) rm(N, nil) -> nil rm(N, add(M, X)) -> ifrm(eq(N, M), N, add(M, X)) ifrm(true, N, add(M, X)) -> rm(N, X) ifrm(false, N, add(M, X)) -> add(M, rm(N, X)) purge(nil) -> nil purge(add(N, X)) -> add(N, purge(rm(N, 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: EQ(s(X), s(Y)) -> EQ(X, Y) IFRM(true, N, add(M, X)) -> RM(N, X) IFRM(false, N, add(M, X)) -> RM(N, X) RM(N, add(M, X)) -> IFRM(eq(N, M), N, add(M, X)) RM(N, add(M, X)) -> EQ(N, M) PURGE(add(N, X)) -> PURGE(rm(N, X)) PURGE(add(N, X)) -> RM(N, X) Furthermore, R contains three SCCs. SCC1: EQ(s(X), s(Y)) -> EQ(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(EQ(x_1, x_2)) = 1 + x_1 + x_2 The following Dependency Pairs can be deleted: EQ(s(X), s(Y)) -> EQ(X, Y) This transformation is resulting in no new subcycles. SCC2: IFRM(false, N, add(M, X)) -> RM(N, X) RM(N, add(M, X)) -> IFRM(eq(N, M), N, add(M, X)) IFRM(true, N, add(M, X)) -> RM(N, X) By using a polynomial ordering, at least one Dependency Pair of this SCC can be strictly oriented. No rules need to be oriented. Used ordering: Polynomial ordering with Polynomial interpretation: POL(add(x_1, x_2)) = 1 + x_2 POL(s(x_1)) = 0 POL(eq(x_1, x_2)) = 0 POL(RM(x_1, x_2)) = x_2 POL(true) = 0 POL(0) = 0 POL(IFRM(x_1, x_2, x_3)) = x_3 POL(false) = 0 resulting in no subcycles. SCC3: PURGE(add(N, X)) -> PURGE(rm(N, X)) By using a polynomial ordering, at least one Dependency Pair of this SCC can be strictly oriented. Additionally, the following rules can be oriented: ifrm(true, N, add(M, X)) -> rm(N, X) ifrm(false, N, add(M, X)) -> add(M, rm(N, X)) rm(N, nil) -> nil rm(N, add(M, X)) -> ifrm(eq(N, M), N, add(M, X)) Used ordering: Polynomial ordering with Polynomial interpretation: POL(nil) = 0 POL(add(x_1, x_2)) = 1 + x_2 POL(ifrm(x_1, x_2, x_3)) = x_3 POL(s(x_1)) = 0 POL(eq(x_1, x_2)) = 0 POL(rm(x_1, x_2)) = x_2 POL(true) = 0 POL(PURGE(x_1)) = x_1 POL(0) = 0 POL(false) = 0 resulting in no subcycles. Termination of R successfully shown. Duration: 0.866 seconds.