Inferring Expected Runtimes Using Sizes


KoAT2 Proof WORST_CASE( ?, 10*(1+Arg_0)+2+2*(1+Arg_0+Arg_1) {O(n)})

Initial Complexity Problem (after preprocessing)

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

G f f g g f->g t₀ ∈ g₀ {0} h h f->h t₆ ∈ g₅ p = 1/4 η (Arg_0) = Arg_0-1 τ = 0<Arg_0 {0} i i f->i t₇ ∈ g₅ p = 3/4 η (Arg_0) = Arg_0-1 τ = 0<Arg_0 {0} h->g t₃ ∈ g₂ η (Arg_1) = Arg_1+1 h->h t₈ ∈ g₆ p = 1/4 η (Arg_0) = Arg_0-1 η (Arg_1) = 1+Arg_1 τ = 0<Arg_0 h->i t₉ ∈ g₆ p = 3/4 η (Arg_0) = Arg_0-1 η (Arg_1) = 1+Arg_1 τ = 0<Arg_0 i->g t₅ ∈ g₄ τ = Arg_1<1 i->h t₁₀ ∈ g₇ p = 1/4 η (Arg_0) = Arg_0-1 τ = Arg_1<1 && 0<Arg_0 i->i t₄ ∈ g₃ η (Arg_1) = Arg_1-1 τ = 0<Arg_1 i->i t₁₁ ∈ g₇ p = 3/4 η (Arg_0) = Arg_0-1 τ = Arg_1<1 && 0<Arg_0

Timebounds:

Overall timebound:2*max([(-1)+Arg_0+Arg_1, 0])+2*max([0, 2*((-1)+Arg_0)])+5+6*max([(-1)+Arg_0, 0]) {O(n)}
0,0: f->g: 1 {O(1)}
6,5: f->h: 1 {O(1)}
7,5: f->i: 1 {O(1)}
3,2: h->g: 1 {O(1)}
8,6: h->h: 2*max([(-1)+Arg_0, 0]) {O(n)}
9,6: h->i: 2*max([0, 2*((-1)+Arg_0)]) {O(n)}
4,3: i->i: 2*max([(-1)+Arg_0+Arg_1, 0]) {O(n)}
5,4: i->g: 1 {O(1)}
10,7: i->h: 2*max([(-1)+Arg_0, 0]) {O(n)}
11,7: i->i: 2*max([(-1)+Arg_0, 0]) {O(n)}

Expected Timebounds:

Overall expected timebound: 10*(1+Arg_0)+4+2*(1+Arg_0+Arg_1) {O(n)}
0: f->[1:g]: 1 {O(1)}
2: h->[1:g]: 1 {O(1)}
3: i->[1:i]: 2*(1+Arg_0+Arg_1) {O(n)}
4: i->[1:g]: 1 {O(1)}
5: f->[1/4:h; 3/4:i]: 1 {O(1)}
6: h->[1/4:h; 3/4:i]: 6*(1+Arg_0) {O(n)}
7: i->[1/4:h; 3/4:i]: 4*(1+Arg_0) {O(n)}

Costbounds:

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

Expected Costbounds:

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