Topic 2.3: Understanding FSP
COMP31212: Concurrency Topics 2.3: Understanding FSP Topic 2.3: - - PowerPoint PPT Presentation
COMP31212: Concurrency Topics 2.3: Understanding FSP Topic 2.3: - - PowerPoint PPT Presentation
Topic 2.3: Understanding FSP COMP31212: Concurrency Topics 2.3: Understanding FSP Topic 2.3: Understanding FSP Outline Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition
Topic 2.3: Understanding FSP
Outline
Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules
Topic 2.3: Understanding FSP
Outline
Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules
Topic 2.3: Understanding FSP
Transition Relation
- An FSP process can make a labelled transition into a new
FSP process.
- Each FSP process has a corresponding LTS
- FSP process transition determines state transition in LTS
- A transition path E
a1
→ E1
a2
→ · · · an → En . . . determines the nodes and edges traversed in the LTS for E. How to find LTS: define Transition Relation Rules for each FSP construct
Topic 2.3: Understanding FSP
Transition Rules
Transition Relation: σ ⊆ (Proc × Act × Proc) where
- Proc is the set of FSP process terms
- Act is the set of action labels, together with tau.
Topic 2.3: Understanding FSP
Transition Rules
Transition Relation: σ ⊆ (Proc × Act × Proc) where
- Proc is the set of FSP process terms
- Act is the set of action labels, together with tau.
General Format of Transition Rule: premisses
RuleName
transition Premisses may be transitions (built via transition rules) or other conditions Transition P
a
→ P′ means that (P, a, P′) ∈ σ
Topic 2.3: Understanding FSP
Outline
Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules
Topic 2.3: Understanding FSP
Prefix and Definition Rules
Prefix Action Rule:
Prefix (a->P)
a
→ P
Topic 2.3: Understanding FSP
Prefix and Definition Rules
Prefix Action Rule:
Prefix (a->P)
a
→ P
Definition Rule:
P
a
→ P′ Defn ProcId
a
→ P′ where (ProcId = P)
Topic 2.3: Understanding FSP
Prefix and Definition Rules
Prefix Action Rule:
Prefix (a->P)
a
→ P
Definition Rule:
P
a
→ P′ Defn ProcId
a
→ P′ where (ProcId = P)
e.g. SWITCH = (on -> (off -> STOP)).
Topic 2.3: Understanding FSP
Prefix and Definition Rules
Prefix Action Rule:
Prefix (a->P)
a
→ P
Definition Rule:
P
a
→ P′ Defn ProcId
a
→ P′ where (ProcId = P)
e.g. SWITCH = (on -> (off -> STOP)). ⋆ Calculate Transitions? ⋆
Topic 2.3: Understanding FSP
Outline
Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules
Topic 2.3: Understanding FSP
Choice Rule
for some i ∈ {1, . . . , n} Choice (a1->P1 | · · · | an->Pn)
ai
→ Pi
Topic 2.3: Understanding FSP
Choice Rule
for some i ∈ {1, . . . , n} Choice (a1->P1 | · · · | an->Pn)
ai
→ Pi
Example:
COIN = (toss->HEADS | toss->TAILS), HEADS = (heads->COIN), TAILS = (tails->COIN).
Transitions:
COIN
toss
→ HEADS
heads
→ COIN and COIN
toss
→ TAILS
tails
→ COIN
⋆ Calculate Transition Relation? ⋆
Topic 2.3: Understanding FSP
Outline
Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules
Topic 2.3: Understanding FSP
Parallel Rules I: Alphabets
- First. . . Alphabet: α(P) ⊆ L:
Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P)
Topic 2.3: Understanding FSP
Parallel Rules I: Alphabets
- First. . . Alphabet: α(P) ⊆ L:
Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn)
Topic 2.3: Understanding FSP
Parallel Rules I: Alphabets
- First. . . Alphabet: α(P) ⊆ L:
Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn)
Topic 2.3: Understanding FSP
Parallel Rules I: Alphabets
- First. . . Alphabet: α(P) ⊆ L:
Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn) Definition: α(ProcId) = α(P) where (ProcId = P)
Topic 2.3: Understanding FSP
Parallel Rules I: Alphabets
- First. . . Alphabet: α(P) ⊆ L:
Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn) Definition: α(ProcId) = α(P) where (ProcId = P) Extension: α(P + {a1, . . . , an}) = α(P) ∪ {a1, . . . , an}
Topic 2.3: Understanding FSP
Parallel Rules I: Alphabets
- First. . . Alphabet: α(P) ⊆ L:
Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn) Definition: α(ProcId) = α(P) where (ProcId = P) Extension: α(P + {a1, . . . , an}) = α(P) ∪ {a1, . . . , an} Hiding: α(P\{a1, . . . , an}) = α(P) − {a1, . . . , an}
Topic 2.3: Understanding FSP
Parallel Rules I: Alphabets
- First. . . Alphabet: α(P) ⊆ L:
Define α recursively. . . Prefix: α(a->P) = {a} ∪ α(P) Choice: α(P1| · · · |Pn) = α(P1) ∪ · · · ∪ α(Pn) Parallel: α(P1|| · · · ||Pn) = α(P1) ∪ · · · ∪ α(Pn) Definition: α(ProcId) = α(P) where (ProcId = P) Extension: α(P + {a1, . . . , an}) = α(P) ∪ {a1, . . . , an} Hiding: α(P\{a1, . . . , an}) = α(P) − {a1, . . . , an} Stop: α(STOP) = { }
Topic 2.3: Understanding FSP
Example
LAUGH = (laugh -> STOP). CONVERSE = (think -> TALK), TALK = (talk
- > STOP).
||LAUGH_CONVERSE = (LAUGH || CONVERSE).
Topic 2.3: Understanding FSP
Example
LAUGH = (laugh -> STOP). CONVERSE = (think -> TALK), TALK = (talk
- > STOP).
||LAUGH_CONVERSE = (LAUGH || CONVERSE). ⋆ Calculate alphabet: α(LAUGH CONVERSE)? ⋆
Topic 2.3: Understanding FSP
Parallel Rules II: Definition
P
a
→ P′ a ∈ α(Q)
Par1
(P||Q)
a
→ (P′||Q)
Topic 2.3: Understanding FSP
Parallel Rules II: Definition
P
a
→ P′ a ∈ α(Q)
Par1
(P||Q)
a
→ (P′||Q) Q
b
→ Q′ b ∈ α(P)
Par2
(P||Q) b → (P||Q′)
Topic 2.3: Understanding FSP
Parallel Rules II: Definition
P
a
→ P′ a ∈ α(Q)
Par1
(P||Q)
a
→ (P′||Q) Q
b
→ Q′ b ∈ α(P)
Par2
(P||Q) b → (P||Q′) P
a
→ P′ Q
a
→ Q′
Par3
(P||Q)
a
→ (P′||Q′)
Topic 2.3: Understanding FSP
An Example Transition Derivation
Consider the LAUGH CONVERSE process ...
Defn
LAUGH CONVERSE
Topic 2.3: Understanding FSP
An Example Transition Derivation
Consider the LAUGH CONVERSE process ...
Par1
(LAUGH || CONVERSE)
Defn
LAUGH CONVERSE
Topic 2.3: Understanding FSP
An Example Transition Derivation
Consider the LAUGH CONVERSE process ...
Defn
LAUGH
Par1
(LAUGH || CONVERSE)
Defn
LAUGH CONVERSE
Topic 2.3: Understanding FSP
An Example Transition Derivation
Consider the LAUGH CONVERSE process ...
Prefix
(laugh->STOP)
Defn
LAUGH
Par1
(LAUGH || CONVERSE)
Defn
LAUGH CONVERSE
Topic 2.3: Understanding FSP
An Example Transition Derivation
Consider the LAUGH CONVERSE process ...
Prefix
(laugh->STOP)
laugh
→ STOP
Defn
LAUGH
Par1
(LAUGH || CONVERSE)
Defn
LAUGH CONVERSE
Topic 2.3: Understanding FSP
An Example Transition Derivation
Consider the LAUGH CONVERSE process ...
Prefix
(laugh->STOP)
laugh
→ STOP
Defn
LAUGH
laugh
→ STOP
Par1
(LAUGH || CONVERSE)
Defn
LAUGH CONVERSE
Topic 2.3: Understanding FSP
An Example Transition Derivation
Consider the LAUGH CONVERSE process ...
Prefix
(laugh->STOP)
laugh
→ STOP
Defn
LAUGH
laugh
→ STOP
Par1
(LAUGH || CONVERSE)
laugh
→ (STOP||CONVERSE)
Defn
LAUGH CONVERSE
Topic 2.3: Understanding FSP
An Example Transition Derivation
Consider the LAUGH CONVERSE process ...
Prefix
(laugh->STOP)
laugh
→ STOP
Defn
LAUGH
laugh
→ STOP
Par1
(LAUGH || CONVERSE)
laugh
→ (STOP||CONVERSE)
Defn
LAUGH CONVERSE
laugh
→ (STOP||CONVERSE)
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
think
→ (STOP || TALK)
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
think
→ (STOP || TALK) talk → (STOP || STOP)
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
think
→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSE
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
think
→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
think
→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)
laugh
→ (STOP || TALK)
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
think
→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)
laugh
→ (STOP || TALK)talk → (STOP || STOP)
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
think
→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)
laugh
→ (STOP || TALK)talk → (STOP || STOP) (LAUGH || TALK)
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
think
→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)
laugh
→ (STOP || TALK)talk → (STOP || STOP) (LAUGH || TALK)talk → (LAUGH || STOP)
Topic 2.3: Understanding FSP
For you to consider ...
⋆ Derive the other transitions for LAUGH CONVERSE? ⋆ LAUGH CONVERSE
laugh
→ (STOP || CONVERSE)
think
→ (STOP || TALK) talk → (STOP || STOP) LAUGH CONVERSEthink → (LAUGH || TALK)
laugh
→ (STOP || TALK)talk → (STOP || STOP) (LAUGH || TALK)talk → (LAUGH || STOP)
laugh
→ (STOP || STOP)
Topic 2.3: Understanding FSP
Some diagrams ...
LAUGH
2 states ✒✑ ✓✏ ✒✑ ✓✏
1
laugh ◮ CONVERSE
3 states ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏
1 2
think ◮ talk ◮
Topic 2.3: Understanding FSP
Some diagrams ...
LAUGH
2 states ✒✑ ✓✏ ✒✑ ✓✏
1
laugh ◮ CONVERSE
3 states ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏
1 2
think ◮ talk ◮ CONVERSE LAUGH
2 × 3 states ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏ ✒✑ ✓✏
1 2 3 4 5
laugh ◮ laugh ◮ laugh ◮ think ◮ talk ◮ talk ◭ think ◭
Topic 2.3: Understanding FSP
The states of CONVERSE LAUGH
state 0: (LAUGH || CONVERSE) state 1: (LAUGH || TALK) state 2: (LAUGH || STOP) state 3: (STOP || STOP) state 4: (STOP || TALK) state 5: (STOP || CONVERSE)
Topic 2.3: Understanding FSP
Another Version
CONVERSE LAUGHv2 = (laugh->think->TALK | think->laugh->TALK | think->talk->laugh->STOP ), TALK = (talk->STOP) ⋆ Calculate transitions? ⋆
Topic 2.3: Understanding FSP
An example with interaction
MKR = (make->M), M = (rdy->MKR). USER = (rdy->U), U = (use->USER). || MKR USER = (MKR || USER). (MKR || USER) make → (M || USER)
rdy
→ (MKR || U) use → (MKR || USER) ⋆ Build Transitions? ⋆ ⋆ Transition Relation? ⋆
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER)
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER)
(M||USER)
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER)
M USER
Par3
(M||USER)
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER)
(rdy->MKR)
Defn
M USER
Par3
(M||USER)
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER) Prefix
(rdy->MKR)
rdy
→ MKR
Defn
M USER
Par3
(M||USER)
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER) Prefix
(rdy->MKR)
rdy
→ MKR
Defn
M
rdy
→ MKR USER
Par3
(M||USER)
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER) Prefix
(rdy->MKR)
rdy
→ MKR
Defn
M
rdy
→ MKR (rdy->U)
Defn
USER
Par3
(M||USER)
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER) Prefix
(rdy->MKR)
rdy
→ MKR
Defn
M
rdy
→ MKR
Prefix
(rdy->U)
rdy
→ U
Defn
USER
Par3
(M||USER)
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER) Prefix
(rdy->MKR)
rdy
→ MKR
Defn
M
rdy
→ MKR
Prefix
(rdy->U)
rdy
→ U
Defn
USER
rdy
→ U
Par3
(M||USER)
Topic 2.3: Understanding FSP
Example Transition Derivation for MKR
(calculate as before) Defn ||MAKER USER
make
→ (M||USER) Prefix
(rdy->MKR)
rdy
→ MKR
Defn
M
rdy
→ MKR
Prefix
(rdy->U)
rdy
→ U
Defn
USER
rdy
→ U
Par3
(M||USER)
rdy
→ (MKR||U)
Topic 2.3: Understanding FSP
Outline
Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules
Topic 2.3: Understanding FSP
Generating LTS
For FSP process P, what is its LTS?: LTSP = (S, A, σ, s0) where S : set of states S ⊆ Proc A : alphabet A ⊆ Act σ : transition relation σ ⊆ (S × A × S) s0 initial state s0 ∈ S
Topic 2.3: Understanding FSP
To find LTS for FSP process P:
- 1. calculate transition relation σ using Transition Rules:
σ = {(s1, a1, s′
1), . . . , (sn, an, s′ n)}
- 2. States: S =
n
- i=1
{si} ∪ {s′
i}
- 3. Starting state: s0 = P
- 4. Alphabet: A = α(P)
* Example of this construction – above *
Topic 2.3: Understanding FSP
Outline
Topic 2.3: Understanding FSP About Transition Systems Prefix & Definition Rules Choice Rule Parallel Composition Rules Generating an LTS Remaining rules
Topic 2.3: Understanding FSP
Remaining rules
Generalised Choice for some i ∈ {1, . . . , n} : bi = true Choice (when b1 a1->P1 | · · · | when bn an->Pn)
ai
→ Pi Process Labelling P
b
→ P′ ProcLabel1 a : P
a.b
→ a : P′ a ∈ A P
b
→ P′ ProcLabel2 A :: P
a.b
→ A :: P′ i ∈ {1, . . . , n} and P
bi
→ P′ ReLabel P/{a1/b1, . . . , an/bn}
ai
→ P′/{a1/b1, . . . , an/bn}
Topic 2.3: Understanding FSP
And some more ...
Hiding Rules P
b
→ P′ and b ∈ A
Hide1
P\A b → P′\A P
b
→ P′ and b ∈ A
Hide2
P\A tau → P′\A P
b
→ P′ and b ∈ A
Hide3
P@A b → P′@A P
b