WORST_CASE(?,O(n^2)) * Step 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 2: UsableRules 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: 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) append#(cons(x,xs),l2) -> c_10(append#(xs,l2)) append#(nil(),l2) -> c_11() 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() leq#(0(),y) -> c_12() leq#(s(x),0()) -> c_13() leq#(s(x),s(y)) -> c_14(leq#(x,y)) * Step 3: 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))) 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 4: 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))) 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 5: 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))) 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 6: Decompose 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: Decompose {onSelection = all cycle independent sub-graph, withBound = RelativeAdd} + Details: 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: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) - Weak DPs: 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} Problem (S) - Strict DPs: 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 DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) - 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} ** Step 6.a:1: RemoveWeakSuffixes 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)) 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: RemoveWeakSuffixes + 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:W:flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) -->_2 flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)):1 -->_1 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):5 3:W: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)):4 4:W: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)):3 5:W:insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)):4 -->_2 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):5 The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. 5: insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) 4: insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) 3: if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) ** Step 6.a:2: SimplifyRHS 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)) - 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:W:flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) -->_2 flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)):1 Due to missing edges in the depndency graph, the right-hand sides of following rules could be simplified: flattensort#(t) -> c_3(flatten#(t)) ** Step 6.a:3: UsableRules 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(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))) 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/1,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: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(flatten#(t)) ** Step 6.a:4: PredecessorEstimationCP 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(flatten#(t)) - 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/1,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: PredecessorEstimationCP {onSelectionCP = any intersect of rules of CDG leaf and strict-rules, withComplexityPair = NaturalMI {miDimension = 1, miDegree = 1, miKind = Algebraic, uargs = UArgs, urules = URules, selector = Nothing}} + Details: We first use the processor NaturalMI {miDimension = 1, miDegree = 1, miKind = Algebraic, uargs = UArgs, urules = URules, selector = Nothing} to orient following rules strictly: 1: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) Consider the set of all dependency pairs 1: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) 2: flattensort#(t) -> c_3(flatten#(t)) Processor NaturalMI {miDimension = 1, miDegree = 1, miKind = Algebraic, uargs = UArgs, urules = URules, selector = Nothing}induces the complexity certificateTIME (?,O(n^1)) SPACE(?,?)on application of the dependency pairs {1} These cover all (indirect) predecessors of dependency pairs {1,2} their number of applications is equally bounded. The dependency pairs are shifted into the weak component. *** Step 6.a:4.a:1: NaturalMI 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(flatten#(t)) - 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/1,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: NaturalMI {miDimension = 1, miDegree = 1, miKind = Algebraic, uargs = UArgs, urules = URules, selector = Just first alternative for predecessorEstimation on any intersect of rules of CDG leaf and strict-rules} + Details: We apply a matrix interpretation of kind constructor based matrix interpretation: The following argument positions are considered usable: uargs(c_2) = {1,2}, uargs(c_3) = {1} Following symbols are considered usable: {append#,flatten#,flattensort#,if'insert#,insert#,insertionsort#,leq#} TcT has computed the following interpretation: p(0) = [0] p(append) = [0] p(cons) = [1] x1 + [1] x2 + [0] p(false) = [0] p(flatten) = [0] p(flattensort) = [0] p(if'insert) = [0] p(insert) = [1] x2 + [0] p(insertionsort) = [0] p(leaf) = [2] p(leq) = [1] x1 + [0] p(nil) = [1] p(node) = [1] x2 + [1] x3 + [2] p(s) = [1] x1 + [1] p(true) = [1] p(append#) = [1] x1 + [2] x2 + [0] p(flatten#) = [8] x1 + [4] p(flattensort#) = [8] x1 + [6] p(if'insert#) = [1] x3 + [1] p(insert#) = [2] x1 + [1] p(insertionsort#) = [2] p(leq#) = [1] x1 + [1] x2 + [0] p(c_1) = [1] p(c_2) = [1] x1 + [1] x2 + [10] p(c_3) = [1] x1 + [2] p(c_4) = [1] p(c_5) = [2] p(c_6) = [1] x1 + [8] p(c_7) = [0] p(c_8) = [1] x1 + [1] p(c_9) = [1] p(c_10) = [1] x1 + [0] p(c_11) = [1] p(c_12) = [1] p(c_13) = [1] p(c_14) = [8] Following rules are strictly oriented: flatten#(node(l,t1,t2)) = [8] t1 + [8] t2 + [20] > [8] t1 + [8] t2 + [18] = c_2(flatten#(t1),flatten#(t2)) Following rules are (at-least) weakly oriented: flattensort#(t) = [8] t + [6] >= [8] t + [6] = c_3(flatten#(t)) *** Step 6.a:4.a:2: Assumption WORST_CASE(?,O(1)) + Considered Problem: - Weak DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(flatten#(t)) - 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/1,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: Assumption {assumed = Certificate {spaceUB = Unknown, spaceLB = Unknown, timeUB = Poly (Just 0), timeLB = Unknown}} + Details: () *** Step 6.a:4.b:1: RemoveWeakSuffixes WORST_CASE(?,O(1)) + Considered Problem: - Weak DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) flattensort#(t) -> c_3(flatten#(t)) - 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/1,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:W: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:W:flattensort#(t) -> c_3(flatten#(t)) -->_1 flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)):1 The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. 2: flattensort#(t) -> c_3(flatten#(t)) 1: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) *** Step 6.a:4.b:2: EmptyProcessor WORST_CASE(?,O(1)) + Considered Problem: - 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/1,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). ** Step 6.b:1: RemoveWeakSuffixes WORST_CASE(?,O(n^2)) + Considered Problem: - Strict DPs: 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 DPs: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) - 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:flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) -->_2 flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)):5 -->_1 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):4 2: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)):3 3: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)):2 4: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)):4 -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)):3 5:W:flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) -->_2 flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)):5 -->_1 flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)):5 The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. 5: flatten#(node(l,t1,t2)) -> c_2(flatten#(t1),flatten#(t2)) ** Step 6.b:2: SimplifyRHS WORST_CASE(?,O(n^2)) + Considered Problem: - Strict DPs: 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: SimplifyRHS + Details: Consider the dependency graph 1:S:flattensort#(t) -> c_3(insertionsort#(flatten(t)),flatten#(t)) -->_1 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):4 2: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)):3 3: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)):2 4: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)):4 -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)):3 Due to missing edges in the depndency graph, the right-hand sides of following rules could be simplified: flattensort#(t) -> c_3(insertionsort#(flatten(t))) ** Step 6.b:3: PredecessorEstimationCP WORST_CASE(?,O(n^2)) + Considered Problem: - Strict DPs: flattensort#(t) -> c_3(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)) -> 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/1,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: PredecessorEstimationCP {onSelectionCP = any intersect of rules of CDG leaf and strict-rules, withComplexityPair = NaturalPI {shape = Mixed 2, restrict = Restrict, uargs = UArgs, urules = URules, selector = Nothing}} + Details: We first use the processor NaturalPI {shape = Mixed 2, restrict = Restrict, uargs = UArgs, urules = URules, selector = Nothing} to orient following rules strictly: 1: flattensort#(t) -> c_3(insertionsort#(flatten(t))) 3: insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) 4: insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) Consider the set of all dependency pairs 1: flattensort#(t) -> c_3(insertionsort#(flatten(t))) 2: if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) 3: insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) 4: insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) Processor NaturalPI {shape = Mixed 2, restrict = Restrict, uargs = UArgs, urules = URules, selector = Nothing}induces the complexity certificateTIME (?,O(n^2)) SPACE(?,?)on application of the dependency pairs {1,3,4} These cover all (indirect) predecessors of dependency pairs {1,2,3,4} their number of applications is equally bounded. The dependency pairs are shifted into the weak component. *** Step 6.b:3.a:1: NaturalPI WORST_CASE(?,O(n^2)) + Considered Problem: - Strict DPs: flattensort#(t) -> c_3(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)) -> 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/1,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: NaturalPI {shape = Mixed 2, restrict = Restrict, uargs = UArgs, urules = URules, selector = Just first alternative for predecessorEstimation on any intersect of rules of CDG leaf and strict-rules} + Details: We apply a polynomial interpretation of kind constructor-based(mixed(2)): The following argument positions are considered usable: uargs(c_3) = {1}, uargs(c_4) = {1}, uargs(c_6) = {1}, uargs(c_8) = {1,2} Following symbols are considered usable: {append,flatten,if'insert,insert,insertionsort,leq,append#,flatten#,flattensort#,if'insert#,insert# ,insertionsort#,leq#} TcT has computed the following interpretation: p(0) = 0 p(append) = x1 + x2 p(cons) = 1 + x2 p(false) = 1 p(flatten) = x1 p(flattensort) = 0 p(if'insert) = 1 + x1^2 + x4 p(insert) = 1 + x2 p(insertionsort) = x1 p(leaf) = 1 p(leq) = 1 p(nil) = 0 p(node) = 1 + x1 + x2 + x3 p(s) = 0 p(true) = 1 p(append#) = 0 p(flatten#) = 0 p(flattensort#) = 1 + x1^2 p(if'insert#) = x4 p(insert#) = x2 p(insertionsort#) = x1^2 p(leq#) = 0 p(c_1) = 0 p(c_2) = 0 p(c_3) = x1 p(c_4) = x1 p(c_5) = 0 p(c_6) = x1 p(c_7) = 0 p(c_8) = x1 + x2 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) = 1 + t^2 > t^2 = c_3(insertionsort#(flatten(t))) insert#(x,cons(y,ys)) = 1 + ys > ys = c_6(if'insert#(leq(x,y),x,y,ys)) insertionsort#(cons(x,xs)) = 1 + 2*xs + xs^2 > xs + xs^2 = c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) Following rules are (at-least) weakly oriented: if'insert#(false(),x,y,ys) = ys >= ys = c_4(insert#(x,ys)) append(cons(x,xs),l2) = 1 + l2 + xs >= 1 + l2 + xs = cons(x,append(xs,l2)) append(nil(),l2) = l2 >= l2 = l2 flatten(leaf()) = 1 >= 0 = nil() flatten(node(l,t1,t2)) = 1 + l + t1 + t2 >= l + t1 + t2 = append(l,append(flatten(t1),flatten(t2))) if'insert(false(),x,y,ys) = 2 + ys >= 2 + ys = cons(y,insert(x,ys)) if'insert(true(),x,y,ys) = 2 + ys >= 2 + ys = cons(x,cons(y,ys)) insert(x,cons(y,ys)) = 2 + ys >= 2 + ys = if'insert(leq(x,y),x,y,ys) insert(x,nil()) = 1 >= 1 = cons(x,nil()) insertionsort(cons(x,xs)) = 1 + xs >= 1 + xs = insert(x,insertionsort(xs)) insertionsort(nil()) = 0 >= 0 = nil() leq(0(),y) = 1 >= 1 = true() leq(s(x),0()) = 1 >= 1 = false() leq(s(x),s(y)) = 1 >= 1 = leq(x,y) *** Step 6.b:3.a:2: Assumption WORST_CASE(?,O(1)) + Considered Problem: - Strict DPs: if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) - Weak DPs: flattensort#(t) -> c_3(insertionsort#(flatten(t))) 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/1,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: Assumption {assumed = Certificate {spaceUB = Unknown, spaceLB = Unknown, timeUB = Poly (Just 0), timeLB = Unknown}} + Details: () *** Step 6.b:3.b:1: RemoveWeakSuffixes WORST_CASE(?,O(1)) + Considered Problem: - Weak DPs: flattensort#(t) -> c_3(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)) -> 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/1,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:W:flattensort#(t) -> c_3(insertionsort#(flatten(t))) -->_1 insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)):4 2:W: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)):3 3:W: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)):2 4:W: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)):4 -->_1 insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)):3 The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. 1: flattensort#(t) -> c_3(insertionsort#(flatten(t))) 4: insertionsort#(cons(x,xs)) -> c_8(insert#(x,insertionsort(xs)),insertionsort#(xs)) 3: insert#(x,cons(y,ys)) -> c_6(if'insert#(leq(x,y),x,y,ys)) 2: if'insert#(false(),x,y,ys) -> c_4(insert#(x,ys)) *** Step 6.b:3.b:2: EmptyProcessor WORST_CASE(?,O(1)) + Considered Problem: - 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/1,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(?,O(n^2))