Preprocessing
Found invariant 1 ≤ X₀ for location h
Probabilistic Analysis
Probabilistic Program after Preprocessing
Start: f
Program_Vars: X₀
Temp_Vars: Y
Locations: f, g, h
Transitions:
g₀:f(X₀) → t₁:g(X₀) :|: 1 ≤ X₀
g₂:g(X₀) → [1/2]:t₃:g(X₀) :+: [1/4]:t₄:h(X₀) :+: [1/4]:t₅:h(1+X₀) :|: 1 ≤ X₀
g₆:h(X₀) → t₇:g(X₀-Y) :|: 1 ≤ Y ∧ 1 ≤ 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}
Costbounds
Overall costbound: inf {Infinity}
g₀: inf {Infinity}
g₂: inf {Infinity}
g₆: inf {Infinity}
Sizebounds
(g₀,g), X₀: X₀ {O(n)}
Run probabilistic analysis on SCC: [f]
Run classical analysis on SCC: [g; h]
MPRF for transition t₄: g(X₀) → h(X₀) :|: 1 ≤ X₀ of depth 1:
new bound:
X₀ {O(n)}
MPRF:
• g: [X₀]
• h: [X₀-1]
Classical Approximation after Lifting Classical Results
All Bounds
Timebounds
Overall timebound:inf {Infinity}
g₀: 1 {O(1)}
g₂: inf {Infinity}
g₆: inf {Infinity}
Costbounds
Overall costbound: inf {Infinity}
g₀: inf {Infinity}
g₂: inf {Infinity}
g₆: inf {Infinity}
Sizebounds
(g₀,g), X₀: X₀ {O(n)}
Run probabilistic analysis on SCC: [g; h]
Analysing control-flow refined program
Run classical analysis on SCC: [g; g_v1; h_v1; h_v2]
MPRF for transition t₉: g(X₀) → h_v1(X₀) :|: 1 ≤ X₀ of depth 1:
new bound:
X₀ {O(n)}
MPRF:
• g: [X₀]
• g_v1: [X₀]
• h_v1: [X₀-1]
• h_v2: [X₀-1]
MPRF for transition t₁₃: g_v1(X₀) → h_v1(X₀) :|: 1 ≤ X₀ of depth 1:
new bound:
X₀ {O(n)}
MPRF:
• g: [X₀]
• g_v1: [X₀]
• h_v1: [X₀-1]
• h_v2: [X₀-1]
MPRF for transition t₁₆: h_v1(X₀) → g(X₀-Y) :|: 1 ≤ X₀ ∧ 1 ≤ Y of depth 1:
new bound:
2⋅X₀ {O(n)}
MPRF:
• g: [2⋅X₀]
• g_v1: [2⋅X₀]
• h_v1: [2⋅X₀]
• h_v2: [2⋅X₀-2]
MPRF for transition t₁₉: g(X₀) → h_v1(X₀) :|: 1 ≤ X₀ of depth 1:
new bound:
X₀ {O(n)}
MPRF:
• g: [X₀]
• g_v1: [X₀]
• h_v1: [X₀-1]
• h_v2: [X₀-1]
Classical Approximation after Lifting Classical Results
All Bounds
Timebounds
Overall timebound:inf {Infinity}
g₀: 1 {O(1)}
g₁₁: inf {Infinity}
g₁₅: inf {Infinity}
g₁₇: 2⋅X₀ {O(n)}
g₂₁: inf {Infinity}
g₂₃: inf {Infinity}
Costbounds
Overall costbound: inf {Infinity}
g₀: inf {Infinity}
g₁₁: inf {Infinity}
g₁₅: inf {Infinity}
g₁₇: inf {Infinity}
g₂₁: inf {Infinity}
g₂₃: inf {Infinity}
Sizebounds
(g₀,g), X₀: X₀ {O(n)}
Run probabilistic analysis on SCC: [g; g_v1; h_v1; h_v2]
Plrf for transition g₁₁:g(X₀) → [1/2]:t₈:g_v1(X₀) :+: [1/4]:t₉:h_v1(X₀) :+: [1/4]:t₁₀:h_v2(1+X₀) :|: 1 ≤ X₀:
new bound:
4⋅X₀+2 {O(n)}
PLRF:
• g: 2
• g_v1: 1
• h_v1: 0
• h_v2: 2
Use classical time bound for entry point (g₀:f→[t₁:1:g],g)
Use classical time bound for entry point (g₁₇:h_v1→[t₁₆:1:g],g)
Plrf for transition g₁₅:g_v1(X₀) → [1/2]:t₁₂:g_v1(X₀) :+: [1/4]:t₁₃:h_v1(X₀) :+: [1/4]:t₁₄:h_v2(1+X₀) :|: 1 ≤ X₀:
new bound:
4⋅X₀+2 {O(n)}
PLRF:
• g: 2
• g_v1: 3
• h_v1: 0
• h_v2: 2
Use classical time bound for entry point (g₀:f→[t₁:1:g],g)
Use classical time bound for entry point (g₁₇:h_v1→[t₁₆:1:g],g)
Plrf for transition g₂₁:g(X₀) → [1/2]:t₁₈:g_v1(X₀) :+: [1/4]:t₁₉:h_v1(X₀) :+: [1/4]:t₂₀:h_v2(1+X₀) :|: 1 ≤ X₀:
new bound:
4⋅X₀+2 {O(n)}
PLRF:
• g: 2
• g_v1: 1
• h_v1: 0
• h_v2: 2
Use classical time bound for entry point (g₀:f→[t₁:1:g],g)
Use classical time bound for entry point (g₁₇:h_v1→[t₁₆:1:g],g)
Plrf for transition g₂₃:h_v2(X₀) → t₂₂:g(X₀-Y) :|: 1 ≤ Y ∧ 1 ≤ X₀ ∧ 2 ≤ X₀:
new bound:
2⋅X₀+1 {O(n)}
PLRF:
• g: 1
• g_v1: 1
• h_v1: 0
• h_v2: 2
Use classical time bound for entry point (g₀:f→[t₁:1:g],g)
Use classical time bound for entry point (g₁₇:h_v1→[t₁₆:1:g],g)
CFR: Improvement to new bound with the following program:
method: PartialEvaluationProbabilistic new bound:
O(n)
cfr-program:
Start: f
Program_Vars: X₀
Temp_Vars: Y
Locations: f, g, g_v1, h_v1, h_v2
Transitions:
g₀:f(X₀) → t₁:g(X₀) :|: 1 ≤ X₀
g₁₁:g(X₀) → [1/2]:t₈:g_v1(X₀) :+: [1/4]:t₉:h_v1(X₀) :+: [1/4]:t₁₀:h_v2(1+X₀) :|: 1 ≤ X₀
g₁₅:g_v1(X₀) → [1/2]:t₁₂:g_v1(X₀) :+: [1/4]:t₁₃:h_v1(X₀) :+: [1/4]:t₁₄:h_v2(1+X₀) :|: 1 ≤ X₀
g₁₇:h_v1(X₀) → t₁₆:g(X₀-Y) :|: 1 ≤ Y ∧ 1 ≤ X₀
g₂₁:g(X₀) → [1/2]:t₁₈:g_v1(X₀) :+: [1/4]:t₁₉:h_v1(X₀) :+: [1/4]:t₂₀:h_v2(1+X₀) :|: 1 ≤ X₀
g₂₃:h_v2(X₀) → t₂₂:g(X₀-Y) :|: 1 ≤ Y ∧ 1 ≤ X₀ ∧ 2 ≤ X₀
Results of Probabilistic Analysis
All Bounds
Timebounds
Overall timebound:16⋅X₀+8 {O(n)}
g₀: 1 {O(1)}
g₁₁: 4⋅X₀+2 {O(n)}
g₁₅: 4⋅X₀+2 {O(n)}
g₁₇: 2⋅X₀ {O(n)}
g₂₁: 4⋅X₀+2 {O(n)}
g₂₃: 2⋅X₀+1 {O(n)}
Costbounds
Overall costbound: 40⋅X₀+20 {O(n)}
g₀: 1 {O(1)}
g₁₁: 12⋅X₀+6 {O(n)}
g₁₅: 12⋅X₀+6 {O(n)}
g₁₇: 2⋅X₀ {O(n)}
g₂₁: 12⋅X₀+6 {O(n)}
g₂₃: 2⋅X₀+1 {O(n)}
Sizebounds
(g₀,g), X₀: X₀ {O(n)}