0 CpxTRS
↳1 TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID), 0 ms)
↳2 CpxWeightedTrs
↳3 TypeInferenceProof (BOTH BOUNDS(ID, ID), 0 ms)
↳4 CpxTypedWeightedTrs
↳5 CompletionProof (UPPER BOUND(ID), 0 ms)
↳6 CpxTypedWeightedCompleteTrs
↳7 CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID), 0 ms)
↳8 CpxRNTS
↳9 CompleteCoflocoProof (⇔, 65 ms)
↳10 BOUNDS(1, n^1)
rev(ls) → r1(ls, empty)
r1(empty, a) → a
r1(cons(x, k), a) → r1(k, cons(x, a))
rev(ls) → r1(ls, empty) [1]
r1(empty, a) → a [1]
r1(cons(x, k), a) → r1(k, cons(x, a)) [1]
rev(ls) → r1(ls, empty) [1]
r1(empty, a) → a [1]
r1(cons(x, k), a) → r1(k, cons(x, a)) [1]
rev :: empty:cons → empty:cons r1 :: empty:cons → empty:cons → empty:cons empty :: empty:cons cons :: a → empty:cons → empty:cons |
const
Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules:
The TRS has the following type information:
Rewrite Strategy: INNERMOST |
empty => 0
const => 0
r1(z, z') -{ 1 }→ a :|: z' = a, a >= 0, z = 0
r1(z, z') -{ 1 }→ r1(k, 1 + x + a) :|: z' = a, a >= 0, x >= 0, k >= 0, z = 1 + x + k
rev(z) -{ 1 }→ r1(ls, 0) :|: ls >= 0, z = ls
eq(start(V, V2),0,[rev(V, Out)],[V >= 0]). eq(start(V, V2),0,[r1(V, V2, Out)],[V >= 0,V2 >= 0]). eq(rev(V, Out),1,[r1(V1, 0, Ret)],[Out = Ret,V1 >= 0,V = V1]). eq(r1(V, V2, Out),1,[],[Out = V3,V2 = V3,V3 >= 0,V = 0]). eq(r1(V, V2, Out),1,[r1(V4, 1 + V5 + V6, Ret1)],[Out = Ret1,V2 = V6,V6 >= 0,V5 >= 0,V4 >= 0,V = 1 + V4 + V5]). input_output_vars(rev(V,Out),[V],[Out]). input_output_vars(r1(V,V2,Out),[V,V2],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. recursive : [r1/3]
1. non_recursive : [rev/2]
2. non_recursive : [start/2]
#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into r1/3
1. SCC is completely evaluated into other SCCs
2. SCC is partially evaluated into start/2
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations r1/3
* CE 5 is refined into CE [6]
* CE 4 is refined into CE [7]
### Cost equations --> "Loop" of r1/3
* CEs [7] --> Loop 4
* CEs [6] --> Loop 5
### Ranking functions of CR r1(V,V2,Out)
* RF of phase [5]: [V]
#### Partial ranking functions of CR r1(V,V2,Out)
* Partial RF of phase [5]:
- RF of loop [5:1]:
V
### Specialization of cost equations start/2
* CE 2 is refined into CE [8,9]
* CE 3 is refined into CE [10,11]
### Cost equations --> "Loop" of start/2
* CEs [9,11] --> Loop 6
* CEs [8,10] --> Loop 7
### Ranking functions of CR start(V,V2)
#### Partial ranking functions of CR start(V,V2)
Computing Bounds
=====================================
#### Cost of chains of r1(V,V2,Out):
* Chain [[5],4]: 1*it(5)+1
Such that:it(5) =< -V2+Out
with precondition: [V+V2=Out,V>=1,V2>=0]
* Chain [4]: 1
with precondition: [V=0,V2=Out,V2>=0]
#### Cost of chains of start(V,V2):
* Chain [7]: 2
with precondition: [V=0]
* Chain [6]: 2*s(1)+2
Such that:aux(1) =< V
s(1) =< aux(1)
with precondition: [V>=1]
Closed-form bounds of start(V,V2):
-------------------------------------
* Chain [7] with precondition: [V=0]
- Upper bound: 2
- Complexity: constant
* Chain [6] with precondition: [V>=1]
- Upper bound: 2*V+2
- Complexity: n
### Maximum cost of start(V,V2): 2*V+2
Asymptotic class: n
* Total analysis performed in 61 ms.