(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
fact(X) → if(zero(X), s(0), prod(X, fact(p(X))))
add(0, X) → X
add(s(X), Y) → s(add(X, Y))
prod(0, X) → 0
prod(s(X), Y) → add(Y, prod(X, Y))
if(true, X, Y) → X
if(false, X, Y) → Y
zero(0) → true
zero(s(X)) → false
p(s(X)) → X
Rewrite Strategy: FULL
(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:
fact(X) → if(zero(X), s(0'), prod(X, fact(p(X))))
add(0', X) → X
add(s(X), Y) → s(add(X, Y))
prod(0', X) → 0'
prod(s(X), Y) → add(Y, prod(X, Y))
if(true, X, Y) → X
if(false, X, Y) → Y
zero(0') → true
zero(s(X)) → false
p(s(X)) → X
S is empty.
Rewrite Strategy: FULL
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
TRS:
Rules:
fact(X) → if(zero(X), s(0'), prod(X, fact(p(X))))
add(0', X) → X
add(s(X), Y) → s(add(X, Y))
prod(0', X) → 0'
prod(s(X), Y) → add(Y, prod(X, Y))
if(true, X, Y) → X
if(false, X, Y) → Y
zero(0') → true
zero(s(X)) → false
p(s(X)) → X
Types:
fact :: 0':s → 0':s
if :: true:false → 0':s → 0':s → 0':s
zero :: 0':s → true:false
s :: 0':s → 0':s
0' :: 0':s
prod :: 0':s → 0':s → 0':s
p :: 0':s → 0':s
add :: 0':s → 0':s → 0':s
true :: true:false
false :: true:false
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
fact,
prod,
addThey will be analysed ascendingly in the following order:
prod < fact
add < prod
(6) Obligation:
TRS:
Rules:
fact(
X) →
if(
zero(
X),
s(
0'),
prod(
X,
fact(
p(
X))))
add(
0',
X) →
Xadd(
s(
X),
Y) →
s(
add(
X,
Y))
prod(
0',
X) →
0'prod(
s(
X),
Y) →
add(
Y,
prod(
X,
Y))
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Yzero(
0') →
truezero(
s(
X)) →
falsep(
s(
X)) →
XTypes:
fact :: 0':s → 0':s
if :: true:false → 0':s → 0':s → 0':s
zero :: 0':s → true:false
s :: 0':s → 0':s
0' :: 0':s
prod :: 0':s → 0':s → 0':s
p :: 0':s → 0':s
add :: 0':s → 0':s → 0':s
true :: true:false
false :: true:false
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
add, fact, prod
They will be analysed ascendingly in the following order:
prod < fact
add < prod
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
add(
gen_0':s3_0(
n5_0),
gen_0':s3_0(
b)) →
gen_0':s3_0(
+(
n5_0,
b)), rt ∈ Ω(1 + n5
0)
Induction Base:
add(gen_0':s3_0(0), gen_0':s3_0(b)) →RΩ(1)
gen_0':s3_0(b)
Induction Step:
add(gen_0':s3_0(+(n5_0, 1)), gen_0':s3_0(b)) →RΩ(1)
s(add(gen_0':s3_0(n5_0), gen_0':s3_0(b))) →IH
s(gen_0':s3_0(+(b, c6_0)))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
TRS:
Rules:
fact(
X) →
if(
zero(
X),
s(
0'),
prod(
X,
fact(
p(
X))))
add(
0',
X) →
Xadd(
s(
X),
Y) →
s(
add(
X,
Y))
prod(
0',
X) →
0'prod(
s(
X),
Y) →
add(
Y,
prod(
X,
Y))
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Yzero(
0') →
truezero(
s(
X)) →
falsep(
s(
X)) →
XTypes:
fact :: 0':s → 0':s
if :: true:false → 0':s → 0':s → 0':s
zero :: 0':s → true:false
s :: 0':s → 0':s
0' :: 0':s
prod :: 0':s → 0':s → 0':s
p :: 0':s → 0':s
add :: 0':s → 0':s → 0':s
true :: true:false
false :: true:false
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Lemmas:
add(gen_0':s3_0(n5_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
prod, fact
They will be analysed ascendingly in the following order:
prod < fact
(10) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
prod(
gen_0':s3_0(
n512_0),
gen_0':s3_0(
b)) →
gen_0':s3_0(
*(
n512_0,
b)), rt ∈ Ω(1 + b·n512
0 + n512
0)
Induction Base:
prod(gen_0':s3_0(0), gen_0':s3_0(b)) →RΩ(1)
0'
Induction Step:
prod(gen_0':s3_0(+(n512_0, 1)), gen_0':s3_0(b)) →RΩ(1)
add(gen_0':s3_0(b), prod(gen_0':s3_0(n512_0), gen_0':s3_0(b))) →IH
add(gen_0':s3_0(b), gen_0':s3_0(*(c513_0, b))) →LΩ(1 + b)
gen_0':s3_0(+(b, *(n512_0, b)))
We have rt ∈ Ω(n2) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n2).
(11) Complex Obligation (BEST)
(12) Obligation:
TRS:
Rules:
fact(
X) →
if(
zero(
X),
s(
0'),
prod(
X,
fact(
p(
X))))
add(
0',
X) →
Xadd(
s(
X),
Y) →
s(
add(
X,
Y))
prod(
0',
X) →
0'prod(
s(
X),
Y) →
add(
Y,
prod(
X,
Y))
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Yzero(
0') →
truezero(
s(
X)) →
falsep(
s(
X)) →
XTypes:
fact :: 0':s → 0':s
if :: true:false → 0':s → 0':s → 0':s
zero :: 0':s → true:false
s :: 0':s → 0':s
0' :: 0':s
prod :: 0':s → 0':s → 0':s
p :: 0':s → 0':s
add :: 0':s → 0':s → 0':s
true :: true:false
false :: true:false
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Lemmas:
add(gen_0':s3_0(n5_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
prod(gen_0':s3_0(n512_0), gen_0':s3_0(b)) → gen_0':s3_0(*(n512_0, b)), rt ∈ Ω(1 + b·n5120 + n5120)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
fact
(13) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol fact.
(14) Obligation:
TRS:
Rules:
fact(
X) →
if(
zero(
X),
s(
0'),
prod(
X,
fact(
p(
X))))
add(
0',
X) →
Xadd(
s(
X),
Y) →
s(
add(
X,
Y))
prod(
0',
X) →
0'prod(
s(
X),
Y) →
add(
Y,
prod(
X,
Y))
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Yzero(
0') →
truezero(
s(
X)) →
falsep(
s(
X)) →
XTypes:
fact :: 0':s → 0':s
if :: true:false → 0':s → 0':s → 0':s
zero :: 0':s → true:false
s :: 0':s → 0':s
0' :: 0':s
prod :: 0':s → 0':s → 0':s
p :: 0':s → 0':s
add :: 0':s → 0':s → 0':s
true :: true:false
false :: true:false
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Lemmas:
add(gen_0':s3_0(n5_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
prod(gen_0':s3_0(n512_0), gen_0':s3_0(b)) → gen_0':s3_0(*(n512_0, b)), rt ∈ Ω(1 + b·n5120 + n5120)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(15) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n2) was proven with the following lemma:
prod(gen_0':s3_0(n512_0), gen_0':s3_0(b)) → gen_0':s3_0(*(n512_0, b)), rt ∈ Ω(1 + b·n5120 + n5120)
(16) BOUNDS(n^2, INF)
(17) Obligation:
TRS:
Rules:
fact(
X) →
if(
zero(
X),
s(
0'),
prod(
X,
fact(
p(
X))))
add(
0',
X) →
Xadd(
s(
X),
Y) →
s(
add(
X,
Y))
prod(
0',
X) →
0'prod(
s(
X),
Y) →
add(
Y,
prod(
X,
Y))
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Yzero(
0') →
truezero(
s(
X)) →
falsep(
s(
X)) →
XTypes:
fact :: 0':s → 0':s
if :: true:false → 0':s → 0':s → 0':s
zero :: 0':s → true:false
s :: 0':s → 0':s
0' :: 0':s
prod :: 0':s → 0':s → 0':s
p :: 0':s → 0':s
add :: 0':s → 0':s → 0':s
true :: true:false
false :: true:false
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Lemmas:
add(gen_0':s3_0(n5_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
prod(gen_0':s3_0(n512_0), gen_0':s3_0(b)) → gen_0':s3_0(*(n512_0, b)), rt ∈ Ω(1 + b·n5120 + n5120)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(18) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n2) was proven with the following lemma:
prod(gen_0':s3_0(n512_0), gen_0':s3_0(b)) → gen_0':s3_0(*(n512_0, b)), rt ∈ Ω(1 + b·n5120 + n5120)
(19) BOUNDS(n^2, INF)
(20) Obligation:
TRS:
Rules:
fact(
X) →
if(
zero(
X),
s(
0'),
prod(
X,
fact(
p(
X))))
add(
0',
X) →
Xadd(
s(
X),
Y) →
s(
add(
X,
Y))
prod(
0',
X) →
0'prod(
s(
X),
Y) →
add(
Y,
prod(
X,
Y))
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Yzero(
0') →
truezero(
s(
X)) →
falsep(
s(
X)) →
XTypes:
fact :: 0':s → 0':s
if :: true:false → 0':s → 0':s → 0':s
zero :: 0':s → true:false
s :: 0':s → 0':s
0' :: 0':s
prod :: 0':s → 0':s → 0':s
p :: 0':s → 0':s
add :: 0':s → 0':s → 0':s
true :: true:false
false :: true:false
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Lemmas:
add(gen_0':s3_0(n5_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(21) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
add(gen_0':s3_0(n5_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n5_0, b)), rt ∈ Ω(1 + n50)
(22) BOUNDS(n^1, INF)