Term Rewriting System R: [y, x, ys, xs] +(0, y) -> y +(s(x), y) -> s(+(x, y)) ++(nil, ys) -> ys ++(:(x, xs), ys) -> :(x, ++(xs, ys)) sum(:(x, nil)) -> :(x, nil) sum(:(x, :(y, xs))) -> sum(:(+(x, y), xs)) sum(++(xs, :(x, :(y, ys)))) -> sum(++(xs, sum(:(x, :(y, ys))))) -(x, 0) -> x -(0, s(y)) -> 0 -(s(x), s(y)) -> -(x, y) quot(0, s(y)) -> 0 quot(s(x), s(y)) -> s(quot(-(x, y), s(y))) length(nil) -> 0 length(:(x, xs)) -> s(length(xs)) hd(:(x, xs)) -> x avg(xs) -> quot(hd(sum(xs)), length(xs)) Termination of R to be shown. R contains the following Dependency Pairs: +'(s(x), y) -> +'(x, y) QUOT(s(x), s(y)) -> QUOT(-(x, y), s(y)) QUOT(s(x), s(y)) -> -'(x, y) -'(s(x), s(y)) -> -'(x, y) AVG(xs) -> QUOT(hd(sum(xs)), length(xs)) AVG(xs) -> HD(sum(xs)) AVG(xs) -> SUM(xs) AVG(xs) -> LENGTH(xs) SUM(:(x, :(y, xs))) -> SUM(:(+(x, y), xs)) SUM(:(x, :(y, xs))) -> +'(x, y) SUM(++(xs, :(x, :(y, ys)))) -> SUM(++(xs, sum(:(x, :(y, ys))))) SUM(++(xs, :(x, :(y, ys)))) -> ++'(xs, sum(:(x, :(y, ys)))) SUM(++(xs, :(x, :(y, ys)))) -> SUM(:(x, :(y, ys))) LENGTH(:(x, xs)) -> LENGTH(xs) ++'(:(x, xs), ys) -> ++'(xs, ys) Furthermore, R contains seven SCCs. SCC1: +'(s(x), y) -> +'(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(+'(x_1, x_2)) = 1 + x_1 + x_2 The following Dependency Pairs can be deleted: +'(s(x), y) -> +'(x, y) This transformation is resulting in no new subcycles. SCC2: -'(s(x), s(y)) -> -'(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(-'(x_1, x_2)) = 1 + x_1 + x_2 The following Dependency Pairs can be deleted: -'(s(x), s(y)) -> -'(x, y) This transformation is resulting in no new subcycles. SCC3: ++'(:(x, xs), ys) -> ++'(xs, ys) 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(++'(x_1, x_2)) = 1 + x_1 + x_2 POL(:(x_1, x_2)) = 1 + x_1 + x_2 The following Dependency Pairs can be deleted: ++'(:(x, xs), ys) -> ++'(xs, ys) This transformation is resulting in no new subcycles. SCC4: LENGTH(:(x, xs)) -> LENGTH(xs) 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(LENGTH(x_1)) = 1 + x_1 POL(:(x_1, x_2)) = 1 + x_1 + x_2 The following Dependency Pairs can be deleted: LENGTH(:(x, xs)) -> LENGTH(xs) This transformation is resulting in no new subcycles. SCC5: SUM(:(x, :(y, xs))) -> SUM(:(+(x, y), xs)) 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)) = x_1 POL(SUM(x_1)) = 1 + x_1 POL(:(x_1, x_2)) = x_1 + x_2 POL(+(x_1, x_2)) = x_1 + x_2 POL(0) = 1 No Dependency Pairs can be deleted. The following rules of R can be deleted: hd(:(x, xs)) -> x quot(s(x), s(y)) -> s(quot(-(x, y), s(y))) quot(0, s(y)) -> 0 -(0, s(y)) -> 0 -(x, 0) -> x -(s(x), s(y)) -> -(x, y) avg(xs) -> quot(hd(sum(xs)), length(xs)) sum(:(x, :(y, xs))) -> sum(:(+(x, y), xs)) sum(++(xs, :(x, :(y, ys)))) -> sum(++(xs, sum(:(x, :(y, ys))))) sum(:(x, nil)) -> :(x, nil) length(nil) -> 0 length(:(x, xs)) -> s(length(xs)) ++(:(x, xs), ys) -> :(x, ++(xs, ys)) ++(nil, ys) -> ys +(0, y) -> y This transformation is resulting in one new subcycle: SCC5.MRR1: SUM(:(x, :(y, xs))) -> SUM(:(+(x, y), xs)) 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)) = x_1 POL(SUM(x_1)) = 1 + x_1 POL(:(x_1, x_2)) = 1 + x_1 + x_2 POL(+(x_1, x_2)) = x_1 + x_2 The following Dependency Pairs can be deleted: SUM(:(x, :(y, xs))) -> SUM(:(+(x, y), xs)) This transformation is resulting in no new subcycles. SCC6: SUM(++(xs, :(x, :(y, ys)))) -> SUM(++(xs, sum(:(x, :(y, ys))))) 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(nil) = 0 POL(++(x_1, x_2)) = x_1 + x_2 POL(s(x_1)) = x_1 POL(SUM(x_1)) = 1 + x_1 POL(sum(x_1)) = x_1 POL(:(x_1, x_2)) = x_1 + x_2 POL(+(x_1, x_2)) = x_1 + x_2 POL(0) = 1 No Dependency Pairs can be deleted. The following rules of R can be deleted: hd(:(x, xs)) -> x quot(s(x), s(y)) -> s(quot(-(x, y), s(y))) quot(0, s(y)) -> 0 -(0, s(y)) -> 0 -(x, 0) -> x -(s(x), s(y)) -> -(x, y) avg(xs) -> quot(hd(sum(xs)), length(xs)) length(nil) -> 0 length(:(x, xs)) -> s(length(xs)) +(0, y) -> y This transformation is resulting in one new subcycle: SCC6.MRR1: SUM(++(xs, :(x, :(y, ys)))) -> SUM(++(xs, sum(:(x, :(y, ys))))) 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(nil) = 0 POL(++(x_1, x_2)) = 1 + x_1 + x_2 POL(s(x_1)) = x_1 POL(SUM(x_1)) = 1 + x_1 POL(sum(x_1)) = x_1 POL(:(x_1, x_2)) = x_1 + x_2 POL(+(x_1, x_2)) = x_1 + x_2 No Dependency Pairs can be deleted. The following rules of R can be deleted: ++(nil, ys) -> ys This transformation is resulting in one new subcycle: SCC6.MRR1.MRR1: SUM(++(xs, :(x, :(y, ys)))) -> SUM(++(xs, sum(:(x, :(y, ys))))) 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(nil) = 0 POL(++(x_1, x_2)) = x_1 + x_2 POL(s(x_1)) = x_1 POL(SUM(x_1)) = 1 + x_1 POL(sum(x_1)) = x_1 POL(:(x_1, x_2)) = 1 + x_1 + x_2 POL(+(x_1, x_2)) = x_1 + x_2 No Dependency Pairs can be deleted. The following rules of R can be deleted: sum(:(x, :(y, xs))) -> sum(:(+(x, y), xs)) This transformation is resulting in one new subcycle: SCC6.MRR1.MRR1.MRR1: SUM(++(xs, :(x, :(y, ys)))) -> SUM(++(xs, sum(:(x, :(y, ys))))) 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(nil) = 0 POL(++(x_1, x_2)) = x_1 + x_2 POL(SUM(x_1)) = 1 + x_1 POL(sum(x_1)) = x_1 POL(:(x_1, x_2)) = x_1 + x_2 No Dependency Pairs can be deleted. The following rules of R can be deleted: +(s(x), y) -> s(+(x, y)) This transformation is resulting in one new subcycle: SCC6.MRR1.MRR1.MRR1.MRR1: SUM(++(xs, :(x, :(y, ys)))) -> SUM(++(xs, sum(:(x, :(y, ys))))) On this Scc, a Narrowing SCC transformation can be performed. As a result of transforming the rule SUM(++(xs, :(x, :(y, ys)))) -> SUM(++(xs, sum(:(x, :(y, ys))))) one new Dependency Pair is created: SUM(++(:(x'', xs''), :(x0, :(y', ys'')))) -> SUM(:(x'', ++(xs'', sum(:(x0, :(y', ys'')))))) The transformation is resulting in no subcycles. SCC7: QUOT(s(x), s(y)) -> QUOT(-(x, y), 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: -(0, s(y)) -> 0 -(x, 0) -> x -(s(x), s(y)) -> -(x, y) Used ordering: Polynomial ordering with Polynomial interpretation: POL(s(x_1)) = 1 + x_1 POL(-(x_1, x_2)) = x_1 POL(QUOT(x_1, x_2)) = 1 + x_1 POL(0) = 0 resulting in no subcycles. Termination of R successfully shown. Duration: 1.152 seconds.