Professional Documents
Culture Documents
Autumn 2021
1/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Outline
Introduction
Preliminaries
Formal Model
Petri Nets
Model Checking
2/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Asynchronous Programming
3/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Some Terminology
4/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Verification
5/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
The Strategy
• The decidability of safety and liveness for synchronous
programs is well known
• The first instinct is to reduce asynchronous programs to
synchronous programs.
Formal Languages
• An alphabet Σ is a finite non-empty collection of symbols. A
word is a sequence of symbols. Σ∗ denotes the set of finite
words, Σω denotes the set of infinite words.
Some Facts
X × (X 2 ∪ Σ ∪ {ε})
8/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Multisets
• A multiset m over an alphabet Σ maps each symbol of Σ to a
natural number. M[Σ] denotes the set of all multisets over Σ.
Handler Code
11/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
The Grammar
12/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Remark
The handler is dispatched atomically, and we don’t care what order
the new handlers are posted in.
13/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
14/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Definition (Fairness)
A run is called fair if finitely many instances of handler σ being
posted implies that there are infinitely many configurations where
there is no pending instance of σ
• (Fair) Non-Termination: Does the program have any (fair)
infinite runs?
• Fair Starvation: Is there a fair infinite run γ0 γ1 . . . γi . . . , a
handler σ and and index J, such that for each j ≥ J,
σ
γj .m(σ) ≥ 1 and if γj =
⇒ γj+1 then γj .m(σ) ≥ 2?
Remark
Fair starvation means that a run could be fair, but a specific
handler instance awaits execution forever. This property is not
desirable.
15/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Semantics
• A Petri Net (PN) N is a triple (S, T , F ) where
• S is a finite non-empty set of places
• T is a finite non-empty set of transitions, and disjoint from S
• F is a pair of functions ⟨I , O⟩, which are maps from T to M[S]
• A marking m ∈ M[S] maps each place p to a non-negative
integer m(p), called the number of tokens at p.
• If I (t) ⪯ m, m[t⟩. The enabled transition can fire, yielding a
new marking m′ such that
m′ ⊕ I (t) = m ⊕ O(t)
We say m[t⟩m′
• Enabledness and firing are inductively extended to sequences
of transitions.
16/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Analogous Problems
17/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
18/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Stitching Widgets
• The places SP = D ∪ Σ ∪ ♣
S
c∈C Sc
19/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
20/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Lemma
Let k = |X |. Then Parikh(L(G )) = Parikh(Lk+1 (G ))
21/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
The Construction
• Given c = (di , σ, df ), we consider derivations of bounded index
k + 1, where k = |X |. To this end, in addition to the symbols
in X and σ we use as places, we introduce a “cost place” $c
• Invariant: As the widget simulates the derivation, the total
number of tokens in X ∪ $c is exactly k + 1.
• Sc♣ = X ∪ Σ ∪ {beginc , endc , $c }
• Tc♣ = P ∪ {ti , te }
• Fc♣ is such that
• Fc♣ (ti ) = ⟨Jbeginc K, J[di λ1σ df ], $kc K⟩
• Fc♣ (X → Y · Z ) = ⟨JX , $c K, JY , Z K⟩
22/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Lemma
Let P be an asynchronous program, and let NP be the PN as
constructed in the previous section. We have
• NP can be constructed from P in polynomial time.
• P is bounded iff NP is bounded.
• (d, m) is reachable in P iff JdK ⊕ m is reachable in NP
23/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Theorem
• The global state reachability and boundedness problems for
asynchronous programs are EXPSPACE-complete.
24/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Theorem
• Determining the existence of an infinite run of an
asynchronous program is EXPSPACE-complete.
26/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Fair Starvation
27/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
Modified Construction
• The places SP = D ∪ Σ ∪ {pf , p∞ } ∪ ♣
S
c∈C Sc
• The transitions TP =
{t f /∞ } ∪ {tcin }c∈C\Cσ ∪ {tcin.f , tcin.∞ }c∈Cσ ∪ c∈C {tcout } ∪ Tc♣
S
Our references
29/30
Introduction Preliminaries Formal Model Petri Nets Model Checking
30/30