WORST_CASE(Omega(n^1),O(n^2)) * Step 1: Sum WORST_CASE(Omega(n^1),O(n^2)) + Considered Problem: - Strict TRS: flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) flattensort(t) -> insertionsort(flatten(t)) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2} / {0/0,cons/2,false/0,leaf/0 ,nil/0,node/3,s/1,true/0} - Obligation: innermost runtime complexity wrt. defined symbols {append,flatten,flattensort,if'insert,insert,insertionsort ,leq} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: Sum {left = someStrategy, right = someStrategy} + Details: () ** Step 1.a:1: DecreasingLoops WORST_CASE(Omega(n^1),?) + Considered Problem: - Strict TRS: flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) flattensort(t) -> insertionsort(flatten(t)) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2} / {0/0,cons/2,false/0,leaf/0 ,nil/0,node/3,s/1,true/0} - Obligation: innermost runtime complexity wrt. defined symbols {append,flatten,flattensort,if'insert,insert,insertionsort ,leq} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: DecreasingLoops {bound = AnyLoop, narrow = 10} + Details: The system has following decreasing Loops: flatten(y){y -> node(x,y,z)} = flatten(node(x,y,z)) ->^+ append(x,append(flatten(y),flatten(z))) = C[flatten(y) = flatten(y){}] ** Step 1.b:1: DependencyPairs WORST_CASE(?,O(n^2)) + Considered Problem: - Strict TRS: flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) flattensort(t) -> insertionsort(flatten(t)) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2} / {0/0,cons/2,false/0,leaf/0 ,nil/0,node/3,s/1,true/0} - Obligation: innermost runtime complexity wrt. defined symbols {append,flatten,flattensort,if'insert,insert,insertionsort ,leq} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: DependencyPairs {dpKind_ = DT} + Details: We add the following dependency tuples: Strict DPs flatten#(leaf()) -> c_1() flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) if'insert#(true(),x,y,ys) -> c_5() insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)) insert#(x,nil()) -> c_7() insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) insertionsort#(nil()) -> c_9() Weak DPs append#(cons(x,xs),l2) -> c_10(append#(xs,l2)) append#(nil(),l2) -> c_11() leq#(0(),y) -> c_12() leq#(s(x),0()) -> c_13() leq#(s(x),s(y)) -> c_14(leq#(x,y)) and mark the set of starting terms. ** Step 1.b:2: PredecessorEstimation WORST_CASE(?,O(n^2)) + Considered Problem: - Strict DPs: flatten#(leaf()) -> c_1() flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) if'insert#(true(),x,y,ys) -> c_5() insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)) insert#(x,nil()) -> c_7() insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) insertionsort#(nil()) -> c_9() - Weak DPs: append#(cons(x,xs),l2) -> c_10(append#(xs,l2)) append#(nil(),l2) -> c_11() leq#(0(),y) -> c_12() leq#(s(x),0()) -> c_13() leq#(s(x),s(y)) -> c_14(leq#(x,y)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) flattensort(t) -> insertionsort(flatten(t)) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/4,c_3/2,c_4/1,c_5/0,c_6/2,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: PredecessorEstimation {onSelection = all simple predecessor estimation selector} + Details: We estimate the number of application of {1,5,7,9} by application of Pre({1,5,7,9}) = {2,3,4,6,8}. Here rules are labelled as follows: 1: flatten#(leaf()) -> c_1() 2: flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)) 3: flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) 4: if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) 5: if'insert#(true(),x,y,ys) -> c_5() 6: insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)) 7: insert#(x,nil()) -> c_7() 8: insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) 9: insertionsort#(nil()) -> c_9() 10: append#(cons(x,xs),l2) -> c_10(append#(xs,l2)) 11: append#(nil(),l2) -> c_11() 12: leq#(0(),y) -> c_12() 13: leq#(s(x),0()) -> c_13() 14: leq#(s(x),s(y)) -> c_14(leq#(x,y)) ** Step 1.b:3: RemoveWeakSuffixes WORST_CASE(?,O(n^2)) + Considered Problem: - Strict DPs: flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)) insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) - Weak DPs: append#(cons(x,xs),l2) -> c_10(append#(xs,l2)) append#(nil(),l2) -> c_11() flatten#(leaf()) -> c_1() if'insert#(true(),x,y,ys) -> c_5() insert#(x,nil()) -> c_7() insertionsort#(nil()) -> c_9() leq#(0(),y) -> c_12() leq#(s(x),0()) -> c_13() leq#(s(x),s(y)) -> c_14(leq#(x,y)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) flattensort(t) -> insertionsort(flatten(t)) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/4,c_3/2,c_4/1,c_5/0,c_6/2,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: RemoveWeakSuffixes + Details: Consider the dependency graph 1:S:flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)) -->_2 append#(cons(x,xs),l2) -> c_10(append#(xs,l2)):6 -->_1 append#(cons(x,xs),l2) -> c_10(append#(xs,l2)):6 -->_4 flatten#(leaf()) -> c_1():8 -->_3 flatten#(leaf()) -> c_1():8 -->_2 append#(nil(),l2) -> c_11():7 -->_1 append#(nil(),l2) -> c_11():7 -->_4 flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)):1 -->_3 flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)):1 2:S:flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) -->_1 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):5 -->_1 insertionsort#(nil()) -> c_9():11 -->_2 flatten#(leaf()) -> c_1():8 -->_2 flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)):1 3:S:if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)):4 -->_1 insert#(x,nil()) -> c_7():10 4:S:insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)) -->_2 leq#(s(x),s(y)) -> c_14(leq#(x,y)):14 -->_2 leq#(s(x),0()) -> c_13():13 -->_2 leq#(0(),y) -> c_12():12 -->_1 if'insert#(true(),x,y,ys) -> c_5():9 -->_1 if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)):3 5:S:insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) -->_2 insertionsort#(nil()) -> c_9():11 -->_1 insert#(x,nil()) -> c_7():10 -->_2 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):5 -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)):4 6:W:append#(cons(x,xs),l2) -> c_10(append#(xs,l2)) -->_1 append#(nil(),l2) -> c_11():7 -->_1 append#(cons(x,xs),l2) -> c_10(append#(xs,l2)):6 7:W:append#(nil(),l2) -> c_11() 8:W:flatten#(leaf()) -> c_1() 9:W:if'insert#(true(),x,y,ys) -> c_5() 10:W:insert#(x,nil()) -> c_7() 11:W:insertionsort#(nil()) -> c_9() 12:W:leq#(0(),y) -> c_12() 13:W:leq#(s(x),0()) -> c_13() 14:W:leq#(s(x),s(y)) -> c_14(leq#(x,y)) -->_1 leq#(s(x),s(y)) -> c_14(leq#(x,y)):14 -->_1 leq#(s(x),0()) -> c_13():13 -->_1 leq#(0(),y) -> c_12():12 The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. 9: if'insert#(true(),x,y,ys) -> c_5() 14: leq#(s(x),s(y)) -> c_14(leq#(x,y)) 12: leq#(0(),y) -> c_12() 13: leq#(s(x),0()) -> c_13() 10: insert#(x,nil()) -> c_7() 11: insertionsort#(nil()) -> c_9() 8: flatten#(leaf()) -> c_1() 6: append#(cons(x,xs),l2) -> c_10(append#(xs,l2)) 7: append#(nil(),l2) -> c_11() ** Step 1.b:4: SimplifyRHS WORST_CASE(?,O(n^2)) + Considered Problem: - Strict DPs: flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)) insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) flattensort(t) -> insertionsort(flatten(t)) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/4,c_3/2,c_4/1,c_5/0,c_6/2,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: SimplifyRHS + Details: Consider the dependency graph 1:S:flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)) -->_4 flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)):1 -->_3 flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)):1 2:S:flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) -->_1 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):5 -->_2 flatten#(node(l,t1,t2)) -> c_2(append#(l,append(flatten(t1),flatten(t2))) ,append#(flatten(t1),flatten(t2)) ,flatten#(t1) ,flatten#(t2)):1 3:S:if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)):4 4:S:insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)) -->_1 if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)):3 5:S:insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) -->_2 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):5 -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys),leq#(x,y)):4 Due to missing edges in the depndency graph, the right-hand sides of following rules could be simplified: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) ** Step 1.b:5: UsableRules WORST_CASE(?,O(n^2)) + Considered Problem: - Strict DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) flattensort(t) -> insertionsort(flatten(t)) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: UsableRules + Details: We replace rewrite rules by usable rules: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) ** Step 1.b:6: DecomposeDG WORST_CASE(?,O(n^2)) + Considered Problem: - Strict DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: DecomposeDG {onSelection = all below first cut in WDG, onUpper = Nothing, onLower = Nothing} + Details: We decompose the input problem according to the dependency graph into the upper component flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) and a lower component if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) Further, following extension rules are added to the lower component. flatten#(node(l,t1,t2)) -> flatten#(t1) flatten#(node(l,t1,t2)) -> flatten#(t2) flattensort#(t) -> flatten#(t) flattensort#(t) -> insertionsort#(flatten(t)) insertionsort#(cons(x,xs)) -> insert#(x,insertionsort(xs)) insertionsort#(cons(x,xs)) -> insertionsort#(xs) *** Step 1.b:6.a:1: SimplifyRHS WORST_CASE(?,O(n^1)) + Considered Problem: - Strict DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: SimplifyRHS + Details: Consider the dependency graph 1:S:flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) -->_2 flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)):1 -->_1 flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)):1 2:S:flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) -->_1 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):3 -->_2 flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)):1 3:S:insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) -->_2 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):3 Due to missing edges in the depndency graph, the right-hand sides of following rules could be simplified: insertionsort#(cons(x,xs)) -> c_8(insertionsort#(xs)) *** Step 1.b:6.a:2: UsableRules WORST_CASE(?,O(n^1)) + Considered Problem: - Strict DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) insertionsort#(cons(x,xs)) -> c_8(insertionsort#(xs)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/1,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: UsableRules + Details: We replace rewrite rules by usable rules: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) insertionsort#(cons(x,xs)) -> c_8(insertionsort#(xs)) *** Step 1.b:6.a:3: WeightGap WORST_CASE(?,O(n^1)) + Considered Problem: - Strict DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) insertionsort#(cons(x,xs)) -> c_8(insertionsort#(xs)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/1,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: WeightGap {wgDimension = 1, wgDegree = 1, wgKind = Algebraic, wgUArgs = UArgs, wgOn = WgOnAny} + Details: The weightgap principle applies using the following constant growth matrix-interpretation: We apply a matrix interpretation of kind constructor based matrix interpretation: The following argument positions are considered usable: uargs(append) = {1,2}, uargs(cons) = {2}, uargs(insertionsort#) = {1}, uargs(c_2) = {1,2}, uargs(c_3) = {1,2}, uargs(c_8) = {1} Following symbols are considered usable: all TcT has computed the following interpretation: p(0) = [0] p(append) = [1] x1 + [1] x2 + [0] p(cons) = [1] x1 + [1] x2 + [0] p(false) = [0] p(flatten) = [1] x1 + [0] p(flattensort) = [0] p(if'insert) = [0] p(insert) = [0] p(insertionsort) = [0] p(leaf) = [0] p(leq) = [0] p(nil) = [0] p(node) = [1] x1 + [1] x2 + [1] x3 + [0] p(s) = [1] x1 + [0] p(true) = [0] p(append#) = [0] p(flatten#) = [5] x1 + [0] p(flattensort#) = [6] x1 + [9] p(if'insert#) = [0] p(insert#) = [0] p(insertionsort#) = [1] x1 + [0] p(leq#) = [0] p(c_1) = [0] p(c_2) = [1] x1 + [1] x2 + [0] p(c_3) = [1] x1 + [1] x2 + [0] p(c_4) = [0] p(c_5) = [0] p(c_6) = [0] p(c_7) = [0] p(c_8) = [1] x1 + [0] p(c_9) = [0] p(c_10) = [0] p(c_11) = [0] p(c_12) = [0] p(c_13) = [0] p(c_14) = [0] Following rules are strictly oriented: flattensort#(t) = [6] t + [9] > [6] t + [0] = c_3(insertionsort#(flatten(t)),flatten#(t)) Following rules are (at-least) weakly oriented: flatten#(node(l,t1,t2)) = [5] l + [5] t1 + [5] t2 + [0] >= [5] t1 + [5] t2 + [0] = c_2(flatten#(t1),flatten#(t2)) insertionsort#(cons(x,xs)) = [1] x + [1] xs + [0] >= [1] xs + [0] = c_8(insertionsort#(xs)) append(cons(x,xs),l2) = [1] l2 + [1] x + [1] xs + [0] >= [1] l2 + [1] x + [1] xs + [0] = cons(x,append(xs,l2)) append(nil(),l2) = [1] l2 + [0] >= [1] l2 + [0] = l2 flatten(leaf()) = [0] >= [0] = nil() flatten(node(l,t1,t2)) = [1] l + [1] t1 + [1] t2 + [0] >= [1] l + [1] t1 + [1] t2 + [0] = append(l,append(flatten(t1),flatten(t2))) Further, it can be verified that all rules not oriented are covered by the weightgap condition. *** Step 1.b:6.a:4: WeightGap WORST_CASE(?,O(n^1)) + Considered Problem: - Strict DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) insertionsort#(cons(x,xs)) -> c_8(insertionsort#(xs)) - Weak DPs: flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/1,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: WeightGap {wgDimension = 1, wgDegree = 1, wgKind = Algebraic, wgUArgs = UArgs, wgOn = WgOnAny} + Details: The weightgap principle applies using the following constant growth matrix-interpretation: We apply a matrix interpretation of kind constructor based matrix interpretation: The following argument positions are considered usable: uargs(append) = {1,2}, uargs(cons) = {2}, uargs(insertionsort#) = {1}, uargs(c_2) = {1,2}, uargs(c_3) = {1,2}, uargs(c_8) = {1} Following symbols are considered usable: all TcT has computed the following interpretation: p(0) = [0] p(append) = [1] x1 + [1] x2 + [0] p(cons) = [1] x1 + [1] x2 + [15] p(false) = [0] p(flatten) = [1] x1 + [0] p(flattensort) = [0] p(if'insert) = [0] p(insert) = [0] p(insertionsort) = [0] p(leaf) = [0] p(leq) = [0] p(nil) = [0] p(node) = [1] x1 + [1] x2 + [1] x3 + [0] p(s) = [1] x1 + [0] p(true) = [0] p(append#) = [0] p(flatten#) = [5] x1 + [0] p(flattensort#) = [6] x1 + [0] p(if'insert#) = [0] p(insert#) = [0] p(insertionsort#) = [1] x1 + [0] p(leq#) = [0] p(c_1) = [0] p(c_2) = [1] x1 + [1] x2 + [0] p(c_3) = [1] x1 + [1] x2 + [0] p(c_4) = [0] p(c_5) = [0] p(c_6) = [0] p(c_7) = [0] p(c_8) = [1] x1 + [0] p(c_9) = [0] p(c_10) = [0] p(c_11) = [0] p(c_12) = [0] p(c_13) = [0] p(c_14) = [0] Following rules are strictly oriented: insertionsort#(cons(x,xs)) = [1] x + [1] xs + [15] > [1] xs + [0] = c_8(insertionsort#(xs)) Following rules are (at-least) weakly oriented: flatten#(node(l,t1,t2)) = [5] l + [5] t1 + [5] t2 + [0] >= [5] t1 + [5] t2 + [0] = c_2(flatten#(t1),flatten#(t2)) flattensort#(t) = [6] t + [0] >= [6] t + [0] = c_3(insertionsort#(flatten(t)),flatten#(t)) append(cons(x,xs),l2) = [1] l2 + [1] x + [1] xs + [15] >= [1] l2 + [1] x + [1] xs + [15] = cons(x,append(xs,l2)) append(nil(),l2) = [1] l2 + [0] >= [1] l2 + [0] = l2 flatten(leaf()) = [0] >= [0] = nil() flatten(node(l,t1,t2)) = [1] l + [1] t1 + [1] t2 + [0] >= [1] l + [1] t1 + [1] t2 + [0] = append(l,append(flatten(t1),flatten(t2))) Further, it can be verified that all rules not oriented are covered by the weightgap condition. *** Step 1.b:6.a:5: WeightGap WORST_CASE(?,O(n^1)) + Considered Problem: - Strict DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) - Weak DPs: flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) insertionsort#(cons(x,xs)) -> c_8(insertionsort#(xs)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/1,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: WeightGap {wgDimension = 1, wgDegree = 1, wgKind = Algebraic, wgUArgs = UArgs, wgOn = WgOnAny} + Details: The weightgap principle applies using the following constant growth matrix-interpretation: We apply a matrix interpretation of kind constructor based matrix interpretation: The following argument positions are considered usable: uargs(append) = {1,2}, uargs(cons) = {2}, uargs(insertionsort#) = {1}, uargs(c_2) = {1,2}, uargs(c_3) = {1,2}, uargs(c_8) = {1} Following symbols are considered usable: all TcT has computed the following interpretation: p(0) = [0] p(append) = [1] x1 + [1] x2 + [1] p(cons) = [1] x1 + [1] x2 + [2] p(false) = [0] p(flatten) = [3] x1 + [5] p(flattensort) = [0] p(if'insert) = [0] p(insert) = [0] p(insertionsort) = [0] p(leaf) = [2] p(leq) = [1] x2 + [8] p(nil) = [0] p(node) = [1] x1 + [1] x2 + [1] x3 + [4] p(s) = [2] p(true) = [1] p(append#) = [1] x2 + [2] p(flatten#) = [4] x1 + [0] p(flattensort#) = [9] x1 + [8] p(if'insert#) = [1] x1 + [1] x2 + [1] x3 + [8] x4 + [1] p(insert#) = [1] x1 + [1] x2 + [1] p(insertionsort#) = [1] x1 + [2] p(leq#) = [1] x1 + [0] p(c_1) = [0] p(c_2) = [1] x1 + [1] x2 + [12] p(c_3) = [1] x1 + [1] x2 + [1] p(c_4) = [1] x1 + [1] p(c_5) = [1] p(c_6) = [1] p(c_7) = [0] p(c_8) = [1] x1 + [0] p(c_9) = [2] p(c_10) = [1] x1 + [8] p(c_11) = [1] p(c_12) = [0] p(c_13) = [1] p(c_14) = [8] x1 + [2] Following rules are strictly oriented: flatten#(node(l,t1,t2)) = [4] l + [4] t1 + [4] t2 + [16] > [4] t1 + [4] t2 + [12] = c_2(flatten#(t1),flatten#(t2)) Following rules are (at-least) weakly oriented: flattensort#(t) = [9] t + [8] >= [7] t + [8] = c_3(insertionsort#(flatten(t)),flatten#(t)) insertionsort#(cons(x,xs)) = [1] x + [1] xs + [4] >= [1] xs + [2] = c_8(insertionsort#(xs)) append(cons(x,xs),l2) = [1] l2 + [1] x + [1] xs + [3] >= [1] l2 + [1] x + [1] xs + [3] = cons(x,append(xs,l2)) append(nil(),l2) = [1] l2 + [1] >= [1] l2 + [0] = l2 flatten(leaf()) = [11] >= [0] = nil() flatten(node(l,t1,t2)) = [3] l + [3] t1 + [3] t2 + [17] >= [1] l + [3] t1 + [3] t2 + [12] = append(l,append(flatten(t1),flatten(t2))) Further, it can be verified that all rules not oriented are covered by the weightgap condition. *** Step 1.b:6.a:6: EmptyProcessor WORST_CASE(?,O(1)) + Considered Problem: - Weak DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) insertionsort#(cons(x,xs)) -> c_8(insertionsort#(xs)) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/1,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: EmptyProcessor + Details: The problem is already closed. The intended complexity is O(1). *** Step 1.b:6.b:1: RemoveWeakSuffixes WORST_CASE(?,O(n^1)) + Considered Problem: - Strict DPs: if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) - Weak DPs: flatten#(node(l,t1,t2)) -> flatten#(t1) flatten#(node(l,t1,t2)) -> flatten#(t2) flattensort#(t) -> flatten#(t) flattensort#(t) -> insertionsort#(flatten(t)) insertionsort#(cons(x,xs)) -> insert#(x,insertionsort(xs)) insertionsort#(cons(x,xs)) -> insertionsort#(xs) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: RemoveWeakSuffixes + Details: Consider the dependency graph 1:S:if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)):2 2:S:insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) -->_1 if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)):1 3:W:flatten#(node(l,t1,t2)) -> flatten#(t1) -->_1 flatten#(node(l,t1,t2)) -> flatten#(t2):4 -->_1 flatten#(node(l,t1,t2)) -> flatten#(t1):3 4:W:flatten#(node(l,t1,t2)) -> flatten#(t2) -->_1 flatten#(node(l,t1,t2)) -> flatten#(t2):4 -->_1 flatten#(node(l,t1,t2)) -> flatten#(t1):3 5:W:flattensort#(t) -> flatten#(t) -->_1 flatten#(node(l,t1,t2)) -> flatten#(t2):4 -->_1 flatten#(node(l,t1,t2)) -> flatten#(t1):3 6:W:flattensort#(t) -> insertionsort#(flatten(t)) -->_1 insertionsort#(cons(x,xs)) -> insertionsort#(xs):8 -->_1 insertionsort#(cons(x,xs)) -> insert#(x,insertionsort(xs)):7 7:W:insertionsort#(cons(x,xs)) -> insert#(x,insertionsort(xs)) -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)):2 8:W:insertionsort#(cons(x,xs)) -> insertionsort#(xs) -->_1 insertionsort#(cons(x,xs)) -> insertionsort#(xs):8 -->_1 insertionsort#(cons(x,xs)) -> insert#(x,insertionsort(xs)):7 The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. 5: flattensort#(t) -> flatten#(t) 3: flatten#(node(l,t1,t2)) -> flatten#(t1) 4: flatten#(node(l,t1,t2)) -> flatten#(t2) *** Step 1.b:6.b:2: WeightGap WORST_CASE(?,O(n^1)) + Considered Problem: - Strict DPs: if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) - Weak DPs: flattensort#(t) -> insertionsort#(flatten(t)) insertionsort#(cons(x,xs)) -> insert#(x,insertionsort(xs)) insertionsort#(cons(x,xs)) -> insertionsort#(xs) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: WeightGap {wgDimension = 1, wgDegree = 1, wgKind = Algebraic, wgUArgs = UArgs, wgOn = WgOnAny} + Details: The weightgap principle applies using the following constant growth matrix-interpretation: We apply a matrix interpretation of kind constructor based matrix interpretation: The following argument positions are considered usable: uargs(append) = {1,2}, uargs(cons) = {2}, uargs(if'insert) = {1}, uargs(insert) = {2}, uargs(if'insert#) = {1}, uargs(insert#) = {2}, uargs(insertionsort#) = {1}, uargs(c_4) = {1}, uargs(c_6) = {1} Following symbols are considered usable: all TcT has computed the following interpretation: p(0) = [0] p(append) = [1] x1 + [1] x2 + [0] p(cons) = [1] x2 + [2] p(false) = [0] p(flatten) = [4] x1 + [0] p(flattensort) = [4] x1 + [1] p(if'insert) = [1] x1 + [1] x4 + [4] p(insert) = [1] x2 + [2] p(insertionsort) = [1] x1 + [3] p(leaf) = [2] p(leq) = [0] p(nil) = [1] p(node) = [1] x1 + [1] x2 + [1] x3 + [0] p(s) = [1] x1 + [0] p(true) = [0] p(append#) = [2] x2 + [0] p(flatten#) = [1] x1 + [2] p(flattensort#) = [7] x1 + [1] p(if'insert#) = [1] x1 + [1] x4 + [5] p(insert#) = [1] x2 + [0] p(insertionsort#) = [1] x1 + [1] p(leq#) = [0] p(c_1) = [0] p(c_2) = [0] p(c_3) = [0] p(c_4) = [1] x1 + [0] p(c_5) = [0] p(c_6) = [1] x1 + [0] p(c_7) = [0] p(c_8) = [0] p(c_9) = [0] p(c_10) = [0] p(c_11) = [0] p(c_12) = [0] p(c_13) = [1] p(c_14) = [0] Following rules are strictly oriented: if'insert#(false(),x,y,ys) = [1] ys + [5] > [1] ys + [0] = c_4(insert#(x,ys)) Following rules are (at-least) weakly oriented: flattensort#(t) = [7] t + [1] >= [4] t + [1] = insertionsort#(flatten(t)) insert#(x,cons(y,ys)) = [1] ys + [2] >= [1] ys + [5] = c_6(if'insert#(leq(x,y),x,y,ys)) insertionsort#(cons(x,xs)) = [1] xs + [3] >= [1] xs + [3] = insert#(x,insertionsort(xs)) insertionsort#(cons(x,xs)) = [1] xs + [3] >= [1] xs + [1] = insertionsort#(xs) append(cons(x,xs),l2) = [1] l2 + [1] xs + [2] >= [1] l2 + [1] xs + [2] = cons(x,append(xs,l2)) append(nil(),l2) = [1] l2 + [1] >= [1] l2 + [0] = l2 flatten(leaf()) = [8] >= [1] = nil() flatten(node(l,t1,t2)) = [4] l + [4] t1 + [4] t2 + [0] >= [1] l + [4] t1 + [4] t2 + [0] = append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) = [1] ys + [4] >= [1] ys + [4] = cons(y,insert(x,ys)) if'insert(true(),x,y,ys) = [1] ys + [4] >= [1] ys + [4] = cons(x,cons(y,ys)) insert(x,cons(y,ys)) = [1] ys + [4] >= [1] ys + [4] = if'insert(leq(x,y),x,y,ys) insert(x,nil()) = [3] >= [3] = cons(x,nil()) insertionsort(cons(x,xs)) = [1] xs + [5] >= [1] xs + [5] = insert(x,insertionsort(xs)) insertionsort(nil()) = [4] >= [1] = nil() leq(0(),y) = [0] >= [0] = true() leq(s(x),0()) = [0] >= [0] = false() leq(s(x),s(y)) = [0] >= [0] = leq(x,y) Further, it can be verified that all rules not oriented are covered by the weightgap condition. *** Step 1.b:6.b:3: WeightGap WORST_CASE(?,O(n^1)) + Considered Problem: - Strict DPs: insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) - Weak DPs: flattensort#(t) -> insertionsort#(flatten(t)) if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insertionsort#(cons(x,xs)) -> insert#(x,insertionsort(xs)) insertionsort#(cons(x,xs)) -> insertionsort#(xs) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: WeightGap {wgDimension = 1, wgDegree = 1, wgKind = Algebraic, wgUArgs = UArgs, wgOn = WgOnAny} + Details: The weightgap principle applies using the following constant growth matrix-interpretation: We apply a matrix interpretation of kind constructor based matrix interpretation: The following argument positions are considered usable: uargs(append) = {1,2}, uargs(cons) = {2}, uargs(if'insert) = {1}, uargs(insert) = {2}, uargs(if'insert#) = {1}, uargs(insert#) = {2}, uargs(insertionsort#) = {1}, uargs(c_4) = {1}, uargs(c_6) = {1} Following symbols are considered usable: all TcT has computed the following interpretation: p(0) = [0] p(append) = [1] x1 + [1] x2 + [1] p(cons) = [1] x2 + [4] p(false) = [4] p(flatten) = [1] x1 + [1] p(flattensort) = [1] x1 + [0] p(if'insert) = [1] x1 + [1] x4 + [4] p(insert) = [1] x2 + [4] p(insertionsort) = [1] x1 + [2] p(leaf) = [4] p(leq) = [4] p(nil) = [4] p(node) = [1] x1 + [1] x2 + [1] x3 + [4] p(s) = [1] p(true) = [4] p(append#) = [1] x1 + [4] x2 + [1] p(flatten#) = [2] x1 + [1] p(flattensort#) = [4] x1 + [7] p(if'insert#) = [1] x1 + [1] x4 + [2] p(insert#) = [1] x2 + [5] p(insertionsort#) = [1] x1 + [6] p(leq#) = [0] p(c_1) = [0] p(c_2) = [4] x1 + [0] p(c_3) = [1] x1 + [4] x2 + [1] p(c_4) = [1] x1 + [1] p(c_5) = [0] p(c_6) = [1] x1 + [2] p(c_7) = [1] p(c_8) = [2] x1 + [1] x2 + [0] p(c_9) = [1] p(c_10) = [2] x1 + [0] p(c_11) = [2] p(c_12) = [1] p(c_13) = [0] p(c_14) = [4] x1 + [1] Following rules are strictly oriented: insert#(x,cons(y,ys)) = [1] ys + [9] > [1] ys + [8] = c_6(if'insert#(leq(x,y),x,y,ys)) Following rules are (at-least) weakly oriented: flattensort#(t) = [4] t + [7] >= [1] t + [7] = insertionsort#(flatten(t)) if'insert#(false(),x,y,ys) = [1] ys + [6] >= [1] ys + [6] = c_4(insert#(x,ys)) insertionsort#(cons(x,xs)) = [1] xs + [10] >= [1] xs + [7] = insert#(x,insertionsort(xs)) insertionsort#(cons(x,xs)) = [1] xs + [10] >= [1] xs + [6] = insertionsort#(xs) append(cons(x,xs),l2) = [1] l2 + [1] xs + [5] >= [1] l2 + [1] xs + [5] = cons(x,append(xs,l2)) append(nil(),l2) = [1] l2 + [5] >= [1] l2 + [0] = l2 flatten(leaf()) = [5] >= [4] = nil() flatten(node(l,t1,t2)) = [1] l + [1] t1 + [1] t2 + [5] >= [1] l + [1] t1 + [1] t2 + [4] = append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) = [1] ys + [8] >= [1] ys + [8] = cons(y,insert(x,ys)) if'insert(true(),x,y,ys) = [1] ys + [8] >= [1] ys + [8] = cons(x,cons(y,ys)) insert(x,cons(y,ys)) = [1] ys + [8] >= [1] ys + [8] = if'insert(leq(x,y),x,y,ys) insert(x,nil()) = [8] >= [8] = cons(x,nil()) insertionsort(cons(x,xs)) = [1] xs + [6] >= [1] xs + [6] = insert(x,insertionsort(xs)) insertionsort(nil()) = [6] >= [4] = nil() leq(0(),y) = [4] >= [4] = true() leq(s(x),0()) = [4] >= [4] = false() leq(s(x),s(y)) = [4] >= [4] = leq(x,y) Further, it can be verified that all rules not oriented are covered by the weightgap condition. *** Step 1.b:6.b:4: EmptyProcessor WORST_CASE(?,O(1)) + Considered Problem: - Weak DPs: flattensort#(t) -> insertionsort#(flatten(t)) if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) insertionsort#(cons(x,xs)) -> insert#(x,insertionsort(xs)) insertionsort#(cons(x,xs)) -> insertionsort#(xs) - Weak TRS: append(cons(x,xs),l2) -> cons(x,append(xs,l2)) append(nil(),l2) -> l2 flatten(leaf()) -> nil() flatten(node(l,t1,t2)) -> append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) -> cons(y,insert(x,ys)) if'insert(true(),x,y,ys) -> cons(x,cons(y,ys)) insert(x,cons(y,ys)) -> if'insert(leq(x,y),x,y,ys) insert(x,nil()) -> cons(x,nil()) insertionsort(cons(x,xs)) -> insert(x,insertionsort(xs)) insertionsort(nil()) -> nil() leq(0(),y) -> true() leq(s(x),0()) -> false() leq(s(x),s(y)) -> leq(x,y) - Signature: {append/2,flatten/1,flattensort/1,if'insert/4,insert/2,insertionsort/1,leq/2,append#/2,flatten#/1 ,flattensort#/1,if'insert#/4,insert#/2,insertionsort#/1,leq#/2} / {0/0,cons/2,false/0,leaf/0,nil/0,node/3 ,s/1,true/0,c_1/0,c_2/2,c_3/2,c_4/1,c_5/0,c_6/1,c_7/0,c_8/2,c_9/0,c_10/1,c_11/0,c_12/0,c_13/0,c_14/1} - Obligation: innermost runtime complexity wrt. defined symbols {append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} and constructors {0,cons,false,leaf,nil,node,s,true} + Applied Processor: EmptyProcessor + Details: The problem is already closed. The intended complexity is O(1). WORST_CASE(Omega(n^1),O(n^2))