Preprocessing

Found invariant 1 ≤ X₂ ∧ 1 ≤ X₁+X₂ ∧ X₁ ≤ X₂ for location g

Probabilistic Analysis

Probabilistic Program after Preprocessing

Start: f
Program_Vars: X₀, X₁, X₂
Temp_Vars:
Locations: f, g
Transitions:
g₀:f(X₀,X₁,X₂) -{0}> t₁:g(X₀,X₁,X₂) :|: 1 ≤ X₁+X₂ ∧ X₁ ≤ 0 ∧ 0 ≤ X₂
g₂:g(X₀,X₁,X₂) → [1/2]:t₃:g(X₀-X₁,X₂,X₂) :+: [1/2]:t₄:g(X₀,X₁,X₂) :|: 1 ≤ X₀ ∧ 1 ≤ X₁+X₂ ∧ 1 ≤ 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}

Costbounds

Overall costbound: 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]

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

new bound:

X₀+X₁+X₂ {O(n)}

MPRF:

• g: [X₀+X₂-X₁]

Classical Approximation after Lifting Classical Results

All Bounds
Timebounds

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

Costbounds

Overall costbound: 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₂,g), X₀: 12⋅X₀⋅X₂+12⋅X₂⋅X₂+16⋅X₁⋅X₂+4⋅X₀⋅X₁+4⋅X₁⋅X₁+12⋅X₂+2⋅X₀+4⋅X₁ {O(n^2)}
(g₂,g), X₁: 6⋅X₂+X₁ {O(n)}
(g₂,g), X₂: 2⋅X₂ {O(n)}

Run probabilistic analysis on SCC: [g]

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

new bound:

2⋅X₀+2⋅X₁+4⋅X₂ {O(n)}

PLRF:

• g: 2⋅X₀+4⋅X₂-2⋅X₁

Use expected size bounds for entry point (g₀:f→[t₁:1:g],g)
Use expected size bounds for entry point (g₀:f→[t₁:1:g],g)
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)

Results of Probabilistic Analysis

All Bounds

Timebounds

Overall timebound:2⋅X₀+2⋅X₁+4⋅X₂+1 {O(n)}
g₀: 1 {O(1)}
g₂: 2⋅X₀+2⋅X₁+4⋅X₂ {O(n)}

Costbounds

Overall costbound: 4⋅X₀+4⋅X₁+8⋅X₂ {O(n)}
g₀: 0 {O(1)}
g₂: 4⋅X₀+4⋅X₁+8⋅X₂ {O(n)}

Sizebounds

(g₀,g), X₀: X₀ {O(n)}
(g₀,g), X₁: X₁ {O(n)}
(g₀,g), X₂: X₂ {O(n)}
(g₂,g), X₀: 10⋅X₁⋅X₂+12⋅X₂⋅X₂+2⋅X₀⋅X₁+2⋅X₁⋅X₁+6⋅X₀⋅X₂+X₀ {O(n^2)}
(g₂,g), X₁: 6⋅X₂+X₁ {O(n)}
(g₂,g), X₂: X₂ {O(n)}