# Inferring Expected Runtimes Using Sizes

KoAT2 Proof WORST_CASE( ?, 2*(2*Arg_1+3*Arg_3+6*Arg_3*Arg_4)+Arg_2 {O(n^2)})

### Initial Complexity Problem (after preprocessing)

Start:f
Program_Vars:Arg_0, Arg_1, Arg_2, Arg_3, Arg_4
Temp_Vars:
Locations:f, g, h, j, k
Transitions:
f(Arg_0,Arg_1,Arg_2,Arg_3,Arg_4) -{0}> g(0,Arg_1,Arg_2,Arg_3,Arg_4)
g(Arg_0,Arg_1,Arg_2,Arg_3,Arg_4) -{0}> h(Uniform (0, 1),Arg_1+3*Arg_4,Arg_2,Arg_3,Arg_4) :|: Arg_0<Arg_3 && 0<=Arg_0
h(Arg_0,Arg_1,Arg_2,Arg_3,Arg_4) -{0}> g(Arg_0,Binomial (3, 1/2),Arg_2,Arg_3,Arg_4) :|: 1<=Arg_3 && 1<=Arg_0+Arg_3 && Arg_0<=Arg_3 && 0<=Arg_0
g(Arg_0,Arg_1,Arg_2,Arg_3,Arg_4) -{0}> j(Arg_0,Arg_1,Arg_2,Arg_3,Arg_4) :|: Arg_3<Arg_0+1 && 0<=Arg_0
j(Arg_0,Arg_1,Arg_2,Arg_3,Arg_4) -{0}> k(Arg_0,Arg_1,Arg_2,Arg_3,Arg_4) :|: 0<Arg_1 && Arg_3<=Arg_0 && 0<=Arg_0
k(Arg_0,Arg_1,Arg_2,Arg_3,Arg_4) -> k(Arg_0,Arg_1,Arg_2-1,Arg_3,Arg_4) :|: 0<Arg_2 && Arg_3<=Arg_0 && 1<=Arg_1 && 1<=Arg_0+Arg_1 && 0<=Arg_0
k(Arg_0,Arg_1,Arg_2,Arg_3,Arg_4) -> 1/4:j(Arg_0,Arg_1+1,Arg_2,Arg_3,Arg_4) :+: 3/4:j(Arg_0,Arg_1-1,Arg_2,Arg_3,Arg_4) :|: Arg_2<1 && Arg_3<=Arg_0 && 1<=Arg_1 && 1<=Arg_0+Arg_1 && 0<=Arg_0

### Timebounds:

Overall timebound:inf {Infinity}
0,0: f->g: 1 {O(1)}
1,1: g->h: inf {Infinity}
3,3: g->j: 1 {O(1)}
2,2: h->g: inf {Infinity}
4,4: j->k: inf {Infinity}
5,5: k->k: max([0, Arg_2]) {O(n)}
6,6: k->j: inf {Infinity}
7,6: k->j: inf {Infinity}

### Expected Timebounds:

Overall expected timebound: 3+4*(2*Arg_1+3*Arg_3+6*Arg_3*Arg_4)+Arg_2+4*Arg_3 {O(n^2)}
0: f->[1:g]: 1 {O(1)}
1: g->[1:h]: 2*Arg_3 {O(n)}
2: h->[1:g]: 2*Arg_3 {O(n)}
3: g->[1:j]: 1 {O(1)}
4: j->[1:k]: 1+2*(2*Arg_1+3*Arg_3+6*Arg_3*Arg_4) {O(n^2)}
5: k->[1:k]: Arg_2 {O(n)}
6: k->[1/4:j; 3/4:j]: 2*(2*Arg_1+3*Arg_3+6*Arg_3*Arg_4) {O(n^2)}

### Costbounds:

Overall costbound: inf {Infinity}
0,0: f->g: inf {Infinity}
1,1: g->h: inf {Infinity}
3,3: g->j: inf {Infinity}
2,2: h->g: inf {Infinity}
4,4: j->k: inf {Infinity}
5,5: k->k: inf {Infinity}
6,6: k->j: inf {Infinity}
7,6: k->j: inf {Infinity}

### Expected Costbounds:

Overall expected costbound: 2*(2*Arg_1+3*Arg_3+6*Arg_3*Arg_4)+Arg_2 {O(n^2)}
0: f->[1:g]: 0 {O(1)}
1: g->[1:h]: 0 {O(1)}
2: h->[1:g]: 0 {O(1)}
3: g->[1:j]: 0 {O(1)}
4: j->[1:k]: 0 {O(1)}
5: k->[1:k]: Arg_2 {O(n)}
6: k->[1/4:j; 3/4:j]: 2*(2*Arg_1+3*Arg_3+6*Arg_3*Arg_4) {O(n^2)}

### Sizebounds:

0,0: f->g, Arg_0: 0 {O(1)}
0,0: f->g, Arg_1: Arg_1 {O(n)}
0,0: f->g, Arg_2: Arg_2 {O(n)}
0,0: f->g, Arg_3: Arg_3 {O(n)}
0,0: f->g, Arg_4: Arg_4 {O(n)}
1,1: g->h, Arg_2: Arg_2 {O(n)}
1,1: g->h, Arg_3: Arg_3 {O(n)}
1,1: g->h, Arg_4: Arg_4 {O(n)}
3,3: g->j, Arg_2: Arg_2 {O(n)}
3,3: g->j, Arg_3: Arg_3 {O(n)}
3,3: g->j, Arg_4: Arg_4 {O(n)}
2,2: h->g, Arg_2: Arg_2 {O(n)}
2,2: h->g, Arg_3: Arg_3 {O(n)}
2,2: h->g, Arg_4: Arg_4 {O(n)}
4,4: j->k, Arg_2: max([0, Arg_2]) {O(n)}
4,4: j->k, Arg_3: Arg_3 {O(n)}
4,4: j->k, Arg_4: Arg_4 {O(n)}
5,5: k->k, Arg_2: max([0, Arg_2]) {O(n)}
5,5: k->k, Arg_3: Arg_3 {O(n)}
5,5: k->k, Arg_4: Arg_4 {O(n)}
6,6: k->j, Arg_2: 0 {O(1)}
6,6: k->j, Arg_3: Arg_3 {O(n)}
6,6: k->j, Arg_4: Arg_4 {O(n)}
7,6: k->j, Arg_2: 0 {O(1)}
7,6: k->j, Arg_3: Arg_3 {O(n)}
7,6: k->j, Arg_4: Arg_4 {O(n)}

### ExpSizeBounds:

(0: f->[1:g], g), Arg_0: 0 {O(1)}
(0: f->[1:g], g), Arg_1: Arg_1 {O(n)}
(0: f->[1:g], g), Arg_2: Arg_2 {O(n)}
(0: f->[1:g], g), Arg_3: Arg_3 {O(n)}
(0: f->[1:g], g), Arg_4: Arg_4 {O(n)}
(1: g->[1:h], h), Arg_0: Arg_3 {O(n)}
(1: g->[1:h], h), Arg_1: 3*Arg_3+Arg_1+6*Arg_3*Arg_4 {O(n^2)}
(1: g->[1:h], h), Arg_2: Arg_2 {O(n)}
(1: g->[1:h], h), Arg_3: Arg_3 {O(n)}
(1: g->[1:h], h), Arg_4: Arg_4 {O(n)}
(2: h->[1:g], g), Arg_0: Arg_3 {O(n)}
(2: h->[1:g], g), Arg_1: 3*Arg_3+Arg_1+6*Arg_3*Arg_4 {O(n^2)}
(2: h->[1:g], g), Arg_2: Arg_2 {O(n)}
(2: h->[1:g], g), Arg_3: Arg_3 {O(n)}
(2: h->[1:g], g), Arg_4: Arg_4 {O(n)}
(3: g->[1:j], j), Arg_0: Arg_3 {O(n)}
(3: g->[1:j], j), Arg_1: 2*Arg_1+3*Arg_3+6*Arg_3*Arg_4 {O(n^2)}
(3: g->[1:j], j), Arg_2: Arg_2 {O(n)}
(3: g->[1:j], j), Arg_3: Arg_3 {O(n)}
(3: g->[1:j], j), Arg_4: Arg_4 {O(n)}
(4: j->[1:k], k), Arg_0: Arg_3 {O(n)}
(4: j->[1:k], k), Arg_1: 2*(2*Arg_1+3*Arg_3+6*Arg_3*Arg_4)+2*Arg_1+3*Arg_3+6*Arg_3*Arg_4 {O(n^2)}
(4: j->[1:k], k), Arg_2: Arg_2 {O(n)}
(4: j->[1:k], k), Arg_3: Arg_3 {O(n)}
(4: j->[1:k], k), Arg_4: Arg_4 {O(n)}
(5: k->[1:k], k), Arg_0: Arg_3 {O(n)}
(5: k->[1:k], k), Arg_1: 2*(2*Arg_1+3*Arg_3+6*Arg_3*Arg_4)+2*Arg_1+3*Arg_3+6*Arg_3*Arg_4 {O(n^2)}
(5: k->[1:k], k), Arg_2: Arg_2 {O(n)}
(5: k->[1:k], k), Arg_3: Arg_3 {O(n)}
(5: k->[1:k], k), Arg_4: Arg_4 {O(n)}
(6: k->[1/4:j; 3/4:j], j), Arg_0: Arg_3 {O(n)}
(6: k->[1/4:j; 3/4:j], j), Arg_1: 2*(2*Arg_1+3*Arg_3+6*Arg_3*Arg_4)+2*Arg_1+3*Arg_3+6*Arg_3*Arg_4 {O(n^2)}
(6: k->[1/4:j; 3/4:j], j), Arg_2: Arg_2 {O(n)}
(6: k->[1/4:j; 3/4:j], j), Arg_3: Arg_3 {O(n)}
(6: k->[1/4:j; 3/4:j], j), Arg_4: Arg_4 {O(n)}