### Lecture7webx

```Process Algebra (2IF45)
Recursion in Process Algebra
Suzana Andova
http://fusionanomaly.net/recursion.jpg
Equational theory: terms and LTSs
Language: BPA(A)
Signature: 0, 1, (a._ )aA, +, …
Language terms T(BPA(A))
Closed terms C(BPA(A)) Axioms of BPA(A):
Deduction rules for BPA(A):
a
a x
a.x 

x  x’
a x’ 
x+y
1 
y  y’

a
x + y  y’
coin.coffee.1
a
x
(x + y) 

y
(x + y) 
⑥
coin
coffee
1
Process Algebra (2IF45)
(A1) x+ y = y+x
(A2) (x+y) + z = x+ (y + z)
(A3) x + x = x
(A4) x+ 0 = x
Equational theory: terms and LTSs
Language: BPA(A)
Signature: 0, 1, (a._ )aA, +, …
Language terms T(BPA(A))
Closed terms C(BPA(A)) Axioms of BPA(A):
Deduction rules for BPA(A):
a
a x
a.x 

x  x’
a x’ 
x+y
1 
y  y’

a
x + y  y’
coin.coffee.1
a
x
(x + y) 

coin
coffee
coin.coffee.1 + coin.coffee.1
y
(x + y) 
⑥
coin
coffee
coin.coffee.1 =
coin.coffee.1 + coin.coffee.1
coin
coffee
Bisimilarity of LTSs
2
(A1) x+ y = y+x
(A2) (x+y) + z = x+ (y + z)
(A3) x + x = x
(A4) x+ 0 = x
Equality of terms
Process Algebra (2IF45)
Recursive processes
thinking
Socrates_thinks
getHungry
goThinking
Socrates_eats
eating
3
Process Algebra (2IF45)
Recursive processes
thinking
Socrates_thinks
getHungry
goThinking
Socrates_eats
eating
Socrates_thinks = getHungry.Socrates_eats
Socrates_eats = goThinking.Socrates_thinks
4
Process Algebra (2IF45)
Recursive specifications and LTSs
Language: BPA(A)
Signature: 0, 1, (a._ )aA, +, …
Language terms T(BPA(A))
Closed terms C(BPA(A))
Deduction rules for BPA(A):
a
a x
a.x 

x  x’
a x’ 
x+y
1 
y  y’

a
x + y  y’
a
x
(x + y) 

y
(x + y) 
Axioms of BPA(A):
(A1) x+ y = y+x
(A2) (x+y) + z = x+ (y + z)
(A3) x + x = x
(A4) x+ 0 = x
⑥
Socrates_thinks =
getHungry.Socrates_eats
getHungry
5
goThinking
Socrates_eats =
goThinking.Socrates_thinks
Process Algebra (2IF45)
Recursive specifications and LTSs
Language: BPA(A)
Signature: 0, 1, (a._ )aA, +, …
Language terms T(BPA(A))
Closed terms C(BPA(A))
Deduction rules for BPA(A):
a
a x
a.x 

x  x’
a x’ 
x+y
1 
y  y’

a
x + y  y’
a
x
(x + y) 

y
(x + y) 
Axioms of BPA(A):
(A1) x+ y = y+x
(A2) (x+y) + z = x+ (y + z)
(A3) x + x = x
(A4) x+ 0 = x
⑥
Socrates_thinks =
getHungry.Socrates_eats
GetHungry
6
GoThinking
Socrates_eats =
goThinking.Socrates_thinks
Process Algebra (2IF45)
Recursive equations and specifications
E = { X = a.0 }
E1 = { X = a.Y, Y = b.0 }
7
Process Algebra (2IF45)
Recursive Equations and Rec. Specification in
Equational Theory
Language: BPA(A)
Signature: 0, 1, (a._ )aA, +, …
Language terms T(BPA(A))
Closed terms C(BPA(A))
Axioms of BPA(A):
(A1) x+ y = y+x
(A2) (x+y) + z = x+ (y + z)
(A3) x + x = x
(A4) x+ 0 = x
Recursive specification E
E = { X = a.Y + c.0,Y = b.X}
BPA(A), E ├ X = a.Y +c.0 = a.(b.X) +c.0
= a.(b.(a.Y + c.))) + c.0
8
Process Algebra (2IF45)
Solutions of recursive equations
Example:
1. E = { X = a.0 }
2. E1 = { X = a.Y, Y = b.0 }
9
Process Algebra (2IF45)
Solutions of recursive equations
Example:
1. E = { X = X }
2. E1 = { X = X + a.0 }
10
Process Algebra (2IF45)
Solutions of recursive equations
Example:
1. E = { X = a.X }
2. E1 = { X = a.(a.(X+1)) +1 }
11
Process Algebra (2IF45)
Solutions of recursive specifications
E1 = { X = a.(a.(X+1)) +1 }
X
a
a.(X+1)
a
This is a solution for X in the recursive spec. E1
Substitute it on the left-hand side and on the
right-hand side and check bisimilarity.
a
X+1
12
Process Algebra (2IF45)
This is also recursion ….
13
Process Algebra (2IF45)
Semantics of Recursive specifications
Language: BPA(A)
Signature: 0, 1, (a._ )aA, +, …
Deduction rules for BPA(A):
Language terms T(BPA(A))
a
a x
a.x 

x  x’
a x’ 
x+y
1 
y  y’

a
x + y  y’
a
x
(x + y) 
14

y
(x + y) 
⑥
Process Algebra (2IF45)
Axioms of BPA(A):
(A1) x+ y = y+x
(A2) (x+y) + z = x+ (y + z)
(A3) x + x = x
(A4) x+ 0 = x
Semantics of Recursive specifications
Language: BPArec(A)
Signature: 0, 1, (a._ )aA, +, X
Deduction rules for BPA(A):
Language terms T(BPA(A))
a
a x
a.x 

x  x’
a x’ 
x+y
1 
y  y’

a
x + y  y’
a
x
(x + y) 
15

y
(x + y) 
⑥
Process Algebra (2IF45)
Axioms of BPA(A):
(A1) x+ y = y+x
(A2) (x+y) + z = x+ (y + z)
(A3) x + x = x
(A4) x+ 0 = x
Semantics of Recursive specifications
16
Process Algebra (2IF45)
Semantics of Recursive specifications
a
tX,E 
w,
a
X
w
17
X=t in E
Process Algebra (2IF45)
Semantics of Recursive specifications
Language: BPArec(A)
Signature: 0, 1, (a._ )aA, +, XE
Language terms T(BPArec(A))
Deduction rules for BPA(A):
x  x’
a x’ 
x+y
a term
a
y  y’

a
x + y  y’
1 
x
(x + y) 
Axioms of BPA(A):
(A1) x+ y = y+x
(A2) (x+y) + z = x+ (y + z)
(A3) x + x = x
(A4) x+ 0 = x
a
a x
a.x 


y
(x + y) 
⑥
….
Socrates_thinks =
getHungry.Socrates_eats
GetHungry
18
GoThinking
Socrates_eats =
goThinking.Socrates_thinks
Process Algebra (2IF45)
Semantics of Recursive specifications
Language: BPArec(A)
Signature: 0, 1, (a._ )aA, +, XE
Language terms T(BPArec(A))
Deduction rules for BPA(A):
x  x’
a x’ 
x+y
a term
a
y  y’

a
x + y  y’
1 
x
(x + y) 
Axioms of BPA(A):
(A1) x+ y = y+x
(A2) (x+y) + z = x+ (y + z)
(A3) x + x = x
(A4) x+ 0 = x
a
a x
a.x 


y
(x + y) 
⑥
….
Socrates_thinks =
getHungry.Socrates_eats
GetHungry
19
GoThinking
Socrates_eats =
goThinking.Socrates_thinks
Process Algebra (2IF45)
Term model T(BPArec(A)) and BPArec(A)
• Bisimulation is congruence
• Soundness holds (it is a model indeed)
• Ground completeness does not hold
• Every recursive specification has a solution
• Not every recursive specification has unique solution
20
Process Algebra (2IF45)
Equational theories with recursion
• Model vs. Solution of recursive specification
• Two important points for “useful models”
• Every recursive specification has a solution
• Every recursive specification has a unique solution
21
Process Algebra (2IF45)
Recursive Definition Principle (RDP)
For every recursive specification there is a solution in the
model
22
Process Algebra (2IF45)
Guarded recursions
• Does E = {X = a.Y, Y = Z, Z = b.X} has a solution and is
this unique in T(BPArec(A))?
23
Process Algebra (2IF45)
Recursive Specification Principle (RSP)
• Every guarded recursive specification has at most one
solution.
24
Process Algebra (2IF45)
Restricted Recursive Definition Principle (RSP-)
• Every guarded recursive specification has a solution.
25
Process Algebra (2IF45)
Combining principles
• RDP- + RSP implies
Every guarded recursive specification has a unique solution.
Example
E = {X = a.X}
E’ = {X’ = a.a.X’}
26
Process Algebra (2IF45)
```