(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: FULL
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(n1):
The rewrite sequence
sub(s(x), s(y)) →+ sub(x, y)
gives rise to a decreasing loop by considering the right hand sides subterm at position [].
The pumping substitution is [x / s(x), y / s(y)].
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:
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: FULL
(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(6) Obligation:
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
(7) 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
(8) Obligation:
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
(9) 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).
(10) Complex Obligation (BEST)
(11) Obligation:
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
(12) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
zero(
gen_nil:cons4_0(
n750_0)) →
gen_nil:cons4_0(
n750_0), rt ∈ Ω(1 + n750
0)
Induction Base:
zero(gen_nil:cons4_0(0)) →RΩ(1)
zero2(0', nil) →RΩ(1)
nil
Induction Step:
zero(gen_nil:cons4_0(+(n750_0, 1))) →RΩ(1)
zero2(sub(0', 0'), cons(0', gen_nil:cons4_0(n750_0))) →LΩ(1)
zero2(gen_0':s3_0(0), cons(0', gen_nil:cons4_0(n750_0))) →RΩ(1)
cons(sub(0', 0'), zero(gen_nil:cons4_0(n750_0))) →LΩ(1)
cons(gen_0':s3_0(0), zero(gen_nil:cons4_0(n750_0))) →IH
cons(gen_0':s3_0(0), gen_nil:cons4_0(c751_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(13) Complex Obligation (BEST)
(14) Obligation:
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(n750_0)) → gen_nil:cons4_0(n750_0), rt ∈ Ω(1 + n7500)
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.
(15) 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)
(16) BOUNDS(n^1, INF)
(17) Obligation:
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(n750_0)) → gen_nil:cons4_0(n750_0), rt ∈ Ω(1 + n7500)
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.
(18) 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)
(19) BOUNDS(n^1, INF)
(20) Obligation:
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.
(21) 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)
(22) BOUNDS(n^1, INF)