# Inferring Expected Runtimes Using Sizes

KoAT2 Proof MAYBE

### Initial Complexity Problem (after preprocessing)

Start:f
Program_Vars:Arg_0, Arg_1, Arg_2
Temp_Vars:
Locations:f, g, l
Transitions:
f(Arg_0,Arg_1,Arg_2) -> g(Arg_0,Arg_1,Arg_2)
g(Arg_0,Arg_1,Arg_2) -> 1/2:l(Arg_0,Arg_1,Arg_1) :+: 1/2:l(Arg_0-1,Arg_1,Arg_1) :|: 0<Arg_0
l(Arg_0,Arg_1,Arg_2) -> l(Arg_0,Arg_1-1,Arg_2) :|: Arg_0<Arg_1 && Arg_1<=Arg_2 && 0<=Arg_0
l(Arg_0,Arg_1,Arg_2) -> g(Arg_0,Arg_2,Arg_2) :|: Arg_1<Arg_0+1 && Arg_1<=Arg_2 && 0<=Arg_0

### Timebounds:

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

### Expected Timebounds:

Overall expected timebound: inf {Infinity}
0: f->[1:g]: 1 {O(1)}
1: g->[1/2:l; 1/2:l]: 2*Arg_0 {O(n)}
2: l->[1:l]: inf {Infinity}
3: l->[1:g]: 2*Arg_0 {O(n)}

### Costbounds:

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

### Expected Costbounds:

Overall expected costbound: inf {Infinity}
0: f->[1:g]: 1 {O(1)}
1: g->[1/2:l; 1/2:l]: 2*Arg_0 {O(n)}
2: l->[1:l]: inf {Infinity}
3: l->[1:g]: 2*Arg_0 {O(n)}

### 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->l, Arg_0: Arg_0 {O(n)}
1,1: g->l, Arg_1: Arg_1 {O(n)}
1,1: g->l, Arg_2: Arg_1 {O(n)}
2,1: g->l, Arg_0: Arg_0 {O(n)}
2,1: g->l, Arg_1: Arg_1 {O(n)}
2,1: g->l, Arg_2: Arg_1 {O(n)}
3,2: l->l, Arg_0: Arg_0 {O(n)}
3,2: l->l, Arg_1: Arg_1 {O(n)}
3,2: l->l, Arg_2: Arg_1 {O(n)}
4,3: l->g, Arg_0: Arg_0 {O(n)}
4,3: l->g, Arg_1: Arg_1 {O(n)}
4,3: l->g, Arg_2: Arg_1 {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/2:l; 1/2:l], l), Arg_0: Arg_0 {O(n)}
(1: g->[1/2:l; 1/2:l], l), Arg_1: Arg_1 {O(n)}
(1: g->[1/2:l; 1/2:l], l), Arg_2: max([1, Arg_1]) {O(n)}
(2: l->[1:l], l), Arg_0: Arg_0 {O(n)}
(2: l->[1:l], l), Arg_1: Arg_1 {O(n)}
(2: l->[1:l], l), Arg_2: Arg_1 {O(n)}
(3: l->[1:g], g), Arg_0: Arg_0 {O(n)}
(3: l->[1:g], g), Arg_1: max([1, Arg_1]) {O(n)}
(3: l->[1:g], g), Arg_2: Arg_1 {O(n)}