# Inferring Expected Runtimes Using Sizes

KoAT2 Proof WORST_CASE( ?, 637/12 {O(1)})

### Initial Complexity Problem (after preprocessing)

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

### Timebounds:

Overall timebound:inf {Infinity}
0,0: f->g: 1 {O(1)}
1,1: g->g: 1 {O(1)}
2,2: g->g: inf {Infinity}
3,2: g->g: 6 {O(1)}
4,3: g->g: inf {Infinity}
5,3: g->g: 6 {O(1)}
6,4: g->g: inf {Infinity}
7,4: g->g: 6 {O(1)}
8,5: g->g: inf {Infinity}
9,5: g->g: 6 {O(1)}

### Expected Timebounds:

Overall expected timebound: 649/12 {O(1)}
0: f->[1:g]: 1 {O(1)}
1: g->[1:g]: 1 {O(1)}
2: g->[1/5:g; 4/5:g]: 25/4 {O(1)}
3: g->[2/5:g; 3/5:g]: 25/3 {O(1)}
4: g->[3/5:g; 2/5:g]: 25/2 {O(1)}
5: g->[4/5:g; 1/5:g]: 25 {O(1)}

### Costbounds:

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

### Expected Costbounds:

Overall expected costbound: 637/12 {O(1)}
0: f->[1:g]: 0 {O(1)}
1: g->[1:g]: 1 {O(1)}
2: g->[1/5:g; 4/5:g]: 25/4 {O(1)}
3: g->[2/5:g; 3/5:g]: 25/3 {O(1)}
4: g->[3/5:g; 2/5:g]: 25/2 {O(1)}
5: g->[4/5:g; 1/5:g]: 25 {O(1)}

### Sizebounds:

0,0: f->g, Arg_0: 0 {O(1)}
1,1: g->g, Arg_0: 1 {O(1)}
2,2: g->g, Arg_0: 1 {O(1)}
3,2: g->g, Arg_0: 2 {O(1)}
4,3: g->g, Arg_0: 2 {O(1)}
5,3: g->g, Arg_0: 3 {O(1)}
6,4: g->g, Arg_0: 3 {O(1)}
7,4: g->g, Arg_0: 4 {O(1)}
8,5: g->g, Arg_0: 4 {O(1)}
9,5: g->g, Arg_0: 5 {O(1)}

### ExpSizeBounds:

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