(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
sub(0, 0) → 0
sub(s(x), 0) → s(x)
sub(0, s(x)) → 0
sub(s(x), s(y)) → sub(x, y)
zero(nil) → zero2(0, nil)
zero(cons(x, xs)) → zero2(sub(x, x), cons(x, xs))
zero2(0, nil) → nil
zero2(0, cons(x, xs)) → cons(sub(x, x), zero(xs))
zero2(s(y), nil) → zero(nil)
zero2(s(y), cons(x, xs)) → zero(cons(x, xs))
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:
sub(0', 0') → 0'
sub(s(x), 0') → s(x)
sub(0', s(x)) → 0'
sub(s(x), s(y)) → sub(x, y)
zero(nil) → zero2(0', nil)
zero(cons(x, xs)) → zero2(sub(x, x), cons(x, xs))
zero2(0', nil) → nil
zero2(0', cons(x, xs)) → cons(sub(x, x), zero(xs))
zero2(s(y), nil) → zero(nil)
zero2(s(y), cons(x, xs)) → zero(cons(x, xs))
S is empty.
Rewrite Strategy: INNERMOST
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
Innermost TRS:
Rules:
sub(0', 0') → 0'
sub(s(x), 0') → s(x)
sub(0', s(x)) → 0'
sub(s(x), s(y)) → sub(x, y)
zero(nil) → zero2(0', nil)
zero(cons(x, xs)) → zero2(sub(x, x), cons(x, xs))
zero2(0', nil) → nil
zero2(0', cons(x, xs)) → cons(sub(x, x), zero(xs))
zero2(s(y), nil) → zero(nil)
zero2(s(y), cons(x, xs)) → zero(cons(x, xs))
Types:
sub :: 0':s → 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
zero :: nil:cons → nil:cons
nil :: nil:cons
zero2 :: 0':s → nil:cons → nil:cons
cons :: 0':s → nil:cons → nil:cons
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
gen_0':s3_0 :: Nat → 0':s
gen_nil:cons4_0 :: Nat → nil:cons
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
sub,
zeroThey will be analysed ascendingly in the following order:
sub < zero
(6) Obligation:
Innermost TRS:
Rules:
sub(
0',
0') →
0'sub(
s(
x),
0') →
s(
x)
sub(
0',
s(
x)) →
0'sub(
s(
x),
s(
y)) →
sub(
x,
y)
zero(
nil) →
zero2(
0',
nil)
zero(
cons(
x,
xs)) →
zero2(
sub(
x,
x),
cons(
x,
xs))
zero2(
0',
nil) →
nilzero2(
0',
cons(
x,
xs)) →
cons(
sub(
x,
x),
zero(
xs))
zero2(
s(
y),
nil) →
zero(
nil)
zero2(
s(
y),
cons(
x,
xs)) →
zero(
cons(
x,
xs))
Types:
sub :: 0':s → 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
zero :: nil:cons → nil:cons
nil :: nil:cons
zero2 :: 0':s → nil:cons → nil:cons
cons :: 0':s → nil:cons → nil:cons
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
gen_0':s3_0 :: Nat → 0':s
gen_nil:cons4_0 :: Nat → nil:cons
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
The following defined symbols remain to be analysed:
sub, zero
They will be analysed ascendingly in the following order:
sub < zero
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
sub(
gen_0':s3_0(
n6_0),
gen_0':s3_0(
n6_0)) →
gen_0':s3_0(
0), rt ∈ Ω(1 + n6
0)
Induction Base:
sub(gen_0':s3_0(0), gen_0':s3_0(0)) →RΩ(1)
0'
Induction Step:
sub(gen_0':s3_0(+(n6_0, 1)), gen_0':s3_0(+(n6_0, 1))) →RΩ(1)
sub(gen_0':s3_0(n6_0), gen_0':s3_0(n6_0)) →IH
gen_0':s3_0(0)
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
Innermost TRS:
Rules:
sub(
0',
0') →
0'sub(
s(
x),
0') →
s(
x)
sub(
0',
s(
x)) →
0'sub(
s(
x),
s(
y)) →
sub(
x,
y)
zero(
nil) →
zero2(
0',
nil)
zero(
cons(
x,
xs)) →
zero2(
sub(
x,
x),
cons(
x,
xs))
zero2(
0',
nil) →
nilzero2(
0',
cons(
x,
xs)) →
cons(
sub(
x,
x),
zero(
xs))
zero2(
s(
y),
nil) →
zero(
nil)
zero2(
s(
y),
cons(
x,
xs)) →
zero(
cons(
x,
xs))
Types:
sub :: 0':s → 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
zero :: nil:cons → nil:cons
nil :: nil:cons
zero2 :: 0':s → nil:cons → nil:cons
cons :: 0':s → nil:cons → nil:cons
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
gen_0':s3_0 :: Nat → 0':s
gen_nil:cons4_0 :: Nat → nil:cons
Lemmas:
sub(gen_0':s3_0(n6_0), gen_0':s3_0(n6_0)) → gen_0':s3_0(0), rt ∈ Ω(1 + n60)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
The following defined symbols remain to be analysed:
zero
(10) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
zero(
gen_nil:cons4_0(
n778_0)) →
gen_nil:cons4_0(
n778_0), rt ∈ Ω(1 + n778
0)
Induction Base:
zero(gen_nil:cons4_0(0)) →RΩ(1)
zero2(0', nil) →RΩ(1)
nil
Induction Step:
zero(gen_nil:cons4_0(+(n778_0, 1))) →RΩ(1)
zero2(sub(0', 0'), cons(0', gen_nil:cons4_0(n778_0))) →LΩ(1)
zero2(gen_0':s3_0(0), cons(0', gen_nil:cons4_0(n778_0))) →RΩ(1)
cons(sub(0', 0'), zero(gen_nil:cons4_0(n778_0))) →LΩ(1)
cons(gen_0':s3_0(0), zero(gen_nil:cons4_0(n778_0))) →IH
cons(gen_0':s3_0(0), gen_nil:cons4_0(c779_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(11) Complex Obligation (BEST)
(12) Obligation:
Innermost TRS:
Rules:
sub(
0',
0') →
0'sub(
s(
x),
0') →
s(
x)
sub(
0',
s(
x)) →
0'sub(
s(
x),
s(
y)) →
sub(
x,
y)
zero(
nil) →
zero2(
0',
nil)
zero(
cons(
x,
xs)) →
zero2(
sub(
x,
x),
cons(
x,
xs))
zero2(
0',
nil) →
nilzero2(
0',
cons(
x,
xs)) →
cons(
sub(
x,
x),
zero(
xs))
zero2(
s(
y),
nil) →
zero(
nil)
zero2(
s(
y),
cons(
x,
xs)) →
zero(
cons(
x,
xs))
Types:
sub :: 0':s → 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
zero :: nil:cons → nil:cons
nil :: nil:cons
zero2 :: 0':s → nil:cons → nil:cons
cons :: 0':s → nil:cons → nil:cons
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
gen_0':s3_0 :: Nat → 0':s
gen_nil:cons4_0 :: Nat → nil:cons
Lemmas:
sub(gen_0':s3_0(n6_0), gen_0':s3_0(n6_0)) → gen_0':s3_0(0), rt ∈ Ω(1 + n60)
zero(gen_nil:cons4_0(n778_0)) → gen_nil:cons4_0(n778_0), rt ∈ Ω(1 + n7780)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
No more defined symbols left to analyse.
(13) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
sub(gen_0':s3_0(n6_0), gen_0':s3_0(n6_0)) → gen_0':s3_0(0), rt ∈ Ω(1 + n60)
(14) BOUNDS(n^1, INF)
(15) Obligation:
Innermost TRS:
Rules:
sub(
0',
0') →
0'sub(
s(
x),
0') →
s(
x)
sub(
0',
s(
x)) →
0'sub(
s(
x),
s(
y)) →
sub(
x,
y)
zero(
nil) →
zero2(
0',
nil)
zero(
cons(
x,
xs)) →
zero2(
sub(
x,
x),
cons(
x,
xs))
zero2(
0',
nil) →
nilzero2(
0',
cons(
x,
xs)) →
cons(
sub(
x,
x),
zero(
xs))
zero2(
s(
y),
nil) →
zero(
nil)
zero2(
s(
y),
cons(
x,
xs)) →
zero(
cons(
x,
xs))
Types:
sub :: 0':s → 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
zero :: nil:cons → nil:cons
nil :: nil:cons
zero2 :: 0':s → nil:cons → nil:cons
cons :: 0':s → nil:cons → nil:cons
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
gen_0':s3_0 :: Nat → 0':s
gen_nil:cons4_0 :: Nat → nil:cons
Lemmas:
sub(gen_0':s3_0(n6_0), gen_0':s3_0(n6_0)) → gen_0':s3_0(0), rt ∈ Ω(1 + n60)
zero(gen_nil:cons4_0(n778_0)) → gen_nil:cons4_0(n778_0), rt ∈ Ω(1 + n7780)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
No more defined symbols left to analyse.
(16) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
sub(gen_0':s3_0(n6_0), gen_0':s3_0(n6_0)) → gen_0':s3_0(0), rt ∈ Ω(1 + n60)
(17) BOUNDS(n^1, INF)
(18) Obligation:
Innermost TRS:
Rules:
sub(
0',
0') →
0'sub(
s(
x),
0') →
s(
x)
sub(
0',
s(
x)) →
0'sub(
s(
x),
s(
y)) →
sub(
x,
y)
zero(
nil) →
zero2(
0',
nil)
zero(
cons(
x,
xs)) →
zero2(
sub(
x,
x),
cons(
x,
xs))
zero2(
0',
nil) →
nilzero2(
0',
cons(
x,
xs)) →
cons(
sub(
x,
x),
zero(
xs))
zero2(
s(
y),
nil) →
zero(
nil)
zero2(
s(
y),
cons(
x,
xs)) →
zero(
cons(
x,
xs))
Types:
sub :: 0':s → 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
zero :: nil:cons → nil:cons
nil :: nil:cons
zero2 :: 0':s → nil:cons → nil:cons
cons :: 0':s → nil:cons → nil:cons
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
gen_0':s3_0 :: Nat → 0':s
gen_nil:cons4_0 :: Nat → nil:cons
Lemmas:
sub(gen_0':s3_0(n6_0), gen_0':s3_0(n6_0)) → gen_0':s3_0(0), rt ∈ Ω(1 + n60)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
No more defined symbols left to analyse.
(19) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
sub(gen_0':s3_0(n6_0), gen_0':s3_0(n6_0)) → gen_0':s3_0(0), rt ∈ Ω(1 + n60)
(20) BOUNDS(n^1, INF)