Inferring Expected Runtimes Using Sizes


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

Initial Complexity Problem (after preprocessing)

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

G f f g g f->g t₀ ∈ g₀ {0} h h g->h t₁ ∈ g₁ p = 1/2 η (Arg_0) = 0 loopstop loopstop g->loopstop t₂ ∈ g₁ p = 1/2 η (Arg_0) = 1 h->g t₃ ∈ g₂ {2} j j loopstop->j t₄ ∈ g₃

Timebounds:

Overall timebound:inf {Infinity}
0,0: f->g: 1 {O(1)}
1,1: g->h: inf {Infinity}
2,1: g->loopstop: 1 {O(1)}
3,2: h->g: inf {Infinity}
4,3: loopstop->j: 1 {O(1)}

Expected Timebounds:

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

Costbounds:

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

Expected Costbounds:

Overall expected costbound: 5 {O(1)}
0: f->[1:g]: 0 {O(1)}
1: g->[1/2:h; 1/2:loopstop]: 2 {O(1)}
2: h->[1:g]: 2 {O(1)}
3: loopstop->[1:j]: 1 {O(1)}

Sizebounds:

0,0: f->g, Arg_0: Arg_0 {O(n)}
1,1: g->h, Arg_0: 0 {O(1)}
2,1: g->loopstop, Arg_0: 1 {O(1)}
3,2: h->g, Arg_0: 0 {O(1)}
4,3: loopstop->j, Arg_0: 1 {O(1)}

ExpSizeBounds:

(0: f->[1:g], g), Arg_0: Arg_0 {O(n)}
(1: g->[1/2:h; 1/2:loopstop], h), Arg_0: 0 {O(1)}
(1: g->[1/2:h; 1/2:loopstop], loopstop), Arg_0: 1/2 {O(1)}
(2: h->[1:g], g), Arg_0: 0 {O(1)}
(3: loopstop->[1:j], j), Arg_0: 1/2 {O(1)}