* Step 1: Sum WORST_CASE(Omega(n^1),O(n^1))
+ Considered Problem:
- Strict TRS:
fold(a,xs) -> Cons(foldl(a,xs),Cons(foldr(a,xs),Nil()))
foldl(a,Nil()) -> a
foldl(x,Cons(S(0()),xs)) -> foldl(S(x),xs)
foldl(S(0()),Cons(x,xs)) -> foldl(S(x),xs)
foldr(a,Cons(x,xs)) -> op(x,foldr(a,xs))
foldr(a,Nil()) -> a
notEmpty(Cons(x,xs)) -> True()
notEmpty(Nil()) -> False()
op(x,S(0())) -> S(x)
op(S(0()),y) -> S(y)
- Signature:
{fold/2,foldl/2,foldr/2,notEmpty/1,op/2} / {0/0,Cons/2,False/0,Nil/0,S/1,True/0}
- Obligation:
innermost runtime complexity wrt. defined symbols {fold,foldl,foldr,notEmpty,op} and constructors {0,Cons
,False,Nil,S,True}
+ Applied Processor:
Sum {left = someStrategy, right = someStrategy}
+ Details:
()
** Step 1.a:1: DecreasingLoops WORST_CASE(Omega(n^1),?)
+ Considered Problem:
- Strict TRS:
fold(a,xs) -> Cons(foldl(a,xs),Cons(foldr(a,xs),Nil()))
foldl(a,Nil()) -> a
foldl(x,Cons(S(0()),xs)) -> foldl(S(x),xs)
foldl(S(0()),Cons(x,xs)) -> foldl(S(x),xs)
foldr(a,Cons(x,xs)) -> op(x,foldr(a,xs))
foldr(a,Nil()) -> a
notEmpty(Cons(x,xs)) -> True()
notEmpty(Nil()) -> False()
op(x,S(0())) -> S(x)
op(S(0()),y) -> S(y)
- Signature:
{fold/2,foldl/2,foldr/2,notEmpty/1,op/2} / {0/0,Cons/2,False/0,Nil/0,S/1,True/0}
- Obligation:
innermost runtime complexity wrt. defined symbols {fold,foldl,foldr,notEmpty,op} and constructors {0,Cons
,False,Nil,S,True}
+ Applied Processor:
DecreasingLoops {bound = AnyLoop, narrow = 10}
+ Details:
The system has following decreasing Loops:
foldl(x,y){y -> Cons(S(0()),y)} =
foldl(x,Cons(S(0()),y)) ->^+ foldl(S(x),y)
= C[foldl(S(x),y) = foldl(x,y){x -> S(x)}]
** Step 1.b:1: WeightGap WORST_CASE(?,O(n^1))
+ Considered Problem:
- Strict TRS:
fold(a,xs) -> Cons(foldl(a,xs),Cons(foldr(a,xs),Nil()))
foldl(a,Nil()) -> a
foldl(x,Cons(S(0()),xs)) -> foldl(S(x),xs)
foldl(S(0()),Cons(x,xs)) -> foldl(S(x),xs)
foldr(a,Cons(x,xs)) -> op(x,foldr(a,xs))
foldr(a,Nil()) -> a
notEmpty(Cons(x,xs)) -> True()
notEmpty(Nil()) -> False()
op(x,S(0())) -> S(x)
op(S(0()),y) -> S(y)
- Signature:
{fold/2,foldl/2,foldr/2,notEmpty/1,op/2} / {0/0,Cons/2,False/0,Nil/0,S/1,True/0}
- Obligation:
innermost runtime complexity wrt. defined symbols {fold,foldl,foldr,notEmpty,op} and constructors {0,Cons
,False,Nil,S,True}
+ Applied Processor:
WeightGap {wgDimension = 1, wgDegree = 1, wgKind = Algebraic, wgUArgs = UArgs, wgOn = WgOnAny}
+ Details:
The weightgap principle applies using the following nonconstant growth matrix-interpretation:
We apply a matrix interpretation of kind constructor based matrix interpretation:
The following argument positions are considered usable:
uargs(Cons) = {1,2},
uargs(op) = {2}
Following symbols are considered usable:
all
TcT has computed the following interpretation:
p(0) = [1]
p(Cons) = [1] x1 + [1] x2 + [0]
p(False) = [0]
p(Nil) = [0]
p(S) = [1] x1 + [2]
p(True) = [2]
p(fold) = [13] x1 + [8] x2 + [1]
p(foldl) = [7] x1 + [7] x2 + [0]
p(foldr) = [6] x1 + [1] x2 + [0]
p(notEmpty) = [0]
p(op) = [1] x1 + [1] x2 + [0]
Following rules are strictly oriented:
fold(a,xs) = [13] a + [8] xs + [1]
> [13] a + [8] xs + [0]
= Cons(foldl(a,xs),Cons(foldr(a,xs),Nil()))
foldl(x,Cons(S(0()),xs)) = [7] x + [7] xs + [21]
> [7] x + [7] xs + [14]
= foldl(S(x),xs)
foldl(S(0()),Cons(x,xs)) = [7] x + [7] xs + [21]
> [7] x + [7] xs + [14]
= foldl(S(x),xs)
op(x,S(0())) = [1] x + [3]
> [1] x + [2]
= S(x)
op(S(0()),y) = [1] y + [3]
> [1] y + [2]
= S(y)
Following rules are (at-least) weakly oriented:
foldl(a,Nil()) = [7] a + [0]
>= [1] a + [0]
= a
foldr(a,Cons(x,xs)) = [6] a + [1] x + [1] xs + [0]
>= [6] a + [1] x + [1] xs + [0]
= op(x,foldr(a,xs))
foldr(a,Nil()) = [6] a + [0]
>= [1] a + [0]
= a
notEmpty(Cons(x,xs)) = [0]
>= [2]
= True()
notEmpty(Nil()) = [0]
>= [0]
= False()
Further, it can be verified that all rules not oriented are covered by the weightgap condition.
** Step 1.b:2: WeightGap WORST_CASE(?,O(n^1))
+ Considered Problem:
- Strict TRS:
foldl(a,Nil()) -> a
foldr(a,Cons(x,xs)) -> op(x,foldr(a,xs))
foldr(a,Nil()) -> a
notEmpty(Cons(x,xs)) -> True()
notEmpty(Nil()) -> False()
- Weak TRS:
fold(a,xs) -> Cons(foldl(a,xs),Cons(foldr(a,xs),Nil()))
foldl(x,Cons(S(0()),xs)) -> foldl(S(x),xs)
foldl(S(0()),Cons(x,xs)) -> foldl(S(x),xs)
op(x,S(0())) -> S(x)
op(S(0()),y) -> S(y)
- Signature:
{fold/2,foldl/2,foldr/2,notEmpty/1,op/2} / {0/0,Cons/2,False/0,Nil/0,S/1,True/0}
- Obligation:
innermost runtime complexity wrt. defined symbols {fold,foldl,foldr,notEmpty,op} and constructors {0,Cons
,False,Nil,S,True}
+ Applied Processor:
WeightGap {wgDimension = 1, wgDegree = 1, wgKind = Algebraic, wgUArgs = UArgs, wgOn = WgOnAny}
+ Details:
The weightgap principle applies using the following nonconstant growth matrix-interpretation:
We apply a matrix interpretation of kind constructor based matrix interpretation:
The following argument positions are considered usable:
uargs(Cons) = {1,2},
uargs(op) = {2}
Following symbols are considered usable:
all
TcT has computed the following interpretation:
p(0) = [1]
p(Cons) = [1] x1 + [1] x2 + [1]
p(False) = [1]
p(Nil) = [1]
p(S) = [0]
p(True) = [0]
p(fold) = [7] x1 + [6] x2 + [7]
p(foldl) = [2] x1 + [2] x2 + [2]
p(foldr) = [2] x1 + [4] x2 + [2]
p(notEmpty) = [4] x1 + [4]
p(op) = [1] x1 + [1] x2 + [4]
Following rules are strictly oriented:
foldl(a,Nil()) = [2] a + [4]
> [1] a + [0]
= a
foldr(a,Nil()) = [2] a + [6]
> [1] a + [0]
= a
notEmpty(Cons(x,xs)) = [4] x + [4] xs + [8]
> [0]
= True()
notEmpty(Nil()) = [8]
> [1]
= False()
Following rules are (at-least) weakly oriented:
fold(a,xs) = [7] a + [6] xs + [7]
>= [4] a + [6] xs + [7]
= Cons(foldl(a,xs),Cons(foldr(a,xs),Nil()))
foldl(x,Cons(S(0()),xs)) = [2] x + [2] xs + [4]
>= [2] xs + [2]
= foldl(S(x),xs)
foldl(S(0()),Cons(x,xs)) = [2] x + [2] xs + [4]
>= [2] xs + [2]
= foldl(S(x),xs)
foldr(a,Cons(x,xs)) = [2] a + [4] x + [4] xs + [6]
>= [2] a + [1] x + [4] xs + [6]
= op(x,foldr(a,xs))
op(x,S(0())) = [1] x + [4]
>= [0]
= S(x)
op(S(0()),y) = [1] y + [4]
>= [0]
= S(y)
Further, it can be verified that all rules not oriented are covered by the weightgap condition.
** Step 1.b:3: WeightGap WORST_CASE(?,O(n^1))
+ Considered Problem:
- Strict TRS:
foldr(a,Cons(x,xs)) -> op(x,foldr(a,xs))
- Weak TRS:
fold(a,xs) -> Cons(foldl(a,xs),Cons(foldr(a,xs),Nil()))
foldl(a,Nil()) -> a
foldl(x,Cons(S(0()),xs)) -> foldl(S(x),xs)
foldl(S(0()),Cons(x,xs)) -> foldl(S(x),xs)
foldr(a,Nil()) -> a
notEmpty(Cons(x,xs)) -> True()
notEmpty(Nil()) -> False()
op(x,S(0())) -> S(x)
op(S(0()),y) -> S(y)
- Signature:
{fold/2,foldl/2,foldr/2,notEmpty/1,op/2} / {0/0,Cons/2,False/0,Nil/0,S/1,True/0}
- Obligation:
innermost runtime complexity wrt. defined symbols {fold,foldl,foldr,notEmpty,op} and constructors {0,Cons
,False,Nil,S,True}
+ Applied Processor:
WeightGap {wgDimension = 1, wgDegree = 1, wgKind = Algebraic, wgUArgs = UArgs, wgOn = WgOnAny}
+ Details:
The weightgap principle applies using the following nonconstant growth matrix-interpretation:
We apply a matrix interpretation of kind constructor based matrix interpretation:
The following argument positions are considered usable:
uargs(Cons) = {1,2},
uargs(op) = {2}
Following symbols are considered usable:
all
TcT has computed the following interpretation:
p(0) = [0]
p(Cons) = [1] x1 + [1] x2 + [1]
p(False) = [2]
p(Nil) = [0]
p(S) = [0]
p(True) = [2]
p(fold) = [5] x1 + [4] x2 + [2]
p(foldl) = [4] x1 + [0]
p(foldr) = [1] x1 + [4] x2 + [0]
p(notEmpty) = [2]
p(op) = [1] x1 + [1] x2 + [1]
Following rules are strictly oriented:
foldr(a,Cons(x,xs)) = [1] a + [4] x + [4] xs + [4]
> [1] a + [1] x + [4] xs + [1]
= op(x,foldr(a,xs))
Following rules are (at-least) weakly oriented:
fold(a,xs) = [5] a + [4] xs + [2]
>= [5] a + [4] xs + [2]
= Cons(foldl(a,xs),Cons(foldr(a,xs),Nil()))
foldl(a,Nil()) = [4] a + [0]
>= [1] a + [0]
= a
foldl(x,Cons(S(0()),xs)) = [4] x + [0]
>= [0]
= foldl(S(x),xs)
foldl(S(0()),Cons(x,xs)) = [0]
>= [0]
= foldl(S(x),xs)
foldr(a,Nil()) = [1] a + [0]
>= [1] a + [0]
= a
notEmpty(Cons(x,xs)) = [2]
>= [2]
= True()
notEmpty(Nil()) = [2]
>= [2]
= False()
op(x,S(0())) = [1] x + [1]
>= [0]
= S(x)
op(S(0()),y) = [1] y + [1]
>= [0]
= S(y)
Further, it can be verified that all rules not oriented are covered by the weightgap condition.
** Step 1.b:4: EmptyProcessor WORST_CASE(?,O(1))
+ Considered Problem:
- Weak TRS:
fold(a,xs) -> Cons(foldl(a,xs),Cons(foldr(a,xs),Nil()))
foldl(a,Nil()) -> a
foldl(x,Cons(S(0()),xs)) -> foldl(S(x),xs)
foldl(S(0()),Cons(x,xs)) -> foldl(S(x),xs)
foldr(a,Cons(x,xs)) -> op(x,foldr(a,xs))
foldr(a,Nil()) -> a
notEmpty(Cons(x,xs)) -> True()
notEmpty(Nil()) -> False()
op(x,S(0())) -> S(x)
op(S(0()),y) -> S(y)
- Signature:
{fold/2,foldl/2,foldr/2,notEmpty/1,op/2} / {0/0,Cons/2,False/0,Nil/0,S/1,True/0}
- Obligation:
innermost runtime complexity wrt. defined symbols {fold,foldl,foldr,notEmpty,op} and constructors {0,Cons
,False,Nil,S,True}
+ Applied Processor:
EmptyProcessor
+ Details:
The problem is already closed. The intended complexity is O(1).
WORST_CASE(Omega(n^1),O(n^1))