D7net Mini Sh3LL v1
Current File : //usr/share/systemd/../doc/libgssapi-krb5-2/../xxd/../ufw/../maria-doc/html/maria_2.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on March 22, 2020 by texi2html 1.82
texi2html was written by:
Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>Maria: 1. The Net Description Language</title>
<meta name="description" content="Maria: 1. The Net Description Language">
<meta name="keywords" content="Maria: 1. The Net Description Language">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Modeling"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maria_1.html#Introduction" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Criteria" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria_1.html#Introduction" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-Net-Description-Language-1"></a>
<h1 class="chapter">1. The Net Description Language</h1>
<a name="index-modeling"></a>
<a name="index-nets_002c-composing"></a>
<p>Petri Nets are often represented as directed bipartite graphs using a
graphical notation. An entirely graphical notation only works for
relatively simple nets that can be represented on one sheet of paper.
We decided to use a purely textual notation, since it avoids many
problems, such as creating an optimal graphical layout for an
automatically generated Petri Net model and creating a graphical user
interface that works flawlessly on various hardware and software
platforms.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Design-Criteria">1.1 Design Criteria</a></td><td> </td><td align="left" valign="top"> Why the language became what it is now
</td></tr>
<tr><td align="left" valign="top"><a href="#Lexical-Conventions">1.2 Lexical Conventions</a></td><td> </td><td align="left" valign="top"> The format of numbers, comments etc.
</td></tr>
<tr><td align="left" valign="top"><a href="#Net-Constructs">1.3 Constructs for Defining Nets</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Types">1.3.1 Type Definitions: ‘<samp>typedef</samp>’</a></td><td> </td><td align="left" valign="top"> Defining data types
</td></tr>
<tr><td align="left" valign="top"><a href="#Functions">1.3.2 Function Definitions</a></td><td> </td><td align="left" valign="top"> Defining functions or constants
</td></tr>
<tr><td align="left" valign="top"><a href="#Places">1.3.3 Place Definition: ‘<samp>place</samp>’</a></td><td> </td><td align="left" valign="top"> Declaring Petri Net places
</td></tr>
<tr><td align="left" valign="top"><a href="#Transitions">1.3.4 Transition Definition: ‘<samp>trans</samp>’</a></td><td> </td><td align="left" valign="top"> Declaring Petri Net transitions
</td></tr>
<tr><td align="left" valign="top"><a href="#Subnets">1.3.5 Defining Subnets for Modular State Space Exploration</a></td><td> </td><td align="left" valign="top"> Declaring Petri Net modules
</td></tr>
<tr><td align="left" valign="top"><a href="#Verification">1.3.6 On-the-Fly Verification</a></td><td> </td><td align="left" valign="top"> Commands for on-the-fly verification
</td></tr>
<tr><td align="left" valign="top"><a href="#Data-Types">1.4 Data Types</a></td><td> </td><td align="left" valign="top"> The data type system
</td></tr>
<tr><td align="left" valign="top"><a href="#Expressions">1.5 Expressions and Formulae</a></td><td> </td><td align="left" valign="top"> Expressions and formulae in the language
</td></tr>
<tr><td align="left" valign="top"><a href="#Output-Variables">1.8 Non-Determinism in Transitions</a></td><td> </td><td align="left" valign="top"> Non-determinism in transitions
</td></tr>
<tr><td align="left" valign="top"><a href="#Scoping">1.9 Scoping of Identifiers</a></td><td> </td><td align="left" valign="top"> Look-up rules for names
</td></tr>
</table>
<hr size="6">
<a name="Design-Criteria"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Modeling" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Conventions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Modeling" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Design-Criteria-1"></a>
<h2 class="section">1.1 Design Criteria</h2>
<p>As an admirer of the programming languages C and C++, I decided to make
the net description language resemble C as closely as possible. Users
familiar with C should feel comfortable with the way data types are
defined and expressions are written in the net description language.
</p>
<p>In the following, we will present the grammar of the net description
language using regular expressions (see <a href="../flex/Patterns.html#Patterns">(flex)Patterns</a> section ‘Patterns’ in <cite>The Flex Manual</cite>) and the Extended Backus-Naur Form
(see <a href="../bison/Language-and-Grammar.html#Language-and-Grammar">(bison)Language and Grammar</a> section ‘Languages and Context-Free Grammars’ in <cite>The GNU Bison Manual</cite>).
</p>
<hr size="6">
<a name="Lexical-Conventions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Design-Criteria" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Formatting" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Modeling" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Lexical-Conventions-1"></a>
<h2 class="section">1.2 Lexical Conventions</h2>
<a name="index-lexical-conventions"></a>
<p>The lexical conventions of the Maria Petri Net description language
determine how to format net descriptions in text files, including the
mechanisms for embedding explanatory comments.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Formatting">1.2.1 Formatting</a></td><td> </td><td align="left" valign="top"> How net descriptions should be formatted
</td></tr>
<tr><td align="left" valign="top"><a href="#Comments">1.2.2 Comments</a></td><td> </td><td align="left" valign="top"> Writing notes for the human reader
</td></tr>
<tr><td align="left" valign="top"><a href="#Lexical-Tokens">1.2.3 Lexical Tokens</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Reserved-Words">1.2.3.1 Reserved Words</a></td><td> </td><td align="left" valign="top"> Reserved words in the language
</td></tr>
<tr><td align="left" valign="top"><a href="#Numeric-Constants">1.2.3.2 Numeric Constants</a></td><td> </td><td align="left" valign="top"> Different ways of presenting numbers
</td></tr>
<tr><td align="left" valign="top"><a href="#Character-Constants">1.2.3.3 Character Constants</a></td><td> </td><td align="left" valign="top"> Single-character constants
</td></tr>
<tr><td align="left" valign="top"><a href="#Identifiers">1.2.3.4 Identifiers</a></td><td> </td><td align="left" valign="top"> Names for variables, places, transitions etc.
</td></tr>
<tr><td align="left" valign="top"><a href="#Preprocessor">1.2.4 Preprocessor Directives</a></td><td> </td><td align="left" valign="top"> Control directives for the preprocessor
</td></tr>
</table>
<hr size="6">
<a name="Formatting"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Lexical-Conventions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Comments" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Formatting-1"></a>
<h3 class="subsection">1.2.1 Formatting</h3>
<p>The net description language is not sensitive to the presence or absence
of white space between language elements provided that all keywords and
identifiers are distinguished. Thus the user has the same degree of
freedom that C and C++ allow in formatting code. White space includes
these characters: space (‘<samp>' '</samp>’), newline (‘<samp>'\n'</samp>’), carriage
return (‘<samp>'\r'</samp>’), form feed (‘<samp>'\f'</samp>’), horizontal tabulator
(‘<samp>'\t'</samp>’) and vertical tabulator (‘<samp>'\v'</samp>’).
</p>
<hr size="6">
<a name="Comments"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Formatting" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Tokens" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Comments-1"></a>
<h3 class="subsection">1.2.2 Comments</h3>
<p>Comments are indicated as they are in the C++ programming language. Two
contiguous slashes (‘<samp>//</samp>’) indicate the start of a comment that
continues to the end of the current line. A slash immediately followed
by an asterisk (‘<samp>/*</samp>’) indicates a comment that continues until the
reverse sequence (‘<samp>*/</samp>’) is encountered. Comments may not be
nested, and comments are interpreted only between language elements
(e.g., not inside names enclosed in double quotes).
</p>
<hr size="6">
<a name="Lexical-Tokens"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Comments" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Reserved-Words" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Lexical-Tokens-1"></a>
<h3 class="subsection">1.2.3 Lexical Tokens</h3>
<p>Lexical tokens are the atomic constituents of the language, consisting
of characters or character sequences.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Reserved-Words">1.2.3.1 Reserved Words</a></td><td> </td><td align="left" valign="top"> Reserved words in the language
</td></tr>
<tr><td align="left" valign="top"><a href="#Numeric-Constants">1.2.3.2 Numeric Constants</a></td><td> </td><td align="left" valign="top"> Different ways of presenting numbers
</td></tr>
<tr><td align="left" valign="top"><a href="#Character-Constants">1.2.3.3 Character Constants</a></td><td> </td><td align="left" valign="top"> Single-character constants
</td></tr>
<tr><td align="left" valign="top"><a href="#Identifiers">1.2.3.4 Identifiers</a></td><td> </td><td align="left" valign="top"> Names for variables, places, transitions etc.
</td></tr>
</table>
<hr size="6">
<a name="Reserved-Words"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Lexical-Tokens" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Numeric-Constants" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Tokens" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Reserved-Words-1"></a>
<h4 class="subsubsection">1.2.3.1 Reserved Words</h4>
<a name="index-reserved-words"></a>
<p>There are quite a few reserved words in the net description language:
</p>
<table>
<tr><td width="25%"><code>atom</code></td><td width="25%"><code>cardinality</code></td><td width="25%"><code>const</code></td><td width="25%"><code>deadlock</code></td></tr>
<tr><td width="25%"><code>empty</code></td><td width="25%"><code>enabled</code></td><td width="25%"><code>enum</code></td><td width="25%"><code>equals</code></td></tr>
<tr><td width="25%"><code>false</code></td><td width="25%"><code>fatal</code></td><td width="25%"><code>gate</code></td><td width="25%"><code>hide</code></td></tr>
<tr><td width="25%"><code>id</code></td><td width="25%"><code>in</code></td><td width="25%"><code>infinite</code></td><td width="25%"><code>intersect</code></td></tr>
<tr><td width="25%"><code>is</code></td><td width="25%"><code>map</code></td><td width="25%"><code>max</code></td><td width="25%"><code>min</code></td></tr>
<tr><td width="25%"><code>minus</code></td><td width="25%"><code>out</code></td><td width="25%"><code>place</code></td><td width="25%"><code>prop</code></td></tr>
<tr><td width="25%"><code>queue</code></td><td width="25%"><code>reject</code></td><td width="25%"><code>release</code></td><td width="25%"><code>stack</code></td></tr>
<tr><td width="25%"><code>strongly_fair</code></td><td width="25%"><code>struct</code></td><td width="25%"><code>subnet</code></td><td width="25%"><code>subset</code></td></tr>
<tr><td width="25%"><code>trans</code></td><td width="25%"><code>true</code></td><td width="25%"><code>typedef</code></td><td width="25%"><code>undefined</code></td></tr>
<tr><td width="25%"><code>union</code></td><td width="25%"><code>until</code></td><td width="25%"><code>weakly_fair</code></td></tr>
</table>
<p>In order to use any of these words as an identifier
(see section <a href="#Identifiers">Identifiers</a>), you will have to enclose it in double quotation
marks (‘<samp>"</samp>’).
</p>
<hr size="6">
<a name="Numeric-Constants"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Reserved-Words" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Character-Constants" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Tokens" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Numeric-Constants-1"></a>
<h4 class="subsubsection">1.2.3.2 Numeric Constants</h4>
<a name="index-constants_002c-numeric"></a>
<a name="index-numeric-constants"></a>
<p>Maria has three interchangeable ways of entering integer numeric
constants. The constants can be entered using one of three different
notations: with decimal numbers (‘<samp>[1-9][0-9]*</samp>’), octal numbers
(‘<samp>0[0-7]*</samp>’) or hexadecimal numbers (‘<samp>0x[0-9a-fA-F]+</samp>’). When a
numeric constant is too long to fit in the internal representation, the
lexical analyzer will detect it and issue a diagnostic message. Decimal
numbers are always unsigned, but the hexadecimal and octal
representations are translated directly to the system-dependent internal
representation, which usually is a 32-bit word interpreted as a signed
integer using two’s complement arithmetic.
</p>
<hr size="6">
<a name="Character-Constants"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Numeric-Constants" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Identifiers" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Tokens" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Character-Constants-1"></a>
<h4 class="subsubsection">1.2.3.3 Character Constants</h4>
<a name="index-constants_002c-character"></a>
<a name="index-character-constants"></a>
<p>Character constants are just like in the C programming language: a
single character enclosed in apostrophes (‘<samp>'</samp>’). The backslash
(‘<samp>\</samp>’) is used for entering special characters:
</p>
<dl compact="compact">
<dt> ‘<samp>\a</samp>’</dt>
<dd><p>alert, bell (<kbd>BEL</kbd>)
</p></dd>
<dt> ‘<samp>\b</samp>’</dt>
<dd><p>backspace (<kbd>BS</kbd>)
</p></dd>
<dt> ‘<samp>\t</samp>’</dt>
<dd><p>horizontal tabulator (<kbd>HT</kbd>)
</p></dd>
<dt> ‘<samp>\n</samp>’</dt>
<dd><p>newline, line feed (<kbd>LF</kbd>)
</p></dd>
<dt> ‘<samp>\v</samp>’</dt>
<dd><p>vertical tabulator (<kbd>VT</kbd>)
</p></dd>
<dt> ‘<samp>\f</samp>’</dt>
<dd><p>form feed (<kbd>FF</kbd>)
</p></dd>
<dt> ‘<samp>\r</samp>’</dt>
<dd><p>carriage return (<kbd>CR</kbd>)
</p></dd>
<dt> ‘<samp>\[0-7]{1,3}</samp>’</dt>
<dd><p>octal notation
</p></dd>
<dt> ‘<samp>\x[0-9a-fA-F]{1,2}</samp>’</dt>
<dd><p>hexadecimal notation
</p></dd>
<dt> ‘<samp>\<var>c</var></samp>’</dt>
<dd><p>character <var>c</var> (<code><var>c</var> != '\n'</code>)
</p></dd>
</dl>
<p>Any other characters than the apostrophe or the backslash can be entered
verbatim between the apostrophes.
</p>
<p>Any non-special character quoted with the backslash will be entered as
such, i.e. the backslash will be ignored. Thus, ‘<samp>'\c'</samp>’ is
equivalent to ‘<samp>'c'</samp>’. The line break character is a special case.
In order to maintain consistence with the quoted identifiers discussed
below, a backslash followed by a line break and any amount of white
space containing no line breaks will be ignored.
</p>
<hr size="6">
<a name="Identifiers"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Character-Constants" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Preprocessor" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Tokens" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Identifiers-1"></a>
<h4 class="subsubsection">1.2.3.4 Identifiers</h4>
<a name="index-identifiers_002c-syntax-of"></a>
<p>Maria uses textual names for identifying places, transitions, data
types, variables, enumeration constants and many other things. None of
the identifiers become reserved words. For instance, ‘<samp>bool</samp>’ may be
a type name, a place name or the name of a structure component.
Anything of the form ‘<samp>[A-Za-z_][A-Za-z0-9_]*</samp>’ that is not a
reserved word is an identifier.
</p>
<p>Identifiers can also be enclosed in double quotation marks. As with
single-character constants, only the backslash and the quotation mark
must be escaped with a backslash, and the backslash notation
(see section <a href="#Character-Constants">Character Constants</a>) can be used for entering non-printable
characters. Non-printable characters need not be escaped, though. The
only character that is not allowed in identifiers is the <kbd>NUL</kbd>
character.
</p>
<p>The backslash character (‘<samp>\</samp>’) can be used to break up long
identifiers. A backslash followed by a line break and any amount of
white space containing no line breaks will be ignored in the input.
Also, backslashes can be used to quote the following character. For
instance, ‘<samp>in\ k</samp>’ is equivalent to ‘<samp>"in k"</samp>’.
</p>
<p>In double quotes, the newline character is just as significant as any
other character. Sometimes one wants to split a long quoted identifier
to several lines without the line breaks being significant. This can be
achieved by putting a backslash immediately before the line break. The
lexical analyzer will ignore the backslash, the line break and the
immediately following white space (not line break).
</p>
<hr size="6">
<a name="Preprocessor"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Identifiers" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Include" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Preprocessor-Directives"></a>
<h3 class="subsection">1.2.4 Preprocessor Directives</h3>
<a name="index-preprocessor"></a>
<p>The language contains a subset of the directives implemented in the C
language preprocessor. Conditional compilation and macro definitions
are not supported in the current version.
</p>
<p>Preprocessor directives are indicated with a number sign (‘<samp>#</samp>’)
located in the first (leftmost) column. The number sign may be
followed by any amount of lexical comments and other white space than
newline. The line, which must be terminated with a newline, must
contain exactly one preprocessor directive.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Include">1.2.4.1 Embedding Other Files: ‘<samp>#include</samp>’</a></td><td> </td><td align="left" valign="top"> Embedding other files
</td></tr>
<tr><td align="left" valign="top"><a href="#Conditions">1.2.4.2 Conditional Processing</a></td><td> </td><td align="left" valign="top"> Conditional processing
</td></tr>
<tr><td align="left" valign="top"><a href="#Line">1.2.4.3 Setting the Line Number: ‘<samp>#line</samp>’</a></td><td> </td><td align="left" valign="top"> Setting the line number counter
</td></tr>
<tr><td align="left" valign="top"><a href="#Comment">1.2.4.4 Preprocessor Comment: ‘<samp>#!</samp>’</a></td><td> </td><td align="left" valign="top"> Preprocessor comment
</td></tr>
</table>
<hr size="6">
<a name="Include"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Preprocessor" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Conditions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Preprocessor" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Embedding-Other-Files_003a-_0023include"></a>
<h4 class="subsubsection">1.2.4.1 Embedding Other Files: ‘<samp>#include</samp>’</h4>
<a name="index-include-files"></a>
<a name="index-_0023include"></a>
<p>The ‘<samp>#include</samp>’ directive works just like in the C preprocessor,
except that the file name must be enclosed in double quotes and never in
angle brackets (‘<samp><</samp>’ and ‘<samp>></samp>’). The string in double quotes is
interpreted as a quoted identifier (see section <a href="#Identifier">Identifier Type</a>).
</p>
<hr size="6">
<a name="Conditions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Include" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Line" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Preprocessor" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Conditional-Processing-1"></a>
<h4 class="subsubsection">1.2.4.2 Conditional Processing</h4>
<a name="index-conditional-processing"></a>
<a name="index-preprocessor-symbols"></a>
<a name="index-_0023ifdef"></a>
<a name="index-_0023ifndef"></a>
<a name="index-_0023else"></a>
<a name="index-_0023endif"></a>
<a name="index-_0023undef"></a>
<a name="index-_0023define"></a>
<p>The ‘<samp>#ifdef</samp>’, ‘<samp>#ifndef</samp>’, ‘<samp>#else</samp>’ and ‘<samp>#endif</samp>’
directives work just like in the C preprocessor, expecting an argument
of the form ‘<samp>[A-Za-z_][A-Za-z0-9_]*</samp>’. Note that there is no
‘<samp>#if</samp>’ directive and that the ‘<samp>#define</samp>’ directive only takes
one argument, the name of the symbol. The preprocessor symbols are not
macros; no macro expansion will take place.
</p>
<p>Conditional processing can be used to avoid problems with multiple
inclusions of a file or to add some parameterization to the net model.
Preprocessor symbols can also be defined on the command line.
</p>
<hr size="6">
<a name="Line"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Conditions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Comment" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Preprocessor" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Setting-the-Line-Number_003a-_0023line"></a>
<h4 class="subsubsection">1.2.4.3 Setting the Line Number: ‘<samp>#line</samp>’</h4>
<a name="index-line-counter_002c-setting"></a>
<a name="index-_0023line"></a>
<p>Code generation tools usually generate ‘<samp>#line</samp>’ directives for
excerpts that are to be embedded verbatim in the generated code. This
allows the compiler to refer to the relevant input file of the code
generator in its diagnostic messages.
</p>
<p>The Maria languages implement the ‘<samp>#line</samp>’ directive in order to
better support the diagnostics of automatically generated net
descriptions. The ‘<samp>line</samp>’ keyword is followed by a numeric constant
and a character string constant indicating the line number and the file
name of the following line.
</p>
<hr size="6">
<a name="Comment"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Line" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Net-Constructs" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Preprocessor" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Preprocessor-Comment_003a-_0023_0021"></a>
<h4 class="subsubsection">1.2.4.4 Preprocessor Comment: ‘<samp>#!</samp>’</h4>
<a name="index-_0023_0021"></a>
<p>The special preprocessor directive ‘<samp>#!</samp>’, which causes the rest of
the line to be ignored, was added in order to make it possible for Maria
input files to also be executable scripts in systems having an
appropriate <code>exec</code> system call.
</p>
<hr size="6">
<a name="Net-Constructs"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Comment" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Types" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Modeling" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Constructs-for-Defining-Nets"></a>
<h2 class="section">1.3 Constructs for Defining Nets</h2>
<a name="index-nets_002c-constructs"></a>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Types">1.3.1 Type Definitions: ‘<samp>typedef</samp>’</a></td><td> </td><td align="left" valign="top"> Defining data types
</td></tr>
<tr><td align="left" valign="top"><a href="#Functions">1.3.2 Function Definitions</a></td><td> </td><td align="left" valign="top"> Defining functions or constants
</td></tr>
<tr><td align="left" valign="top"><a href="#Places">1.3.3 Place Definition: ‘<samp>place</samp>’</a></td><td> </td><td align="left" valign="top"> Declaring Petri Net places
</td></tr>
<tr><td align="left" valign="top"><a href="#Transitions">1.3.4 Transition Definition: ‘<samp>trans</samp>’</a></td><td> </td><td align="left" valign="top"> Declaring Petri Net transitions
</td></tr>
<tr><td align="left" valign="top"><a href="#Subnets">1.3.5 Defining Subnets for Modular State Space Exploration</a></td><td> </td><td align="left" valign="top"> Declaring Petri Net modules
</td></tr>
<tr><td align="left" valign="top"><a href="#Verification">1.3.6 On-the-Fly Verification</a></td><td> </td><td align="left" valign="top"> Commands for on-the-fly verification
</td></tr>
</table>
<hr size="6">
<a name="Types"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Net-Constructs" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Functions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Net-Constructs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Type-Definitions_003a-typedef"></a>
<h3 class="subsection">1.3.1 Type Definitions: ‘<samp>typedef</samp>’</h3>
<a name="index-data-types_002c-defining"></a>
<a name="index-typedef"></a>
<p>In the Maria languages, only the predefined data types ‘<samp>bool</samp>’,
‘<samp>int</samp>’, ‘<samp>unsigned</samp>’ and ‘<samp>char</samp>’ can be used without naming
them using the grammatical construct
</p>
<table><tr><td> </td><td><pre class="example">type: TYPEDEF typedefinition name
</pre></td></tr></table>
<p>inspired by C. The built-in type names are not reserved words.
For instance, any reference to the type ‘<samp>int</samp>’ following the
definition <code>typedef int (-64..63) int;</code> will refer to an integer
representable with 7 bits.
</p>
<p>For a comprehensive description of the data type system, see <a href="#Data-Types">Data Types</a>. Here we will only present the syntax, not the semantics.
</p>
<p>Some of the syntax for defining data types resembles the C programming
language very closely:
</p><table><tr><td> </td><td><pre class="example">typedefinition:
ENUM '{' enum_item ( delim enum_item )* '}'
|
STRUCT '{' comp_list '}'
|
UNION '{' comp_list '}'
|
typereference
</pre><pre class="example">typereference:
name
enum_item:
name [ [ '=' ] number ]
comp_list:
comp (delim comp)* [ delim ]
comp:
typedefinition name
number:
expr
delim:
','
|
';'
</pre></td></tr></table>
<p>The extra leaf data types include an empty ‘<samp>struct</samp>’, often used for
denoting black tokens, and an <em>identifier</em> type used for identifying
e.g. processes or objects. Note that if you intend to compile the
model (see section <a href="maria_3.html#Maria-Options">Options</a>), the empty ‘<samp>struct</samp>’ does not work on
all C compilers.
</p>
<table><tr><td> </td><td><pre class="example">typedefinition:
STRUCT '{' '}'
|
ID '[' number ']'
</pre></td></tr></table>
<p>It is a good idea to define an alias (see section <a href="#Functions">Function Definitions</a>) for the black
token, so that its definition can be changed easily:
</p><table><tr><td> </td><td><pre class="example">typedef struct {} token;
// typedef unsigned (0) token;
token token = <token;
</pre></td></tr></table>
<p>The alert reader may have noticed that we have not introduced arrays
yet. Arrays in Maria are not necessarily indexed by integers, but by
any type having a limited set of possible values. One can also define a
finite-capacity buffer that uses either a queue or a stack discipline.
</p>
<table><tr><td> </td><td><pre class="example">typedefinition:
typedefinition '[' typedefinition ']'
|
typedefinition '[' QUEUE number ']'
|
typedefinition '[' STACK number ']'
</pre></td></tr></table>
<p>Last but not least, it is possible to limit the set of possible values
for a type by defining <em>constraints</em>, unions of closed or semi-open
ranges of constant values.
</p>
<table><tr><td> </td><td><pre class="example">typedefinition:
typedefinition constraint
constraint:
'(' range (delim range)* ')'
range:
value
|
'..' value
|
value '..' value
|
value '..'
value:
expr
</pre></td></tr></table>
<hr size="6">
<a name="Functions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Types" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Places" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Net-Constructs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Function-Definitions"></a>
<h3 class="subsection">1.3.2 Function Definitions</h3>
<a name="index-functions_002c-defining"></a>
<p>Commonly used expressions can be defined as functions, which can be
viewed as macros with strictly typed parameters. Functions are defined
in the following way:
</p>
<table><tr><td> </td><td><pre class="example">function:
typereference name ('='|'()') formula
|
typereference name '(' param_list ')' formula
param_list:
[ param_list_item (delim param_list_item)* ]
param_list_item:
typereference name
</pre></td></tr></table>
<p>The function name and the optional parameter list are followed by a
formula that usually refers to all the function parameters. When the
function is “called” (the macro is expanded), each instance of a named
parameter will be substituted with the corresponding expression passed
as an argument to the function. Parameterless functions are practical
for defining constants.
</p>
<p>Functions can be defined both in the global scope and in the transition
scope. Functions defined in the declaration block of a transition will
only be accessible to that transition, and they will temporarily
override a global function definition.
</p>
<hr size="6">
<a name="Places"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Functions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Transitions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Net-Constructs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Place-Definition_003a-place"></a>
<h3 class="subsection">1.3.3 Place Definition: ‘<samp>place</samp>’</h3>
<a name="index-nets_002c-place-definition"></a>
<a name="index-tokens"></a>
<a name="index-initial-marking"></a>
<a name="index-redundant-places"></a>
<a name="index-place"></a>
<a name="index-_003a_002c-initial-marking"></a>
<a name="index-const"></a>
<a name="index-capacity-constraint"></a>
<p>All persistent data in Petri Nets is stored in <em>places</em> that can
contain a number of <em>tokens</em>, which in the case of Algebraic System
Nets have values. When a place is defined, it is given a unique name,
and it is assigned a type.
</p>
<table><tr><td> </td><td><pre class="example">place:
PLACE name constraint* typedefinition
[ CONST ] [ ':' marking_list ]
</pre></td></tr></table>
<p>It is possible to define a <em>capacity constraint</em>, a non-negative
integer constraint (see section <a href="#Constraints">Constraints</a>) that constrains the total
number of tokens the place can contain. Note that the constraint does
not need to be of the form ‘<samp>(0..<var>n</var>)</samp>’ for some positive integer
<var>n</var>; it can be e.g. ‘<samp>(1)</samp>’ if the place always contains
exactly one token, or ‘<samp>(0,2,4)</samp>’. Defining constraints has two
major advantages. First, they help to catch errors in the model.
Second, analysis algorithms may benefit from them, and resources can be
saved when maintaining the reachability graph (see section <a href="maria_6.html#Graph-Files">The Graph Files</a>).
</p>
<p>Places can be assigned an <em>initial marking</em>, a multi-set valued
expression (see section <a href="#Multi_002dSets">Operations on Multi-Sets</a>) that evaluates to the collection of
tokens that will be assigned to the place in the system’s initial state.
To parameterise initial markings, you may use the multi-set summation
operator.
</p>
<p>Sometimes, it is necessary to introduce control places in the model
whose contents remains constant. It would be unnecessary to include
such places in the representation of model states, or in the unfolding
(see section <a href="maria_3.html#Unfold">Unfolding a Model</a>) of the model. The keyword ‘<samp>const</samp>’ in the place
definition indicates a constant place.
</p>
<p>When the marking of a place is a function of the marking of other
places, the place is called a <em>redundant place</em>. Examples of such
places include counters and complement places. It is possible to
identify such places by writing initialization expressions that make use
of the ‘<samp>place <var>name</var></samp>’ operation (see section <a href="#Multi_002dSets">Operations on Multi-Sets</a>). Doing so
not only reduces disk space consumption; Maria will also check that such
invariant properties hold in all states it generates.
</p>
<hr size="6">
<a name="Transitions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Places" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Subnets" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Net-Constructs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Transition-Definition_003a-trans"></a>
<h3 class="subsection">1.3.4 Transition Definition: ‘<samp>trans</samp>’</h3>
<a name="index-nets_002c-transition-definition"></a>
<a name="index-transitions_002c-firing"></a>
<a name="index-transitions_002c-enabled"></a>
<a name="index-priority-transitions"></a>
<a name="index-places_002c-input"></a>
<a name="index-places_002c-output"></a>
<a name="index-variable-declarations"></a>
<a name="index-fairness-sets"></a>
<a name="index-modules"></a>
<a name="index-trans"></a>
<a name="index-gate"></a>
<a name="index-hide"></a>
<a name="index-in"></a>
<a name="index-out"></a>
<a name="index-place-1"></a>
<a name="index-_003a_002c-arc-expressions"></a>
<a name="index-_0021_002c-transitions"></a>
<a name="index-strongly_005ffair"></a>
<a name="index-weakly_005ffair"></a>
<a name="index-enabled"></a>
<p>The state of a Petri system is changed by <em>firing</em> transitions,
removing tokens from their <em>input places</em> and adding tokens to their
<em>output places</em>. A transition is <em>enabled</em> if its each input
place contains at least the amount of tokens the transition is about to
remove. Only enabled transitions may be fired.
</p>
<table><tr><td> </td><td><pre class="example">transition:
TRANS [ ':' ] name [ '!' ] trans*
trans:
'{' [ var_expr (delim var_expr)* [ delim ] ] '}'
|
IN trans_places
|
OUT trans_places
|
GATE expr (',' expr)*
</pre><pre class="example"> |
HIDE expr
</pre><pre class="example"> |
STRONGLY_FAIR expr
|
WEAKLY_FAIR expr
|
ENABLED expr
</pre><pre class="example"> |
':' [ TRANS ] name
|
NUMBER
</pre><pre class="example">var_expr:
[ HIDE ] typereference name
|
[ HIDE ] typereference name '!' [ '(' expr ')' ]
|
function
</pre><pre class="example">trans_places:
'{' place_marking (';' place_marking)* '}'
place_marking:
[ PLACE ] name ':' marking_list
</pre></td></tr></table>
<p>A transition definition is further divided to four different kinds of
declarations. The <em>variable declaration block</em> is used for
declaring input and output variables and functions. Using the block is
optional, since Maria allows implicit variable declarations. When
declaring input variables implicitly, you may have to define the type
context (see section <a href="#Type-Casting">Type Casting</a>).
</p>
<p>The blocks for defining <em>input and output arcs</em> bind the
transition with places. Last but not least, the transition may be
assigned <em>gate expressions</em>, which are additional Boolean
conditions for enabling the transition. All gate expressions
associated with a transition must hold in order for an instance of the
transition to be enabled.
</p>
<p>The gate expressions ‘<samp>undefined</samp>’ and ‘<samp>fatal</samp>’ (see section <a href="#Dynamic-Errors">Dynamic Errors</a>) can be used for defining “assertion” transitions. If a
transition having such a gate is enabled, an error is reported. As
these transitions cannot be fired, it is not meaningful for them to
have output arcs.
</p>
<p>In order to ease the transition instance analysis, the parser splits
all top-level logical conjunctions ‘<samp>&&</samp>’ in gate expressions. For
this reason, gate expressions that rely on short-circuit evaluation
should be declared indivisible with the ‘<samp>atom</samp>’ keyword.
</p>
<p>Transitions may be defined in several parts of the input file. There
may be any number of ‘<samp>in</samp>’, ‘<samp>out</samp>’ and ‘<samp>gate</samp>’ blocks and
variable or function definitions for a transition, and the transition
definition may span over several ‘<samp>trans</samp>’ blocks.
</p>
<p>It is possible to define fairness sets of transition instances to
guide the on-the-fly model checker. A transition-specific fairness
set definition consists of one of the reserved words
‘<samp>strongly_fair</samp>’ and ‘<samp>weakly_fair</samp>’ followed by a Boolean
condition. The condition identifies the transition instances that are
to be treated fairly. All instances fulfilling the condition will be
treated as one unique fairness set.
</p>
<p>The ‘<samp>enabled</samp>’ keyword allows the definition of enabledness sets
of transition instances. If no transition instances belonging to an
enabledness set are enabled, the set will be reported at the end of
the analysis. Use the ‘<samp>dump</samp>’ command (see section <a href="maria_3.html#Dump">Displaying a Model</a>) to see the
enabledness set numbers.
</p>
<p>See section <a href="#Fairness">Defining Fairness Constraints</a>, for fairness and enabledness sets comprising several
transitions.
</p>
<p>Maria supports a form of <em>transition fusion</em>, which is a key
feature to constructing models in a modular way (See also
see section <a href="#Subnets">Defining Subnets for Modular State Space Exploration</a>). A transition whose name is preceded with a colon
(‘<samp>trans :callee</samp>’) is not an actual transition but it designates a
kind of a macro or a function body that can be substituted to other
transitions, like this: ‘<samp>trans caller:trans callee</samp>’. The Maria
parser would merge the definitions of ‘<samp>trans :callee</samp>’ to the
definition of ‘<samp>trans caller</samp>’.
</p>
<p>There is a simple priority method in the search algorithm of Maria
that works as follows. When computing the successors of a marking,
Maria investigates the transitions in the order they were defined in
the model, from top to bottom. Whenever a transition having a nonzero
priority class is found to be enabled, no further transitions of other
priority classes will be analyzed in the marking.
</p>
<p>The default priority class is zero. It is worth noting that
non-prioritized transitions that are defined before any prioritized
transitions are completely independent of other transitions in the
model. Any non-prioritized transitions that are defined after
prioritized ones will be analyzed only if no prioritized transitions
are enabled.
</p>
<p>The priority class can be specified by writing a non-negative integer
number after the name of the transition. The exclamation point
‘<samp>!</samp>’ is an alternative mechanism for providing backward
compatibility. It assigns a nonzero priority class to the transition
from a global counter and then decrements the counter by one, so that
the next transitions marked with ‘<samp>!</samp>’ will be assigned other
priority classes.
</p>
<p>The ‘<samp>hide</samp>’ keyword affects the output of labelled state
transition systems (see section <a href="maria_3.html#LSTS">Exporting a Labelled State Transition System</a>) and the ‘<samp>-Y</samp>’ command line
option for suppressing hidden states (see section <a href="maria_3.html#Invoking-Maria">Invoking Maria</a>). A
transition instance is hidden (renamed to the special "tau" action) if
the hiding condition (a truth-valued expression on the transition
variables) holds. Transition variables can be omitted from action
names by declaring them with the ‘<samp>hide</samp>’ keyword.
</p>
<hr size="6">
<a name="Subnets"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Transitions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Verification" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Net-Constructs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Defining-Subnets-for-Modular-State-Space-Exploration"></a>
<h3 class="subsection">1.3.5 Defining Subnets for Modular State Space Exploration</h3>
<a name="index-subnets"></a>
<a name="index-modules-1"></a>
<a name="index-subnet"></a>
<p>When a system being modelled consists of a number of loosely
synchronised processes, it is often useful to distinguish between the
internal actions of these processes and the actions that model the
communication or synchronisation of the processes.
</p>
<p>In Maria, it is possible to define tree-like hierarchies of high-level
nets. In the outer-level net, all transitions are <em>visible</em>, that
is, their occurrences directly corresponds to edges in the global
reachability graph (synchronisation graph).
</p>
<p>In a subnet, defined within a ‘<samp>subnet</samp>’ block, normal transitions
model internal actions, which do not show up in the synchronisation
graph. Synchronisation or communication of subnets is modelled with
transition fusion (see section <a href="#Transitions">Transition Definition: ‘<samp>trans</samp>’</a>). When a transition in a
subnet calls a transition in its parent net, its occurrences will show
in the state space of the parent net.
</p>
<p>When the model contains subnets, modular analysis should be applied
(command line option ‘<samp>-R</samp>’ or ‘<samp>--modular</samp>’; see section <a href="maria_3.html#Invoking-Maria">Invoking Maria</a>).
</p>
<table><tr><td> </td><td><pre class="example">subnet:
SUBNET [ name ] '{' net '}'
</pre></td></tr></table>
<hr size="6">
<a name="Verification"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Subnets" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Assertions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Net-Constructs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="On_002dthe_002dFly-Verification"></a>
<h3 class="subsection">1.3.6 On-the-Fly Verification</h3>
<a name="index-nets_002c-on_002dthe_002dfly-verification"></a>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Assertions">1.3.6.1 Verifying Safety Properties</a></td><td> </td><td align="left" valign="top"> Check whether a safety property holds
</td></tr>
<tr><td align="left" valign="top"><a href="#Fairness">1.3.6.2 Defining Fairness Constraints</a></td><td> </td><td align="left" valign="top"> Specifying fairness sets of transition instances
</td></tr>
<tr><td align="left" valign="top"><a href="#Propositions">1.3.6.3 Specifying State Propositions for LSTS Output</a></td><td> </td><td align="left" valign="top"> Specifying state propositions for LSTS output
</td></tr>
</table>
<hr size="6">
<a name="Assertions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Verification" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Fairness" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Verification" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Verifying-Safety-Properties"></a>
<h4 class="subsubsection">1.3.6.1 Verifying Safety Properties</h4>
<a name="index-assertions"></a>
<a name="index-reject"></a>
<a name="index-deadlock"></a>
<p>The ‘<samp>reject</samp>’ and ‘<samp>deadlock</samp>’ statements are used in conjunction
with Boolean conditions on markings. When these statements are used, the
reachability analyzer reports an error whenever
</p><ol>
<li> a state violating the ‘<samp>reject</samp>’ formula has been generated
</li><li> the ‘<samp>deadlock</samp>’ formula holds
in a marking where no transitions are enabled
</li></ol>
<p>If the formula cannot be evaluated, the analysis will be stopped. Thus,
commanding
</p>
<table><tr><td> </td><td><pre class="example">deadlock fatal;
</pre></td></tr></table>
<p>will cause the analysis to stop when a deadlock is reached. The
following construct can be used to stop the analysis when an undesired
state is reached:
</p>
<table><tr><td> </td><td><pre class="example">reject place fork equals empty && fatal;
</pre></td></tr></table>
<p>An alternative mechanism for specifying undesired states is to define
“assertion” transitions with ‘<samp>undefined</samp>’ or ‘<samp>fatal</samp>’ in
their gate expressions (see section <a href="#Transitions">Transition Definition: ‘<samp>trans</samp>’</a>).
</p>
<table><tr><td> </td><td><pre class="example">verify:
REJECT expr
|
DEADLOCK expr
</pre></td></tr></table>
<hr size="6">
<a name="Fairness"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Assertions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Propositions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Verification" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Defining-Fairness-Constraints"></a>
<h4 class="subsubsection">1.3.6.2 Defining Fairness Constraints</h4>
<a name="index-fairness-sets-1"></a>
<a name="index-strongly_005ffair-1"></a>
<a name="index-weakly_005ffair-1"></a>
<a name="index-enabled-1"></a>
<p>It is possible to define fairness sets of transition instances to guide
the on-the-fly model checker. Such sets may contain instances of a
single transition (see section <a href="#Transitions">Transition Definition: ‘<samp>trans</samp>’</a>) or of several transitions. The
latter case is handled by identifying the transition instances that are
to be included to a set using qualifier expressions, which consist of
transition names followed by Boolean conditions for transition
variables.
</p>
<p>A generic fairness set definition consists of one of the reserved words
‘<samp>strongly_fair</samp>’ and ‘<samp>weakly_fair</samp>’ followed by a list of
qualifier expressions. Each qualifier expression identifies some
transition instances that are to be treated fairly. All instances
fulfilling a qualifier expression will be treated as one fairness set.
</p>
<p>The ‘<samp>enabled</samp>’ keyword allows the definition of enabledness sets
of transition instances. If no transition instances belonging to an
enabledness set are enabled, the set will be reported at the end of
the analysis. Use the ‘<samp>dump</samp>’ command (see section <a href="maria_3.html#Dump">Displaying a Model</a>) to see the
enabledness set numbers.
</p>
<table><tr><td> </td><td><pre class="example">fairness:
STRONGLY_FAIR qual_expr ( ',' qual_expr )*
|
WEAKLY_FAIR qual_expr ( ',' qual_expr )*
|
ENABLED qual_expr ( ',' qual_expr )*
</pre><pre class="example">qual_expr:
TRANS name [ ':' expr ]
|
'(' qual_expr ')'
|
</pre><pre class="example"> '!' qual_expr
|
qual_expr '&&' qual_expr
|
qual_expr '^^' qual_expr
|
qual_expr '||' qual_expr
|
qual_expr '<=>' qual_expr
|
qual_expr '=>' qual_expr
</pre></td></tr></table>
<p>Qualifier expressions may also be quantified. The semantics of the
multi-set summation operation is that each summand is associated with a
new fairness set. Universal and existential quantification have their
normal semantics, i.e. they are translated into chains of conjunctions
or disjunctions.
</p>
<table><tr><td> </td><td><pre class="example">qual_expr:
typereference name [ '(' expr ')' ] ':' qual_expr
|
typereference name [ '(' expr ')' ] '&&' qual_expr
|
typereference name [ '(' expr ')' ] '||' qual_expr
</pre></td></tr></table>
<hr size="6">
<a name="Propositions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Fairness" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Data-Types" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Verification" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Specifying-State-Propositions-for-LSTS-Output"></a>
<h4 class="subsubsection">1.3.6.3 Specifying State Propositions for LSTS Output</h4>
<a name="index-state-propositions"></a>
<a name="index-prop"></a>
<p>The labelled state transition systems that Maria is able to output
(see section <a href="maria_3.html#LSTS">Exporting a Labelled State Transition System</a>) have a notion of state propositions. As they do not have a
natural counterpart in a high-level Petri net, a special construct has
to be used for specifying them.
</p>
<table><tr><td> </td><td><pre class="example">proposition:
PROP name ':' expr
</pre></td></tr></table>
<p>The ‘<samp>prop</samp>’ definition does not affect anything else except the
output of labelled state transition systems and the resolution of
identifiers in the query language. The expression must be a
truth-valued state formula.
</p>
<hr size="6">
<a name="Data-Types"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Propositions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Types-Background" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Modeling" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Data-Types-1"></a>
<h2 class="section">1.4 Data Types</h2>
<a name="index-data-types"></a>
<p>In programming languages, user-defined structural data types became
popular in the 1970s with the success of C and other high-level
languages. The original Petri Net formalism did not make use of any
data types or algebraic sorts, and its high-level variations usually
keep the data types pretty simple, often restricted to tuples of integer
numbers or enumerated data types.
</p>
<p>In order to efficiently analyze the behavior of parallel programs
written in a high-level language, there must exist a straightforward
translation from the data types in the source formalism to the types
supported by the analyzer. Using tuples of integers, one can emulate
simple higher-level types, such as a unidimensional array of a leaf
type, but anything beyond that is next to impossible.
</p>
<p>The data type system in Maria holds the comparison with any high-level
programming language. The only thing that is missing is pointers or
references, which would entirely break the locality principle of Petri
Nets.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Types-Background">1.4.1 Background</a></td><td> </td><td align="left" valign="top"> Technical background of the data type system
</td></tr>
<tr><td align="left" valign="top"><a href="#Leaf-Types">1.4.2 Leaf Types</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Integer">1.4.2.1 Integer Types</a></td><td> </td><td align="left" valign="top"> Integer number (‘<samp>int</samp>’ and ‘<samp>unsigned</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Boolean">1.4.2.2 Boolean Type</a></td><td> </td><td align="left" valign="top"> Truth value (‘<samp>bool</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Character">1.4.2.3 Character Type</a></td><td> </td><td align="left" valign="top"> Character (‘<samp>char</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Enumerated">1.4.2.4 Enumerated Type</a></td><td> </td><td align="left" valign="top"> Enumerated integer (‘<samp>enum</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Identifier">1.4.2.5 Identifier Type</a></td><td> </td><td align="left" valign="top"> Identifier type (‘<samp>id</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Composite-Types">1.4.3 Composite Types</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Structure">1.4.3.1 Structure</a></td><td> </td><td align="left" valign="top"> Composition of types (‘<samp>struct</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Union">1.4.3.2 Union</a></td><td> </td><td align="left" valign="top"> One of many types (‘<samp>union</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Array">1.4.3.3 Array</a></td><td> </td><td align="left" valign="top"> Fixed-size array
</td></tr>
<tr><td align="left" valign="top"><a href="#Buffer">1.4.3.4 Buffer (Queue or Stack)</a></td><td> </td><td align="left" valign="top"> Queue or stack of fixed capacity
</td></tr>
<tr><td align="left" valign="top"><a href="#Constraints">1.4.4 Constraints</a></td><td> </td><td align="left" valign="top"> Limiting the range of a type
</td></tr>
</table>
<hr size="6">
<a name="Types-Background"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Data-Types" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Leaf-Types" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Data-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Background"></a>
<h3 class="subsection">1.4.1 Background</h3>
<p>The Maria software stores data in two forms: as trees formed by C++
objects, which are easy to manipulate but use up much space, or as
compact bit strings. Converting structured values to a fixed-length bit
string and vice versa requires that the number of all possible values of
a type is known and that there exists a total order among the values.
</p>
<p>For supporting iteration through all values of a type, there are
successor and predecessor functions and functions for determining the
smallest and the largest value of a type. These are in harmony with the
conversion functions: the numeric representation of the smallest value
of a type is 0, and its successor is 1 (unless the type only has one
value), and so on.
</p>
<hr size="6">
<a name="Leaf-Types"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Types-Background" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Integer" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Data-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Leaf-Types-1"></a>
<h3 class="subsection">1.4.2 Leaf Types</h3>
<p>Data types that do not have any further structure are called <em>leaf
types</em>. In Maria, all leaf types can be represented using a machine
word, an unsigned integer of usually 32 bits.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Integer">1.4.2.1 Integer Types</a></td><td> </td><td align="left" valign="top"> Integer number (‘<samp>int</samp>’ and ‘<samp>unsigned</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Boolean">1.4.2.2 Boolean Type</a></td><td> </td><td align="left" valign="top"> Truth value (‘<samp>bool</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Character">1.4.2.3 Character Type</a></td><td> </td><td align="left" valign="top"> Character (‘<samp>char</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Enumerated">1.4.2.4 Enumerated Type</a></td><td> </td><td align="left" valign="top"> Enumerated integer (‘<samp>enum</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Identifier">1.4.2.5 Identifier Type</a></td><td> </td><td align="left" valign="top"> Identifier type (‘<samp>id</samp>’)
</td></tr>
</table>
<hr size="6">
<a name="Integer"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Leaf-Types" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Boolean" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Leaf-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Integer-Types"></a>
<h4 class="subsubsection">1.4.2.1 Integer Types</h4>
<a name="index-data-types_002c-integer"></a>
<a name="index-int"></a>
<a name="index-unsigned"></a>
<p>There are two predefined integer types: ‘<samp>int</samp>’, a signed integer in
the range <code>INT_MIN</code> to <code>INT_MAX</code>, as defined by
‘<tt><limits.h></tt>’ in C, and ‘<samp>unsigned</samp>’, an unsigned integer in the
range <code>0</code> to <code>UINT_MAX</code>.
</p>
<p>Integer literals are numeric constants, given by the regular expressions
‘<samp>[1-9][0-9]*</samp>’, ‘<samp>0[0-7]*</samp>’ and ‘<samp>0x[0-9a-fA-F]+</samp>’. Negative
decimal numbers are formed using the unary ‘<samp>-</samp>’ operator.
</p>
<p>The unconstrained built-in integer types have <code>INT_MAX-INT_MIN+1</code>
or <code>UINT_MAX+1</code> possible values, both usually
<em>2^32</em>.
The order among the values is determined by integer arithmetics. All
arithmetic operations in the expression evaluator are performed using
the unconstrained integer type. Binary operators require their operands
to be either both signed or both unsigned.
</p>
<hr size="6">
<a name="Boolean"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Integer" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Character" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Leaf-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Boolean-Type"></a>
<h4 class="subsubsection">1.4.2.2 Boolean Type</h4>
<a name="index-data-types_002c-boolean"></a>
<a name="index-bool"></a>
<p>The Boolean type ‘<samp>bool</samp>’ is for storing truth values. It has two
literals: ‘<samp>false</samp>’ (the smallest value) and ‘<samp>true</samp>’.
</p>
<hr size="6">
<a name="Character"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Boolean" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Enumerated" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Leaf-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Character-Type"></a>
<h4 class="subsubsection">1.4.2.3 Character Type</h4>
<a name="index-data-types_002c-character"></a>
<a name="index-char"></a>
<p>Characters internally use the <code>unsigned char</code> type in C++.
Analogously with the unsigned integer type, the smallest value is
<code>0</code> and the largest <code>UCHAR_MAX</code>, and the total number
of different values is <code>UCHAR_MAX+1</code>, usually
<em>2^8</em>.
</p>
<hr size="6">
<a name="Enumerated"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Character" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Identifier" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Leaf-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Enumerated-Type"></a>
<h4 class="subsubsection">1.4.2.4 Enumerated Type</h4>
<a name="index-data-types_002c-enumerated"></a>
<a name="index-enum"></a>
<p>There are two variants of the enumerated type. A constrained
enumerated type acts just like an integer having some named constants.
In the following we will concentrate on the unconstrained variant of
the enumerated type.
</p>
<p>The domain of an unconstrained enumeration ranges from the smallest
enumeration constant to the largest one. The order among the
enumeration constants is determined by their integer value. Enumeration
constants whose value is not explicitly specified in the type definition
get their values just like in the C programming language: it is the
successor of the value given to the last declared constant. By default,
the first constant will get the value 0.
</p>
<hr size="6">
<a name="Identifier"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Enumerated" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Composite-Types" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Leaf-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Identifier-Type"></a>
<h4 class="subsubsection">1.4.2.5 Identifier Type</h4>
<a name="index-data-types_002c-identifier"></a>
<a name="index-id"></a>
<p>In SDL, there is a data type for process identifiers. Values of this
type can only be compared for equality and inequality, and there is an
operator for obtaining a new identifier value. SDL assumes an unlimited
pool of distinct identifier values: the operator for obtaining a new
value will always return something that is different from all previous
values. This is impossible for any practical system. The identifier
type in Maria has otherwise the same properties as the one in SDL, but
one must declare the size of the identifier pool when declaring an
identifier type.
</p>
<p>Internally, identifier values are unsigned integers ranging up to the
size of the identifier pool, exclusive. The operator for obtaining a
new identifier value has not been implemented yet, but quantification
(see section <a href="#Multi_002dSets">Operations on Multi-Sets</a>) is possible. In the future, it is
intended to implement symmetry reductions of the state space, making use
of the properties of the identifier type.
</p>
<hr size="6">
<a name="Composite-Types"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Identifier" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Structure" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Data-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Composite-Types-1"></a>
<h3 class="subsection">1.4.3 Composite Types</h3>
<p>The leaf data types represented in previous section are adequate for
representing any kind of data. Composite data types can be viewed as
syntactic sugar: by defining structural types, one can group data
items together, which can drastically simplify the notation required
for referring to the data items.
</p>
<p>Composite types in Maria are constructed in a truly recursive way.
There are no arbitrary limits. For example, it is entirely possible to
define a buffer of buffers containing a union of an array and a
structure.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Structure">1.4.3.1 Structure</a></td><td> </td><td align="left" valign="top"> Composition of types (‘<samp>struct</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Union">1.4.3.2 Union</a></td><td> </td><td align="left" valign="top"> One of many types (‘<samp>union</samp>’)
</td></tr>
<tr><td align="left" valign="top"><a href="#Array">1.4.3.3 Array</a></td><td> </td><td align="left" valign="top"> Fixed-size array
</td></tr>
<tr><td align="left" valign="top"><a href="#Buffer">1.4.3.4 Buffer (Queue or Stack)</a></td><td> </td><td align="left" valign="top"> Queue or stack of fixed capacity
</td></tr>
</table>
<hr size="6">
<a name="Structure"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Composite-Types" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Union" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Composite-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Structure-1"></a>
<h4 class="subsubsection">1.4.3.1 Structure</h4>
<a name="index-data-types_002c-structure"></a>
<a name="index-struct"></a>
<p>A structure type describes a sequentially allocated set of member
objects, each of which has a distinct name and possibly distinct type.
The order of structure values is determined in little-endian way: the
most significant component is stored last. For instance, the four
values of the type ‘<samp>struct{bool a;bool b}</samp>’ are ordered
‘<samp>{false,false}</samp>’, ‘<samp>{true,false}</samp>’, ‘<samp>{false,true}</samp>’ and
‘<samp>{true,true}</samp>’.
</p>
<p>A structure type that has <em>n</em> members, each member <em>i</em> having
<em>c_i</em>
possible values, has
</p>
<p><em>c_1 * c_2 * ... * c_n</em>
</p>
<p>possible values. An empty structure has only one possible value,
‘<samp>{}</samp>’.
</p>
<hr size="6">
<a name="Union"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Structure" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Array" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Composite-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Union-1"></a>
<h4 class="subsubsection">1.4.3.2 Union</h4>
<a name="index-data-types_002c-union"></a>
<a name="index-union_002c-data-type"></a>
<p>Often there is a need to pass a parameter whose type is determined
dynamically. The tagged union type in Maria serves exactly this
purpose. It describes an overlapping nonempty set of member objects,
each of which have a name and a possibly distinct type. Whenever a
union value is initialized, also the union component must be identified.
</p>
<p>The union can be viewed as a special kind of structure of two
components: the actual value inside the union and the identifier of the
component to which the value belongs. For instance, the values of the
type ‘<samp>union{bool a;struct{} b;}</samp>’ are ordered ‘<samp>a=false</samp>’,
‘<samp>a=true</samp>’ and ‘<samp>b={}</samp>’. A union type that has <em>n</em>
members, each member <em>i</em> having
<em>c_i</em>
possible values, has
</p>
<p><em>c_1 + c_2 + ... + c_n</em>
</p>
<p>possible values.
</p>
<hr size="6">
<a name="Array"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Union" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Buffer" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Composite-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Array-1"></a>
<h4 class="subsubsection">1.4.3.3 Array</h4>
<a name="index-data-types_002c-array"></a>
<p>An array type describes a contiguously allocated nonempty set of objects
with a particular member object, called the <em>element type</em>. The
members (elements) of an array are accessed by indexing the array with
values of the <em>index type</em> of the array. The number of possible
values in the index type determines the number of elements in the array.
</p>
<p>The order of values in an array type is determined in the little-endian
manner. The four values of the type ‘<samp>bool[bool]</samp>’ are ordered
‘<samp>{false,false}</samp>’, ‘<samp>{true,false}</samp>’, ‘<samp>{false,true}</samp>’ and
‘<samp>{true,true}</samp>’.
</p>
<p>An array whose element type has
<em>c_e</em>
possible values and index type
<em>c_i</em>
possible values, has
<em>c_e^c_i</em>
possible values.
</p>
<hr size="6">
<a name="Buffer"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Array" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Constraints" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Composite-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Buffer-_0028Queue-or-Stack_0029"></a>
<h4 class="subsubsection">1.4.3.4 Buffer (Queue or Stack)</h4>
<a name="index-data-types_002c-buffer"></a>
<a name="index-queue"></a>
<a name="index-stack"></a>
<p>Communication protocols use queue-like transmission buffers heavily.
Many algorithms and the translation of procedural programming languages
to Petri Net models require stack-like buffers. The buffer type in
Maria has a maximum size, and it has two variants, queue and stack. A
buffer is much like an array, but it may contain a variable number of
items.
</p>
<p>The order of values is determined in the little-endian manner. Shorter
buffers come first. For instance, the values of the type
‘<samp>bool[queue 2]</samp>’ are ordered ‘<samp>{}</samp>’, ‘<samp>{false}</samp>’,
‘<samp>{true}</samp>’, ‘<samp>{false,false}</samp>’, ‘<samp>{true,false}</samp>’,
‘<samp>{false,true}</samp>’ and ‘<samp>{true,true}</samp>’.
</p>
<p>A buffer of at most <em>n</em> elements whose element type has
<em>c_e</em>
possible values has
</p>
<p>possible values.
</p>
<hr size="6">
<a name="Constraints"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Buffer" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Expressions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Data-Types" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Constraints-1"></a>
<h3 class="subsection">1.4.4 Constraints</h3>
<a name="index-data-types_002c-limiting-with-constraints"></a>
<a name="index-state-space-explosion_002c-avoiding"></a>
<a name="index-_002e_002e"></a>
<p>When performing reachability analysis, it is often desirable to limit
the analysis in many ways to address the problem known as the <em>state
space explosion</em>. One of the ways is to limit the domain of data types.
Instead of considering all 32-bit integer numbers, one may restrict the
analysis to numbers ranging from 0 to 10, for instance.
</p>
<p>In addition to limiting the search, type constraints can act as a
valuable aid for detecting errors in system models. The expression
evaluator will detect and report <em>constraint violations</em> whenever a
subexpression evaluates to an unconstrained value. The successor and
predecessor functions will, however, conveniently wrap around, so that
the successor of the largest value of a type is the smallest value.
</p>
<p>Constraints can be applied to all types whose values can be expressed
with constant literals.<a name="DOCF1" href="maria_fot.html#FOOT1">(1)</a> Not only leaf types can be constrained. For instance,
it is possible (while not necessarily sensible) to define a type
‘<samp>bool(false)[queue 347](..{false})[int(33101)]</samp>’, a single-element
array of a buffer having two possible values: ‘<samp>{{}}</samp>’ and
‘<samp>{{false}}</samp>’.
</p>
<p>The net description language parser computes unions and intersections of
value ranges while parsing constraints, which are internally stored as
unions of disjoint ranges. In addition, it will combine adjacent
constraints and eliminate overlapping constraints. The type
‘<samp>int(1..4,3,5)</samp>’ is thus equivalent with the types
‘<samp>int(1..)(..5)</samp>’ and ‘<samp>int(1..5)</samp>’, the canonical form.
</p>
<hr size="6">
<a name="Expressions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Constraints" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Literals" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Modeling" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Expressions-and-Formulae"></a>
<h2 class="section">1.5 Expressions and Formulae</h2>
<a name="index-expressions_002c-overview"></a>
<p>Expressions form the core of any language. One of the design goals of
the Maria reachability analyzer was to make expressions as rich as
possible, to add expressive power to the language and to make the
language attractive to people who are familiar with and accustomed to
modern high-level programming languages.
</p>
<p>Like the data type system, the expression system of Maria has been
greatly inspired by that of the programming language C. There are no
pointer operations and no expressions with side-effects, and some
operators of our language have no direct counterpart in C.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Literals">1.5.1 Literals</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Constants">1.5.1.1 Constants</a></td><td> </td><td align="left" valign="top"> Anything that is a constant isn’t.
</td></tr>
<tr><td align="left" valign="top"><a href="#Variables">1.5.1.2 Variables</a></td><td> </td><td align="left" valign="top"> Anything that is a variable doesn’t.
</td></tr>
<tr><td align="left" valign="top"><a href="#Dynamic-Errors">1.5.1.3 Dynamic Errors</a></td><td> </td><td align="left" valign="top"> Trapping undefined behavior
</td></tr>
<tr><td align="left" valign="top"><a href="#Operators">1.5.2 Operators</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Integer-Arithmetic">1.5.2.1 Integer Arithmetic</a></td><td> </td><td align="left" valign="top"> Basic integer arithmetic
</td></tr>
<tr><td align="left" valign="top"><a href="#Successor">1.5.2.2 Successor and Predecessor</a></td><td> </td><td align="left" valign="top"> The successor and predecessor functions
</td></tr>
<tr><td align="left" valign="top"><a href="#Comparison">1.5.2.3 Comparison</a></td><td> </td><td align="left" valign="top"> Comparing values
</td></tr>
<tr><td align="left" valign="top"><a href="#Logic">1.5.2.4 Boolean Logic</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Selection">1.5.2.5 Selection</a></td><td> </td><td align="left" valign="top"> The generalized if-then-else operator
</td></tr>
<tr><td align="left" valign="top"><a href="#Type-Casting">1.5.2.6 Type Casting</a></td><td> </td><td align="left" valign="top"> Type conversions
</td></tr>
<tr><td align="left" valign="top"><a href="#Atomicity">1.5.2.7 Atomicity</a></td><td> </td><td align="left" valign="top"> Prohibiting formula transformations
</td></tr>
<tr><td align="left" valign="top"><a href="#Structures">1.5.3 Structures</a></td><td> </td><td align="left" valign="top"> Dealing with the structured type
</td></tr>
<tr><td align="left" valign="top"><a href="#Unions">1.5.4 Unions</a></td><td> </td><td align="left" valign="top"> Dealing with the union type
</td></tr>
<tr><td align="left" valign="top"><a href="#Arrays">1.5.5 Arrays</a></td><td> </td><td align="left" valign="top"> Dealing with arrays
</td></tr>
<tr><td align="left" valign="top"><a href="#Buffers">1.5.6 Buffers</a></td><td> </td><td align="left" valign="top"> Dealing with buffer contents
</td></tr>
<tr><td align="left" valign="top"><a href="#Multi_002dSets">1.6 Operations on Multi-Sets</a></td><td> </td><td align="left" valign="top"> Multi-set operations
</td></tr>
<tr><td align="left" valign="top"><a href="#Temporal">1.7 Temporal Logic</a></td><td> </td><td align="left" valign="top"> Formulae of temporal logic
</td></tr>
</table>
<hr size="6">
<a name="Literals"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Expressions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Constants" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Expressions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Literals-1"></a>
<h3 class="subsection">1.5.1 Literals</h3>
<p>When an expression is viewed as a tree, the leaves of the tree are
called <em>literals</em>. There are three kinds of literals in Maria
expressions: constant values, variable names and the reserved words
‘<samp>undefined</samp>’ and ‘<samp>fatal</samp>’. Also invocations of functions with
zero arguments, also called <em>nullary functions</em> or <em>named
constants</em>, could be viewed as literals, but they can expand to more
complex expressions or formulae.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Constants">1.5.1.1 Constants</a></td><td> </td><td align="left" valign="top"> Anything that is a constant isn’t.
</td></tr>
<tr><td align="left" valign="top"><a href="#Variables">1.5.1.2 Variables</a></td><td> </td><td align="left" valign="top"> Anything that is a variable doesn’t.
</td></tr>
<tr><td align="left" valign="top"><a href="#Dynamic-Errors">1.5.1.3 Dynamic Errors</a></td><td> </td><td align="left" valign="top"> Trapping undefined behavior
</td></tr>
</table>
<hr size="6">
<a name="Constants"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Literals" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Variables" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Literals" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Constants-1"></a>
<h4 class="subsubsection">1.5.1.1 Constants</h4>
<a name="index-constants"></a>
<p>The constants in the Maria languages are type-specific. The Boolean
type (types derived from the built-in ‘<samp>bool</samp>’ type) has two
constants: ‘<samp>false</samp>’ and ‘<samp>true</samp>’. Character types (‘<samp>char</samp>’)
uses single character constants enclosed in single quotes
(see section <a href="#Lexical-Tokens">Lexical Tokens</a>), and integer types (‘<samp>int</samp>’ and
‘<samp>unsigned</samp>’) use decimal, octal or hexadecimal numbers with a
notation familiar from the programming language C.
</p>
<p>There are three unary pseudo-operators that deal with type names and
yield constant. The number-of-values operator ‘<samp>#</samp>’ can be used to
refer to the number of possible values a type can receive. For
instance, ‘<samp>#bool</samp>’ is equivalent to ‘<samp>2</samp>’, unless you have
redefined the built-in type ‘<samp>bool</samp>’ to be something else. The
operators ‘<samp><</samp>’ and ‘<samp>></samp>’ refer to the smallest and to the largest
value of a type, respectively. For instance, you can use ‘<samp><bool</samp>’
interchangeably with ‘<samp>false</samp>’, unless the type has been redefined.
</p>
<p>The constants of enumerated types are written either using numbers, just
as with integer types, or using the names of the enumeration symbols.
The names do not have global scope, and in the cases when the parser
cannot determine the type from the context, you must use the type
casting operator (see section <a href="#Type-Casting">Type Casting</a>). If you want an enumeration
symbol to have global scope, you can define it as a nullary function or
named constant:
</p>
<table><tr><td> </td><td><pre class="example">typedef enum { a, b, c } enum_t;
enum_t a = is enum_t a;
reject <enum_t != a;
</pre></td></tr></table>
<p>Constants of compound types are written using the respective expressions
for creating compound values, restricting the literals in the
expressions to constants. The expressions will be evaluated while
parsing them and replaced with corresponding constants. This is called
<em>constant folding</em>.
</p>
<hr size="6">
<a name="Variables"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Constants" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-Errors" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Literals" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Variables-1"></a>
<h4 class="subsubsection">1.5.1.2 Variables</h4>
<a name="index-variables"></a>
<p>Variables make expressions behave dynamically. In high-level Petri
Nets, variables make the arc expressions of transitions evaluate in
different ways. Each combination of variable–value pairs (usually
referred to as <em>valuation</em>) that enables a transition is called an
enabled <em>instance</em> for the transition.<a name="DOCF2" href="maria_fot.html#FOOT2">(2)</a> Enabled transition
instances are sought in a process called <em>unification</em>
(see section <a href="maria_4.html#Unification">The Unification Algorithm</a>). Variables cannot be explicitly assigned to in
the high-level Petri Net formalism.
</p>
<p>Variables can be declared either explicitly e.g. in the declaration
blocks of transitions, or implicitly in the input arc expressions of
transitions.
</p>
<hr size="6">
<a name="Dynamic-Errors"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Variables" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Operators" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Literals" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Dynamic-Errors-1"></a>
<h4 class="subsubsection">1.5.1.3 Dynamic Errors</h4>
<a name="index-assertions-1"></a>
<a name="index-catching-dynamic-errors"></a>
<p>The ‘<samp>undefined</samp>’ and ‘<samp>fatal</samp>’ keywords can be used to catch
dynamic errors in the model. Both can be seen as type-less nullary
operators. When the ‘<samp>undefined</samp>’ symbol is evaluated while
searching for enabled transition instances, the valuation built so far
will be marked as erroneous and the instance will not be fired. The
‘<samp>fatal</samp>’ keyword is similar, but evaluating it will cause the whole
analysis to be aborted.
</p>
<p>These two keywords are usually used on the right-hand-side of the
if-then-else operator or of the logical ‘<samp>&&</samp>’, ‘<samp>||</samp>’ or
‘<samp>=></samp>’ operators.<a name="DOCF3" href="maria_fot.html#FOOT3">(3)</a> To improve readability, one could define an ‘<samp>assert()</samp>’
macro. Unlike its counterpart in the C library, the following macro
will return a value.
</p>
<table><tr><td> </td><td><pre class="example">bool assert (bool expr) expr || fatal;
place p unsigned: 42;
trans t in { place p: p; }
gate assert (p == 42);
</pre></td></tr></table>
<p>The search for enabled transition instances is an iterative process.
Because of this, expressions containing ‘<samp>undefined</samp>’ and
‘<samp>fatal</samp>’ keywords may be evaluated before the transition instance is
complete. If this is not desirable, the expression for catching dynamic
errors should be placed on an output arc, perhaps on the right-hand-side
of an if-then-else operator.
</p>
<p>If you use either keyword in a gate expression as the right-hand-side of
the ‘<samp>&&</samp>’ operator, you’d better declare the expression atomic by
enclosing it with ‘<samp>atom()</samp>’, so that the parser will not split the
gate expression into two, which would break the short-circuit evaluation
of the ‘<samp>&&</samp>’ operator.
</p>
<hr size="6">
<a name="Operators"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Dynamic-Errors" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Integer-Arithmetic" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Expressions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Operators-1"></a>
<h3 class="subsection">1.5.2 Operators</h3>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Precedence">• Precedence</a></td><td> </td><td align="left" valign="top"> Operator precedence
</td></tr>
<tr><td align="left" valign="top"><a href="#Integer-Arithmetic">1.5.2.1 Integer Arithmetic</a></td><td> </td><td align="left" valign="top"> Basic integer arithmetic
</td></tr>
<tr><td align="left" valign="top"><a href="#Successor">1.5.2.2 Successor and Predecessor</a></td><td> </td><td align="left" valign="top"> The successor and predecessor functions
</td></tr>
<tr><td align="left" valign="top"><a href="#Comparison">1.5.2.3 Comparison</a></td><td> </td><td align="left" valign="top"> Comparing values
</td></tr>
<tr><td align="left" valign="top"><a href="#Logic">1.5.2.4 Boolean Logic</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Selection">1.5.2.5 Selection</a></td><td> </td><td align="left" valign="top"> The generalized if-then-else operator
</td></tr>
<tr><td align="left" valign="top"><a href="#Type-Casting">1.5.2.6 Type Casting</a></td><td> </td><td align="left" valign="top"> Type conversions
</td></tr>
<tr><td align="left" valign="top"><a href="#Atomicity">1.5.2.7 Atomicity</a></td><td> </td><td align="left" valign="top"> Prohibiting formula transformations
</td></tr>
</table>
<a name="Precedence"></a>
<a name="index-operator-precedence"></a>
<p>The operator precedence in the Maria languages is as follows. Each
table row forms a precedence class.
</p><table>
<tr><td width="20%">‘<samp>?:</samp>’<br>(selection)</td><td width="20%">‘<samp>!</samp>’<br>(output)</td><td width="20%">‘<samp>:</samp>’<br>(multi-sets)</td></tr>
<tr><td width="20%">‘<samp>until</samp>’</td><td width="20%">‘<samp>release</samp>’</td><td width="20%">‘<samp>=</samp>’</td></tr>
<tr><td width="20%">‘<samp>=></samp>’</td><td width="20%">‘<samp><=></samp>’</td></tr>
<tr><td width="20%">‘<samp>||</samp>’</td></tr>
<tr><td width="20%">‘<samp>^^</samp>’</td></tr>
<tr><td width="20%">‘<samp>&&</samp>’</td></tr>
<tr><td width="20%">‘<samp><></samp>’</td><td width="20%">‘<samp>[]</samp>’</td><td width="20%">‘<samp>()</samp>’</td></tr>
<tr><td width="20%">‘<samp>|</samp>’</td></tr>
<tr><td width="20%">‘<samp>^</samp>’</td></tr>
<tr><td width="20%">‘<samp>&</samp>’</td></tr>
<tr><td width="20%">‘<samp>!=</samp>’</td><td width="20%">‘<samp>==</samp>’</td></tr>
<tr><td width="20%">‘<samp>>=</samp>’</td><td width="20%">‘<samp><=</samp>’</td><td width="20%">‘<samp><</samp>’</td><td width="20%">‘<samp>></samp>’</td></tr>
<tr><td width="20%">‘<samp><<</samp>’</td><td width="20%">‘<samp>>></samp>’</td></tr>
<tr><td width="20%">‘<samp>+</samp>’</td><td width="20%">‘<samp>-</samp>’</td></tr>
<tr><td width="20%">‘<samp>*</samp>’</td><td width="20%">‘<samp>/</samp>’</td><td width="20%">‘<samp>%</samp>’</td></tr>
<tr><td width="20%">‘<samp>#</samp>’ (binary)</td><td width="20%">‘<samp>is</samp>’</td></tr>
<tr><td width="20%">unary: ‘<samp>~</samp>’, ‘<samp>-</samp>’, ‘<samp>!</samp>’</td><td width="20%">‘<samp>#</samp>’</td><td width="20%">‘<samp><</samp>’, ‘<samp>></samp>’, ‘<samp>|</samp>’, ‘<samp>+</samp>’</td><td width="20%">‘<samp>*</samp>’, ‘<samp>/</samp>’, ‘<samp>%</samp>’</td></tr>
<tr><td width="20%">‘<samp>cardinality</samp>’</td><td width="20%">‘<samp>max</samp>’</td><td width="20%">‘<samp>min</samp>’</td><td width="20%">‘<samp>subset</samp>’<br>(ternary)</td><td width="20%">‘<samp>map</samp>’</td></tr>
<tr><td width="20%">‘<samp>equals</samp>’</td></tr>
<tr><td width="20%">‘<samp>subset</samp>’</td></tr>
<tr><td width="20%">‘<samp>minus</samp>’</td><td width="20%">‘<samp>union</samp>’</td></tr>
<tr><td width="20%">‘<samp>intersect</samp>’</td></tr>
<tr><td width="20%">‘<samp>atom</samp>’</td><td width="20%">‘<samp>is</samp>’ (cast)</td></tr>
<tr><td width="20%">‘<samp>.</samp>’</td><td width="20%">‘<samp>[</samp>’</td><td width="20%">‘<samp>(</samp>’</td></tr>
</table>
<p>Some operators have several meanings. For instance, there are two
variants of the ‘<samp>is</samp>’ operator, one that performs type conversions,
and another that determines whether a union component is active:
</p><table><tr><td> </td><td><pre class="example">expr:
IS typereference expr
|
expr IS name
</pre></td></tr></table>
<hr size="6">
<a name="Integer-Arithmetic"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Operators" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Successor" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Operators" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Integer-Arithmetic-1"></a>
<h4 class="subsubsection">1.5.2.1 Integer Arithmetic</h4>
<a name="index-expressions_002c-arithmetic"></a>
<a name="index-_002d_002c-unary"></a>
<a name="index-_007e_002c-unary"></a>
<a name="index-_002b"></a>
<a name="index-_002d"></a>
<a name="index-_002f"></a>
<a name="index-_002a"></a>
<a name="index-_0025"></a>
<a name="index-_0026"></a>
<a name="index-_007c"></a>
<a name="index-_005e"></a>
<a name="index-_003c_003c"></a>
<a name="index-_003e_003e"></a>
<p>For performing integer arithmetic, the language contains all the integer
operators of C: negation (sign change, unary ‘<samp>-</samp>’), bitwise
complementation (unary ‘<samp>~</samp>’), basic arithmetics (‘<samp>+</samp>’,
‘<samp>-</samp>’, ‘<samp>/</samp>’, ‘<samp>*</samp>’, ‘<samp>%</samp>’) and bit operations (‘<samp>&</samp>’,
‘<samp>|</samp>’, ‘<samp>^</samp>’, ‘<samp><<</samp>’, ‘<samp>>></samp>’).
</p>
<p>Actually there are two sets of integer operators: signed and unsigned
operators. Both operands must be either signed or unsigned, and the
result is accordingly signed or unsigned. Unsigned arithmetics is a
little faster than signed arithmetics. Numeric constants, unsigned by
default, are automatically converted to signed integers. For binary
integer operators, the type of the first operand determines whether the
operation is signed or unsigned.
</p>
<p>All integer operators in Maria have been implemented in terms of the
corresponding C++ operators, but some error handling has been added.
The operators whose result can exceed the limits of the built-in
integer type will detect overflows. These operators are negation,
addition, subtraction and multiplication. The division and modulus
operators will check for division by zero, and the bit shifting
operators will ensure that the amount to be shifted does not exceed
the size of the integer type in bits. Last but not least, if the
result type has a constraint, the result will be checked against it.
</p>
<hr size="6">
<a name="Successor"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Integer-Arithmetic" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Comparison" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Operators" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Successor-and-Predecessor"></a>
<h4 class="subsubsection">1.5.2.2 Successor and Predecessor</h4>
<a name="index-expressions_002c-successor"></a>
<a name="index-expressions_002c-predecessor"></a>
<a name="index-successor-and-predecessor"></a>
<a name="index-_002b_002c-unary"></a>
<a name="index-_007c_002c-unary"></a>
<p>The successor and the predecessor are defined for all ordered types.
All other types than the identifier type and structural types containing
an identifier component are ordered. The successor of the largest value
of a type is the smallest value, whose predecessor in turn is the
largest value.<a name="DOCF4" href="maria_fot.html#FOOT4">(4)</a> No errors can occur while computing the successor
(unary ‘<samp>+</samp>’) or predecessor (unary ‘<samp>|</samp>’).
</p>
<hr size="6">
<a name="Comparison"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Successor" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Logic" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Operators" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Comparison-1"></a>
<h4 class="subsubsection">1.5.2.3 Comparison</h4>
<a name="index-expressions_002c-comparison"></a>
<a name="index-_003d_003d"></a>
<a name="index-_0021_003d"></a>
<a name="index-_003c"></a>
<a name="index-_003c_003d"></a>
<a name="index-_003e_003d"></a>
<a name="index-_003e"></a>
<p>The language contains the usual comparison operators (‘<samp>==</samp>’,
‘<samp>!=</samp>’, ‘<samp><</samp>’, ‘<samp><=</samp>’, ‘<samp>>=</samp>’ and ‘<samp>></samp>’). Equality and
inequality comparisons are available for all types, while other
comparisons are only available for ordered types. The only error that
can occur in a comparison is a constraint violation, in case the result
type is constrained.<a name="DOCF5" href="maria_fot.html#FOOT5">(5)</a>
</p>
<hr size="6">
<a name="Logic"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Comparison" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Selection" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Operators" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Boolean-Logic"></a>
<h4 class="subsubsection">1.5.2.4 Boolean Logic</h4>
<a name="index-expressions_002c-logic"></a>
<a name="index-expressions_002c-short_002dcircuit-evaluation"></a>
<a name="index-_0021"></a>
<a name="index-_0026_0026"></a>
<a name="index-_005e_005e"></a>
<a name="index-_007c_007c"></a>
<a name="index-_003d_003e"></a>
<a name="index-_003c_003d_003e"></a>
<p>Boolean logic in Maria has the familiar operators from C: negation
(unary ‘<samp>!</samp>’), conjunction (‘<samp>&&</samp>’) and disjunction
(‘<samp>||</samp>’). There is also some syntactic sugar: implication
(‘<samp>a=>b</samp>’ is equivalent to ‘<samp>!a||b</samp>’), logical equivalence
(‘<samp>a<=>b</samp>’ is equivalent to ‘<samp>(a&&b)||!(a||b)</samp>’) and logical
exclusive or (‘<samp>a^^b</samp>’, equivalent to ‘<samp>!(a<=>b)</samp>’).
</p>
<p>Also, the language supports universal and existential quantification,
and translates them to conjunctions and disjunctions:
</p>
<table><tr><td> </td><td><pre class="example">formula:
typereference name [ '(' expr ')' ] '&&' formula
|
typereference name [ '(' expr ')' ] '||' formula
</pre></td></tr></table>
<p>For instance, the existential quantification
</p><table><tr><td> </td><td><pre class="example">char a (a>='a' && a<='c') || b==a
</pre></td></tr></table>
<p>expands to the formula ‘<samp>b=='a'||b=='b'||b=='c'</samp>’.
</p>
<p>In the quantified formulae, it is possible to refer to <em>quantified
variables</em>, variables indexed by a quantifier or the preceding value of
a quantifier:
</p><table><tr><td> </td><td><pre class="example">expr:
'.' name [ name ]
|
':' name [ name ]
</pre></td></tr></table>
<p>For instance, if there is a declaration ‘<samp>typedef unsigned (1..3)
index_t</samp>’, the universal quantification
</p><table><tr><td> </td><td><pre class="example">index_t e && (e == <index_t || :n < .n)
</pre></td></tr></table>
<p>is equivalent to ‘<samp>n[1]<n[2]&&n[2]<n[3]</samp>’.
</p>
<p>The conjunction and disjunction operators use <em>short-circuit
evaluation</em>, meaning that the expression is evaluated in depth-first
manner from left to right, and if the value of the left-hand-side
expression of an operator alone can determine the value of the
expression, no matter what the right-hand-side evaluates to, the
right-hand-side will not be evaluated.
</p>
<hr size="6">
<a name="Selection"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Logic" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Type-Casting" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Operators" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Selection-1"></a>
<h4 class="subsubsection">1.5.2.5 Selection</h4>
<a name="index-if_002dthen_002delse_002c-generalized"></a>
<a name="index-expressions_002c-selection"></a>
<a name="index-_003f_003a"></a>
<p>The ternary ‘<samp>?:</samp>’ operator of C selects its second or third argument
based on its first argument interpreted as a truth value. The ‘<samp>?:</samp>’
operator in Maria is more generic. It is not a ternary operator but
<em>n</em>-ary, with <em>n-1</em> being the number of possible values for
the type of its first argument.
</p>
<p>Here is an example of the ‘<samp>?:</samp>’ operator for a type having three
possible values.
</p>
<table><tr><td> </td><td><pre class="example">typedef int (1..3) i3_t;
place p i3_t: 1;
trans t
in { place p: p; }
out { place p: p ? p : |p : +p; };
</pre></td></tr></table>
<p>The left-hand-side of the ‘<samp>?</samp>’ on the output arc of transition
‘<samp>t</samp>’ is the variable ‘<samp>p</samp>’, which is of type ‘<samp>i3_t</samp>’
and has three possible values. When the expression has its largest
value (in this case ‘<samp>3</samp>’), the argument immediately following the
‘<samp>?</samp>’ will be selected. The second largest value (‘<samp>2</samp>’) will
select the third argument (‘<samp>|p</samp>’), and the smallest value (‘<samp>1</samp>’)
will select the last argument (‘<samp>+p</samp>’).
</p>
<p>In this simple example, the marking of place ‘<samp>p</samp>’ will alternate
between ‘<samp>1</samp>’ and ‘<samp>2</samp>’ in two states. It really should be
emphasized that it is the number of values of the type that matters, not
the number of possible (reachable) values for the left-hand-side
expression. Selecting an initial marking ‘<samp>3</samp>’ for place
‘<samp>p</samp>’ would yield only one state in the reachability graph.
</p>
<hr size="6">
<a name="Type-Casting"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Selection" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Atomicity" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Operators" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Type-Casting-1"></a>
<h4 class="subsubsection">1.5.2.6 Type Casting</h4>
<a name="index-data-types_002c-conversions"></a>
<a name="index-is_002c-unary"></a>
<p>The type casting operator, the prefix ‘<samp>is</samp>’, has two purposes.
First, it can be used to set the <em>context type</em> in case it cannot be
determined correctly. The parser is pretty good at guessing the context
type, but there is one remarkable case when it cannot do so. Comparison
expressions occur in Boolean context, but the arguments to the
comparison operator typically are of some other type. If the argument
is an enumeration constant or a construction expression for a compound
value, the context must be set with the ‘<samp>is</samp>’ operator:
</p>
<table><tr><td> </td><td><pre class="example">typedef enum { a, b, c } e3_t;
place p e3_t: a;
trans t
in { place p: p; }
out { place p: b; }
gate p != is e3_t a;
</pre></td></tr></table>
<p>Boolean, integer and character literals will always be detected as such,
no matter what the context type is.
</p>
<p>The dynamic behavior of type casting is to convert a value of one type
to an equivalent value of another type. Type conversion is only allowed
if the two types have at least one common value. The only error that
can occur during the conversion is a constraint violation.
</p>
<p>Also compound values can be converted. Two compound types are
considered compatible for the conversion if all their components are
compatible. A union-typed value can be converted to the type of one of
its components, or vice versa.
</p>
<hr size="6">
<a name="Atomicity"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Type-Casting" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Structures" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Operators" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Atomicity-1"></a>
<h4 class="subsubsection">1.5.2.7 Atomicity</h4>
<a name="index-expressions_002c-prohibiting-transformations"></a>
<a name="index-expressions_002c-atomicity"></a>
<a name="index-atom"></a>
<p>The parser may perform optimizations on expressions by converting them
to equivalent forms. Currently transition gate expressions containing
a conjunction in the top level will be split to several gate
expressions, and it is likely that the model checker will do something
similar to temporal logic formulae.
</p>
<p>The transformations of expressions have one disadvantage: they break
short-circuit evaluation. If you rely on short-circuit evaluation when
writing an expression, it is a good practice to enclose the expression
with ‘<samp>atom()</samp>’, e.g. ‘<samp>atom (y==0||x/y>z)</samp>’. Short-circuit
evaluation takes place with the operators ‘<samp>||</samp>’, ‘<samp>&&</samp>’,
‘<samp>=></samp>’ and ‘<samp>?:</samp>’.
</p>
<hr size="6">
<a name="Structures"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Atomicity" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Unions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Expressions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Structures-1"></a>
<h3 class="subsection">1.5.3 Structures</h3>
<a name="index-expressions_002c-structures"></a>
<a name="index-_002e"></a>
<p>There are two basic operators for structures: for constructing a value
of a structure type and for accessing a structure component. Both
inherit their syntax and semantics from C.
</p>
<table><tr><td> </td><td><pre class="example">expr:
'{' [ [ name ':' ] expr ( ',' [ name ':' ] expr )* ] '}'
|
expr '.' name
</pre></td></tr></table>
<p>In the constructor expression, the expressions for individual components
may be preceded by the name of the corresponding struct component.
</p>
<p>Since Petri nets have no assignment statement, a special operation is
needed for modifying a structure component.
</p>
<table><tr><td> </td><td><pre class="example">expr:
expr '.' '{' name expr '}'
</pre></td></tr></table>
<p>For instance, ‘<samp>a.{b c}</samp>’ has otherwise the same value as the
structure ‘<samp>a</samp>’, but with the component ‘<samp>b</samp>’ equal to ‘<samp>c</samp>’.
</p>
<hr size="6">
<a name="Unions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Structures" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Arrays" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Expressions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Unions-1"></a>
<h3 class="subsection">1.5.4 Unions</h3>
<a name="index-expressions_002c-unions"></a>
<a name="index-unions_002c-active-component"></a>
<a name="index-_003d"></a>
<a name="index-is"></a>
<a name="index-_002e-1"></a>
<p>The union type in Maria is tagged: it is always known which component of
the union has been assigned to (or is the <em>active component</em>), and
this information can also be enquired by using the infix ‘<samp>is</samp>’
operator.
</p>
<table><tr><td> </td><td><pre class="example">expr:
name '=' expr
|
expr IS name
|
expr '.' name
</pre></td></tr></table>
<p>The ‘<samp>.</samp>’ operator can be used to access the value of the active
component. If the specified component is not active, a union violation
will occur.
</p>
<p>Structures and unions are very practical for modeling inherited classes
of object-oriented languages. The example file ‘<tt>object.pn</tt>’ in
the Maria distribution shows how a simple class structure can be
translated to Maria types and how objects can be converted between a
base class and derived classes.
</p>
<hr size="6">
<a name="Arrays"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Unions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Buffers" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Expressions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Arrays-1"></a>
<h3 class="subsection">1.5.5 Arrays</h3>
<a name="index-expressions_002c-arrays"></a>
<a name="index-_003f_002c-unary"></a>
<p>Array values are constructed and indexed with a syntax familiar from the
C programming language.
</p>
<table><tr><td> </td><td><pre class="example">expr:
'{' [ expr ] ( ',' [ expr ] )* '}'
|
expr '[' expr ']'
</pre></td></tr></table>
<p>In addition, the contents of an array can be shifted by a given number
of items. The amount to be shifted is always reduced to the modulo of
number of items in the array. For instance, shifting an array indexed
by Boolean values by an even number of items has no effect.
</p>
<table><tr><td> </td><td><pre class="example">expr:
expr '<<' expr
|
expr '>>' expr
</pre></td></tr></table>
<p>Since Petri nets have no assignment statement, a special operation is
needed for modifying an array item.
</p>
<table><tr><td> </td><td><pre class="example">expr:
expr '.' '{' '[' expr ']' expr '}'
</pre></td></tr></table>
<p>For instance, ‘<samp>a.{[b] c}</samp>’ has otherwise the same value as the
array ‘<samp>a</samp>’, but with the item at ‘<samp>b</samp>’ equal to ‘<samp>c</samp>’.
</p>
<hr size="6">
<a name="Buffers"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Arrays" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Multi_002dSets" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Expressions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Buffers-1"></a>
<h3 class="subsection">1.5.6 Buffers</h3>
<a name="index-buffers"></a>
<a name="index-FIFO-buffers"></a>
<a name="index-LIFO-buffers"></a>
<a name="index-stacks"></a>
<a name="index-queues"></a>
<a name="index-_002b_002c-buffer"></a>
<a name="index-_002d_002c-unary_002c-buffer"></a>
<a name="index-_002a_002c-unary"></a>
<a name="index-_002f_002c-unary"></a>
<a name="index-_0025_002c-unary"></a>
<p>For ideal buffers, two operations ought to be enough: removing an item
for reading, and writing an item. Since there is no well-defined
semantics for Petri Nets whose arc expressions have side-effects,
reading a buffer has to be split in two separate operations: peeking at
an item (‘<samp>*</samp>’) and removing (‘<samp>-</samp>’).
</p>
<p>Some applications need to access buffers out of order. It is possible
to specify the buffer position using an index.
</p>
<table><tr><td> </td><td><pre class="example">expr:
expr index '+' expr
|
'-' expr index
|
expr index '-' expr
|
'*' expr index
index:
[ '[' expr ']' ]
</pre></td></tr></table>
<p>The unary ‘<samp>-</samp>’ operator removes one item from a buffer. With the
binary ‘<samp>-</samp>’ operator, it is possible to remove several successive
items. The second operand indicates the number of items to be removed.
</p>
<p>Many applications need to know the remaining or used buffer capacity.
That is what the unary operators ‘<samp>%</samp>’ and ‘<samp>/</samp>’ are for. It is
also possible to construct the whole buffer contents with one
expression, just like struct and array values.
</p>
<table><tr><td> </td><td><pre class="example">expr:
'{' [ expr ] ( ',' [ expr ] )* '}'
|
'/' expr
|
'%' expr
</pre></td></tr></table>
<hr size="6">
<a name="Multi_002dSets"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Buffers" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Temporal" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Modeling" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Operations-on-Multi_002dSets"></a>
<h2 class="section">1.6 Operations on Multi-Sets</h2>
<a name="index-multi_002dsets"></a>
<a name="index-sets"></a>
<a name="index-marking-expressions"></a>
<a name="index-multiplicity"></a>
<a name="index-quantification"></a>
<a name="index-expressions_002c-multi_002dset-valued"></a>
<a name="index-empty"></a>
<a name="index-place-2"></a>
<a name="index-subset"></a>
<a name="index-equals"></a>
<a name="index-union"></a>
<a name="index-intersect"></a>
<a name="index-minus"></a>
<a name="index-subset_002c-selection"></a>
<a name="index-cardinality"></a>
<a name="index-max"></a>
<a name="index-min"></a>
<a name="index-_0023"></a>
<p>The state of a Petri Net is identified by the distribution of tokens in
the places. The contents of the places, also called <em>markings</em>, can
be represented as multi-sets, which are sets that can contain several
instances of an item, meaning that the <em>multiplicity</em> of an item in
the set may be greater than one.
</p>
<p>Arc expressions of transitions and initialization expressions of the
model typically make use of two multi-set operations. The simpler one,
specifying a multiplicity or a token multiplier, makes use of the binary
‘<samp>#</samp>’ operator.
</p>
<table><tr><td> </td><td><pre class="example">marking:
'(' marking_list ')'
|
expr '#' marking
</pre></td></tr></table>
<p>For instance, ‘<samp>347#33101</samp>’ stands for 347 tokens having the value
33101, and ‘<samp>4#(3#2,1)</samp>’ is another way for expressing
‘<samp>12#2,4#1</samp>’, which means 12 tokens of the value 2 and four tokens of
the value 1.
</p>
<p>The other operation, computing a multi-set sum, is called
<em>quantification</em>.
</p>
<table><tr><td> </td><td><pre class="example">marking:
typereference name [ '(' expr ')' ] ':' marking
</pre></td></tr></table>
<p>The construct will iterate through all the values of the type, binding
each value to a named variable. If the condition expression evaluates
to true when the variable is bound to a value, the marking expression
will be evaluated using that binding, and the resulting items will be
added to the quantification result.
</p>
<p>In transition expressions, it is possible to define <em>quantified
variables</em>, variables indexed by a quantifier:
</p>
<table><tr><td> </td><td><pre class="example">expr:
'.' name [ name ]
|
':' name [ name ]
</pre></td></tr></table>
<p>For instance, writing ‘<samp>bool b: .a</samp>’ is equivalent to writing
‘<samp>"a[false]", "a[true]"</samp>’. The optional second name refers to a
quantifier variable. It is needed in nested quantifications when
indexing a variable by something else than the innermost quantifier.
</p>
<p>The variant with the colon indexes variables based on the predecessor of
the quantifier variable. It is more useful in universal and existential
quantification (see section <a href="#Logic">Boolean Logic</a>).
</p>
<p>There are two multi-set valued literals: the empty set, which is useful
in subset and equality comparisons, and the marking of a place.
</p>
<p>In a formula, the marking of a place is a function of the current state.
In the output arc of a transition, it is defined as the multi-set of
tokens that will be removed from the place by the input arcs of the
transition instance. Referring to the contents of a place in an input
arc or in a gate expression yields a dynamic error.
</p>
<table><tr><td> </td><td><pre class="example">marking:
EMPTY
|
PLACE name
</pre></td></tr></table>
<p>Multi-sets can be compared in two ways. Two sets are equal if both
contain the same amount of the same items. Multi-set <em>A</em> is subset
of multi-set <em>B</em> if for each item in <em>A</em> there are at least as
many such items in <em>B</em>.
</p>
<table><tr><td> </td><td><pre class="example">formula:
marking SUBSET marking
|
marking EQUALS marking
</pre></td></tr></table>
<p>Multi-sets can be combined in three ways. The union of two multi-sets
is computed by adding the multiplicities of all items in each set
together. The intersection is formed by computing the maximum
multiplicity of each item in both sets. Finally, multi-sets can be
subtracted from each other. In <em>A-B</em> there are only items that
have a greater multiplicity in <em>A</em> than in <em>B</em>. The
multiplicity of each item is the difference of the multiplicities in
<em>A</em> and in <em>B</em>.
</p>
<table><tr><td> </td><td><pre class="example">marking:
marking UNION marking
|
marking INTERSECT marking
|
marking MINUS marking
</pre></td></tr></table>
<p>As a special case of intersection, it is possible to filter multi-sets
based on conditions. A named variable will iterate through all the
items in a multi-set, and if the condition expression is true, the item
will be included in the resulting set, with its original multiplicity.
This construct can be viewed as an intersection with a multi-set whose
items have either zero or infinite multiplicity.
</p>
<table><tr><td> </td><td><pre class="example">marking:
SUBSET name '{' marking_list '}' expr
</pre></td></tr></table>
<p>For instance, ‘<samp>subset t { 3#true, 2#false } !t</samp>’ equals
‘<samp>2#false</samp>’.
</p>
<p>There are two mapping operations similar to the filtering operation
described above. One operation preserves the cardinality of a multi-set
(the number of contained items). It transforms a multi-set of one type
to a multi-set of another type by iterating through all the items in the
source multi-set with a named variable, and by computing the items for
the target multi-set by evaluating a basic expression.
</p>
<p>A more generic mapping iterates through a multi-set, assigning the
multiplicity and the value of each distinct item to a pair of variables,
and mapping the items by evaluating a multi-set valued expression.
</p>
<table><tr><td> </td><td><pre class="example">marking:
MAP name '{' marking_list '}' expr
|
MAP name '#' name '{' marking_list '}' marking
</pre></td></tr></table>
<p>For instance, ‘<samp>map t { 3#true, 2#false } !t</samp>’ equals
‘<samp>3#false, 2#true</samp>’, while the expression ‘<samp>map n#t { 3#true,
2#false } (t?1#!t:n#t)</samp>’ evaluates to ‘<samp>3#false</samp>’.
</p>
<p>Last but not least, there are operations for determining the minimum or
maximum multiplicity of the items belonging to a multi-set, or for
computing the cardinality, the sum of the multiplicities. The minimum
multiplicity of an empty set is <code>UINT_MAX</code>.
</p>
<table><tr><td> </td><td><pre class="example">formula:
MAX marking
|
MIN marking
|
CARDINALITY marking
</pre></td></tr></table>
<hr size="6">
<a name="Temporal"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Multi_002dSets" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Output-Variables" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Modeling" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Temporal-Logic"></a>
<h2 class="section">1.7 Temporal Logic</h2>
<a name="index-temporal-operators"></a>
<a name="index-LTL"></a>
<a name="index-expressions_002c-temporal"></a>
<a name="index-_003c_003e"></a>
<a name="index-_005b_005d"></a>
<a name="index-_0028_0029"></a>
<a name="index-until"></a>
<a name="index-release"></a>
<a name="index-_0021-1"></a>
<a name="index-_0026_0026-1"></a>
<a name="index-_005e_005e-1"></a>
<a name="index-_007c_007c-1"></a>
<a name="index-_003d_003e-1"></a>
<a name="index-_003c_003d_003e-1"></a>
<p>The grammar for temporal logic is <em>LTL</em>, Linear Temporal Logic. The
operators “eventually”, “henceforth”, and “in the next state” have
the digraph representations ‘<samp><></samp>’, ‘<samp>[]</samp>’ and ‘<samp>()</samp>’,
respectively.
</p>
<table><tr><td> </td><td><pre class="example"> '<>' formula
|
'[]' formula
|
'()' formula
|
formula UNTIL formula
|
formula RELEASE formula
</pre></td></tr></table>
<hr size="6">
<a name="Output-Variables"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Temporal" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Scoping" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Modeling" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Non_002dDeterminism-in-Transitions"></a>
<h2 class="section">1.8 Non-Determinism in Transitions</h2>
<a name="index-non_002ddeterminism"></a>
<a name="index-output-variables"></a>
<a name="index-variables_002c-output"></a>
<a name="index-random-behavior"></a>
<p>Sometimes it is necessary to have non-deterministic transitions, that
is, transitions that have several possible outputs for one input.
Often such behavior is modeled by adding a ‘<samp>const</samp>’ place to the
net and binding a token from the place to the non-deterministic
transition through a bidirectional arc. This approach may disturb
partial order reduction algorithms.
</p>
<p>The Maria language contains a construct for declaring non-deterministic
transition variables, called <em>output variables</em>. <a name="DOCF6" href="maria_fot.html#FOOT6">(6)</a>
</p>
<table><tr><td> </td><td><pre class="example">expr:
typereference [ name ] '!' [ '(' expr ')' ]
</pre></td></tr></table>
<p>The expression will evaluate to the value of the output variable, which
will iterate through all the values of the type, or to all values for
which the condition expression is true. The output variable can be
given a name, and doing so is recommended if the output variable is used
in several expressions or if a condition expression is used.
</p>
<table><tr><td> </td><td><pre class="example">place p bool: true;
trans t in { place p: p } out { place p: bool! };
</pre></td></tr></table>
<p>The default names for unnamed output variables are ‘<samp>:0</samp>’, ‘<samp>:1</samp>’,
and so on, a colon followed by a hexadecimal number. Those who want to
write obfuscated net descriptions can refer to these names using the
double-quoted notation.
</p>
<hr size="6">
<a name="Scoping"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Output-Variables" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Modeling" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Scoping-of-Identifiers"></a>
<h2 class="section">1.9 Scoping of Identifiers</h2>
<a name="index-scoping_002c-identifiers"></a>
<a name="index-name-spaces"></a>
<a name="index-shadowing-declarations"></a>
<p>Even though Petri Nets are a very flat formalism, there is pretty much
depth in the scoping of names. In the Petri Net level, there are three
name spaces that cannot be overridden: one for place names, one for
transition names and one for data type names. Function names can be
overridden in the transition level.
</p>
<p>In expressions (see section <a href="#Literals">Literals</a>), names can stand for several things.
The names will be looked up in the following order:
</p>
<ol>
<li> function parameters (in a function definition),
</li><li> iterator variables (multi-set operations, non-determinism)
</li><li> previously declared transition variables
</li><li> nullary functions
</li><li> enumeration constants (in the type context)
</li><li> state propositions (in ‘<samp>deadlock</samp>’ and ‘<samp>reject</samp>’ formulae)
</li></ol>
<p>If all the look-ups fail for a name, a transition variable will be
declared, if a transition definition is being parsed and if the type
context is known.
</p>
<p>The parser can issue warning messages about names that exist in several
name spaces. If you know what you are doing, these warnings can safely
be ignored.
</p>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Modeling" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maria_3.html#Analysis" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maria.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maria_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maria_10.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maria_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>root</em> on <em>March 22, 2020</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</font>
<br>
</p>
</body>
</html>
AnonSec - 2021 | Recode By D7net