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 (⇔, 167 ms)
↳10 BOUNDS(1, n^1)
a__f(f(a)) → a__f(g(f(a)))
mark(f(X)) → a__f(mark(X))
mark(a) → a
mark(g(X)) → g(X)
a__f(X) → f(X)
a__f(f(a)) → a__f(g(f(a))) [1]
mark(f(X)) → a__f(mark(X)) [1]
mark(a) → a [1]
mark(g(X)) → g(X) [1]
a__f(X) → f(X) [1]
a__f(f(a)) → a__f(g(f(a))) [1]
mark(f(X)) → a__f(mark(X)) [1]
mark(a) → a [1]
mark(g(X)) → g(X) [1]
a__f(X) → f(X) [1]
a__f :: a:f:g → a:f:g f :: a:f:g → a:f:g a :: a:f:g g :: a:f:g → a:f:g mark :: a:f:g → a:f:g |
Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules:
The TRS has the following type information:
Rewrite Strategy: INNERMOST |
a => 0
a__f(z) -{ 1 }→ a__f(1 + (1 + 0)) :|: z = 1 + 0
a__f(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
mark(z) -{ 1 }→ a__f(mark(X)) :|: z = 1 + X, X >= 0
mark(z) -{ 1 }→ 0 :|: z = 0
mark(z) -{ 1 }→ 1 + X :|: z = 1 + X, X >= 0
eq(start(V),0,[fun(V, Out)],[V >= 0]). eq(start(V),0,[mark(V, Out)],[V >= 0]). eq(fun(V, Out),1,[fun(1 + (1 + 0), Ret)],[Out = Ret,V = 1]). eq(mark(V, Out),1,[mark(X1, Ret0),fun(Ret0, Ret1)],[Out = Ret1,V = 1 + X1,X1 >= 0]). eq(mark(V, Out),1,[],[Out = 0,V = 0]). eq(mark(V, Out),1,[],[Out = 1 + X2,V = 1 + X2,X2 >= 0]). eq(fun(V, Out),1,[],[Out = 1 + X3,X3 >= 0,V = X3]). input_output_vars(fun(V,Out),[V],[Out]). input_output_vars(mark(V,Out),[V],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. recursive : [fun/2]
1. recursive [non_tail] : [mark/2]
2. non_recursive : [start/1]
#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into fun/2
1. SCC is partially evaluated into mark/2
2. SCC is partially evaluated into start/1
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations fun/2
* CE 5 is refined into CE [9]
* CE 4 is refined into CE [10]
### Cost equations --> "Loop" of fun/2
* CEs [10] --> Loop 7
* CEs [9] --> Loop 8
### Ranking functions of CR fun(V,Out)
#### Partial ranking functions of CR fun(V,Out)
### Specialization of cost equations mark/2
* CE 8 is refined into CE [11]
* CE 7 is refined into CE [12]
* CE 6 is refined into CE [13,14]
### Cost equations --> "Loop" of mark/2
* CEs [14] --> Loop 9
* CEs [13] --> Loop 10
* CEs [11] --> Loop 11
* CEs [12] --> Loop 12
### Ranking functions of CR mark(V,Out)
* RF of phase [9,10]: [V]
#### Partial ranking functions of CR mark(V,Out)
* Partial RF of phase [9,10]:
- RF of loop [9:1,10:1]:
V
### Specialization of cost equations start/1
* CE 2 is refined into CE [15,16]
* CE 3 is refined into CE [17,18,19]
### Cost equations --> "Loop" of start/1
* CEs [15] --> Loop 13
* CEs [16,17,18,19] --> Loop 14
### Ranking functions of CR start(V)
#### Partial ranking functions of CR start(V)
Computing Bounds
=====================================
#### Cost of chains of fun(V,Out):
* Chain [8]: 1
with precondition: [V+1=Out,V>=0]
* Chain [7,8]: 2
with precondition: [V=1,Out=3]
#### Cost of chains of mark(V,Out):
* Chain [[9,10],12]: 5*it(9)+1
Such that:aux(3) =< V
it(9) =< aux(3)
with precondition: [Out>=V,2*V>=Out+1]
* Chain [[9,10],11]: 5*it(9)+1
Such that:aux(4) =< V
it(9) =< aux(4)
with precondition: [V>=2,Out>=V,V+1>=Out]
* Chain [12]: 1
with precondition: [V=0,Out=0]
* Chain [11]: 1
with precondition: [V=Out,V>=1]
#### Cost of chains of start(V):
* Chain [14]: 10*s(4)+1
Such that:aux(5) =< V
s(4) =< aux(5)
with precondition: [V>=0]
* Chain [13]: 2
with precondition: [V=1]
Closed-form bounds of start(V):
-------------------------------------
* Chain [14] with precondition: [V>=0]
- Upper bound: 10*V+1
- Complexity: n
* Chain [13] with precondition: [V=1]
- Upper bound: 2
- Complexity: constant
### Maximum cost of start(V): max([10*V,1])+1
Asymptotic class: n
* Total analysis performed in 84 ms.