Process Calculus
Behavior expressions are the core of SPL. They describe process control flow using algebraic operators over actions and behavior names.
Terminals
| Symbol | Name | Meaning |
|---|---|---|
done | Successful termination | Process completes normally |
Bottom | Deadlock | Process is stuck, cannot proceed |
0 | Deadlock (alternative) | Same as Bottom |
Operators (by precedence, lowest to highest)
| Operator | Syntax | Name | Meaning |
|---|---|---|---|
| Parallel | P1 || P2 | Parallel composition | Interleaved concurrent execution |
| Choice | P1 + P2 | Nondeterministic choice | One branch is chosen |
| Prefix | a . P | Action prefix | Execute action a, then continue as P |
| Star | P * | Kleene iteration | Zero or more repetitions |
| Guard | [cond] P | Guarded behavior | Execute P only if cond holds |
Prefix (sequential composition)
The dot . operator creates action-prefixed behaviors. a . P means "execute action a, then behave as P".
// Execute action a, then b, then terminate
P0 = a . b . done ;
When the left side of . is a named reference with arguments, it is parsed as an action prefix:
P0 = selectValidator(timeSlot) . P1 ;
Choice (nondeterministic)
The + operator models nondeterministic choice between alternatives:
// Either go left or go right
P0 = goLeft . P1 + goRight . P2 ;
N-ary choice is supported — multiple + alternatives are flattened:
P0 = action1 . P1
+ action2 . P2
+ action3 . P3 ;
Parallel composition
The || operator composes behaviors concurrently. Actions interleave nondeterministically:
// Two processes run concurrently
System = ProcessA || ProcessB ;
Guard
Square brackets [cond] create conditional guards:
Idle = [state == INVALID] HandleMiss
+ [state != INVALID] HandleHit ;
Guards are essential for modeling conditional branching.
Star (iteration)
The * postfix operator models repetition — zero or more executions:
P0 = (action . done) * ;
Recursion
Behavioral equations support mutual recursion through name references:
behavior {
// P0 → P1 → P0 → P1 → ... (infinite loop)
P0 = action1 . P1 ;
P1 = action2 . P0 ;
}
A common pattern is looping back with a termination option:
behavior {
P0 = processItem . P0 // loop
+ done ; // or terminate
}
Parentheses
Use () to group sub-expressions:
P0 = a . (b . P1 + c . P2) ;
Algebraic laws
The substrate satisfies these laws (applied automatically during normalization):
| Law | Equation |
|---|---|
| Choice is commutative | P1 + P2 = P2 + P1 |
| Choice is associative | (P1 + P2) + P3 = P1 + (P2 + P3) |
| Choice is idempotent | P + P = P |
| Deadlock is choice identity | P + 0 = P |
done is seq identity (left) | done . P = P |
done is seq identity (right) | P . done = P |
| Deadlock is seq zero (left) | 0 . P = 0 |
| Deadlock propagates (seq) | P . 0 = 0 |
| Right distributivity | (P1 + P2) . P3 = P1 . P3 + P2 . P3 |
done is parallel identity | P || done = P |
| Deadlock propagates (parallel) | P || 0 = 0 |
| Expansion law | a.P1 || b.P2 = a.(P1 || b.P2) + b.(a.P1 || P2) |