# Inferring Expected Runtimes Using Sizes

KoAT2 Proof WORST_CASE( ?, 10*Arg_0+8 {O(n)})

### Initial Complexity Problem (after preprocessing)

Start:f
Program_Vars:Arg_0
Temp_Vars:
Locations:f, g, h
Transitions:
f(Arg_0) -{0}> g(Arg_0)
g(Arg_0) -{10}> g(Uniform (-8, -6)) :|: 8<=Arg_0
g(Arg_0) -> h(Arg_0) :|: Arg_0<8
h(Arg_0) -> h(Arg_0-1) :|: 0<Arg_0 && Arg_0<=7

### Timebounds:

Overall timebound:max([9, 7+2+Arg_0]) {O(n)}
0,0: f->g: 1 {O(1)}
1,1: g->g: max([0, Arg_0]) {O(n)}
2,2: g->h: 1 {O(1)}
3,3: h->h: 7 {O(1)}

### Expected Timebounds:

Overall expected timebound: 9+Arg_0 {O(n)}
0: f->[1:g]: 1 {O(1)}
1: g->[1:g]: Arg_0 {O(n)}
2: g->[1:h]: 1 {O(1)}
3: h->[1:h]: 7 {O(1)}

### Costbounds:

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

### Expected Costbounds:

Overall expected costbound: 10*Arg_0+8 {O(n)}
0: f->[1:g]: 0 {O(1)}
1: g->[1:g]: 10*Arg_0 {O(n)}
2: g->[1:h]: 1 {O(1)}
3: h->[1:h]: 7 {O(1)}

### Sizebounds:

0,0: f->g, Arg_0: Arg_0 {O(n)}
1,1: g->g, Arg_0: Arg_0 {O(n)}
2,2: g->h, Arg_0: 7 {O(1)}
3,3: h->h, Arg_0: 6 {O(1)}

### ExpSizeBounds:

(0: f->[1:g], g), Arg_0: Arg_0 {O(n)}
(1: g->[1:g], g), Arg_0: Arg_0 {O(n)}
(2: g->[1:h], h), Arg_0: 7 {O(1)}
(3: h->[1:h], h), Arg_0: 6 {O(1)}