We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict Trs: { foldl(x, Cons(S(0()), xs)) -> foldl(S(x), xs) , foldl(a, Nil()) -> a , foldl(S(0()), Cons(x, xs)) -> foldl(S(x), xs) , foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) , notEmpty(Cons(x, xs)) -> True() , notEmpty(Nil()) -> False() , fold(a, xs) -> Cons(foldl(a, xs), Cons(foldr(a, xs), Nil())) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We add the following weak dependency pairs: Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(a, Nil()) -> c_2() , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , foldr^#(a, Nil()) -> c_5() , op^#(x, S(0())) -> c_6() , op^#(S(0()), y) -> c_7() , notEmpty^#(Cons(x, xs)) -> c_8() , notEmpty^#(Nil()) -> c_9() , fold^#(a, xs) -> c_10(foldl^#(a, xs), foldr^#(a, xs)) } and mark the set of starting terms. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(a, Nil()) -> c_2() , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , foldr^#(a, Nil()) -> c_5() , op^#(x, S(0())) -> c_6() , op^#(S(0()), y) -> c_7() , notEmpty^#(Cons(x, xs)) -> c_8() , notEmpty^#(Nil()) -> c_9() , fold^#(a, xs) -> c_10(foldl^#(a, xs), foldr^#(a, xs)) } Strict Trs: { foldl(x, Cons(S(0()), xs)) -> foldl(S(x), xs) , foldl(a, Nil()) -> a , foldl(S(0()), Cons(x, xs)) -> foldl(S(x), xs) , foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) , notEmpty(Cons(x, xs)) -> True() , notEmpty(Nil()) -> False() , fold(a, xs) -> Cons(foldl(a, xs), Cons(foldr(a, xs), Nil())) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We replace rewrite rules by usable rules: Strict Usable Rules: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(a, Nil()) -> c_2() , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , foldr^#(a, Nil()) -> c_5() , op^#(x, S(0())) -> c_6() , op^#(S(0()), y) -> c_7() , notEmpty^#(Cons(x, xs)) -> c_8() , notEmpty^#(Nil()) -> c_9() , fold^#(a, xs) -> c_10(foldl^#(a, xs), foldr^#(a, xs)) } Strict Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) The weightgap principle applies (using the following constant growth matrix-interpretation) The following argument positions are usable: Uargs(op) = {2}, Uargs(c_1) = {1}, Uargs(c_3) = {1}, Uargs(c_4) = {1}, Uargs(op^#) = {2}, Uargs(c_10) = {1, 2} TcT has computed the following constructor-restricted matrix interpretation. [Cons](x1, x2) = [1 0] x1 + [1 0] x2 + [0] [0 1] [0 1] [2] [S](x1) = [1 0] x1 + [0] [0 1] [0] [0] = [1] [0] [foldr](x1, x2) = [2 0] x1 + [2 1] x2 + [1] [0 2] [0 1] [2] [op](x1, x2) = [1 1] x1 + [1 0] x2 + [0] [0 1] [0 1] [0] [Nil] = [0] [0] [foldl^#](x1, x2) = [0] [0] [c_1](x1) = [1 0] x1 + [0] [0 1] [0] [c_2] = [0] [0] [c_3](x1) = [1 0] x1 + [0] [0 1] [0] [foldr^#](x1, x2) = [2 0] x1 + [2 1] x2 + [0] [0 0] [0 0] [0] [c_4](x1) = [1 0] x1 + [0] [0 1] [0] [op^#](x1, x2) = [1 0] x2 + [0] [0 0] [0] [c_5] = [0] [0] [c_6] = [0] [0] [c_7] = [0] [0] [notEmpty^#](x1) = [0] [0] [c_8] = [0] [0] [c_9] = [0] [0] [fold^#](x1, x2) = [2 1] x1 + [2 2] x2 + [0] [0 0] [0 0] [0] [c_10](x1, x2) = [1 0] x1 + [1 0] x2 + [2] [0 1] [0 1] [2] The order satisfies the following ordering constraints: [foldr(a, Cons(x, xs))] = [2 1] x + [2 1] xs + [2 0] a + [3] [0 1] [0 1] [0 2] [4] > [1 1] x + [2 1] xs + [2 0] a + [1] [0 1] [0 1] [0 2] [2] = [op(x, foldr(a, xs))] [foldr(a, Nil())] = [2 0] a + [1] [0 2] [2] > [1 0] a + [0] [0 1] [0] = [a] [op(x, S(0()))] = [1 1] x + [1] [0 1] [0] > [1 0] x + [0] [0 1] [0] = [S(x)] [op(S(0()), y)] = [1 0] y + [1] [0 1] [0] > [1 0] y + [0] [0 1] [0] = [S(y)] [foldl^#(x, Cons(S(0()), xs))] = [0] [0] >= [0] [0] = [c_1(foldl^#(S(x), xs))] [foldl^#(a, Nil())] = [0] [0] >= [0] [0] = [c_2()] [foldl^#(S(0()), Cons(x, xs))] = [0] [0] >= [0] [0] = [c_3(foldl^#(S(x), xs))] [foldr^#(a, Cons(x, xs))] = [2 1] x + [2 1] xs + [2 0] a + [2] [0 0] [0 0] [0 0] [0] > [2 1] xs + [2 0] a + [1] [0 0] [0 0] [0] = [c_4(op^#(x, foldr(a, xs)))] [foldr^#(a, Nil())] = [2 0] a + [0] [0 0] [0] >= [0] [0] = [c_5()] [op^#(x, S(0()))] = [1] [0] > [0] [0] = [c_6()] [op^#(S(0()), y)] = [1 0] y + [0] [0 0] [0] >= [0] [0] = [c_7()] [notEmpty^#(Cons(x, xs))] = [0] [0] >= [0] [0] = [c_8()] [notEmpty^#(Nil())] = [0] [0] >= [0] [0] = [c_9()] [fold^#(a, xs)] = [2 2] xs + [2 1] a + [0] [0 0] [0 0] [0] ? [2 1] xs + [2 0] a + [2] [0 0] [0 0] [2] = [c_10(foldl^#(a, xs), foldr^#(a, xs))] Further, it can be verified that all rules not oriented are covered by the weightgap condition. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(a, Nil()) -> c_2() , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , foldr^#(a, Nil()) -> c_5() , op^#(S(0()), y) -> c_7() , notEmpty^#(Cons(x, xs)) -> c_8() , notEmpty^#(Nil()) -> c_9() , fold^#(a, xs) -> c_10(foldl^#(a, xs), foldr^#(a, xs)) } Weak DPs: { foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , op^#(x, S(0())) -> c_6() } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We estimate the number of application of {2,4,6,7} by applications of Pre({2,4,6,7}) = {1,3,8}. Here rules are labeled as follows: DPs: { 1: foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , 2: foldl^#(a, Nil()) -> c_2() , 3: foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , 4: foldr^#(a, Nil()) -> c_5() , 5: op^#(S(0()), y) -> c_7() , 6: notEmpty^#(Cons(x, xs)) -> c_8() , 7: notEmpty^#(Nil()) -> c_9() , 8: fold^#(a, xs) -> c_10(foldl^#(a, xs), foldr^#(a, xs)) , 9: foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , 10: op^#(x, S(0())) -> c_6() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , op^#(S(0()), y) -> c_7() , fold^#(a, xs) -> c_10(foldl^#(a, xs), foldr^#(a, xs)) } Weak DPs: { foldl^#(a, Nil()) -> c_2() , foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , foldr^#(a, Nil()) -> c_5() , op^#(x, S(0())) -> c_6() , notEmpty^#(Cons(x, xs)) -> c_8() , notEmpty^#(Nil()) -> c_9() } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { foldl^#(a, Nil()) -> c_2() , foldr^#(a, Nil()) -> c_5() , op^#(x, S(0())) -> c_6() , notEmpty^#(Cons(x, xs)) -> c_8() , notEmpty^#(Nil()) -> c_9() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , op^#(S(0()), y) -> c_7() , fold^#(a, xs) -> c_10(foldl^#(a, xs), foldr^#(a, xs)) } Weak DPs: { foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) Consider the dependency graph 1: foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) -->_1 foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) :2 -->_1 foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) :1 2: foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) -->_1 foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) :2 -->_1 foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) :1 3: op^#(S(0()), y) -> c_7() 4: fold^#(a, xs) -> c_10(foldl^#(a, xs), foldr^#(a, xs)) -->_2 foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) :5 -->_1 foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) :2 -->_1 foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) :1 5: foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) -->_1 op^#(S(0()), y) -> c_7() :3 Following roots of the dependency graph are removed, as the considered set of starting terms is closed under reduction with respect to these rules (modulo compound contexts). { fold^#(a, xs) -> c_10(foldl^#(a, xs), foldr^#(a, xs)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , op^#(S(0()), y) -> c_7() } Weak DPs: { foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We analyse the complexity of following sub-problems (R) and (S). Problem (S) is obtained from the input problem by shifting strict rules from (R) into the weak component: Problem (R): ------------ Strict DPs: { op^#(S(0()), y) -> c_7() } Weak DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } StartTerms: basic terms Strategy: innermost Problem (S): ------------ Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) } Weak DPs: { foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , op^#(S(0()), y) -> c_7() } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } StartTerms: basic terms Strategy: innermost Overall, the transformation results in the following sub-problem(s): Generated new problems: ----------------------- R) Strict DPs: { op^#(S(0()), y) -> c_7() } Weak DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } StartTerms: basic terms Strategy: innermost This problem was proven YES(O(1),O(1)). S) Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) } Weak DPs: { foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , op^#(S(0()), y) -> c_7() } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } StartTerms: basic terms Strategy: innermost This problem was proven YES(O(1),O(n^1)). Proofs for generated problems: ------------------------------ R) We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Strict DPs: { op^#(S(0()), y) -> c_7() } Weak DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) , foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Strict DPs: { op^#(S(0()), y) -> c_7() } Weak DPs: { foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) The dependency graph contains no loops, we remove all dependency pairs. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) No rule is usable, rules are removed from the input problem. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Rules: Empty Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) Empty rules are trivially bounded S) We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) } Weak DPs: { foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , op^#(S(0()), y) -> c_7() } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { foldr^#(a, Cons(x, xs)) -> c_4(op^#(x, foldr(a, xs))) , op^#(S(0()), y) -> c_7() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) } Weak Trs: { foldr(a, Cons(x, xs)) -> op(x, foldr(a, xs)) , foldr(a, Nil()) -> a , op(x, S(0())) -> S(x) , op(S(0()), y) -> S(y) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) No rule is usable, rules are removed from the input problem. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We use the processor 'Small Polynomial Path Order (PS,1-bounded)' to orient following rules strictly. DPs: { 1: foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , 2: foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) } Sub-proof: ---------- The input was oriented with the instance of 'Small Polynomial Path Order (PS,1-bounded)' as induced by the safe mapping safe(Cons) = {1, 2}, safe(S) = {1}, safe(0) = {}, safe(foldl^#) = {1}, safe(c_1) = {}, safe(c_3) = {} and precedence empty . Following symbols are considered recursive: {foldl^#} The recursion depth is 1. Further, following argument filtering is employed: pi(Cons) = [1, 2], pi(S) = [1], pi(0) = [], pi(foldl^#) = [2], pi(c_1) = [1], pi(c_3) = [1] Usable defined function symbols are a subset of: {foldl^#} For your convenience, here are the satisfied ordering constraints: pi(foldl^#(x, Cons(S(0()), xs))) = foldl^#(Cons(; S(; 0()), xs);) > c_1(foldl^#(xs;);) = pi(c_1(foldl^#(S(x), xs))) pi(foldl^#(S(0()), Cons(x, xs))) = foldl^#(Cons(; x, xs);) > c_3(foldl^#(xs;);) = pi(c_3(foldl^#(S(x), xs))) The strictly oriented rules are moved into the weak component. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Weak DPs: { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) } Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { foldl^#(x, Cons(S(0()), xs)) -> c_1(foldl^#(S(x), xs)) , foldl^#(S(0()), Cons(x, xs)) -> c_3(foldl^#(S(x), xs)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Rules: Empty Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) Empty rules are trivially bounded Hurray, we answered YES(O(1),O(n^1))