# Inferring Expected Runtimes Using Sizes

KoAT2 Proof WORST_CASE( ?, 12*Arg_2+15*Arg_0+15*Arg_1 {O(n)})

### Initial Complexity Problem (after preprocessing)

Start:f
Program_Vars:Arg_0, Arg_1, Arg_2
Temp_Vars:
Locations:f, g, h, i
Transitions:
f(Arg_0,Arg_1,Arg_2) -{0}> g(Arg_0,Arg_1,Arg_2)
g(Arg_0,Arg_1,Arg_2) -{0}> h(Arg_0,Arg_1,Arg_2) :|: 0<=Arg_2
h(Arg_0,Arg_1,Arg_2) -> h(Arg_0-1,Arg_1,Arg_2) :|: Arg_1<Arg_0 && 0<=Arg_2
h(Arg_0,Arg_1,Arg_2) -{0}> 1/10:i(Arg_0+1,Arg_1,Arg_2) :+: 7/10:i(Arg_0+2,Arg_1,Arg_2) :+: 1/5:i(Arg_0+3,Arg_1,Arg_2) :|: Arg_0<=Arg_1 && Arg_1<=Arg_0 && 0<=Arg_2
i(Arg_0,Arg_1,Arg_2) -{0}> g(Uniform (-1, 1),Arg_1,Arg_2-5) :|: 0<=Arg_2 && 1+Arg_1<=Arg_0 && Arg_0<=3+Arg_1

### Timebounds:

Overall timebound:max([(-15)*Arg_1+12*Arg_2+15*Arg_0, 0])+max([0, 1+2*Arg_2])+max([0, 1+4*Arg_2])+max([0, 11+3*Arg_2])+max([0, 2*Arg_2+3])+max([1, 4+Arg_2]) {O(n)}
0,0: f->g: 1 {O(1)}
1,1: g->h: max([0, 3+Arg_2]) {O(n)}
2,2: h->h: max([(-15)*Arg_1+12*Arg_2+15*Arg_0, 0]) {O(n)}
3,3: h->i: max([0, 11+3*Arg_2]) {O(n)}
4,3: h->i: max([0, 1+2*Arg_2]) {O(n)}
5,3: h->i: max([0, 2*Arg_2+3]) {O(n)}
6,4: i->g: max([0, 1+4*Arg_2]) {O(n)}

### Expected Timebounds:

Overall expected timebound: 15*Arg_0+15*Arg_1+20+24*Arg_2 {O(n)}
0: f->[1:g]: 1 {O(1)}
1: g->[1:h]: 3+Arg_2 {O(n)}
2: h->[1:h]: 12*Arg_2+15*Arg_0+15*Arg_1 {O(n)}
3: h->[1/10:i; 7/10:i; 1/5:i]: 15+7*Arg_2 {O(n)}
4: i->[1:g]: 1+4*Arg_2 {O(n)}

### Costbounds:

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

### Expected Costbounds:

Overall expected costbound: 12*Arg_2+15*Arg_0+15*Arg_1 {O(n)}
0: f->[1:g]: 0 {O(1)}
1: g->[1:h]: 0 {O(1)}
2: h->[1:h]: 12*Arg_2+15*Arg_0+15*Arg_1 {O(n)}
3: h->[1/10:i; 7/10:i; 1/5:i]: 0 {O(1)}
4: i->[1:g]: 0 {O(1)}

### Sizebounds:

0,0: f->g, Arg_0: Arg_0 {O(n)}
0,0: f->g, Arg_1: Arg_1 {O(n)}
0,0: f->g, Arg_2: Arg_2 {O(n)}
1,1: g->h, Arg_0: 2*max([0, 1+2*Arg_2])+3*max([0, 2*Arg_2+3])+Arg_0+max([0, 1+4*Arg_2])+max([0, 11+3*Arg_2]) {O(n)}
1,1: g->h, Arg_1: Arg_1 {O(n)}
1,1: g->h, Arg_2: Arg_2 {O(n)}
2,2: h->h, Arg_0: 2*max([0, 1+2*Arg_2])+3*max([0, 2*Arg_2+3])+Arg_0+max([0, 1+4*Arg_2])+max([0, 11+3*Arg_2]) {O(n)}
2,2: h->h, Arg_1: Arg_1 {O(n)}
2,2: h->h, Arg_2: Arg_2 {O(n)}
3,3: h->i, Arg_0: 2*max([0, 1+2*Arg_2])+3*max([0, 2*Arg_2+3])+Arg_0+max([0, 1+4*Arg_2])+max([0, 11+3*Arg_2]) {O(n)}
3,3: h->i, Arg_1: Arg_1 {O(n)}
3,3: h->i, Arg_2: Arg_2 {O(n)}
4,3: h->i, Arg_0: 2*max([0, 1+2*Arg_2])+3*max([0, 2*Arg_2+3])+Arg_0+max([0, 1+4*Arg_2])+max([0, 11+3*Arg_2]) {O(n)}
4,3: h->i, Arg_1: Arg_1 {O(n)}
4,3: h->i, Arg_2: Arg_2 {O(n)}
5,3: h->i, Arg_0: 2*max([0, 1+2*Arg_2])+3*max([0, 2*Arg_2+3])+Arg_0+max([0, 1+4*Arg_2])+max([0, 11+3*Arg_2]) {O(n)}
5,3: h->i, Arg_1: Arg_1 {O(n)}
5,3: h->i, Arg_2: Arg_2 {O(n)}
6,4: i->g, Arg_0: 2*max([0, 1+2*Arg_2])+3*max([0, 2*Arg_2+3])+Arg_0+max([0, 1+4*Arg_2])+max([0, 11+3*Arg_2]) {O(n)}
6,4: i->g, Arg_1: Arg_1 {O(n)}
6,4: i->g, Arg_2: Arg_2 {O(n)}

### ExpSizeBounds:

(0: f->[1:g], g), Arg_0: Arg_0 {O(n)}
(0: f->[1:g], g), Arg_1: Arg_1 {O(n)}
(0: f->[1:g], g), Arg_2: Arg_2 {O(n)}
(1: g->[1:h], h), Arg_0: 1+15*Arg_1+16*Arg_0+16*Arg_2+21/10*(15+7*Arg_2) {O(n)}
(1: g->[1:h], h), Arg_1: Arg_1 {O(n)}
(1: g->[1:h], h), Arg_2: Arg_2 {O(n)}
(2: h->[1:h], h), Arg_0: 1+15*Arg_1+16*Arg_0+16*Arg_2+21/10*(15+7*Arg_2) {O(n)}
(2: h->[1:h], h), Arg_1: Arg_1 {O(n)}
(2: h->[1:h], h), Arg_2: Arg_2 {O(n)}
(3: h->[1/10:i; 7/10:i; 1/5:i], i), Arg_0: 1+15*Arg_1+16*Arg_0+16*Arg_2+21/10*(15+7*Arg_2) {O(n)}
(3: h->[1/10:i; 7/10:i; 1/5:i], i), Arg_1: Arg_1 {O(n)}
(3: h->[1/10:i; 7/10:i; 1/5:i], i), Arg_2: Arg_2 {O(n)}
(4: i->[1:g], g), Arg_0: 1+15*Arg_1+16*Arg_0+16*Arg_2+21/10*(15+7*Arg_2) {O(n)}
(4: i->[1:g], g), Arg_1: Arg_1 {O(n)}
(4: i->[1:g], g), Arg_2: max([5, Arg_2]) {O(n)}