Initial Problem
Start: l0
Program_Vars: X₀, X₁, X₂, X₃
Temp_Vars:
Locations: l0, l1, l2
Transitions:
t₀: l0(X₀, X₁, X₂, X₃) → l1(0, X₁, X₂, X₃)
t₁: l1(X₀, X₁, X₂, X₃) → l2(X₀, X₁, 0, 0) :|: 1 ≤ X₁
t₃: l2(X₀, X₁, X₂, X₃) → l1(X₀+X₃, X₁-1, X₂, X₃) :|: X₁ ≤ X₂
t₂: l2(X₀, X₁, X₂, X₃) → l2(X₀, X₁, X₂+1, X₃+X₂) :|: X₂+1 ≤ X₁
Preprocessing
Eliminate variables {X₀,X₃} that do not contribute to the problem
Found invariant X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ 1 ≤ X₁+X₂ ∧ 1 ≤ X₁ for location l2
Problem after Preprocessing
Start: l0
Program_Vars: X₁, X₂
Temp_Vars:
Locations: l0, l1, l2
Transitions:
t₉: l0(X₁, X₂) → l1(X₁, X₂)
t₁₀: l1(X₁, X₂) → l2(X₁, 0) :|: 1 ≤ X₁
t₁₂: l2(X₁, X₂) → l1(X₁-1, X₂) :|: X₁ ≤ X₂ ∧ X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ 1 ≤ X₁+X₂ ∧ 1 ≤ X₁
t₁₁: l2(X₁, X₂) → l2(X₁, X₂+1) :|: X₂+1 ≤ X₁ ∧ X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ 1 ≤ X₁+X₂ ∧ 1 ≤ X₁
MPRF for transition t₁₀: l1(X₁, X₂) → l2(X₁, 0) :|: 1 ≤ X₁ of depth 1:
new bound:
X₁ {O(n)}
MPRF:
l2 [X₁-1 ]
l1 [X₁ ]
MPRF for transition t₁₂: l2(X₁, X₂) → l1(X₁-1, X₂) :|: X₁ ≤ X₂ ∧ X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ 1 ≤ X₁+X₂ ∧ 1 ≤ X₁ of depth 1:
new bound:
X₁ {O(n)}
MPRF:
l2 [X₁ ]
l1 [X₁ ]
MPRF for transition t₁₁: l2(X₁, X₂) → l2(X₁, X₂+1) :|: X₂+1 ≤ X₁ ∧ X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ 1 ≤ X₁+X₂ ∧ 1 ≤ X₁ of depth 1:
new bound:
X₁⋅X₁+2⋅X₁+1 {O(n^2)}
MPRF:
l1 [X₁+1 ]
l2 [X₁+1-X₂ ]
Analysing control-flow refined program
Cut unsatisfiable transition t₁₂: l2→l1
Found invariant X₂ ≤ 0 ∧ 1+X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ 1 ≤ X₁+X₂ ∧ 1 ≤ X₁ for location l2
Found invariant X₂ ≤ X₁ ∧ 1 ≤ X₂ ∧ 2 ≤ X₁+X₂ ∧ 1 ≤ X₁ for location n_l2___1
knowledge_propagation leads to new time bound X₁ {O(n)} for transition t₃₃: l2(X₁, X₂) → n_l2___1(X₁, X₂+1) :|: 1+X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ X₂ ≤ 0 ∧ 0 ≤ X₂ ∧ 1 ≤ X₁ ∧ 0 ≤ X₂ ∧ 1+X₂ ≤ X₁ ∧ 1+X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ X₂ ≤ 0 ∧ 1+X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ 1 ≤ X₁+X₂ ∧ 1 ≤ X₁
MPRF for transition t₃₂: n_l2___1(X₁, X₂) → n_l2___1(X₁, X₂+1) :|: 0 ≤ X₂ ∧ 1 ≤ X₂ ∧ X₂ ≤ X₁ ∧ 1+X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ X₂ ≤ X₁ ∧ 1 ≤ X₂ ∧ 2 ≤ X₁+X₂ ∧ 1 ≤ X₁ of depth 1:
new bound:
X₁⋅X₁+2⋅X₁ {O(n^2)}
MPRF:
l2 [0 ]
n_l2___1 [X₁+1-X₂ ]
l1 [0 ]
MPRF for transition t₃₆: n_l2___1(X₁, X₂) → l1(X₁-1, X₂) :|: X₁ ≤ X₂ ∧ X₂ ≤ X₁ ∧ 0 ≤ X₂ ∧ 1 ≤ X₁+X₂ ∧ 1 ≤ X₁ ∧ X₂ ≤ X₁ ∧ 1 ≤ X₂ ∧ 2 ≤ X₁+X₂ ∧ 1 ≤ X₁ of depth 1:
new bound:
X₁ {O(n)}
MPRF:
l2 [X₁ ]
n_l2___1 [X₁ ]
l1 [X₁ ]
CFR did not improve the program. Rolling back
All Bounds
Timebounds
Overall timebound:X₁⋅X₁+4⋅X₁+2 {O(n^2)}
t₉: 1 {O(1)}
t₁₀: X₁ {O(n)}
t₁₁: X₁⋅X₁+2⋅X₁+1 {O(n^2)}
t₁₂: X₁ {O(n)}
Costbounds
Overall costbound: X₁⋅X₁+4⋅X₁+2 {O(n^2)}
t₉: 1 {O(1)}
t₁₀: X₁ {O(n)}
t₁₁: X₁⋅X₁+2⋅X₁+1 {O(n^2)}
t₁₂: X₁ {O(n)}
Sizebounds
t₉, X₁: X₁ {O(n)}
t₉, X₂: X₂ {O(n)}
t₁₀, X₁: X₁ {O(n)}
t₁₀, X₂: 0 {O(1)}
t₁₁, X₁: X₁ {O(n)}
t₁₁, X₂: X₁⋅X₁+2⋅X₁+1 {O(n^2)}
t₁₂, X₁: X₁ {O(n)}
t₁₂, X₂: X₁⋅X₁+2⋅X₁+1 {O(n^2)}