0 CpxTRS
↳1 TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID), 0 ms)
↳2 CpxWeightedTrs
↳3 TypeInferenceProof (BOTH BOUNDS(ID, ID), 4 ms)
↳4 CpxTypedWeightedTrs
↳5 CompletionProof (UPPER BOUND(ID), 0 ms)
↳6 CpxTypedWeightedCompleteTrs
↳7 CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID), 0 ms)
↳8 CpxRNTS
↳9 CompleteCoflocoProof (⇔, 172 ms)
↳10 BOUNDS(1, 1)
fst(0, Z) → nil
fst(s, cons(Y)) → cons(Y)
from(X) → cons(X)
add(0, X) → X
add(s, Y) → s
len(nil) → 0
len(cons(X)) → s
fst(0, Z) → nil [1]
fst(s, cons(Y)) → cons(Y) [1]
from(X) → cons(X) [1]
add(0, X) → X [1]
add(s, Y) → s [1]
len(nil) → 0 [1]
len(cons(X)) → s [1]
fst(0, Z) → nil [1]
fst(s, cons(Y)) → cons(Y) [1]
from(X) → cons(X) [1]
add(0, X) → X [1]
add(s, Y) → s [1]
len(nil) → 0 [1]
len(cons(X)) → s [1]
fst :: 0:s → nil:cons → nil:cons 0 :: 0:s nil :: nil:cons s :: 0:s cons :: a → nil:cons from :: a → nil:cons add :: 0:s → 0:s → 0:s len :: nil:cons → 0:s |
fst(v0, v1) → null_fst [0]
len(v0) → null_len [0]
add(v0, v1) → null_add [0]
null_fst, null_len, null_add, 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 |
0 => 1
nil => 0
s => 2
null_fst => 0
null_len => 0
null_add => 0
const => 0
add(z, z') -{ 1 }→ X :|: z' = X, z = 1, X >= 0
add(z, z') -{ 1 }→ 2 :|: z = 2, z' = Y, Y >= 0
add(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1
from(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
fst(z, z') -{ 1 }→ 0 :|: Z >= 0, z = 1, z' = Z
fst(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1
fst(z, z') -{ 1 }→ 1 + Y :|: z = 2, Y >= 0, z' = 1 + Y
len(z) -{ 1 }→ 2 :|: z = 1 + X, X >= 0
len(z) -{ 1 }→ 1 :|: z = 0
len(z) -{ 0 }→ 0 :|: v0 >= 0, z = v0
eq(start(V, V1),0,[fst(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1),0,[from(V, Out)],[V >= 0]). eq(start(V, V1),0,[add(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1),0,[len(V, Out)],[V >= 0]). eq(fst(V, V1, Out),1,[],[Out = 0,Z1 >= 0,V = 1,V1 = Z1]). eq(fst(V, V1, Out),1,[],[Out = 1 + Y1,V = 2,Y1 >= 0,V1 = 1 + Y1]). eq(from(V, Out),1,[],[Out = 1 + X1,X1 >= 0,V = X1]). eq(add(V, V1, Out),1,[],[Out = X2,V1 = X2,V = 1,X2 >= 0]). eq(add(V, V1, Out),1,[],[Out = 2,V = 2,V1 = Y2,Y2 >= 0]). eq(len(V, Out),1,[],[Out = 1,V = 0]). eq(len(V, Out),1,[],[Out = 2,V = 1 + X3,X3 >= 0]). eq(fst(V, V1, Out),0,[],[Out = 0,V2 >= 0,V3 >= 0,V = V2,V1 = V3]). eq(len(V, Out),0,[],[Out = 0,V4 >= 0,V = V4]). eq(add(V, V1, Out),0,[],[Out = 0,V5 >= 0,V6 >= 0,V = V5,V1 = V6]). input_output_vars(fst(V,V1,Out),[V,V1],[Out]). input_output_vars(from(V,Out),[V],[Out]). input_output_vars(add(V,V1,Out),[V,V1],[Out]). input_output_vars(len(V,Out),[V],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. non_recursive : [add/3]
1. non_recursive : [from/2]
2. non_recursive : [fst/3]
3. non_recursive : [len/2]
4. non_recursive : [start/2]
#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into add/3
1. SCC is completely evaluated into other SCCs
2. SCC is partially evaluated into fst/3
3. SCC is partially evaluated into len/2
4. SCC is partially evaluated into start/2
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations add/3
* CE 11 is refined into CE [15]
* CE 10 is refined into CE [16]
* CE 9 is refined into CE [17]
### Cost equations --> "Loop" of add/3
* CEs [15] --> Loop 10
* CEs [16] --> Loop 11
* CEs [17] --> Loop 12
### Ranking functions of CR add(V,V1,Out)
#### Partial ranking functions of CR add(V,V1,Out)
### Specialization of cost equations fst/3
* CE 7 is refined into CE [18]
* CE 6 is refined into CE [19]
* CE 8 is refined into CE [20]
### Cost equations --> "Loop" of fst/3
* CEs [18] --> Loop 13
* CEs [19,20] --> Loop 14
### Ranking functions of CR fst(V,V1,Out)
#### Partial ranking functions of CR fst(V,V1,Out)
### Specialization of cost equations len/2
* CE 13 is refined into CE [21]
* CE 14 is refined into CE [22]
* CE 12 is refined into CE [23]
### Cost equations --> "Loop" of len/2
* CEs [21] --> Loop 15
* CEs [22] --> Loop 16
* CEs [23] --> Loop 17
### Ranking functions of CR len(V,Out)
#### Partial ranking functions of CR len(V,Out)
### Specialization of cost equations start/2
* CE 2 is refined into CE [24,25]
* CE 3 is refined into CE [26]
* CE 4 is refined into CE [27,28,29]
* CE 5 is refined into CE [30,31,32]
### Cost equations --> "Loop" of start/2
* CEs [24,28] --> Loop 18
* CEs [27] --> Loop 19
* CEs [25,26,29,30,31,32] --> Loop 20
### Ranking functions of CR start(V,V1)
#### Partial ranking functions of CR start(V,V1)
Computing Bounds
=====================================
#### Cost of chains of add(V,V1,Out):
* Chain [12]: 1
with precondition: [V=1,V1=Out,V1>=0]
* Chain [11]: 1
with precondition: [V=2,Out=2,V1>=0]
* Chain [10]: 0
with precondition: [Out=0,V>=0,V1>=0]
#### Cost of chains of fst(V,V1,Out):
* Chain [14]: 1
with precondition: [Out=0,V>=0,V1>=0]
* Chain [13]: 1
with precondition: [V=2,V1=Out,V1>=1]
#### Cost of chains of len(V,Out):
* Chain [17]: 1
with precondition: [V=0,Out=1]
* Chain [16]: 0
with precondition: [Out=0,V>=0]
* Chain [15]: 1
with precondition: [Out=2,V>=1]
#### Cost of chains of start(V,V1):
* Chain [20]: 1
with precondition: [V>=0]
* Chain [19]: 1
with precondition: [V=1,V1>=0]
* Chain [18]: 1
with precondition: [V=2,V1>=0]
Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [20] with precondition: [V>=0]
- Upper bound: 1
- Complexity: constant
* Chain [19] with precondition: [V=1,V1>=0]
- Upper bound: 1
- Complexity: constant
* Chain [18] with precondition: [V=2,V1>=0]
- Upper bound: 1
- Complexity: constant
### Maximum cost of start(V,V1): 1
Asymptotic class: constant
* Total analysis performed in 67 ms.