(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
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
foldl(a, Nil) → a
notEmpty(Cons(x, xs)) → True
notEmpty(Nil) → False
op(x, S(0)) → S(x)
op(S(0), y) → S(y)
fold(a, xs) → Cons(foldl(a, xs), Cons(foldr(a, xs), Nil))
Rewrite Strategy: INNERMOST
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
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
foldl(a, Nil) → a
notEmpty(Cons(x, xs)) → True
notEmpty(Nil) → False
op(x, S(0')) → S(x)
op(S(0'), y) → S(y)
fold(a, xs) → Cons(foldl(a, xs), Cons(foldr(a, xs), Nil))
S is empty.
Rewrite Strategy: INNERMOST
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
Innermost TRS:
Rules:
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
foldl(a, Nil) → a
notEmpty(Cons(x, xs)) → True
notEmpty(Nil) → False
op(x, S(0')) → S(x)
op(S(0'), y) → S(y)
fold(a, xs) → Cons(foldl(a, xs), Cons(foldr(a, xs), Nil))
Types:
foldl :: 0':S → Cons:Nil → 0':S
Cons :: 0':S → Cons:Nil → Cons:Nil
S :: 0':S → 0':S
0' :: 0':S
foldr :: 0':S → Cons:Nil → 0':S
op :: 0':S → 0':S → 0':S
Nil :: Cons:Nil
notEmpty :: Cons:Nil → True:False
True :: True:False
False :: True:False
fold :: 0':S → Cons:Nil → Cons:Nil
hole_0':S1_0 :: 0':S
hole_Cons:Nil2_0 :: Cons:Nil
hole_True:False3_0 :: True:False
gen_0':S4_0 :: Nat → 0':S
gen_Cons:Nil5_0 :: Nat → Cons:Nil
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
foldl, foldr
(6) Obligation:
Innermost TRS:
Rules:
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) →
afoldl(
a,
Nil) →
anotEmpty(
Cons(
x,
xs)) →
TruenotEmpty(
Nil) →
Falseop(
x,
S(
0')) →
S(
x)
op(
S(
0'),
y) →
S(
y)
fold(
a,
xs) →
Cons(
foldl(
a,
xs),
Cons(
foldr(
a,
xs),
Nil))
Types:
foldl :: 0':S → Cons:Nil → 0':S
Cons :: 0':S → Cons:Nil → Cons:Nil
S :: 0':S → 0':S
0' :: 0':S
foldr :: 0':S → Cons:Nil → 0':S
op :: 0':S → 0':S → 0':S
Nil :: Cons:Nil
notEmpty :: Cons:Nil → True:False
True :: True:False
False :: True:False
fold :: 0':S → Cons:Nil → Cons:Nil
hole_0':S1_0 :: 0':S
hole_Cons:Nil2_0 :: Cons:Nil
hole_True:False3_0 :: True:False
gen_0':S4_0 :: Nat → 0':S
gen_Cons:Nil5_0 :: Nat → Cons:Nil
Generator Equations:
gen_0':S4_0(0) ⇔ 0'
gen_0':S4_0(+(x, 1)) ⇔ S(gen_0':S4_0(x))
gen_Cons:Nil5_0(0) ⇔ Nil
gen_Cons:Nil5_0(+(x, 1)) ⇔ Cons(0', gen_Cons:Nil5_0(x))
The following defined symbols remain to be analysed:
foldl, foldr
(7) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol foldl.
(8) Obligation:
Innermost TRS:
Rules:
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) →
afoldl(
a,
Nil) →
anotEmpty(
Cons(
x,
xs)) →
TruenotEmpty(
Nil) →
Falseop(
x,
S(
0')) →
S(
x)
op(
S(
0'),
y) →
S(
y)
fold(
a,
xs) →
Cons(
foldl(
a,
xs),
Cons(
foldr(
a,
xs),
Nil))
Types:
foldl :: 0':S → Cons:Nil → 0':S
Cons :: 0':S → Cons:Nil → Cons:Nil
S :: 0':S → 0':S
0' :: 0':S
foldr :: 0':S → Cons:Nil → 0':S
op :: 0':S → 0':S → 0':S
Nil :: Cons:Nil
notEmpty :: Cons:Nil → True:False
True :: True:False
False :: True:False
fold :: 0':S → Cons:Nil → Cons:Nil
hole_0':S1_0 :: 0':S
hole_Cons:Nil2_0 :: Cons:Nil
hole_True:False3_0 :: True:False
gen_0':S4_0 :: Nat → 0':S
gen_Cons:Nil5_0 :: Nat → Cons:Nil
Generator Equations:
gen_0':S4_0(0) ⇔ 0'
gen_0':S4_0(+(x, 1)) ⇔ S(gen_0':S4_0(x))
gen_Cons:Nil5_0(0) ⇔ Nil
gen_Cons:Nil5_0(+(x, 1)) ⇔ Cons(0', gen_Cons:Nil5_0(x))
The following defined symbols remain to be analysed:
foldr
(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
foldr(
gen_0':S4_0(
1),
gen_Cons:Nil5_0(
n18_0)) →
gen_0':S4_0(
1), rt ∈ Ω(1 + n18
0)
Induction Base:
foldr(gen_0':S4_0(1), gen_Cons:Nil5_0(0)) →RΩ(1)
gen_0':S4_0(1)
Induction Step:
foldr(gen_0':S4_0(1), gen_Cons:Nil5_0(+(n18_0, 1))) →RΩ(1)
op(0', foldr(gen_0':S4_0(1), gen_Cons:Nil5_0(n18_0))) →IH
op(0', gen_0':S4_0(1)) →RΩ(1)
S(0')
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(10) Complex Obligation (BEST)
(11) Obligation:
Innermost TRS:
Rules:
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) →
afoldl(
a,
Nil) →
anotEmpty(
Cons(
x,
xs)) →
TruenotEmpty(
Nil) →
Falseop(
x,
S(
0')) →
S(
x)
op(
S(
0'),
y) →
S(
y)
fold(
a,
xs) →
Cons(
foldl(
a,
xs),
Cons(
foldr(
a,
xs),
Nil))
Types:
foldl :: 0':S → Cons:Nil → 0':S
Cons :: 0':S → Cons:Nil → Cons:Nil
S :: 0':S → 0':S
0' :: 0':S
foldr :: 0':S → Cons:Nil → 0':S
op :: 0':S → 0':S → 0':S
Nil :: Cons:Nil
notEmpty :: Cons:Nil → True:False
True :: True:False
False :: True:False
fold :: 0':S → Cons:Nil → Cons:Nil
hole_0':S1_0 :: 0':S
hole_Cons:Nil2_0 :: Cons:Nil
hole_True:False3_0 :: True:False
gen_0':S4_0 :: Nat → 0':S
gen_Cons:Nil5_0 :: Nat → Cons:Nil
Lemmas:
foldr(gen_0':S4_0(1), gen_Cons:Nil5_0(n18_0)) → gen_0':S4_0(1), rt ∈ Ω(1 + n180)
Generator Equations:
gen_0':S4_0(0) ⇔ 0'
gen_0':S4_0(+(x, 1)) ⇔ S(gen_0':S4_0(x))
gen_Cons:Nil5_0(0) ⇔ Nil
gen_Cons:Nil5_0(+(x, 1)) ⇔ Cons(0', gen_Cons:Nil5_0(x))
No more defined symbols left to analyse.
(12) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
foldr(gen_0':S4_0(1), gen_Cons:Nil5_0(n18_0)) → gen_0':S4_0(1), rt ∈ Ω(1 + n180)
(13) BOUNDS(n^1, INF)
(14) Obligation:
Innermost TRS:
Rules:
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) →
afoldl(
a,
Nil) →
anotEmpty(
Cons(
x,
xs)) →
TruenotEmpty(
Nil) →
Falseop(
x,
S(
0')) →
S(
x)
op(
S(
0'),
y) →
S(
y)
fold(
a,
xs) →
Cons(
foldl(
a,
xs),
Cons(
foldr(
a,
xs),
Nil))
Types:
foldl :: 0':S → Cons:Nil → 0':S
Cons :: 0':S → Cons:Nil → Cons:Nil
S :: 0':S → 0':S
0' :: 0':S
foldr :: 0':S → Cons:Nil → 0':S
op :: 0':S → 0':S → 0':S
Nil :: Cons:Nil
notEmpty :: Cons:Nil → True:False
True :: True:False
False :: True:False
fold :: 0':S → Cons:Nil → Cons:Nil
hole_0':S1_0 :: 0':S
hole_Cons:Nil2_0 :: Cons:Nil
hole_True:False3_0 :: True:False
gen_0':S4_0 :: Nat → 0':S
gen_Cons:Nil5_0 :: Nat → Cons:Nil
Lemmas:
foldr(gen_0':S4_0(1), gen_Cons:Nil5_0(n18_0)) → gen_0':S4_0(1), rt ∈ Ω(1 + n180)
Generator Equations:
gen_0':S4_0(0) ⇔ 0'
gen_0':S4_0(+(x, 1)) ⇔ S(gen_0':S4_0(x))
gen_Cons:Nil5_0(0) ⇔ Nil
gen_Cons:Nil5_0(+(x, 1)) ⇔ Cons(0', gen_Cons:Nil5_0(x))
No more defined symbols left to analyse.
(15) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
foldr(gen_0':S4_0(1), gen_Cons:Nil5_0(n18_0)) → gen_0':S4_0(1), rt ∈ Ω(1 + n180)
(16) BOUNDS(n^1, INF)