Preprocessing

Found invariant X₁ ≤ X₂ ∧ 0 ≤ X₀ for location l

Probabilistic Analysis

Probabilistic Program after Preprocessing

Start: f
Program_Vars: X₀, X₁, X₂
Temp_Vars:
Locations: f, g, l
Transitions:
g₀:f(X₀,X₁,X₂) → t₁:g(X₀,X₁,X₂) :|:
g₂:g(X₀,X₁,X₂) → [1/2]:t₃:l(X₀,X₁,X₁) :+: [1/2]:t₄:l(X₀-1,X₁,X₁) :|: 1 ≤ X₀
g₅:l(X₀,X₁,X₂) → t₆:l(X₀,X₁-1,X₂) :|: 1+X₀ ≤ X₁ ∧ 0 ≤ X₀ ∧ X₁ ≤ X₂
g₇:l(X₀,X₁,X₂) → t₈:g(X₀,X₂,X₂) :|: X₁ ≤ X₀ ∧ 0 ≤ X₀ ∧ X₁ ≤ X₂

Run classical analysis on SCC: [f]

Classical Approximation after Lifting Classical Results

All Bounds
Timebounds

Overall timebound:inf {Infinity}
g₀: 1 {O(1)}
g₂: inf {Infinity}
g₅: inf {Infinity}
g₇: inf {Infinity}

Costbounds

Overall costbound: inf {Infinity}
g₀: inf {Infinity}
g₂: inf {Infinity}
g₅: inf {Infinity}
g₇: inf {Infinity}

Sizebounds

(g₀,g), X₀: X₀ {O(n)}
(g₀,g), X₁: X₁ {O(n)}
(g₀,g), X₂: X₂ {O(n)}

Run probabilistic analysis on SCC: [f]

Run classical analysis on SCC: [g; l]

MPRF for transition t₄: g(X₀,X₁,X₂) → l(X₀-1,X₁,X₁) :|: 1 ≤ X₀ of depth 1:

new bound:

X₀ {O(n)}

MPRF:

• g: [X₀]
• l: [X₀]

Classical Approximation after Lifting Classical Results

All Bounds
Timebounds

Overall timebound:inf {Infinity}
g₀: 1 {O(1)}
g₂: inf {Infinity}
g₅: inf {Infinity}
g₇: inf {Infinity}

Costbounds

Overall costbound: inf {Infinity}
g₀: inf {Infinity}
g₂: inf {Infinity}
g₅: inf {Infinity}
g₇: inf {Infinity}

Sizebounds

(g₀,g), X₀: X₀ {O(n)}
(g₀,g), X₁: X₁ {O(n)}
(g₀,g), X₂: X₂ {O(n)}
(g₂,l), X₀: 2⋅X₀ {O(n)}
(g₂,l), X₁: 4⋅X₁ {O(n)}
(g₂,l), X₂: 2⋅X₁ {O(n)}
(g₅,l), X₀: X₀ {O(n)}
(g₅,l), X₁: 4⋅X₁ {O(n)}
(g₅,l), X₂: X₁ {O(n)}
(g₇,g), X₀: X₀ {O(n)}
(g₇,g), X₁: X₁ {O(n)}
(g₇,g), X₂: 3⋅X₁ {O(n)}

Run probabilistic analysis on SCC: [g; l]

Plrf for transition g₂:g(X₀,X₁,X₂) → [1/2]:t₃:l(X₀,X₁,X₁) :+: [1/2]:t₄:l(X₀-1,X₁,X₁) :|: 1 ≤ X₀:

new bound:

2⋅X₀ {O(n)}

PLRF:

• g: 2⋅X₀
• l: 2⋅X₀

Use expected size bounds for entry point (g₀:f→[t₁:1:g],g)
Use classical time bound for entry point (g₀:f→[t₁:1:g],g)

Plrf for transition g₇:l(X₀,X₁,X₂) → t₈:g(X₀,X₂,X₂) :|: X₁ ≤ X₀ ∧ 0 ≤ X₀ ∧ X₁ ≤ X₂:

new bound:

2⋅X₀ {O(n)}

PLRF:

• g: 2⋅X₀
• l: 1+2⋅X₀

Use expected size bounds for entry point (g₀:f→[t₁:1:g],g)
Use classical time bound for entry point (g₀:f→[t₁:1:g],g)

Computed expected time bound for g₅:l→[t₆:1:l] with MPRF

Obtained bound 2⋅X₀⋅X₁+2⋅X₀+X₁+1 {O(n^2)}
MPRF for transition t₆: l(X₀,X₁,X₂) → l(X₀,X₁-1,X₂) :|: 0 ≤ X₀ ∧ X₁ ≤ X₂ ∧ 1+X₀ ≤ X₁ of depth 1:

new bound:

2⋅X₀⋅X₁+2⋅X₀+X₁+1 {O(n^2)}

MPRF:

• g: [1+X₁]
• l: [1+X₁]

Use classical time bound for t₁∈g₀: f→1:g
Use expected size bounds for t₁∈g₀: f→1:g
Use expected time bound for t₈∈g₇: l→1:g
Use classical size bounds for t₈∈g₇: l→1:g

Results of Probabilistic Analysis

All Bounds

Timebounds

Overall timebound:2⋅X₀⋅X₁+6⋅X₀+X₁+2 {O(n^2)}
g₀: 1 {O(1)}
g₂: 2⋅X₀ {O(n)}
g₅: 2⋅X₀⋅X₁+2⋅X₀+X₁+1 {O(n^2)}
g₇: 2⋅X₀ {O(n)}

Costbounds

Overall costbound: 2⋅X₀⋅X₁+8⋅X₀+X₁+2 {O(n^2)}
g₀: 1 {O(1)}
g₂: 4⋅X₀ {O(n)}
g₅: 2⋅X₀⋅X₁+2⋅X₀+X₁+1 {O(n^2)}
g₇: 2⋅X₀ {O(n)}

Sizebounds

(g₀,g), X₀: X₀ {O(n)}
(g₀,g), X₁: X₁ {O(n)}
(g₀,g), X₂: X₂ {O(n)}
(g₂,l), X₀: X₀ {O(n)}
(g₂,l), X₁: 4⋅X₁ {O(n)}
(g₂,l), X₂: 2⋅X₁ {O(n)}
(g₅,l), X₀: X₀ {O(n)}
(g₅,l), X₁: 4⋅X₁ {O(n)}
(g₅,l), X₂: X₁ {O(n)}
(g₇,g), X₀: X₀ {O(n)}
(g₇,g), X₁: X₁ {O(n)}
(g₇,g), X₂: 3⋅X₁ {O(n)}