(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

f(X, n__g(X), Y) → f(activate(Y), activate(Y), activate(Y))
g(b) → c
bc
g(X) → n__g(X)
activate(n__g(X)) → g(X)
activate(X) → X

Rewrite Strategy: INNERMOST

(1) NestedDefinedSymbolProof (BOTH BOUNDS(ID, ID) transformation)

The following defined symbols can occur below the 0th argument of f: activate, g
The following defined symbols can occur below the 1th argument of f: activate, g
The following defined symbols can occur below the 2th argument of f: activate, g
The following defined symbols can occur below the 0th argument of activate: activate, g

Hence, the left-hand sides of the following rules are not basic-reachable and can be removed:
g(b) → c

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

g(X) → n__g(X)
bc
activate(X) → X
f(X, n__g(X), Y) → f(activate(Y), activate(Y), activate(Y))
activate(n__g(X)) → g(X)

Rewrite Strategy: INNERMOST

(3) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(4) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

g(X) → n__g(X) [1]
bc [1]
activate(X) → X [1]
f(X, n__g(X), Y) → f(activate(Y), activate(Y), activate(Y)) [1]
activate(n__g(X)) → g(X) [1]

Rewrite Strategy: INNERMOST

(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(6) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

g(X) → n__g(X) [1]
bc [1]
activate(X) → X [1]
f(X, n__g(X), Y) → f(activate(Y), activate(Y), activate(Y)) [1]
activate(n__g(X)) → g(X) [1]

The TRS has the following type information:
g :: n__g → n__g
n__g :: n__g → n__g
b :: c
c :: c
activate :: n__g → n__g
f :: n__g → n__g → n__g → f

Rewrite Strategy: INNERMOST

(7) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:

f(v0, v1, v2) → null_f [0]

And the following fresh constants:

null_f, const

(8) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

g(X) → n__g(X) [1]
bc [1]
activate(X) → X [1]
f(X, n__g(X), Y) → f(activate(Y), activate(Y), activate(Y)) [1]
activate(n__g(X)) → g(X) [1]
f(v0, v1, v2) → null_f [0]

The TRS has the following type information:
g :: n__g → n__g
n__g :: n__g → n__g
b :: c
c :: c
activate :: n__g → n__g
f :: n__g → n__g → n__g → null_f
null_f :: null_f
const :: n__g

Rewrite Strategy: INNERMOST

(9) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

c => 0
null_f => 0
const => 0

(10) Obligation:

Complexity RNTS consisting of the following rules:

activate(z) -{ 1 }→ X :|: X >= 0, z = X
activate(z) -{ 1 }→ g(X) :|: z = 1 + X, X >= 0
b -{ 1 }→ 0 :|:
f(z, z', z'') -{ 1 }→ f(activate(Y), activate(Y), activate(Y)) :|: Y >= 0, z'' = Y, z' = 1 + X, X >= 0, z = X
f(z, z', z'') -{ 0 }→ 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0
g(z) -{ 1 }→ 1 + X :|: X >= 0, z = X

Only complete derivations are relevant for the runtime complexity.

(11) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1, V2),0,[g(V, Out)],[V >= 0]).
eq(start(V, V1, V2),0,[b(Out)],[]).
eq(start(V, V1, V2),0,[activate(V, Out)],[V >= 0]).
eq(start(V, V1, V2),0,[f(V, V1, V2, Out)],[V >= 0,V1 >= 0,V2 >= 0]).
eq(g(V, Out),1,[],[Out = 1 + X1,X1 >= 0,V = X1]).
eq(b(Out),1,[],[Out = 0]).
eq(activate(V, Out),1,[],[Out = X2,X2 >= 0,V = X2]).
eq(f(V, V1, V2, Out),1,[activate(Y1, Ret0),activate(Y1, Ret1),activate(Y1, Ret2),f(Ret0, Ret1, Ret2, Ret)],[Out = Ret,Y1 >= 0,V2 = Y1,V1 = 1 + X3,X3 >= 0,V = X3]).
eq(activate(V, Out),1,[g(X4, Ret3)],[Out = Ret3,V = 1 + X4,X4 >= 0]).
eq(f(V, V1, V2, Out),0,[],[Out = 0,V3 >= 0,V2 = V4,V5 >= 0,V = V3,V1 = V5,V4 >= 0]).
input_output_vars(g(V,Out),[V],[Out]).
input_output_vars(b(Out),[],[Out]).
input_output_vars(activate(V,Out),[V],[Out]).
input_output_vars(f(V,V1,V2,Out),[V,V1,V2],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [g/2]
1. non_recursive : [activate/2]
2. non_recursive : [b/1]
3. recursive : [f/4]
4. non_recursive : [start/3]

#### Obtained direct recursion through partial evaluation
0. SCC is completely evaluated into other SCCs
1. SCC is partially evaluated into activate/2
2. SCC is completely evaluated into other SCCs
3. SCC is partially evaluated into f/4
4. SCC is partially evaluated into start/3

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations activate/2
* CE 5 is refined into CE [9]
* CE 6 is refined into CE [10]


### Cost equations --> "Loop" of activate/2
* CEs [9,10] --> Loop 5

### Ranking functions of CR activate(V,Out)

#### Partial ranking functions of CR activate(V,Out)


### Specialization of cost equations f/4
* CE 8 is refined into CE [11]
* CE 7 is refined into CE [12]


### Cost equations --> "Loop" of f/4
* CEs [12] --> Loop 6
* CEs [11] --> Loop 7

### Ranking functions of CR f(V,V1,V2,Out)

#### Partial ranking functions of CR f(V,V1,V2,Out)


### Specialization of cost equations start/3
* CE 2 is refined into CE [13]
* CE 3 is refined into CE [14]
* CE 4 is refined into CE [15]


### Cost equations --> "Loop" of start/3
* CEs [13,14,15] --> Loop 8

### Ranking functions of CR start(V,V1,V2)

#### Partial ranking functions of CR start(V,V1,V2)


Computing Bounds
=====================================

#### Cost of chains of activate(V,Out):
* Chain [5]: 2
with precondition: [V=Out,V>=0]


#### Cost of chains of f(V,V1,V2,Out):
* Chain [7]: 0
with precondition: [Out=0,V>=0,V1>=0,V2>=0]

* Chain [6,7]: 7
with precondition: [Out=0,V1=V+1,V1>=1,V2>=0]


#### Cost of chains of start(V,V1,V2):
* Chain [8]: 7
with precondition: []


Closed-form bounds of start(V,V1,V2):
-------------------------------------
* Chain [8] with precondition: []
- Upper bound: 7
- Complexity: constant

### Maximum cost of start(V,V1,V2): 7
Asymptotic class: constant
* Total analysis performed in 51 ms.

(12) BOUNDS(1, 1)