# Inferring Expected Runtimes Using Sizes

KoAT2 Proof MAYBE

### Initial Complexity Problem (after preprocessing)

Start:f
Program_Vars:Arg_0, Arg_1, Arg_2, Arg_3
Temp_Vars:
Locations:f, g, h, i, j
Transitions:
f(Arg_0,Arg_1,Arg_2,Arg_3) -> g(Arg_0,Arg_1,Arg_2,0) :|: 0<=Arg_0
h(Arg_0,Arg_1,Arg_2,Arg_3) -> 1/6:i(Arg_0,Arg_1,-2,Arg_3) :+: 1/6:i(Arg_0,Arg_1,-1,Arg_3) :+: 1/6:i(Arg_0,Arg_1,0,Arg_3) :+: 1/6:i(Arg_0,Arg_1,1,Arg_3) :+: 1/6:i(Arg_0,Arg_1,2,Arg_3) :+: 1/6:i(Arg_0,Arg_1,3,Arg_3) :|: Arg_3<=0 && Arg_3<=Arg_1 && Arg_3<=Arg_0 && 0<=Arg_3 && 0<=Arg_1+Arg_3 && 0<=Arg_0+Arg_3 && 0<=Arg_1 && 0<=Arg_0+Arg_1 && Arg_0<=Arg_1 && 0<=Arg_0 && Arg_3<=0 && Arg_3<=Arg_1 && Arg_3<=Arg_0 && 0<=Arg_3 && 0<=Arg_1+Arg_3 && 0<=Arg_0+Arg_3 && 0<=Arg_1 && 0<=Arg_0+Arg_1 && Arg_0<=Arg_1 && 0<=Arg_0
i(Arg_0,Arg_1,Arg_2,Arg_3) -> i(Arg_0,Arg_1,Arg_2-1,Arg_3+Arg_1) :|: 0<Arg_2 && 0<=Arg_3 && 0<=2+Arg_2+Arg_3 && Arg_2<=3+Arg_3 && 0<=Arg_1+Arg_3 && 0<=Arg_0+Arg_3 && Arg_2<=3 && Arg_2<=3+Arg_1 && Arg_2<=3+Arg_0 && 0<=2+Arg_2 && 0<=2+Arg_1+Arg_2 && 0<=2+Arg_0+Arg_2 && 0<=Arg_1 && 0<=Arg_0+Arg_1 && Arg_0<=Arg_1 && 0<=Arg_0 && 0<=Arg_3 && 0<=2+Arg_2+Arg_3 && Arg_2<=3+Arg_3 && 0<=Arg_1+Arg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4:h(Arg_0,Arg_1-1,Arg_2,0) :|: 0<=Arg_0 && Arg_0<Arg_1 && 0<=0 && 0<=Arg_0 && 0<=0 && 0<=Arg_0 && 0<=Arg_0

### Timebounds:

Overall timebound:inf {Infinity}
0,0: f->g: 1 {O(1)}
13,7: f->h: 1 {O(1)}
14,7: f->h: 1 {O(1)}
3,2: h->i: 1 {O(1)}
4,2: h->i: 1 {O(1)}
5,2: h->i: 1 {O(1)}
6,2: h->i: 1 {O(1)}
7,2: h->i: 1 {O(1)}
8,2: h->i: 1 {O(1)}
9,3: i->i: 12 {O(1)}
10,4: i->j: 1 {O(1)}
11,5: j->j: inf {Infinity}

### Expected Timebounds:

Overall expected timebound: inf {Infinity}
0: f->[1:g]: 1 {O(1)}
2: h->[1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i]: 1 {O(1)}
3: i->[1:i]: 12 {O(1)}
4: i->[1:j]: 1 {O(1)}
5: j->[1:j]: inf {Infinity}
7: f->[1/4:h; 3/4:h]: 1 {O(1)}

### Costbounds:

Overall costbound: inf {Infinity}
0,0: f->g: inf {Infinity}
13,7: f->h: inf {Infinity}
14,7: f->h: inf {Infinity}
3,2: h->i: inf {Infinity}
4,2: h->i: inf {Infinity}
5,2: h->i: inf {Infinity}
6,2: h->i: inf {Infinity}
7,2: h->i: inf {Infinity}
8,2: h->i: inf {Infinity}
9,3: i->i: inf {Infinity}
10,4: i->j: inf {Infinity}
11,5: j->j: inf {Infinity}

### Expected Costbounds:

Overall expected costbound: inf {Infinity}
0: f->[1:g]: 1 {O(1)}
2: h->[1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i]: 1 {O(1)}
3: i->[1:i]: 12 {O(1)}
4: i->[1:j]: 1 {O(1)}
5: j->[1:j]: inf {Infinity}
7: f->[1/4:h; 3/4:h]: 2 {O(1)}

### 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)}
0,0: f->g, Arg_3: 0 {O(1)}
13,7: f->h, Arg_0: Arg_0 {O(n)}
13,7: f->h, Arg_1: 2*Arg_1 {O(n)}
13,7: f->h, Arg_2: Arg_2 {O(n)}
13,7: f->h, Arg_3: 0 {O(1)}
14,7: f->h, Arg_0: Arg_0 {O(n)}
14,7: f->h, Arg_1: Arg_1 {O(n)}
14,7: f->h, Arg_2: Arg_2 {O(n)}
14,7: f->h, Arg_3: 0 {O(1)}
3,2: h->i, Arg_0: Arg_0 {O(n)}
3,2: h->i, Arg_1: 2*Arg_1 {O(n)}
3,2: h->i, Arg_2: (-2) {O(1)}
3,2: h->i, Arg_3: 0 {O(1)}
4,2: h->i, Arg_0: Arg_0 {O(n)}
4,2: h->i, Arg_1: 2*Arg_1 {O(n)}
4,2: h->i, Arg_2: (-1) {O(1)}
4,2: h->i, Arg_3: 0 {O(1)}
5,2: h->i, Arg_0: Arg_0 {O(n)}
5,2: h->i, Arg_1: 2*Arg_1 {O(n)}
5,2: h->i, Arg_2: 0 {O(1)}
5,2: h->i, Arg_3: 0 {O(1)}
6,2: h->i, Arg_0: Arg_0 {O(n)}
6,2: h->i, Arg_1: 2*Arg_1 {O(n)}
6,2: h->i, Arg_2: 1 {O(1)}
6,2: h->i, Arg_3: 0 {O(1)}
7,2: h->i, Arg_0: Arg_0 {O(n)}
7,2: h->i, Arg_1: 2*Arg_1 {O(n)}
7,2: h->i, Arg_2: 2 {O(1)}
7,2: h->i, Arg_3: 0 {O(1)}
8,2: h->i, Arg_0: Arg_0 {O(n)}
8,2: h->i, Arg_1: 2*Arg_1 {O(n)}
8,2: h->i, Arg_2: 3 {O(1)}
8,2: h->i, Arg_3: 0 {O(1)}
9,3: i->i, Arg_0: Arg_0 {O(n)}
9,3: i->i, Arg_1: 2*Arg_1 {O(n)}
9,3: i->i, Arg_2: 2 {O(1)}
9,3: i->i, Arg_3: 13*max([0, 2*Arg_1]) {O(n)}
10,4: i->j, Arg_0: Arg_0 {O(n)}
10,4: i->j, Arg_1: 2*Arg_1 {O(n)}
10,4: i->j, Arg_2: (-1) {O(1)}
10,4: i->j, Arg_3: 13*max([0, 2*Arg_1]) {O(n)}
11,5: j->j, Arg_0: Arg_0 {O(n)}
11,5: j->j, Arg_1: 2*Arg_1 {O(n)}
11,5: j->j, Arg_2: (-2) {O(1)}
11,5: j->j, Arg_3: 13*max([0, 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)}
(0: f->[1:g], g), Arg_3: 0 {O(1)}
(2: h->[1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i], i), Arg_0: Arg_0 {O(n)}
(2: h->[1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i], i), Arg_1: 2*Arg_1 {O(n)}
(2: h->[1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i], i), Arg_2: 3 {O(1)}
(2: h->[1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i; 1/6:i], i), Arg_3: 0 {O(1)}
(3: i->[1:i], i), Arg_0: Arg_0 {O(n)}
(3: i->[1:i], i), Arg_1: 2*Arg_1 {O(n)}
(3: i->[1:i], i), Arg_2: 2 {O(1)}
(3: i->[1:i], i), Arg_3: 24*Arg_1 {O(n)}
(4: i->[1:j], j), Arg_0: Arg_0 {O(n)}
(4: i->[1:j], j), Arg_1: 4*Arg_1 {O(n)}
(4: i->[1:j], j), Arg_2: 3 {O(1)}
(4: i->[1:j], j), Arg_3: 24*Arg_1 {O(n)}
(5: j->[1:j], j), Arg_0: Arg_0 {O(n)}
(5: j->[1:j], j), Arg_1: 4*Arg_1 {O(n)}
(7: f->[1/4:h; 3/4:h], h), Arg_0: Arg_0 {O(n)}
(7: f->[1/4:h; 3/4:h], h), Arg_1: 2*Arg_1 {O(n)}
(7: f->[1/4:h; 3/4:h], h), Arg_2: Arg_2 {O(n)}
(7: f->[1/4:h; 3/4:h], h), Arg_3: 0 {O(1)}