Inferring Expected Runtimes Using Sizes


KoAT2 Proof WORST_CASE( ?, 3*(Arg_0+Arg_1)+3/20*(3*(Arg_0+Arg_1)+Arg_1) {O(n)})

Initial Complexity Problem (after preprocessing)

Start:f
Program_Vars:Arg_0, Arg_1
Temp_Vars:
Locations:f, g, h
Transitions:
f(Arg_0,Arg_1) -{0}> g(Arg_0,Arg_1)
g(Arg_0,Arg_1) -{3}> g(Arg_0,Uniform (1, 3)) :|: 2+Arg_1<Arg_0
g(Arg_0,Arg_1) -{0}> h(Arg_0,Arg_1) :|: Arg_0<Arg_1+3
h(Arg_0,Arg_1) -> 2/3:h(Arg_0,Arg_1-10) :+: 1/3:h(Arg_0,Arg_1) :|: 9<Arg_1

G f f g g f->g t₀ ∈ g₀ {0} g->g t₁ ∈ g₁ η (Arg_1) = Uniform (1, 3) τ = 2+Arg_1<Arg_0 {3} h h g->h t₂ ∈ g₂ τ = Arg_0<Arg_1+3 {0} h->h t₃ ∈ g₃ p = 2/3 η (Arg_1) = Arg_1-10 τ = 9<Arg_1 h->h t₄ ∈ g₃ p = 1/3 τ = 9<Arg_1

Timebounds:

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

Expected Timebounds:

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

Costbounds:

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

Expected Costbounds:

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

Sizebounds:

0,0: f->g, Arg_0: Arg_0 {O(n)}
0,0: f->g, Arg_1: Arg_1 {O(n)}
1,1: g->g, Arg_0: Arg_0 {O(n)}
1,1: g->g, Arg_1: 3*max([-(Arg_1)+Arg_0, 0])+Arg_1 {O(n)}
2,2: g->h, Arg_0: Arg_0 {O(n)}
2,2: g->h, Arg_1: 3*max([-(Arg_1)+Arg_0, 0])+Arg_1 {O(n)}
3,3: h->h, Arg_0: Arg_0 {O(n)}
3,3: h->h, Arg_1: 3*max([-(Arg_1)+Arg_0, 0])+Arg_1 {O(n)}
4,3: h->h, Arg_0: Arg_0 {O(n)}
4,3: h->h, Arg_1: 3*max([-(Arg_1)+Arg_0, 0])+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)}
(1: g->[1:g], g), Arg_0: Arg_0 {O(n)}
(1: g->[1:g], g), Arg_1: 2*(Arg_0+Arg_1)+Arg_1 {O(n)}
(2: g->[1:h], h), Arg_0: Arg_0 {O(n)}
(2: g->[1:h], h), Arg_1: 3*(Arg_0+Arg_1)+Arg_1 {O(n)}
(3: h->[2/3:h; 1/3:h], h), Arg_0: Arg_0 {O(n)}
(3: h->[2/3:h; 1/3:h], h), Arg_1: 3*(Arg_0+Arg_1)+Arg_1 {O(n)}