# Inferring Expected Runtimes Using Sizes

KoAT2 Proof WORST_CASE( ?, 15 {O(1)})

### Initial Complexity Problem (after preprocessing)

Start:f
Program_Vars:Arg_0
Temp_Vars:
Locations:f, g, h, i, j, k, l, m
Transitions:
f(Arg_0) -{0}> 1/3:g(0) :+: 2/3:h(Arg_0)
g(Arg_0) -{3}> i(Arg_0) :|: Arg_0<=0 && 0<=Arg_0
h(Arg_0) -{0}> 1/2:j(1) :+: 1/2:k(1)
j(Arg_0) -{5}> l(Arg_0) :|: Arg_0<=1 && 1<=Arg_0
k(Arg_0) -{7}> m(Arg_0) :|: Arg_0<=1 && 1<=Arg_0

### Timebounds:

Overall timebound:7 {O(1)}
0,0: f->g: 1 {O(1)}
1,0: f->h: 1 {O(1)}
2,1: g->i: 1 {O(1)}
3,2: h->j: 1 {O(1)}
4,2: h->k: 1 {O(1)}
5,3: j->l: 1 {O(1)}
6,4: k->m: 1 {O(1)}

### Expected Timebounds:

Overall expected timebound: 5 {O(1)}
0: f->[1/3:g; 2/3:h]: 1 {O(1)}
1: g->[1:i]: 1 {O(1)}
2: h->[1/2:j; 1/2:k]: 1 {O(1)}
3: j->[1:l]: 1 {O(1)}
4: k->[1:m]: 1 {O(1)}

### Costbounds:

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

### Expected Costbounds:

Overall expected costbound: 15 {O(1)}
0: f->[1/3:g; 2/3:h]: 0 {O(1)}
1: g->[1:i]: 3 {O(1)}
2: h->[1/2:j; 1/2:k]: 0 {O(1)}
3: j->[1:l]: 5 {O(1)}
4: k->[1:m]: 7 {O(1)}

### Sizebounds:

0,0: f->g, Arg_0: 0 {O(1)}
1,0: f->h, Arg_0: Arg_0 {O(n)}
2,1: g->i, Arg_0: 0 {O(1)}
3,2: h->j, Arg_0: 1 {O(1)}
4,2: h->k, Arg_0: 1 {O(1)}
5,3: j->l, Arg_0: 1 {O(1)}
6,4: k->m, Arg_0: 1 {O(1)}

### ExpSizeBounds:

(0: f->[1/3:g; 2/3:h], g), Arg_0: 0 {O(1)}
(0: f->[1/3:g; 2/3:h], h), Arg_0: 2/3*Arg_0 {O(n)}
(1: g->[1:i], i), Arg_0: 0 {O(1)}
(2: h->[1/2:j; 1/2:k], j), Arg_0: 1/2 {O(1)}
(2: h->[1/2:j; 1/2:k], k), Arg_0: 1/2 {O(1)}
(3: j->[1:l], l), Arg_0: 1/2 {O(1)}
(4: k->[1:m], m), Arg_0: 1/2 {O(1)}