(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
walk#1(Leaf(x2)) → cons_x(x2)
walk#1(Node(x5, x3)) → comp_f_g(walk#1(x5), walk#1(x3))
comp_f_g#1(comp_f_g(x4, x5), comp_f_g(x2, x3), x1) → comp_f_g#1(x4, x5, comp_f_g#1(x2, x3, x1))
comp_f_g#1(comp_f_g(x7, x9), cons_x(x2), x4) → comp_f_g#1(x7, x9, Cons(x2, x4))
comp_f_g#1(cons_x(x2), comp_f_g(x5, x7), x3) → Cons(x2, comp_f_g#1(x5, x7, x3))
comp_f_g#1(cons_x(x5), cons_x(x2), x4) → Cons(x5, Cons(x2, x4))
main(Leaf(x4)) → Cons(x4, Nil)
main(Node(x9, x5)) → comp_f_g#1(walk#1(x9), walk#1(x5), Nil)
Rewrite Strategy: INNERMOST
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(n1):
The rewrite sequence
walk#1(Node(x5, x3)) →+ comp_f_g(walk#1(x5), walk#1(x3))
gives rise to a decreasing loop by considering the right hand sides subterm at position [0].
The pumping substitution is [x5 / Node(x5, x3)].
The result substitution is [ ].
(2) BOUNDS(n^1, INF)
(3) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
walk#1(Leaf(x2)) → cons_x(x2)
walk#1(Node(x5, x3)) → comp_f_g(walk#1(x5), walk#1(x3))
comp_f_g#1(comp_f_g(x4, x5), comp_f_g(x2, x3), x1) → comp_f_g#1(x4, x5, comp_f_g#1(x2, x3, x1))
comp_f_g#1(comp_f_g(x7, x9), cons_x(x2), x4) → comp_f_g#1(x7, x9, Cons(x2, x4))
comp_f_g#1(cons_x(x2), comp_f_g(x5, x7), x3) → Cons(x2, comp_f_g#1(x5, x7, x3))
comp_f_g#1(cons_x(x5), cons_x(x2), x4) → Cons(x5, Cons(x2, x4))
main(Leaf(x4)) → Cons(x4, Nil)
main(Node(x9, x5)) → comp_f_g#1(walk#1(x9), walk#1(x5), Nil)
S is empty.
Rewrite Strategy: INNERMOST
(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(6) Obligation:
Innermost TRS:
Rules:
walk#1(Leaf(x2)) → cons_x(x2)
walk#1(Node(x5, x3)) → comp_f_g(walk#1(x5), walk#1(x3))
comp_f_g#1(comp_f_g(x4, x5), comp_f_g(x2, x3), x1) → comp_f_g#1(x4, x5, comp_f_g#1(x2, x3, x1))
comp_f_g#1(comp_f_g(x7, x9), cons_x(x2), x4) → comp_f_g#1(x7, x9, Cons(x2, x4))
comp_f_g#1(cons_x(x2), comp_f_g(x5, x7), x3) → Cons(x2, comp_f_g#1(x5, x7, x3))
comp_f_g#1(cons_x(x5), cons_x(x2), x4) → Cons(x5, Cons(x2, x4))
main(Leaf(x4)) → Cons(x4, Nil)
main(Node(x9, x5)) → comp_f_g#1(walk#1(x9), walk#1(x5), Nil)
Types:
walk#1 :: Leaf:Node → cons_x:comp_f_g
Leaf :: a → Leaf:Node
cons_x :: a → cons_x:comp_f_g
Node :: Leaf:Node → Leaf:Node → Leaf:Node
comp_f_g :: cons_x:comp_f_g → cons_x:comp_f_g → cons_x:comp_f_g
comp_f_g#1 :: cons_x:comp_f_g → cons_x:comp_f_g → Cons:Nil → Cons:Nil
Cons :: a → Cons:Nil → Cons:Nil
main :: Leaf:Node → Cons:Nil
Nil :: Cons:Nil
hole_cons_x:comp_f_g1_0 :: cons_x:comp_f_g
hole_Leaf:Node2_0 :: Leaf:Node
hole_a3_0 :: a
hole_Cons:Nil4_0 :: Cons:Nil
gen_cons_x:comp_f_g5_0 :: Nat → cons_x:comp_f_g
gen_Leaf:Node6_0 :: Nat → Leaf:Node
gen_Cons:Nil7_0 :: Nat → Cons:Nil
(7) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
walk#1, comp_f_g#1
(8) Obligation:
Innermost TRS:
Rules:
walk#1(
Leaf(
x2)) →
cons_x(
x2)
walk#1(
Node(
x5,
x3)) →
comp_f_g(
walk#1(
x5),
walk#1(
x3))
comp_f_g#1(
comp_f_g(
x4,
x5),
comp_f_g(
x2,
x3),
x1) →
comp_f_g#1(
x4,
x5,
comp_f_g#1(
x2,
x3,
x1))
comp_f_g#1(
comp_f_g(
x7,
x9),
cons_x(
x2),
x4) →
comp_f_g#1(
x7,
x9,
Cons(
x2,
x4))
comp_f_g#1(
cons_x(
x2),
comp_f_g(
x5,
x7),
x3) →
Cons(
x2,
comp_f_g#1(
x5,
x7,
x3))
comp_f_g#1(
cons_x(
x5),
cons_x(
x2),
x4) →
Cons(
x5,
Cons(
x2,
x4))
main(
Leaf(
x4)) →
Cons(
x4,
Nil)
main(
Node(
x9,
x5)) →
comp_f_g#1(
walk#1(
x9),
walk#1(
x5),
Nil)
Types:
walk#1 :: Leaf:Node → cons_x:comp_f_g
Leaf :: a → Leaf:Node
cons_x :: a → cons_x:comp_f_g
Node :: Leaf:Node → Leaf:Node → Leaf:Node
comp_f_g :: cons_x:comp_f_g → cons_x:comp_f_g → cons_x:comp_f_g
comp_f_g#1 :: cons_x:comp_f_g → cons_x:comp_f_g → Cons:Nil → Cons:Nil
Cons :: a → Cons:Nil → Cons:Nil
main :: Leaf:Node → Cons:Nil
Nil :: Cons:Nil
hole_cons_x:comp_f_g1_0 :: cons_x:comp_f_g
hole_Leaf:Node2_0 :: Leaf:Node
hole_a3_0 :: a
hole_Cons:Nil4_0 :: Cons:Nil
gen_cons_x:comp_f_g5_0 :: Nat → cons_x:comp_f_g
gen_Leaf:Node6_0 :: Nat → Leaf:Node
gen_Cons:Nil7_0 :: Nat → Cons:Nil
Generator Equations:
gen_cons_x:comp_f_g5_0(0) ⇔ cons_x(hole_a3_0)
gen_cons_x:comp_f_g5_0(+(x, 1)) ⇔ comp_f_g(cons_x(hole_a3_0), gen_cons_x:comp_f_g5_0(x))
gen_Leaf:Node6_0(0) ⇔ Leaf(hole_a3_0)
gen_Leaf:Node6_0(+(x, 1)) ⇔ Node(Leaf(hole_a3_0), gen_Leaf:Node6_0(x))
gen_Cons:Nil7_0(0) ⇔ Nil
gen_Cons:Nil7_0(+(x, 1)) ⇔ Cons(hole_a3_0, gen_Cons:Nil7_0(x))
The following defined symbols remain to be analysed:
walk#1, comp_f_g#1
(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
walk#1(
gen_Leaf:Node6_0(
n9_0)) →
gen_cons_x:comp_f_g5_0(
n9_0), rt ∈ Ω(1 + n9
0)
Induction Base:
walk#1(gen_Leaf:Node6_0(0)) →RΩ(1)
cons_x(hole_a3_0)
Induction Step:
walk#1(gen_Leaf:Node6_0(+(n9_0, 1))) →RΩ(1)
comp_f_g(walk#1(Leaf(hole_a3_0)), walk#1(gen_Leaf:Node6_0(n9_0))) →RΩ(1)
comp_f_g(cons_x(hole_a3_0), walk#1(gen_Leaf:Node6_0(n9_0))) →IH
comp_f_g(cons_x(hole_a3_0), gen_cons_x:comp_f_g5_0(c10_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(10) Complex Obligation (BEST)
(11) Obligation:
Innermost TRS:
Rules:
walk#1(
Leaf(
x2)) →
cons_x(
x2)
walk#1(
Node(
x5,
x3)) →
comp_f_g(
walk#1(
x5),
walk#1(
x3))
comp_f_g#1(
comp_f_g(
x4,
x5),
comp_f_g(
x2,
x3),
x1) →
comp_f_g#1(
x4,
x5,
comp_f_g#1(
x2,
x3,
x1))
comp_f_g#1(
comp_f_g(
x7,
x9),
cons_x(
x2),
x4) →
comp_f_g#1(
x7,
x9,
Cons(
x2,
x4))
comp_f_g#1(
cons_x(
x2),
comp_f_g(
x5,
x7),
x3) →
Cons(
x2,
comp_f_g#1(
x5,
x7,
x3))
comp_f_g#1(
cons_x(
x5),
cons_x(
x2),
x4) →
Cons(
x5,
Cons(
x2,
x4))
main(
Leaf(
x4)) →
Cons(
x4,
Nil)
main(
Node(
x9,
x5)) →
comp_f_g#1(
walk#1(
x9),
walk#1(
x5),
Nil)
Types:
walk#1 :: Leaf:Node → cons_x:comp_f_g
Leaf :: a → Leaf:Node
cons_x :: a → cons_x:comp_f_g
Node :: Leaf:Node → Leaf:Node → Leaf:Node
comp_f_g :: cons_x:comp_f_g → cons_x:comp_f_g → cons_x:comp_f_g
comp_f_g#1 :: cons_x:comp_f_g → cons_x:comp_f_g → Cons:Nil → Cons:Nil
Cons :: a → Cons:Nil → Cons:Nil
main :: Leaf:Node → Cons:Nil
Nil :: Cons:Nil
hole_cons_x:comp_f_g1_0 :: cons_x:comp_f_g
hole_Leaf:Node2_0 :: Leaf:Node
hole_a3_0 :: a
hole_Cons:Nil4_0 :: Cons:Nil
gen_cons_x:comp_f_g5_0 :: Nat → cons_x:comp_f_g
gen_Leaf:Node6_0 :: Nat → Leaf:Node
gen_Cons:Nil7_0 :: Nat → Cons:Nil
Lemmas:
walk#1(gen_Leaf:Node6_0(n9_0)) → gen_cons_x:comp_f_g5_0(n9_0), rt ∈ Ω(1 + n90)
Generator Equations:
gen_cons_x:comp_f_g5_0(0) ⇔ cons_x(hole_a3_0)
gen_cons_x:comp_f_g5_0(+(x, 1)) ⇔ comp_f_g(cons_x(hole_a3_0), gen_cons_x:comp_f_g5_0(x))
gen_Leaf:Node6_0(0) ⇔ Leaf(hole_a3_0)
gen_Leaf:Node6_0(+(x, 1)) ⇔ Node(Leaf(hole_a3_0), gen_Leaf:Node6_0(x))
gen_Cons:Nil7_0(0) ⇔ Nil
gen_Cons:Nil7_0(+(x, 1)) ⇔ Cons(hole_a3_0, gen_Cons:Nil7_0(x))
The following defined symbols remain to be analysed:
comp_f_g#1
(12) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
comp_f_g#1(
gen_cons_x:comp_f_g5_0(
0),
gen_cons_x:comp_f_g5_0(
n165_0),
gen_Cons:Nil7_0(
c)) →
gen_Cons:Nil7_0(
+(
+(
2,
n165_0),
c)), rt ∈ Ω(1 + n165
0)
Induction Base:
comp_f_g#1(gen_cons_x:comp_f_g5_0(0), gen_cons_x:comp_f_g5_0(0), gen_Cons:Nil7_0(c)) →RΩ(1)
Cons(hole_a3_0, Cons(hole_a3_0, gen_Cons:Nil7_0(c)))
Induction Step:
comp_f_g#1(gen_cons_x:comp_f_g5_0(0), gen_cons_x:comp_f_g5_0(+(n165_0, 1)), gen_Cons:Nil7_0(c)) →RΩ(1)
Cons(hole_a3_0, comp_f_g#1(cons_x(hole_a3_0), gen_cons_x:comp_f_g5_0(n165_0), gen_Cons:Nil7_0(c))) →IH
Cons(hole_a3_0, gen_Cons:Nil7_0(+(+(2, c), c166_0)))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(13) Complex Obligation (BEST)
(14) Obligation:
Innermost TRS:
Rules:
walk#1(
Leaf(
x2)) →
cons_x(
x2)
walk#1(
Node(
x5,
x3)) →
comp_f_g(
walk#1(
x5),
walk#1(
x3))
comp_f_g#1(
comp_f_g(
x4,
x5),
comp_f_g(
x2,
x3),
x1) →
comp_f_g#1(
x4,
x5,
comp_f_g#1(
x2,
x3,
x1))
comp_f_g#1(
comp_f_g(
x7,
x9),
cons_x(
x2),
x4) →
comp_f_g#1(
x7,
x9,
Cons(
x2,
x4))
comp_f_g#1(
cons_x(
x2),
comp_f_g(
x5,
x7),
x3) →
Cons(
x2,
comp_f_g#1(
x5,
x7,
x3))
comp_f_g#1(
cons_x(
x5),
cons_x(
x2),
x4) →
Cons(
x5,
Cons(
x2,
x4))
main(
Leaf(
x4)) →
Cons(
x4,
Nil)
main(
Node(
x9,
x5)) →
comp_f_g#1(
walk#1(
x9),
walk#1(
x5),
Nil)
Types:
walk#1 :: Leaf:Node → cons_x:comp_f_g
Leaf :: a → Leaf:Node
cons_x :: a → cons_x:comp_f_g
Node :: Leaf:Node → Leaf:Node → Leaf:Node
comp_f_g :: cons_x:comp_f_g → cons_x:comp_f_g → cons_x:comp_f_g
comp_f_g#1 :: cons_x:comp_f_g → cons_x:comp_f_g → Cons:Nil → Cons:Nil
Cons :: a → Cons:Nil → Cons:Nil
main :: Leaf:Node → Cons:Nil
Nil :: Cons:Nil
hole_cons_x:comp_f_g1_0 :: cons_x:comp_f_g
hole_Leaf:Node2_0 :: Leaf:Node
hole_a3_0 :: a
hole_Cons:Nil4_0 :: Cons:Nil
gen_cons_x:comp_f_g5_0 :: Nat → cons_x:comp_f_g
gen_Leaf:Node6_0 :: Nat → Leaf:Node
gen_Cons:Nil7_0 :: Nat → Cons:Nil
Lemmas:
walk#1(gen_Leaf:Node6_0(n9_0)) → gen_cons_x:comp_f_g5_0(n9_0), rt ∈ Ω(1 + n90)
comp_f_g#1(gen_cons_x:comp_f_g5_0(0), gen_cons_x:comp_f_g5_0(n165_0), gen_Cons:Nil7_0(c)) → gen_Cons:Nil7_0(+(+(2, n165_0), c)), rt ∈ Ω(1 + n1650)
Generator Equations:
gen_cons_x:comp_f_g5_0(0) ⇔ cons_x(hole_a3_0)
gen_cons_x:comp_f_g5_0(+(x, 1)) ⇔ comp_f_g(cons_x(hole_a3_0), gen_cons_x:comp_f_g5_0(x))
gen_Leaf:Node6_0(0) ⇔ Leaf(hole_a3_0)
gen_Leaf:Node6_0(+(x, 1)) ⇔ Node(Leaf(hole_a3_0), gen_Leaf:Node6_0(x))
gen_Cons:Nil7_0(0) ⇔ Nil
gen_Cons:Nil7_0(+(x, 1)) ⇔ Cons(hole_a3_0, gen_Cons:Nil7_0(x))
No more defined symbols left to analyse.
(15) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
walk#1(gen_Leaf:Node6_0(n9_0)) → gen_cons_x:comp_f_g5_0(n9_0), rt ∈ Ω(1 + n90)
(16) BOUNDS(n^1, INF)
(17) Obligation:
Innermost TRS:
Rules:
walk#1(
Leaf(
x2)) →
cons_x(
x2)
walk#1(
Node(
x5,
x3)) →
comp_f_g(
walk#1(
x5),
walk#1(
x3))
comp_f_g#1(
comp_f_g(
x4,
x5),
comp_f_g(
x2,
x3),
x1) →
comp_f_g#1(
x4,
x5,
comp_f_g#1(
x2,
x3,
x1))
comp_f_g#1(
comp_f_g(
x7,
x9),
cons_x(
x2),
x4) →
comp_f_g#1(
x7,
x9,
Cons(
x2,
x4))
comp_f_g#1(
cons_x(
x2),
comp_f_g(
x5,
x7),
x3) →
Cons(
x2,
comp_f_g#1(
x5,
x7,
x3))
comp_f_g#1(
cons_x(
x5),
cons_x(
x2),
x4) →
Cons(
x5,
Cons(
x2,
x4))
main(
Leaf(
x4)) →
Cons(
x4,
Nil)
main(
Node(
x9,
x5)) →
comp_f_g#1(
walk#1(
x9),
walk#1(
x5),
Nil)
Types:
walk#1 :: Leaf:Node → cons_x:comp_f_g
Leaf :: a → Leaf:Node
cons_x :: a → cons_x:comp_f_g
Node :: Leaf:Node → Leaf:Node → Leaf:Node
comp_f_g :: cons_x:comp_f_g → cons_x:comp_f_g → cons_x:comp_f_g
comp_f_g#1 :: cons_x:comp_f_g → cons_x:comp_f_g → Cons:Nil → Cons:Nil
Cons :: a → Cons:Nil → Cons:Nil
main :: Leaf:Node → Cons:Nil
Nil :: Cons:Nil
hole_cons_x:comp_f_g1_0 :: cons_x:comp_f_g
hole_Leaf:Node2_0 :: Leaf:Node
hole_a3_0 :: a
hole_Cons:Nil4_0 :: Cons:Nil
gen_cons_x:comp_f_g5_0 :: Nat → cons_x:comp_f_g
gen_Leaf:Node6_0 :: Nat → Leaf:Node
gen_Cons:Nil7_0 :: Nat → Cons:Nil
Lemmas:
walk#1(gen_Leaf:Node6_0(n9_0)) → gen_cons_x:comp_f_g5_0(n9_0), rt ∈ Ω(1 + n90)
comp_f_g#1(gen_cons_x:comp_f_g5_0(0), gen_cons_x:comp_f_g5_0(n165_0), gen_Cons:Nil7_0(c)) → gen_Cons:Nil7_0(+(+(2, n165_0), c)), rt ∈ Ω(1 + n1650)
Generator Equations:
gen_cons_x:comp_f_g5_0(0) ⇔ cons_x(hole_a3_0)
gen_cons_x:comp_f_g5_0(+(x, 1)) ⇔ comp_f_g(cons_x(hole_a3_0), gen_cons_x:comp_f_g5_0(x))
gen_Leaf:Node6_0(0) ⇔ Leaf(hole_a3_0)
gen_Leaf:Node6_0(+(x, 1)) ⇔ Node(Leaf(hole_a3_0), gen_Leaf:Node6_0(x))
gen_Cons:Nil7_0(0) ⇔ Nil
gen_Cons:Nil7_0(+(x, 1)) ⇔ Cons(hole_a3_0, gen_Cons:Nil7_0(x))
No more defined symbols left to analyse.
(18) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
walk#1(gen_Leaf:Node6_0(n9_0)) → gen_cons_x:comp_f_g5_0(n9_0), rt ∈ Ω(1 + n90)
(19) BOUNDS(n^1, INF)
(20) Obligation:
Innermost TRS:
Rules:
walk#1(
Leaf(
x2)) →
cons_x(
x2)
walk#1(
Node(
x5,
x3)) →
comp_f_g(
walk#1(
x5),
walk#1(
x3))
comp_f_g#1(
comp_f_g(
x4,
x5),
comp_f_g(
x2,
x3),
x1) →
comp_f_g#1(
x4,
x5,
comp_f_g#1(
x2,
x3,
x1))
comp_f_g#1(
comp_f_g(
x7,
x9),
cons_x(
x2),
x4) →
comp_f_g#1(
x7,
x9,
Cons(
x2,
x4))
comp_f_g#1(
cons_x(
x2),
comp_f_g(
x5,
x7),
x3) →
Cons(
x2,
comp_f_g#1(
x5,
x7,
x3))
comp_f_g#1(
cons_x(
x5),
cons_x(
x2),
x4) →
Cons(
x5,
Cons(
x2,
x4))
main(
Leaf(
x4)) →
Cons(
x4,
Nil)
main(
Node(
x9,
x5)) →
comp_f_g#1(
walk#1(
x9),
walk#1(
x5),
Nil)
Types:
walk#1 :: Leaf:Node → cons_x:comp_f_g
Leaf :: a → Leaf:Node
cons_x :: a → cons_x:comp_f_g
Node :: Leaf:Node → Leaf:Node → Leaf:Node
comp_f_g :: cons_x:comp_f_g → cons_x:comp_f_g → cons_x:comp_f_g
comp_f_g#1 :: cons_x:comp_f_g → cons_x:comp_f_g → Cons:Nil → Cons:Nil
Cons :: a → Cons:Nil → Cons:Nil
main :: Leaf:Node → Cons:Nil
Nil :: Cons:Nil
hole_cons_x:comp_f_g1_0 :: cons_x:comp_f_g
hole_Leaf:Node2_0 :: Leaf:Node
hole_a3_0 :: a
hole_Cons:Nil4_0 :: Cons:Nil
gen_cons_x:comp_f_g5_0 :: Nat → cons_x:comp_f_g
gen_Leaf:Node6_0 :: Nat → Leaf:Node
gen_Cons:Nil7_0 :: Nat → Cons:Nil
Lemmas:
walk#1(gen_Leaf:Node6_0(n9_0)) → gen_cons_x:comp_f_g5_0(n9_0), rt ∈ Ω(1 + n90)
Generator Equations:
gen_cons_x:comp_f_g5_0(0) ⇔ cons_x(hole_a3_0)
gen_cons_x:comp_f_g5_0(+(x, 1)) ⇔ comp_f_g(cons_x(hole_a3_0), gen_cons_x:comp_f_g5_0(x))
gen_Leaf:Node6_0(0) ⇔ Leaf(hole_a3_0)
gen_Leaf:Node6_0(+(x, 1)) ⇔ Node(Leaf(hole_a3_0), gen_Leaf:Node6_0(x))
gen_Cons:Nil7_0(0) ⇔ Nil
gen_Cons:Nil7_0(+(x, 1)) ⇔ Cons(hole_a3_0, gen_Cons:Nil7_0(x))
No more defined symbols left to analyse.
(21) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
walk#1(gen_Leaf:Node6_0(n9_0)) → gen_cons_x:comp_f_g5_0(n9_0), rt ∈ Ω(1 + n90)
(22) BOUNDS(n^1, INF)