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