# Inferring Expected Runtimes Using Sizes

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

### Initial Complexity Problem (after preprocessing)

Start:f
Program_Vars:Arg_0
Temp_Vars:Y
Locations:f, g, h
Transitions:
f(Arg_0) -> g(Arg_0) :|: 0<Arg_0
g(Arg_0) -> 1/2:g(Arg_0) :+: 1/4:h(Arg_0) :+: 1/4:h(Arg_0+1) :|: 0<Arg_0
h(Arg_0) -> g(Arg_0-Y) :|: 0<Y && 1<=Arg_0

### Timebounds:

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

### Expected Timebounds:

Overall expected timebound: 1+8*Arg_0 {O(n)}
0: f->[1:g]: 1 {O(1)}
1: g->[1/2:g; 1/4:h; 1/4:h]: 4*Arg_0 {O(n)}
2: h->[1:g]: 4*Arg_0 {O(n)}

### Costbounds:

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

### Expected Costbounds:

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

### Sizebounds:

0,0: f->g, Arg_0: Arg_0 {O(n)}

### ExpSizeBounds:

(0: f->[1:g], g), Y: Y {O(n)}
(0: f->[1:g], g), Arg_0: Arg_0 {O(n)}
(1: g->[1/2:g; 1/4:h; 1/4:h], g), Y: Y {O(n)}
(1: g->[1/2:g; 1/4:h; 1/4:h], h), Y: Y {O(n)}
(2: h->[1:g], g), Y: Y {O(n)}