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 (⇔, 334 ms)
↳10 BOUNDS(1, n^1)
minus(x, 0) → x
minus(s(x), s(y)) → minus(x, y)
le(0, y) → true
le(s(x), 0) → false
le(s(x), s(y)) → le(x, y)
quot(0, s(y)) → 0
quot(s(x), s(y)) → s(quot(minus(s(x), s(y)), s(y)))
minus(x, 0) → x [1]
minus(s(x), s(y)) → minus(x, y) [1]
le(0, y) → true [1]
le(s(x), 0) → false [1]
le(s(x), s(y)) → le(x, y) [1]
quot(0, s(y)) → 0 [1]
quot(s(x), s(y)) → s(quot(minus(s(x), s(y)), s(y))) [1]
minus(x, 0) → x [1]
minus(s(x), s(y)) → minus(x, y) [1]
le(0, y) → true [1]
le(s(x), 0) → false [1]
le(s(x), s(y)) → le(x, y) [1]
quot(0, s(y)) → 0 [1]
quot(s(x), s(y)) → s(quot(minus(s(x), s(y)), s(y))) [1]
minus :: 0:s → 0:s → 0:s 0 :: 0:s s :: 0:s → 0:s le :: 0:s → 0:s → true:false true :: true:false false :: true:false quot :: 0:s → 0:s → 0:s |
minus(v0, v1) → null_minus [0]
quot(v0, v1) → null_quot [0]
le(v0, v1) → null_le [0]
null_minus, null_quot, null_le
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
true => 2
false => 1
null_minus => 0
null_quot => 0
null_le => 0
le(z, z') -{ 1 }→ le(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x
le(z, z') -{ 1 }→ 2 :|: y >= 0, z = 0, z' = y
le(z, z') -{ 1 }→ 1 :|: x >= 0, z = 1 + x, z' = 0
le(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1
minus(z, z') -{ 1 }→ x :|: x >= 0, z = x, z' = 0
minus(z, z') -{ 1 }→ minus(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x
minus(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1
quot(z, z') -{ 1 }→ 0 :|: z' = 1 + y, y >= 0, z = 0
quot(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1
quot(z, z') -{ 1 }→ 1 + quot(minus(1 + x, 1 + y), 1 + y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x
eq(start(V, V1),0,[minus(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1),0,[le(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1),0,[quot(V, V1, Out)],[V >= 0,V1 >= 0]). eq(minus(V, V1, Out),1,[],[Out = V2,V2 >= 0,V = V2,V1 = 0]). eq(minus(V, V1, Out),1,[minus(V3, V4, Ret)],[Out = Ret,V1 = 1 + V4,V3 >= 0,V4 >= 0,V = 1 + V3]). eq(le(V, V1, Out),1,[],[Out = 2,V5 >= 0,V = 0,V1 = V5]). eq(le(V, V1, Out),1,[],[Out = 1,V6 >= 0,V = 1 + V6,V1 = 0]). eq(le(V, V1, Out),1,[le(V7, V8, Ret1)],[Out = Ret1,V1 = 1 + V8,V7 >= 0,V8 >= 0,V = 1 + V7]). eq(quot(V, V1, Out),1,[],[Out = 0,V1 = 1 + V9,V9 >= 0,V = 0]). eq(quot(V, V1, Out),1,[minus(1 + V10, 1 + V11, Ret10),quot(Ret10, 1 + V11, Ret11)],[Out = 1 + Ret11,V1 = 1 + V11,V10 >= 0,V11 >= 0,V = 1 + V10]). eq(minus(V, V1, Out),0,[],[Out = 0,V12 >= 0,V13 >= 0,V = V12,V1 = V13]). eq(quot(V, V1, Out),0,[],[Out = 0,V14 >= 0,V15 >= 0,V = V14,V1 = V15]). eq(le(V, V1, Out),0,[],[Out = 0,V16 >= 0,V17 >= 0,V = V16,V1 = V17]). input_output_vars(minus(V,V1,Out),[V,V1],[Out]). input_output_vars(le(V,V1,Out),[V,V1],[Out]). input_output_vars(quot(V,V1,Out),[V,V1],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. recursive : [le/3]
1. recursive : [minus/3]
2. recursive : [quot/3]
3. non_recursive : [start/2]
#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into le/3
1. SCC is partially evaluated into minus/3
2. SCC is partially evaluated into quot/3
3. SCC is partially evaluated into start/2
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations le/3
* CE 11 is refined into CE [15]
* CE 9 is refined into CE [16]
* CE 8 is refined into CE [17]
* CE 10 is refined into CE [18]
### Cost equations --> "Loop" of le/3
* CEs [18] --> Loop 11
* CEs [15] --> Loop 12
* CEs [16] --> Loop 13
* CEs [17] --> Loop 14
### Ranking functions of CR le(V,V1,Out)
* RF of phase [11]: [V,V1]
#### Partial ranking functions of CR le(V,V1,Out)
* Partial RF of phase [11]:
- RF of loop [11:1]:
V
V1
### Specialization of cost equations minus/3
* CE 7 is refined into CE [19]
* CE 5 is refined into CE [20]
* CE 6 is refined into CE [21]
### Cost equations --> "Loop" of minus/3
* CEs [21] --> Loop 15
* CEs [19] --> Loop 16
* CEs [20] --> Loop 17
### Ranking functions of CR minus(V,V1,Out)
* RF of phase [15]: [V,V1]
#### Partial ranking functions of CR minus(V,V1,Out)
* Partial RF of phase [15]:
- RF of loop [15:1]:
V
V1
### Specialization of cost equations quot/3
* CE 12 is refined into CE [22]
* CE 14 is refined into CE [23]
* CE 13 is refined into CE [24,25]
### Cost equations --> "Loop" of quot/3
* CEs [25] --> Loop 18
* CEs [24] --> Loop 19
* CEs [22,23] --> Loop 20
### Ranking functions of CR quot(V,V1,Out)
* RF of phase [18]: [V,V-V1+1]
#### Partial ranking functions of CR quot(V,V1,Out)
* Partial RF of phase [18]:
- RF of loop [18:1]:
V
V-V1+1
### Specialization of cost equations start/2
* CE 2 is refined into CE [26,27,28]
* CE 3 is refined into CE [29,30,31,32,33]
* CE 4 is refined into CE [34,35,36]
### Cost equations --> "Loop" of start/2
* CEs [26,30] --> Loop 21
* CEs [27,28,29,31,32,33,34,35,36] --> Loop 22
### Ranking functions of CR start(V,V1)
#### Partial ranking functions of CR start(V,V1)
Computing Bounds
=====================================
#### Cost of chains of le(V,V1,Out):
* Chain [[11],14]: 1*it(11)+1
Such that:it(11) =< V
with precondition: [Out=2,V>=1,V1>=V]
* Chain [[11],13]: 1*it(11)+1
Such that:it(11) =< V1
with precondition: [Out=1,V1>=1,V>=V1+1]
* Chain [[11],12]: 1*it(11)+0
Such that:it(11) =< V1
with precondition: [Out=0,V>=1,V1>=1]
* Chain [14]: 1
with precondition: [V=0,Out=2,V1>=0]
* Chain [13]: 1
with precondition: [V1=0,Out=1,V>=1]
* Chain [12]: 0
with precondition: [Out=0,V>=0,V1>=0]
#### Cost of chains of minus(V,V1,Out):
* Chain [[15],17]: 1*it(15)+1
Such that:it(15) =< V1
with precondition: [V=Out+V1,V1>=1,V>=V1]
* Chain [[15],16]: 1*it(15)+0
Such that:it(15) =< V1
with precondition: [Out=0,V>=1,V1>=1]
* Chain [17]: 1
with precondition: [V1=0,V=Out,V>=0]
* Chain [16]: 0
with precondition: [Out=0,V>=0,V1>=0]
#### Cost of chains of quot(V,V1,Out):
* Chain [[18],20]: 2*it(18)+1*s(5)+1
Such that:it(18) =< V-V1+1
aux(3) =< V
it(18) =< aux(3)
s(5) =< aux(3)
with precondition: [V1>=1,Out>=1,V+1>=Out+V1]
* Chain [[18],19,20]: 3*it(18)+1*s(6)+2
Such that:s(6) =< V1
aux(4) =< V
it(18) =< aux(4)
with precondition: [V1>=1,Out>=2,V+1>=Out+V1]
* Chain [20]: 1
with precondition: [Out=0,V>=0,V1>=0]
* Chain [19,20]: 1*s(6)+2
Such that:s(6) =< V1
with precondition: [Out=1,V>=1,V1>=1]
#### Cost of chains of start(V,V1):
* Chain [22]: 6*s(13)+5*s(17)+2*s(19)+2
Such that:s(19) =< V-V1+1
aux(6) =< V
aux(7) =< V1
s(17) =< aux(6)
s(13) =< aux(7)
s(19) =< aux(6)
with precondition: [V>=0,V1>=0]
* Chain [21]: 1
with precondition: [V1=0,V>=0]
Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [22] with precondition: [V>=0,V1>=0]
- Upper bound: 5*V+6*V1+2+nat(V-V1+1)*2
- Complexity: n
* Chain [21] with precondition: [V1=0,V>=0]
- Upper bound: 1
- Complexity: constant
### Maximum cost of start(V,V1): 5*V+6*V1+1+nat(V-V1+1)*2+1
Asymptotic class: n
* Total analysis performed in 234 ms.