Process Algebra (2IF45)
Expressiveness of BPArec
Suzana Andova
2
Outline
• How far can we go with recursive specifications in BPArec(A)? How expressive is BPArec(A)?
• If it is not expressive as we want can we do better? How?
Process Algebra (2IF45)
3
Recursive specs vs. Transition systems
• Every recursive specification in BPArec(A) has a solution that can be represented as an LTS
• For this purpose we use the SOS rules
• Sometimes we understand the process behaviour better from its LTS representation
4
Recursive specs vs. Transition systems
• But sometimes a process LTS has infinitely many states or infinitely many transitions
a(i)i<10, b
i10, c
• Symbolic (graphical) representation of the specification but this is not an LTS
5
Recursive specs vs. Transition systems
• LTSs are very simple but expressible language
• They can be finite or infinite,
• with countable or uncountable number of states or number of transitions
• The language defined with a given process algebra and its corresponding SOS semantics can specify a subset of LTSs
• A simple example: BPA(A) cannot be used to specify LTSs with time
6
Recursive specs vs. Transition systems
Question: What sort LTSs are specifiable by recursive specifications in BPArec(A)?
7
Recursive specs vs. Transition systems
Question: What sort LTSs are specifiable by recursive specifications in BPArec(A)?
1. LTSs with finite number of states and finite number of transitions and no loops closed BPA(A) terms
2. Can we specify LTSs with countable number of states or countable number of transitions?
8
Recursive specs vs. Transition systems
2. Can we specify LTSs with countable number of states and countable number of transitions?
a aa a …l1: States x Act ↦ StatesStates = NatA = {a}l1(n,a) = n+1, n Nat
l2: States x Act ↦ StatesStates = [0,1]A = {a}l2(0,a) = r, r [0,1]
l3: States x Act ↦ StatesStates = {s}A = {a}l3(s,a) = s
a
3. Can we specify LTSs with uncountable number of states or uncountable number of transitions?
a
l2 is bisimilar to
9
Expressivity of BPArec(A)
Question: What sort LTSs are specifiable by recursive specifications in BPArec(A)?
2. Can we specify any LTSs with countable number of states and transitions? YES! 3. Can we specify any LTSs with uncountable number of states or transitions? NO!
Theorem: Up to bisimulation, only LTSs with countable number of states and transitions, and only those are specifiable in BPArec(A).
10
Expressivity of BPArec(A)
Example:
0
1 2
a3
aa a… n
…
a…
a
a
a
a
a
X = n1 a.a. … a.0
n
Is this a proper recursive specification in BPArec(A)? NO!
11
Expressivity of BPArec(A)
Example: S0 = a.S11 + S01
S01 = a.S21 + S02
S02 = a.S31 + S03
…
S11 = 0S21 = a.0S31 = a.a.0…
0
1 2
a3
aa a… n
…
a…
a
a
a
a
a
Is this a proper recursive specification in BPArec(A)?
12
Expressivity of BPArec(A)
Example: S0 = a.S11 + S01
S01 = a.S21 + S02
S02 = a.S31 + S03
…
S11 = 0S21 = a.0S31 = a.a.0…
0
1 2
a3
aa a… n
…
a…
a
a
a
a
a
Is this a proper recursive specification in BPArec(A)? YES!
This process is specifiable in BPArec(A)!
13
Expressivity of BPArec(A)
Example: S0 = a.S11 + S01
S01 = a.S21 + S02
S02 = a.S31 + S03
…
S11 = 0S21 = a.0S31 = a.a.0…
0
1 2
a3
aa a… n
…
a…
a
a
a
a
a
Is this a proper recursive specification in BPArec(A)? YES!
Observe: - It is an infinite rec. spec- It is an unguarded rec. spec
- Some states are bisimilarbut the root does not change
14
Expressivity of BPArec(A)
Example: S0 = a.S11 + S01
S01 = a.S21 + S02
S02 = a.S31 + S03
…
S11 = 0S21 = a.0S31 = a.a.0…
0
1 2
a3
aa a… n
…
a…
a
a
a
a
a
Is this a proper recursive specification in BPArec(A)? YES!
Can we do better? Can we do guarded specification for this process?Can we do better? Can we do finite specification for this process?
Observe: -It is an infinite rec. spec- It is an unguarded rec. spec
- Some states are bisimilar but the root does not change
15
Expressivity of BPArec(A)
Example: S0 = a.S11 + S01
S01 = a.S21 + S02
S02 = a.S31 + S03
…
S11 = 0S21 = a.0S31 = a.a.0…
0
1 2
a3
aa a… n
…
a…
a
a
a
a
a
Is this a proper recursive specification in BPArec(A)? YES!
Can we do better? Can we do guarded specification for this process? NO!Can we do better? Can we do finite specification for this process? NO!
Observe: -It is an infinite rec. spec- It is an unguarded rec. spec
- Some states are bisimilar but the root does not change
16
Expressivity of BPArec(A)
Question: What sort LTSs are specifiable by guarded recursive specifications in BPArec(A)?
Theorem: Up to bisimulation, only finitely branching processes/LTSs and only those are specifiable by a guarded recursive specification in BPArec(A).
17
Expressivity of BPArec(A): Definability
Question: What sort LTSs are specifiable by guarded recursive specifications in BPArec(A)?
Theorem: Up to bisimulation, only finitely branching processes/LTSs and only those are specifiable by a guarded recursive specification in BPArec(A).
definable
18
Expressivity of BPArec(A): Definability
Example: S0 = a.S11 + S01
S01 = a.S21 + S02
S02 = a.S31 + S03
…
S11 = 0S21 = a.0S31 = a.a.0…
0
1 2
a3
aa a… n
…
a…
a
a
a
a
a
Can we do better? Can we do guarded specification for this process? NO!Can we do better? Can we do finite specification for this process? NO!
Observe: -It is an infinite rec. spec- It is an unguarded rec. spec
- Some states are bisimilar but the root does not change- It is infinitely branching
This process is not definable in BPArec(A)!
19
Expressivity of BPArec(A):Stack example
Example: We consider a Stack with unlimited capacity Elements are taken from a finite set of data elements D = {d1, d2, …, dn} (n N) Elements from D can be added to or removed from the top of the stack.
20
Expressivity of BPArec(A):Stack example
Example: We consider a Stack with unlimited capacity Elements are taken from a finite set of data elements D = {d1, d2, …, dn} (n N) Elements from D can be added to or removed from the top of the stack.
Steps: 1. First, define the set of atomic actions.
A = { push(d) | d D } {pop(d) | d D }
2. How many recursive variables may be needed S denotes the situation when the stack is empty S denotes the state of the stack process when the content is D*
21
Expressivity of BPArec(A):Stack example
1. Atomic actions A = { push(d) | d D } {pop(d) | d D }
2. recursive variables S denotes the situation when the stack is empty S denotes the state of the stack process when the content is D*
S = dD push(d).Sd, for any d D
Sd = eD push(e).Sed + pop(d).S , for any d D
Sd = eD push(e).Sed + pop(d).S, for any d D and D*
22
Expressivity of BPArec(A):Stack example
For D = {0,1}S = d{0,1} push(d).Sd, for any d {0,1},
Sd = eD{0,1} push(e).Sed + pop(d).S, for any d {0,1, {0,1}*
S
0 1
11011000
pp(1)pp(0)
pp(0) pp(0)
pp(1)
pp(1)
ps(0) ps(0)
ps(0) ps(1)ps(1)ps(0)
… … … …
23
Expressivity of BPArec(A):Stack example
For D = {0,1}S = d{0,1} push(d).Sd, for any d {0,1},
Sd = eD{0,1} push(e).Sed + pop(d).S, for any d {0,1, {0,1}*
S
0 1
11011000
pp(1)pp(0)
pp(0) pp(0)
pp(1)
pp(1)
ps(0) ps(0)
ps(0) ps(1)ps(1)ps(0)
… … … …
Observe: -It is a nice guarded rec. spec
This process is definable, therefore it is finitely branching
24
Expressivity of BPArec(A):Stack example
For D = {0,1}S = d{0,1} push(d).Sd, for any d {0,1},
Sd = eD{0,1} push(e).Sed + pop(d).S, for any d {0,1, {0,1}*
S
0 1
11011000
pp(1)pp(0)
pp(0) pp(0)
pp(1)
pp(1)
ps(0) ps(0)
ps(0) ps(1)ps(1)ps(0)
… … … …
Observe: - It is finitely branching
There is a guarded spec defining this process
25
Expressivity of BPArec(A):Stack example
For D = {0,1}S = d{0,1} push(d).Sd, for any d {0,1},
Sd = eD{0,1} push(e).Sed + pop(d).S, for any d {0,1, {0,1}*
S
0 1
11011000
pp(1)pp(0)
pp(0) pp(0)
pp(1)
pp(1)
ps(0) ps(0)
ps(0) ps(1)ps(1)ps(0)
… … … …
Observe: - It is finitely branching
There is a guarded spec defining this process
Can we do better in BPArec(A)? Can we do finite spec?
26
Expressivity of BPArec(A):Stack example
For D = {0,1}S = d{0,1} push(d).Sd, for any d {0,1},
Sd = eD{0,1} push(e).Sed + pop(d).S, for any d {0,1, {0,1}*
S
0 1
11011000
pp(1)pp(0)
pp(0) pp(0)
pp(1)
pp(1)
ps(0) ps(0)
ps(0) ps(1)ps(1)ps(0)
… … … …
Observe: - It has infinitely many states- None of them are bisimilar- Cannot be turned into a finite LTS
Can we do better in BPArec(A)? Can we do finite spec?
27
Expressivity of BPArec(A):Finite definability
Question: What sort LTSs are specifiable by finite guarded recursive specifications in BPArec(A)?
Theorem: Up to bisimulation, only processes with finitely many states and finitely many transitions and only those are definable by finite
guarded recursive specifications in BPArec(A).
28
Expressivity of BPArec(A):Finite definability
Question: What sort LTSs are specifiable by finite guarded recursive specifications in BPArec(A)?
Theorem: Up to bisimulation, only processes with finitely many states and finitely many transitions and only those are definable by finite
guarded recursive specifications in BPArec(A).
regular processes
29
Expressivity of BPArec(A):Finite definability
Question: What sort LTSs are specifiable by finite guarded recursive specifications in BPArec(A)?
Theorem: Up to bisimulation, only processes with finitely many states and finitely many transitions and only those are definable by finite
guarded recursive specifications in BPArec(A).
regular processes
finitely definable
30
Expressivity of BPArec(A):Finite definability
For D = {0,1}S = d{0,1} push(d).Sd, for any d {0,1},
Sd = eD{0,1} push(e).Sed + pop(d).S, for any d {0,1, {0,1}*
S
0 1
11011000
pp(1)pp(0)
pp(0) pp(0)
pp(1)
pp(1)
ps(0) ps(0)
ps(0) ps(1)ps(1)ps(0)
… … … …
Observe: - It has infinitely many states- None of them are bisimilar- Cannot be turned into a finite LTS- This is not a regular process
Can we do better in BPArec(A)? NO! Can we do finite spec? NO!
There is no finite rec. spec. in BPArec(A) !
31
Expressivity of BPArec(A)
Question: What do we need to add to BPArec(A) just sufficient that this is possible?
32
Expressivity of BPArec(A)
Question: What do we need to add to BPArec(A) just sufficient that this is possible?
Very simple extension: (general) sequential composition!
33 Process Algebra (2IF45)
Theory of Sequential Processes TSP
34 Process Algebra (2IF45)
TSPrec(A) = BPArec(A) + sequential composition
Language: TSPrec(A)
Signature: 0, 1, (a._ )aA, +, •, X
Axioms of BPArec(A):
(A1) – (A4)(A5) (x+ y) z = x z+y z(A6) (x y) z = x (y z)
(A7) 0 x = 0(A8) x 1 = x(A9) 1 x = x
(A10) a.x y = a.(x y)
Deduction rules for TSPrec(A):
a.x x a y
(x + y) ⑥
35 Process Algebra (2IF45)
TSPrec(A) = BPArec(A) + sequential composition
Language: TSPrec(A)
Signature: 0, 1, (a._ )aA, +, •, X
Axioms of TSPrec(A):
(A1) – (A4)(A5) (x+ y) z = x z+y z(A6) (x y) z = x (y z)
(A7) 0 x = 0(A8) x 1 = x(A9) 1 x = x
(A10) a.x y = a.(x y)
Deduction rules for TSPrec(A):
a.x x . . .a y
(x + y) ⑥
Deduction rules for sequential composition
x x’ x y x’
a
a
x y (x y)
x y y’ x y y’
a
a
36 Process Algebra (2IF45)
TSPrec(A) = BPArec(A) + sequential composition
Language: TSPrec(A)
Signature: 0, 1, (a._ )aA, +, •, X
Axioms of TSPrec(A):
(A1) – (A4)(A5) (x+ y) z = x z+y z(A6) (x y) z = x (y z)
(A7) 0 x = 0(A8) x 1 = x(A9) 1 x = x
(A10) a.x y = a.(x y)
Deduction rules for TSPrec(A):
a.x x . . .a y
(x + y) ⑥
Deduction rules for sequential comosition
x x’ x y x’
a
a
x y (x y)
x y y’ x y y’
a
a
Bisimilarity of LTSs Equality of terms
37
TSPrec(A) process algebra
- Congruence of bisimulation with respect to all operators in TSPrec(A)
- Elimination result: BPA(A) are still basic terms
- Soundness of TSPrec(A) with respect to the SOS semantic (term model)
- Ground completeness: bisimilarity between closed terms is derivable in TSP(A)
38
Stack process in TSPrec(A)
Revise the Stack example: We consider a Stack with unlimited capacity Elements are taken from a finite set of data elements D = {d1, d2, …, dn} (n N) Elements from D can be added to or removed from the top of the stack.
39
Stack process in TSPrec(A)
Revision of the Stack example: We consider a Stack with unlimited capacity Elements are taken from a finite set of data elements D = {d1, d2, …, dn} (n N) Elements from D can be added to or removed from the top of the stack.
Stack2 = T
T = dD push(d). ( U pop(d).1)
40
Stack process in TSPrec(A)
Revision of the Stack example: We consider a Stack with unlimited capacity Elements are taken from a finite set of data elements D = {d1, d2, …, dn} (n N) Elements from D can be added to or removed from the top of the stack.
Stack2 = T
T = dD push(d). ( U pop(d).1)U = 1 + T U
41
Stack process in TSPrec(A)
Stack1 = S
S = dD push(d).Sd, for any d D
Sd = eD push(e).Sed + pop(d).S, for any d D and D*
Stack2 = T
T = dD push(d). ( U pop(d).1)U = 1 + T U
Is Stack1 = Stack2 ?
YES! Can be proved using RDP+RSP principles*.
*See the proof in the book
42
Expressivity of TSPrec(A)
- BSPrec(A) and TSPrec(A) in general are equally expressive!
- A process is definable in TSPrec(A) if and only if it is a solution of a guarded recursive spec. the same as in BPSrec(A)
- Nevertheless in TSPrec(A) infinitely branching processes can be specified by a finite (unguarded) recursive spec.
Example: X = X • (a.1) + a.1
43
Expressivity of TSPrec(A)
Example 2: Consider recursive specification in TSPrec(A)X = a. (Y • a.1) Y = a. (Y • Z) + a.1Z = a.1 + 1
Observe:- the specification is guarded - the process is finitely branching- but “the degree of branching” is unbounded
44
Expressivity of TSPrec(A)
Example 2: Consider recursive specification in TSPrec(A)X = a. (Y • a.1) Y = a. (Y • Z) + a.1Z = a.1 + 1
Observe:- the specification is guarded - the process is finitely branching- but “the degree of branching” is unbounded
Results: - In TSPrec(A) unbounded branching processes can be defined by a
finite guarded specification- This is not the case with BPArec(A)
45
What about the Bag process?
- Can we find any BPArec(A) or TSPrec(A) specification of the Bag process?
- Can we find any which is finite guarded specification?- Or do we need to extend TSP(A) with more operators?