Pipe-calculus: Difference between revisions

Line 80: Line 80:


\begin{alignat}{2}
\begin{alignat}{2}
& \mbox{Atoms}~        & x, y \rule & \mathsf{A} \mid \mathsf{B} \mid \mathsf{'foo} \mid \mathsf{'bar} \mid ... \\
& \mbox{Atoms}~        & a, b \rule & \mathsf{A} \mid \mathsf{B} \mid \mathsf{'foo} \mid \mathsf{'bar} \mid ... \\


& \mbox{Variables}~    & v, w \rule & \mathsf{v} \mid \mathsf{w} \mid ... \\
& \mbox{Variables}~    & v, w \rule & \mathsf{v} \mid \mathsf{w} \mid ... \\


& \mbox{Terms}~      & s, t, u \rule & ~
& \mbox{Terms}~      & s, t, u \rule & ~
\show x \mid \match x
\show a \seq s \mid \match a \seq s
\mid \mathsf{v}
\mid \mathsf{v}
\mid (s)
\mid (s)
Line 94: Line 94:
</math>
</math>


'''Atoms''' are unscoped symbols. We assume a countably infinite set of atoms that is disjunct from the set of constants (operators and constant symbols).
'''Atoms''' are unscoped symbols. We assume a countably infinite set of atoms that is disjunct from the set of constants (operators, keywords and punctuation).


'''Literals''' are atoms with '''polarity'''.
There are two '''synchronization''' prefixes, <math>\show a \seq s</math> and <math>\match a \seq s</math>.
We say that a literal of the form <math>a</math> is ''positive'', while <math>\neg a</math> is ''negative''.
<ref>See [[wikipedia:Literal_(mathematical_logic)|Literal (mathematical_logic)]] on literals in general.</ref>


There is only one kind of '''action''', which is '''synchronization'''.
'''Sequences''' are temporally ordered actions. The symbol <math>\succeed</math> denotes an empty sequence which can be interpreted as successful termination.
 
Prefixes can be treated as specialized indivisible sequences.  
'''Sequences''' are ordered lists of actions. The symbol <math>\succeed</math> denotes an empty sequence which can be interpreted as successful termination.


'''Nondeterministic choice''' is an enumeration of alternatives. <math>\textbf{fail}</math> denotes the lack of choices, or intuitively a failure to find any viable alternative.
'''Nondeterministic choice''' is an enumeration of alternatives. <math>\textbf{fail}</math> denotes the lack of choices, or intuitively a failure to find any viable alternative.
Line 109: Line 106:
<math>\pass</math> denotes a passive pipeline that transfers its input unchanged to the output.  
<math>\pass</math> denotes a passive pipeline that transfers its input unchanged to the output.  


For better readability, let's define some syntax sugar that will be used throughout this article. Extend the syntax of sequences as follows.
For better readability, let's define some syntax sugar that will be used throughout this article. Extend the syntax of terms as follows.


<math>\mbox{Sequences}~ s, t ::= ... \mid a \pto s \mid a \nto s \mbox{, where}</math>
<math>\mbox{Terms}~ s, t ::= ... \mid a \pto s \mid a \nto s \mbox{, where}</math>


<math>
<math>
\begin{alignat}{4}
\begin{alignat}{1}
~~~~ & a \pto s & = & ~\sync      a & \seq s \\
~~~~ & a \pto s & = & ~\show a \seq s \\
~~~~ & a \nto s & = & ~\sync \neg a & \seq s
~~~~ & a \nto s & = & ~\match a \seq s \\
\end{alignat}
\end{alignat}
</math>
</math>
Line 129: Line 126:
|-
|-
! style="text-align:left;"| Symbol
! style="text-align:left;"| Symbol
! style="text-align:left;"| Name
! style="text-align:left;"| Associativity<ref>
! style="text-align:left;"| Associativity<ref>
Notice that ''left or right associativity'' is a grammatical property of a binary operator,
Notice that ''left or right associativity'' is a grammatical property of a binary operator,
Line 138: Line 134:
! style="text-align:left;"| Precedence
! style="text-align:left;"| Precedence
|-
|-
| <math>\seq~\pto~\nto</math> || Sequence and arrows  || right || highest
| <math>\seq~\pto~\nto</math> || right || highest
|-
|-
| <math>\mid</math>          || Nondeterministic choice || right ||  
| <math>\mid</math>          || right ||  
|-
|-
| <math>\rhd</math>          || Pipe                    || right || lowest
| <math>\rhd</math>          || right || lowest
|}
|}


283

edits