validation

This commit is contained in:
elvis
2025-11-17 04:04:55 +01:00
parent c16cd0c08d
commit e298bac6cd
24 changed files with 2626 additions and 71 deletions

View File

@ -41,12 +41,11 @@
We call \(\tau \defeq W_0, \ldots, W_n\) the state sequence, where \(W_i \defeq C_i \cup D_i\) for all \(i \in [0, n]\). We call \(\tau \defeq W_0, \ldots, W_n\) the state sequence, where \(W_i \defeq C_i \cup D_i\) for all \(i \in [0, n]\).
\end{definition} \end{definition}
%% TODO figure 1 from 2001 a tour of reaction systems \begin{figure}[h]
% \begin{tikzpicture}[node distance=5mm] \def\svgwidth{\linewidth}
% \node (dot) [terminal] {.}; \import{figures}{reaction_system.pdf_tex}
% \node (digit) [terminal,base right=of dot] {digit}; \caption{Interactive process of a reaction system.}
% \node (E) [terminal,base right=of digit] {E}; \end{figure}
% \end{tikzpicture}
Note that \(C_i\) and \(D_i\) do not have to be disjointed. Note that \(C_i\) and \(D_i\) do not have to be disjointed.
@ -73,10 +72,10 @@
where reactions \(a\) cause the bits to be restrained in the next state if there is no operation, reactions \(b\) implement the increment operation by flipping the least significant zero to one, reactions \(c\) let the more significant bits remain, reactions \(d\) implements the decrement operation by flipping to one the bits when there is no one at a lower position, and reactions \(e\) let the more significant bits remain. where reactions \(a\) cause the bits to be restrained in the next state if there is no operation, reactions \(b\) implement the increment operation by flipping the least significant zero to one, reactions \(c\) let the more significant bits remain, reactions \(d\) implements the decrement operation by flipping to one the bits when there is no one at a lower position, and reactions \(e\) let the more significant bits remain.
The complete RS \(\mathcal{B}_n\) is defined as follows: \(\mathcal{B}_n = \left(S_n, B_n\right)\) where \(S_n = \{p_0, p_1, \ldots, p_{n-1}\} \cup \{dec, inc\}\) and \(B_n = \{a_j, b_j, d_j | 0 \leq k < n\} \cup \{c_{j, k}, e_{j, k} | 0 \leq l < k < n\}\). The complete RS \(\mathcal{B}_n\) is defined as follows: \(\mathcal{B}_n = \left(S_n, B_n\right)\) where\[S_n = \{p_0, p_1, \ldots, p_{n-1}\} \cup \{dec, inc\}\] and \[B_n = \{a_j, b_j, d_j | 0 \leq k < n\} \cup \{c_{j, k}, e_{j, k} | 0 \leq l < k < n\}\]
To illustrate the system in action consider the sequence of contexts: To illustrate the system in action consider the sequence of contexts:
\(C_0 = \{p1, p3\}, C_1 = \emptyset, C_2 = \{inc\}, C_3 = \{inc\}, C_4 = \{dec\}, C_5 = \{dec, inc\}\). This gives the result sequence \(\delta = \emptyset.\{p1, p3\}.\{p1, p3\}.\{p0, p1, p3\}.\{p2, p3\}.\{p0, p1, p3\}.\emptyset\) and state sequence \(\tau = \{p1, p3\}.\{p1, p3\}.\{p1, p3, inc\}.\{p0, p1, p3, inc\}.\{p2, p3, dec\}.\{p0, p1, p3, dec, inc\}.\emptyset\) that in binary representation is \(\{1010\}.\{1010\}.\{1010\}.\{1011\}.\{1100\}.\{1011\}.\{0000\}\) by ignoring \(inc\) and \(dec\). \(C_0 = \{p1, p3\},\\C_1 = \emptyset, C_2 = \{inc\}, C_3 = \{inc\}, C_4 = \{dec\}, C_5 = \{dec, inc\}\). This gives the result sequence \(\delta = \emptyset.\{p1, p3\}.\{p1, p3\}.\{p0, p1, p3\}.\{p2, p3\}.\{p0, p1, p3\}.\emptyset\) and state sequence\\\(\tau = \{p1, p3\}.\{p1, p3\}.\{p1, p3, inc\}.\{p0, p1, p3, inc\}.\{p2, p3, dec\}.\{p0, p1, p3, dec, inc\}.\emptyset\)\\that in binary representation is \(\{1010\}.\{1010\}.\{1010\}.\{1011\}.\{1100\}.\{1011\}.\{0000\}\) by ignoring \(inc\) and \(dec\).
\end{subsection} \end{subsection}
\begin{subsection}{Simple loops} \begin{subsection}{Simple loops}
@ -86,7 +85,7 @@
These loops are called \textit{lollipops}. These loops are called \textit{lollipops}.
For example by providing the set \(\{inc\}\) as the context at each step of the system from Example\ \ref{binary_counter}, we obtain the loop: \(\{p1, p3\}.\{p0, p1, p3\}.\{p3, p2\}.\{p0, p3, p2\}.\{p1, p3, p2\}.\{p0, p1, p3, p2\}.\{\}.\{p0\}.\{p1\}.\{p0, p1\}.\{p2\}.\{p0, p2\}.\{p1, p2\}.\{p0, p1, p2\}.\{p3\}.\{p0, p3\}\). For example by providing the set \(\{inc\}\) as the context at each step of the system from Example\ \ref{binary_counter}, we obtain the loop: \(\{p1, p3\}.\{p0, p1, p3\}.\{p2, p3\}.\{p0, p2, p3\}.\{p1, p2, p3\}.\\\{p0, p1, p2, p3\}.\{\}.\{p0\}.\{p1\}.\{p0, p1\}.\{p2\}.\{p0, p2\}.\{p1, p2\}.\{p0, p1, p2\}.\{p3\}.\{p0, p3\}\).
\end{subsection} \end{subsection}
\end{section} \end{section}
@ -117,7 +116,7 @@
$K$ : ::= % chktex 26 $K$ : ::= % chktex 26
| \textbf{$0$} : nil context % chktex 26 | \textbf{$0$} : nil context % chktex 26
| $X$ : process variable % chktex 26 | $X$ : process variable % chktex 26
| $C.X$ : set of entities followed by context % chktex 26 | $C.X$ : {set of entities\\followed by context} % chktex 26
| $K + K$ : non deterministic choice % chktex 26 | $K + K$ : non deterministic choice % chktex 26
| $\texttt{rec} X . K$ : recursive operator % chktex 26 | $\texttt{rec} X . K$ : recursive operator % chktex 26
;; % chktex 26 ;; % chktex 26
@ -324,7 +323,7 @@
\end{enumerate} \end{enumerate}
\end{itemize} \end{itemize}
\(TS_1\) and \(TS_2\) are bisimulation-equivalent (bisimilar), denoted \(TS_1 ~ TS_2\), if there exists a bisimulation \(\mathcal{R}\) for \((TS_1, TS_2)\). \(TS_1\) and \(TS_2\) are bisimulation-equivalent (bisimilar), denoted \(TS_1 \sim TS_2\), if there exists a bisimulation \(\mathcal{R}\) for \((TS_1, TS_2)\).
\end{definition} \end{definition}
Where \(Post(s)\) is the set of successors of \(s\) defined as Where \(Post(s)\) is the set of successors of \(s\) defined as
@ -427,7 +426,7 @@
When applied to a finite labeled transition system with \(n\) states and \(m\) transitions, the algorithm of Kanellakis and Smolka computes the partition corresponding to bisimilarity in time \(O(n \cdot m)\). When applied to a finite labeled transition system with \(n\) states and \(m\) transitions, the algorithm of Kanellakis and Smolka computes the partition corresponding to bisimilarity in time \(O(n \cdot m)\).
\end{theorem} \end{theorem}
Proof of correctness relies on the fact that when \(changed\) is false, there is no splitter for any of the blocks in \(\pi\). Moreover, if we denote by \(\pi_i\) the partition after the \(i\)-iteration of the main loop, we have \(~ \subseteq ~_i \subseteq \pi_i\). Thus the algorithm terminates with \(\pi = ~\). Proof of correctness relies on the fact that when \(changed\) is false, there is no splitter for any of the blocks in \(\pi\). Moreover, if we denote by \(\pi_i\) the partition after the \(i\)-iteration of the main loop, we have \(\sim \subseteq \sim_i \subseteq \pi_i\). Thus the algorithm terminates with \(\pi = \sim\).
\end{paragraph} \end{paragraph}

View File

@ -1,10 +1,12 @@
\begin{chapter}{Design} \begin{chapter}{Design}
Two sub-problems where identified during the design: simulating the behavior of Reaction Systems, RS processes and other operations on LTS, and interacting with the user in a intuitive manner. The programming language chosen was \href{https://rust-lang.org/}{Rust}, since it offered good performance and ease of development. Two sub-problems where identified during the design: simulating the behavior of Reaction Systems, RS processes and other operations on LTS, and interacting with the user in a intuitive manner. The programming language chosen was Rust\cite{rust_2025}, since it offered good performance and ease of development.
Two Git repositories are provided: \href{https://github.com/elvisrossi/ReactionSystems}{github.com/elvisrossi/ReactionSystems} and \href{https://github.com/elvisrossi/ReactionSystemsGUI}{github.com/elvisrossi/ReactionSystemsGUI}. Two Git repositories are provided: \href{https://github.com/elvisrossi/ReactionSystems}{github.com/elvisrossi/ReactionSystems} and \href{https://github.com/elvisrossi/ReactionSystemsGUI}{github.com/elvisrossi/ReactionSystemsGUI}.
The ReactionSystems project follows a modular architecture and clear design principles to mirror the theoretical model; it implements procedures over RS as pure rust functions and is structured as a library. It also provides a crude Command Line Interface for some of the functions provided. The ReactionSystems project follows a modular architecture and clear design principles to mirror the theoretical model; it implements procedures over RS as pure rust functions and is structured as a library. It also provides a crude Command Line Interface for some of the functions provided.
The code is organized in workspaces in order to reduce compilation time and aid code reuse. The code is organized in workspaces in order to reduce compilation time and aid code reuse.
In the second Git repository a native and web application is implemented in Rust and in \href{https://webassembly.org/}{webassembly} generated from Rust code. The web application consists of only static files and as such may be served by a simple HTTP server. In the second Git repository a native and web application is implemented in Rust and in webassembly\cite{WebAssemblyCoreSpecification2} generated from Rust code. The web application consists of only static files and as such may be served by a simple HTTP server.
In the signature of the functions, types will be displayed in teletype font. The decorator \({}^{?}\) will be used for both option types and for result types without distinction.
\begin{section}{ReactionSystems} \begin{section}{ReactionSystems}
The design is structured to faithfully implement the reaction system formalism while remaining flexible. The design is structured to faithfully implement the reaction system formalism while remaining flexible.
@ -12,7 +14,7 @@
Since the language Rust supports object-oriented programming via traits, but lacks generic inheritance, the design of the basic building blocks of RSs are designed around this limitation. Since the language Rust supports object-oriented programming via traits, but lacks generic inheritance, the design of the basic building blocks of RSs are designed around this limitation.
Usually a basic trait is provided for each of them and an extension of the trait is implemented for all structures that implement the basic trait. Usually a basic trait is provided for each of them and an extension of the trait is implemented for all structures that implement the basic trait.
Since it is not practical for a user to specify the structures in Rust, a syntax for the basic structures has been specified. This syntax tries to remain as much as possible compatible with ones from previous software. To develop the parser, \href{https://github.com/lalrpop/lalrpop}{LALRPOP} was chosen as the parser generator framework. LALRPOP code is transpiled to Rust code via macros and then compiled to machine code. Since it is not practical for a user to specify the structures in Rust, a syntax for the basic structures has been specified. This syntax tries to remain as much as possible compatible with ones from previous software. To develop the parser, LALRPOP\cite{Burgener2025} was chosen as the parser generator framework. LALRPOP code is transpiled to Rust code via macros and then compiled to machine code.
\begin{figure}[!h] \begin{figure}[!h]
\centering \centering
@ -98,7 +100,7 @@
\begin{minipage}{\textwidth} \begin{minipage}{\textwidth}
\centering \centering
\begin{minipage}{.48\textwidth} \begin{minipage}[b][][b]{.38\textwidth}
\centering \centering
\begin{bnf}(relation-sym-map = % chktex 36 \begin{bnf}(relation-sym-map = % chktex 36
{ {
@ -108,19 +110,21 @@
},) },)
$Set$ : ::= % chktex 26 $Set$ : ::= % chktex 26
| $\texttt{\{} S \texttt{\}}$ : % chktex 26 | $\texttt{\{} S \texttt{\}}$ : % chktex 26
| $\texttt{\{} \texttt{\}}$ : % chktex 26
;; % chktex 26 ;; % chktex 26
$S$ : ::= % chktex 26 $S$ : ::= % chktex 26
| $s\ \texttt{,}\ S$ : % chktex 26 | $s\ \texttt{,}\ S$ : % chktex 26
| $s$ : % chktex 26 | $s$ : % chktex 26
| $\epsilon$ : % chktex 26
;; % chktex 26 ;; % chktex 26
Where \\ & \(s\) -> is a string : % chktex 26 Where \\ & \(s\) -> is a string : % chktex 26
;; % chktex 26 ;; % chktex 26
$\epsilon$ -> is the empty string : % chktex 26
;; % chktex 26
\end{bnf} \end{bnf}
\captionsetup{type=table, name=\textbf{Syntax}} \captionsetup{type=table, name=\textbf{Syntax}}
\caption{Syntax for Set}\label{bnf_set} \caption{Syntax for Set}\label{bnf_set}
\end{minipage}% \end{minipage}%
\begin{minipage}{.48\textwidth} \begin{minipage}[b][][b]{.58\textwidth}
\centering \centering
\begin{bnf}(relation-sym-map = % chktex 36 \begin{bnf}(relation-sym-map = % chktex 36
{ {
@ -128,13 +132,13 @@
{->} = {}, {->} = {},
{:in:} = {\ensuremath{\in}}, {:in:} = {\ensuremath{\in}},
},) },)
$PositiveSet$ : ::= % chktex 26 {\small $PositiveSet$} : ::= % chktex 26
| $\texttt{\{} S \texttt{\}}$ : % chktex 26 | $\texttt{\{} S \texttt{\}}$ : % chktex 26
| $\texttt{\{} \texttt{\}}$ : % chktex 26
;; % chktex 26 ;; % chktex 26
$S$ : ::= % chktex 26 $S$ : ::= % chktex 26
| $\mathit{state}\ s\ \texttt{,}\ S$ : % chktex 26 | $\mathit{state}\ s\ \texttt{,}\ S$ : % chktex 26
| $\mathit{state}\ s$ : % chktex 26 | $\mathit{state}\ s$ : % chktex 26
| $\epsilon$ : % chktex 26
;; % chktex 26 ;; % chktex 26
$state$ : ::= % chktex 26 $state$ : ::= % chktex 26
| $\texttt{+}$ : % chktex 26 | $\texttt{+}$ : % chktex 26
@ -142,6 +146,8 @@
;; % chktex 26 ;; % chktex 26
Where \\ & \(s\) -> is a string : % chktex 26 Where \\ & \(s\) -> is a string : % chktex 26
;; % chktex 26 ;; % chktex 26
$\epsilon$ -> is the empty string : % chktex 26
;; % chktex 26
\end{bnf} \end{bnf}
\captionsetup{type=table, name=\textbf{Syntax}} \captionsetup{type=table, name=\textbf{Syntax}}
\caption{Syntax for Positive Set}\label{bnf_positive_set} \caption{Syntax for Positive Set}\label{bnf_positive_set}
@ -167,7 +173,7 @@
\begin{minipage}{\textwidth} \begin{minipage}{\textwidth}
\centering \centering
\begin{minipage}{.48\textwidth} \begin{minipage}{\textwidth}
\centering \centering
\begin{bnf} (relation = {::=|:in:|->}, \begin{bnf} (relation = {::=|:in:|->},
comment = {==}, comment = {==},
@ -186,9 +192,9 @@
\end{bnf} \end{bnf}
\captionsetup{type=table, name=\textbf{Syntax}} \captionsetup{type=table, name=\textbf{Syntax}}
\caption{Syntax for Reaction}\label{bnf_reaction} \caption{Syntax for Reaction}\label{bnf_reaction}
\end{minipage}\vspace{1em} \end{minipage}\vspace{2em}
\begin{minipage}{.48\textwidth} \begin{minipage}{\textwidth}
\centering \centering
\begin{bnf} (relation = {::=|:in:|->}, \begin{bnf} (relation = {::=|:in:|->},
comment = {==}, comment = {==},
@ -221,7 +227,7 @@
\end{itemize} \end{itemize}
\begin{minipage}{\textwidth} \begin{minipage}{\textwidth}
\begin{minipage}{.48\textwidth} \begin{minipage}[b][][b]{.48\textwidth}
\begin{bnf} (relation = {::=|:in:|->}, \begin{bnf} (relation = {::=|:in:|->},
comment = {==}, comment = {==},
relation-sym-map = % chktex 36 relation-sym-map = % chktex 36
@ -258,7 +264,7 @@
\captionsetup{type=table, name=\textbf{Syntax}} \captionsetup{type=table, name=\textbf{Syntax}}
\caption{Syntax for Process}\label{bnf_process} \caption{Syntax for Process}\label{bnf_process}
\end{minipage} \end{minipage}
\begin{minipage}{.48\textwidth} \begin{minipage}[b][][b]{.48\textwidth}
\begin{bnf} (relation = {::=|:in:|->}, \begin{bnf} (relation = {::=|:in:|->},
comment = {==}, comment = {==},
relation-sym-map = % chktex 36 relation-sym-map = % chktex 36
@ -316,8 +322,19 @@
\item \(\texttt{unfold}(a, \mathit{context}: \texttt{process}, \mathit{s}: \texttt{set}) \to \texttt{choices}^{?}\), which returns the list of choices for the context, given the process definitions environment and is used to generate the next systems with the SOS rules. \item \(\texttt{unfold}(a, \mathit{context}: \texttt{process}, \mathit{s}: \texttt{set}) \to \texttt{choices}^{?}\), which returns the list of choices for the context, given the process definitions environment and is used to generate the next systems with the SOS rules.
\end{itemize} \end{itemize}
Some methods are automatically implemented for all \(\texttt{BasicEnvironment}\): \(\texttt{lollipops\_decomposed}\), \(\texttt{lollipops\_prefix\_len\_loop\_decomposed}\), \(\texttt{lollipops\_only\_loop\_decomposed}\), \(\texttt{lollipops\_decomposed\_named}\), \(\texttt{lollipops\_prefix\_len\_loop\_decomposed\_named}\), and \(\texttt{lollipops\_only\_loop\_decomposed\_named}\). These methods are automatically implemented for all \(\texttt{BasicEnvironment}\):
They all try to find a loop and return some information about the found loop. The \(\texttt{\_named}\) variants require a variable symbol for which in the environment there is an association to a process with the form \( X = Q.\texttt{rec}(X)\), where \(Q\) is a set.\vspace{1em} \begin{itemize}
\item \(\texttt{lollipops\_decomposed}\),
\item \(\texttt{lollipops\_decomposed\_named}\),
\item \(\texttt{lollipops\_prefix\_len\_loop\_decomposed}\),
\item \(\texttt{lollipops\_prefix\_len\_loop\_decomposed\_named}\),
\item \(\texttt{lollipops\_only\_loop\_decomposed}\),
\item \(\texttt{lollipops\_only\_loop\_decomposed\_named}\).
\end{itemize}
They all try to find a loop and return some information about the found loop. The \(\texttt{\_named}\) variants require a variable symbol for which in the environment there is an association to a process with the form \( X = Q.\texttt{rec}(X) = Q.X\), where \(Q\) is a set and \(X\) is a variable name. The others instead finds all the symbols that satisfy the constraint and uses them all.
Function \(\texttt{lollipops\_decomposed}\) returns the trace of sets for the prefix and the trace of sets for the loop for each recursive variable.\\
\(\texttt{lollipops\_prefix\_len\_loop\_decomposed}\) returns the length of the prefix and the trace of the loop for each recursive variable.
\(\texttt{lollipops\_only\_loop\_decomposed}\) returns the trace of the loop for each recursive variable.\vspace{1em}
\begin{minipage}{\textwidth} \begin{minipage}{\textwidth}
\centering \centering
@ -336,11 +353,14 @@
$E$ == ::= % chktex 26 $E$ == ::= % chktex 26
| $ x = c \texttt{,} E $ == | $ x = c \texttt{,} E $ ==
| $ x = c $ == | $ x = c $ ==
| $ \epsilon $ ==
;; % chktex 26 ;; % chktex 26
Where \\ & \(c\) -> {is a process, see\ \ref{bnf_process}} == Where \\ & \(c\) -> {is a process, see\ \ref{bnf_process}} ==
;; % chktex 26 ;; % chktex 26
\(x\) -> is a variable name == \(x\) -> is a variable name ==
;; % chktex 26 ;; % chktex 26
\(\epsilon\) -> is the empty string ==
;; % chktex 26
\end{bnf} \end{bnf}
\captionsetup{type=table, name=\textbf{Syntax}} \captionsetup{type=table, name=\textbf{Syntax}}
\caption{Syntax for Environment}\label{bnf_environment} \caption{Syntax for Environment}\label{bnf_environment}
@ -361,11 +381,14 @@
$E$ == ::= % chktex 26 $E$ == ::= % chktex 26
| $ x = pc \texttt{,} E $ == | $ x = pc \texttt{,} E $ ==
| $ x = pc $ == | $ x = pc $ ==
| $ \epsilon $ ==
;; % chktex 26 ;; % chktex 26
Where \\ & \(pc\) -> {is a positive process, see\ \ref{bnf_positive_process}} == Where \\ & \(pc\) -> {is a positive process, see\ \ref{bnf_positive_process}} ==
;; % chktex 26 ;; % chktex 26
\(x\) -> is a variable name == \(x\) -> is a variable name ==
;; % chktex 26 ;; % chktex 26
\(\epsilon\) -> is the empty string ==
;; % chktex 26
\end{bnf} \end{bnf}
\captionsetup{type=table, name=\textbf{Syntax}} \captionsetup{type=table, name=\textbf{Syntax}}
\caption{Syntax for Positive Environment}\label{bnf_positive_environment} \caption{Syntax for Positive Environment}\label{bnf_positive_environment}
@ -374,12 +397,12 @@
\end{subsection} \end{subsection}
\begin{subsection}{System} \begin{subsection}{System}\label{design_system}
The basic interface for systems is only the following methods: The basic interface for systems is only the following methods:
\begin{itemize} \begin{itemize}
\item \(\texttt{to\_transitions\_iterator}(sys) \to \texttt{iterator over (label, system)}\) \item \(\texttt{to\_transitions\_iterator}(sys) \to \texttt{iterator}\text{ that yields }\texttt{(label, system)}\)
\item \(\texttt{to\_slicing\_iterator}(sys) \to \texttt{iterator over (label, system)}\) \item \(\texttt{to\_slicing\_iterator}(sys) \to \texttt{iterator}\text{ that yields }\\\hspace*{0pt}\hfill \texttt{(set, set, [int], system)}\)
\item \(\texttt{context\_elements}(sys) \to \texttt{set}\) \item \(\texttt{context\_elements}(sys) \to \texttt{set}\)
\item \(\texttt{products\_elements}(sys) \to \texttt{set}\) \item \(\texttt{products\_elements}(sys) \to \texttt{set}\)
\end{itemize} \end{itemize}
@ -387,7 +410,7 @@
The method \(\texttt{to\_transitions\_iterator}\) should return an iterator over all the possible evaluations of the system. Likewise \(\texttt{to\_slicing\_iterator}\) should return an iterator over the same outgoing edges, but with information that support the creation of a trace to be used for slicing. The method \(\texttt{to\_transitions\_iterator}\) should return an iterator over all the possible evaluations of the system. Likewise \(\texttt{to\_slicing\_iterator}\) should return an iterator over the same outgoing edges, but with information that support the creation of a trace to be used for slicing.
The two methods \(\texttt{context\_elements}\) and \(\texttt{products\_elements}\) should return the set of entities that are related to the context and the one related to the reactions. Since it may be a computationally expensive calculation, the result is cached in the structures. The two methods \(\texttt{context\_elements}\) and \(\texttt{products\_elements}\) should return the set of entities that are related to the context and the one related to the reactions. Since it may be a computationally expensive calculation, the result is cached in the structures.
Since there may be errors when deciding what constitutes an element belonging to the context, methods are also present to override the default values. The heuristic that decides which elements belong to the context and which belong to the reactions might give incorrect results, so methods are provided that override the calculated values.
Other methods are implemented for all structures that satisfy the previous interface: Other methods are implemented for all structures that satisfy the previous interface:
@ -395,9 +418,10 @@
\item \(\texttt{unfold}(\mathit{sys}) \to \texttt{choices}^{?}\), which, by calling the same method of the environment, returns the list of choices for the context; \item \(\texttt{unfold}(\mathit{sys}) \to \texttt{choices}^{?}\), which, by calling the same method of the environment, returns the list of choices for the context;
\item \(\texttt{run}(\mathit{sys}) \to \texttt{[system]}^{?}\), which computes the sequence of systems for the leftmost execution; \item \(\texttt{run}(\mathit{sys}) \to \texttt{[system]}^{?}\), which computes the sequence of systems for the leftmost execution;
\item \(\texttt{digraph}(\mathit{sys}) \to \texttt{graph}^{?}\), which computes the graph generated by the execution of the system; \item \(\texttt{digraph}(\mathit{sys}) \to \texttt{graph}^{?}\), which computes the graph generated by the execution of the system;
\item \(\texttt{target}(\mathit{sys}) \to \texttt{(integer, set)}^{?}\), which returns the state in one of the terminal states and the number of steps to arrive at the last state; \item \(\texttt{target}(\mathit{sys}) \to \texttt{(integer, set)}^{?}\), which returns the state in one of the terminal states and the number of steps to arrive at the last state;\label{function_target}
\item \(\texttt{slice\_trace}(\mathit{sys}) \to \texttt{trace}^{?}\), which generates, similarly to \(\texttt{run}\), a trace appropriate to run slicing calculations over; \item \(\texttt{slice\_trace}(\mathit{sys}) \to \texttt{trace}^{?}\), which generates, similarly to \(\texttt{run}\), a trace appropriate to run slicing calculations over;
\item \(\texttt{lollipops}(\mathit{sys}) \to \texttt{[([set], [set])]}\), similar to the method \(\texttt{lollipops\_decomposed}\) provided by \(\texttt{environment}\). \item \(\texttt{lollipops}(\mathit{sys}) \to \texttt{[([set], [set])]}\), similar to the method\\\(\texttt{lollipops\_decomposed}\) provided by \(\texttt{environment}\).
\item \(\texttt{lollipops\_only\_loop\_named}(\mathit{sys}, el: \texttt{element}) \to \texttt{[[set]]}^{?}\), similar to the method provided by \(\texttt{environment}\), returns the sequence of entities in the loop individuated by the variable name \(el\) in the environment.
\end{itemize} \end{itemize}
\begin{minipage}{\textwidth} \begin{minipage}{\textwidth}
@ -436,7 +460,7 @@
\end{subsection} \end{subsection}
\begin{subsection}{Label} \begin{subsection}{Label}
The label structure holds the information about how entities are used in the production of a system and are the labels on the edges of the graphs. Since the only use is to hold data, no meaningful method is required. The label structure holds the information about how entities are used in the production of a system and are the labels on the edges of the graphs. Since the only use is to hold data, no meaningful method is required.\vspace{2em}
\begin{minipage}{\textwidth} \begin{minipage}{\textwidth}
\centering \centering
@ -481,7 +505,7 @@
\end{subsection} \end{subsection}
\begin{subsection}{Graph}\label{design_graph} \begin{subsection}{Graph}\label{design_graph}
The project uses \href{https://github.com/petgraph/petgraph}{petgraph} as graph data structure library. \textit{petgraph} provides several graph types, but the only one used is \(\texttt{Graph}\), since it provided the best performance during testing. The library provides methods for converting the graph structures into \href{https://graphviz.org/doc/info/lang.html}{Dot Language} and \href{http://graphml.graphdrawing.org/}{GraphML File Format}. The Dot methods where found to be not powerful enough and where partially rewritten in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/dot.rs}{dot.rs}. The project uses petgraph\cite{Borgna2025} as graph data structure library. \textit{petgraph} provides several graph types, but the only one used is \(\texttt{Graph}\), since it provided the best performance during testing. The library has methods for converting the graph structures into {Dot Language}\cite{graphviz_2025} and {GraphML File Format}\cite{graphml_2025}. The Dot methods where found to be not powerful enough and where partially rewritten in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/dot.rs}{dot.rs}.
Custom formatting of the graphs was a key requirement, so domain specific languages are provided to customize the appearance of the generated formats. Custom formatting of the graphs was a key requirement, so domain specific languages are provided to customize the appearance of the generated formats.
Four structures are provided: Four structures are provided:
@ -493,7 +517,7 @@
\item \(\texttt{EdgeColor}\), to specify the color of each edge. \item \(\texttt{EdgeColor}\), to specify the color of each edge.
\end{itemize} \end{itemize}
Follows the BNF for each of the languages: Follows the BNF for each of the languages:\vspace{2em}
\begin{minipage}{\textwidth} \begin{minipage}{\textwidth}
\centering \centering
@ -767,6 +791,7 @@
| $\texttt{SystemContext}$ == | $\texttt{SystemContext}$ ==
| $\texttt{source}$ == source of edge | $\texttt{source}$ == source of edge
| $\texttt{target}$ == target of edge | $\texttt{target}$ == target of edge
| $\texttt{label}$ == label of an edge
| $\texttt{neightbours}$ == node's neighbours | $\texttt{neightbours}$ == node's neighbours
| $\texttt{system}$ == node's system | $\texttt{system}$ == node's system
;; % chktex 26 ;; % chktex 26
@ -778,7 +803,7 @@
| $\texttt{<}$ == less, set inclusion | $\texttt{<}$ == less, set inclusion
| $\texttt{<=}$ == less equal, set inclusion or equal | $\texttt{<=}$ == less equal, set inclusion or equal
| $\texttt{>}$ == greater, reverse set inclusion | $\texttt{>}$ == greater, reverse set inclusion
| $\texttt{>=}$ == greater equal, reverse set inclusion or equal | $\texttt{>=}$ == {greater equal,\\reverse set inclusion or equal}
| $\texttt{=}\texttt{=}$ == | $\texttt{=}\texttt{=}$ ==
| $\texttt{!=}$ == | $\texttt{!=}$ ==
| $\texttt{+}$ == | $\texttt{+}$ ==
@ -790,10 +815,10 @@
;; % chktex 26 ;; % chktex 26
$binaryP$ == ::= % chktex 26 $binaryP$ == ::= % chktex 26
| $\texttt{substr}$ == logical and | $\texttt{substr}$ ==
| $\texttt{min}$ == logical or % chktex 35 | $\texttt{min}$ == % chktex 35
| $\texttt{max}$ == logical xor % chktex 35 | $\texttt{max}$ == % chktex 35
| $\texttt{commonsubstr}$ == less or set inclusion | $\texttt{commonsubstr}$ ==
;; % chktex 26 ;; % chktex 26
$unaryS$ == ::= % chktex 26 $unaryS$ == ::= % chktex 26
@ -808,6 +833,16 @@
\caption{Syntax for \(\texttt{Assert}\) (Continued)} \caption{Syntax for \(\texttt{Assert}\) (Continued)}
\end{minipage}\vspace{1em} \end{minipage}\vspace{1em}
Four different languages are provided as modules in the workspace \(\texttt{Assert}\):
\begin{itemize}
\item \(\texttt{relabel}\)
\item \(\texttt{grouping}\)
\item \(\texttt{positive\_relabel}\)
\item \(\texttt{positive\_grouping}\)
\end{itemize}
\(\texttt{relabel}\) has, in its syntax, the first token equal to \(\texttt{label}\), has as special variables \(\texttt{label}\) and \(\texttt{edge}\) that function as input, with \(\texttt{edge.label} == \texttt{label}\). It's used for grouping labels before calculating bisimilarity. \(\texttt{grouping}\) has, in its syntax, the first token equal to \(\texttt{node}\), has as special variables \(\texttt{entities}\) and \(\texttt{node}\) that function as input, with \(\texttt{node.system.SystemEntities} == \texttt{entities}\). It's used for grouping nodes. \(\texttt{positive\_relabel}\) and \(\texttt{positive\_grouping}\) have as first token \(\texttt{label}\) and \(\texttt{node}\) respectively and behave in a similar manner compared to their respective functions over RS.%
The template language requires two structures to function relating to the input of the language: a type structure and a value structure. The trait \(\texttt{SpecialVariables}\) holds all the necessary functions that need to be implemented for the special variables to function. Finally the generic language can have the two functions \(\texttt{typecheck}\) and \(\texttt{execute}\) implemented. The template language requires two structures to function relating to the input of the language: a type structure and a value structure. The trait \(\texttt{SpecialVariables}\) holds all the necessary functions that need to be implemented for the special variables to function. Finally the generic language can have the two functions \(\texttt{typecheck}\) and \(\texttt{execute}\) implemented.
The language is very limited and is only designed for simple algorithms since there is no scoping. Typechecking consists in only asserting acceptable types for unary and binary functions, range declaration and for all return statements to return the same type. The language is very limited and is only designed for simple algorithms since there is no scoping. Typechecking consists in only asserting acceptable types for unary and binary functions, range declaration and for all return statements to return the same type.
@ -823,10 +858,10 @@
An experiment is a list of weights and a list of sets of same length. The sets are used as entities given in addition to the context entities when computing the RS.\ The resulting trace is then synthesized into relative frequencies. The methods offered by \(\texttt{Frequency}\) and \(\texttt{PositiveFrequency}\) are: An experiment is a list of weights and a list of sets of same length. The sets are used as entities given in addition to the context entities when computing the RS.\ The resulting trace is then synthesized into relative frequencies. The methods offered by \(\texttt{Frequency}\) and \(\texttt{PositiveFrequency}\) are:
\begin{itemize} \begin{itemize}
\item \(\texttt{naive\_frequency}(sys: \texttt{system}) \to \texttt{frequency}^{?}\), which computes the relative frequency of each entity in all traversed states, assuming the computation is finite; \item \(\texttt{naive\_frequency}(sys: \texttt{system}) \to \texttt{frequency}^{?}\), which computes the relative frequency of each entity in all traversed states, assuming the computation is finite;\label{function_naive_frequency}
\item \(\texttt{loop\_frequency}(sys: \texttt{system}, symbol: \texttt{IdType}) \to \texttt{frequency}\), which computes the relative frequency of each entity in each state of the encountered loop, assuming the system stabilizes in a loop; \item \(\texttt{loop\_frequency}(sys: \texttt{system}, symbol: \texttt{IdType}) \to \texttt{frequency}\), which computes the relative frequency of each entity in each state of the encountered loop, assuming the system stabilizes in a loop;
\item \(\texttt{limit\_frequency}(experiment: \texttt{[set]}, reactions: \texttt{[reaction]}, entities: \texttt{set}) \to \texttt{frequency}^{?}\), which computes the relative frequency of each entity in the states of the last loop by providing repeatedly the sets in the experiment until the system stabilizes in a loop; \item \(\texttt{limit\_frequency}(experiment: \texttt{[set]}, reactions: \texttt{[reaction]}, entities: \texttt{set}) \to \texttt{frequency}^{?}\), which computes the relative frequency of each entity in the states of the last loop by providing repeatedly the sets in the experiment until the system stabilizes in a loop;
\item \(\texttt{fast\_frequency}(experiment: \texttt{[set]}, reactions: \texttt{[reaction]}, entities: \texttt{set}, weights: \texttt{[int]}) \to \texttt{frequency}^{?}\), which computes the weighted relative frequency of each entity in any of the loops. \item \(\texttt{fast\_frequency}(experiment: \texttt{[set]}, reactions: \texttt{[reaction]}, entities: \texttt{set},\\ weights: \texttt{[int]}) \to \texttt{frequency}^{?}\), which computes the weighted relative frequency of each entity in any of the loops.
\end{itemize} \end{itemize}
\begin{minipage}{\textwidth} \begin{minipage}{\textwidth}
@ -841,29 +876,134 @@
| $\texttt{Weights : } W \texttt{ Sets : } S$ == | $\texttt{Weights : } W \texttt{ Sets : } S$ ==
;; % chktex 26 ;; % chktex 26
$W$ == ::= % chktex 26 $W$ == ::= % chktex 26
| $ i \texttt{, } W$ == | $ i \texttt{, } W $ ==
| $ i $ ==
| $ \epsilon $ == | $ \epsilon $ ==
;; % chktex 26 ;; % chktex 26
$S$ == ::= % chktex 26 $S$ == ::= % chktex 26
| $ s \texttt{, } S$ == | $ s \texttt{, } S $ ==
| $ s $ ==
| $ \epsilon $ == | $ \epsilon $ ==
;; % chktex 26 ;; % chktex 26
Where \\ & \(s\) -> is a sets of entities, see\ \ref{bnf_set} == Where \\ & \(s\) -> is a sets of entities, see\ \ref{bnf_set} ==
;; % chktex 26 ;; % chktex 26
\(i\) :in: $\mathbb{Z}$ == % chktex 26 \(i\) :in: $\mathbb{Z}$ == % chktex 26
;; % chktex 26 ;; % chktex 26
\(\epsilon\) -> is the empty string == % chktex 26
;; % chktex 26
\end{bnf} \end{bnf}
\captionsetup{type=table, name=\textbf{Syntax}} \captionsetup{type=table, name=\textbf{Syntax}}
\caption{Syntax for Experiment} \caption{Syntax for Experiment}
\end{minipage} \end{minipage}
\end{subsection} \end{subsection}
\begin{subsection}{Instructions}
The command line interface provided by the workspace \(\texttt{analysis}\) expects as input a path to a file with a RS and some instructions, reads the file, executes the instructions and returns the result in the forms specified. The syntax for specifying instructions is as follows:\vspace{1em}
\begin{minipage}{\textwidth}
\begin{bnf}(relation-sym-map = % chktex 36
{
{::=} = {\ensuremath{\Coloneqq}},
{->} = {},
{:in:} = {\ensuremath{\in}},
},
comment = {==})
$Instructions$ == ::= % chktex 26
| $System\ \mathit{Is}$ ==
| $\texttt{Deserialize (} path \texttt{) } \mathit{Is}$ == % chktex 9
;; % chktex 26
$\mathit{Is}$ == ::= % chktex 26
| $ I, \mathit{Is} $ ==
| $ I $ ==
| $ \epsilon $ ==
;; % chktex 26
Where \\ & \(\epsilon\) -> is the empty string ==
;; % chktex 26
\end{bnf}
\captionsetup{type=table, name=\textbf{Syntax}}
\caption{Syntax for Instructions}
\end{minipage}
\begin{minipage}{\textwidth}
\begin{bnf}(relation-sym-map = % chktex 36
{
{::=} = {\ensuremath{\Coloneqq}},
{->} = {},
{:in:} = {\ensuremath{\in}},
},
comment = {==})
$I$ == ::= % chktex 26
| $ \texttt{Stats > } so $ ==
| $ \texttt{Target > } so $ ==
| $ \texttt{Target ( Limit :} i \texttt{ ) > } so $ == % chktex 9
| $ \texttt{Run > } so $ ==
| $ \texttt{Run ( Limit :} i \texttt{ ) > } so $ == % chktex 9
| $ \texttt{Loop (} el \texttt{) > } so $ == % chktex 9
| $ \texttt{Frequency > } so $ ==
| $ \texttt{LimitFrequency ("} path \texttt{") > } so $ == % chktex 9 chktex 18
| $ \texttt{FastFrequency ("} path \texttt{") > } so $ == % chktex 9 chktex 18
| $ \texttt{Digraph > } gso $ ==
| $ \texttt{Digraph } group \texttt{ > } \mathit{gso} $ ==
| $ \texttt{Bisimilarity ("} path \texttt{") relabel } relabel \texttt{ > } so $ == % chktex 9 chktex 18
;; % chktex 26
$\mathit{gso}$ == ::= % chktex 26
| $g\ \texttt{\textbar}\ \mathit{gso}$ ==
| $g$ ==
;; % chktex 26
$g$ == ::= % chktex 26
| { $\texttt{Dot}$\\ $\texttt{\textbar}\ NodeDisplay$\\ $\texttt{\textbar}\ EdgeDisplay$\\ $\texttt{\textbar}\ NodeColor$\\ $\texttt{\textbar}\ EdgeColor$\\ $\texttt{>}\ so$ } ==
| { $\texttt{GraphML}$\\ $\texttt{\textbar}\ NodeDisplay$\\ $\texttt{\textbar}\ EdgeDisplay$\\ $\texttt{>}\ so$ } ==
| $\texttt{Serialize("} path \texttt{")}$ == % chktex 9 chktex 18
;; % chktex 26
$so$ == ::= % chktex 26
| $\texttt{Print}; so$ ==
| $\texttt{Print}$ ==
| $\texttt{Save ("} path \texttt{")}; so$ == % chktex 9 chktex 18
| $\texttt{Save ("} path \texttt{")}$ == % chktex 9 chktex 18
;; % chktex 26
Where \\ & \(path\) -> is a path to a file ==
;; % chktex 26
\(NodeDisplay\) -> follows the syntax from\ \ref{bnf_node_display} ==
;; % chktex 26
\(EdgeDisplay\) -> follows the syntax from\ \ref{bnf_edge_display} ==
;; % chktex 26
\(NodeColor\) -> follows the syntax from\ \ref{bnf_node_color} ==
;; % chktex 26
\(EdgeColor\) -> follows the syntax from\ \ref{bnf_edge_color} ==
;; % chktex 26
\(group\) -> is a group function with syntax from\ \ref{bnf_assert} ==
;; % chktex 26
\(relabel\) -> is a relabel function with syntax from\ \ref{bnf_assert} ==
;; % chktex 26
\(i\) :in: $\mathbb{N}$ == % chktex 26
;; % chktex 26
\(el\) -> is a string that symbolizes an element ==
;; % chktex 26
\(path\) -> is a path to a file ==
;; % chktex 26
\end{bnf}
\captionsetup{type=table, name=\textbf{Syntax}}
\ContinuedFloat{}
\caption{Syntax for Instructions (Continued)}
\end{minipage}
The instruction \(\texttt{Stats}\) returns static information and statistics about the system. \(\texttt{Target}\) and \(\texttt{Run}\) return the results of the function with the same name defined in section\ \ref{function_target}. \(\texttt{Loop}\) returns the result of the function \(\texttt{lollipops\_only\_loop\_named}\) described in the same section. \(\texttt{Frequency}\) returns the results of \(\texttt{naive\_frequency}\) as described in section\ \ref{function_naive_frequency}. \(\texttt{LimitFrequency}\) and \(\texttt{FastFrequency}\) require a path to an experiment, with syntax described in\ \ref{experiment}, and they return the result of \(\texttt{limit\_frequency}\) and \(\texttt{fast\_frequency}\) respectively. \(\texttt{Digraph}\) may take a function \(group\) that groups together nodes that have the same output, described in section\ \ref{bisimilarity_design}. The graphs can be either saved as a Dot or GraphML file or serialized directly. \(\texttt{Bisimilarity}\) takes a path to another instruction file, whose instructions are ignored, and returns if the two systems are bisimilar. The results can be saved to a file or print to screen or both.
\end{subsection}
\end{section} \end{section}
\begin{section}{ReactionSystemsGUI} \begin{section}{ReactionSystemsGUI}
During development of ReactionSystems, a need for a more intuitive interaction with the structures presented itself. Since the all the operations on the types where already limited and During development of ReactionSystems, a need for a more intuitive interaction with the structures presented itself. Since the all the operations on the types where already limited and
structured, a visual programming language was chosen as the best fit. structured, a visual programming language was chosen as the best fit.
The library \href{https://github.com/trevyn/egui_node_graph2}{\(\texttt{egui\_node\_graph2}\)} was chosen since it offered customizability, performance and ease of programming. The library unfortunately lacked compatibility with the most recent version of \href{https://github.com/emilk/egui}{\(\texttt{egui}\)}, so it is included as a workspace and modified to fit better the need of the project. This way a couple of bugs present in the original code could be fixed. The library {\(\texttt{egui\_node\_graph2}\)}\cite{egui_node_graph22024} was chosen since it offered customizability, performance and ease of programming. The library unfortunately lacked compatibility with the most recent version of {\(\texttt{egui}\)}\cite{Ernerfeldt2025}, so it is included as a workspace and modified to fit better the need of the project.
This way a couple of visual bugs present in the original code have also been fixed.
\(\texttt{egui\_node\_graph2}\) is based on the library \(\texttt{egui}\), which is an immediate mode GUI. % chktex 13 \(\texttt{egui\_node\_graph2}\) is based on the library \(\texttt{egui}\), which is an immediate mode GUI. % chktex 13
It differentiate itself from retained mode GUIs by having all the elements specified at every frame; this eases programming at the expense of performance. The trade-off is favorable since most of the computation will be on the algorithms over RS and the number of elements of the UI will remain small in most cases. It differentiate itself from retained mode GUIs by having all the elements specified at every frame; this eases programming at the expense of performance. The trade-off is favorable since most of the computation will be on the algorithms over RS and the number of elements of the UI will remain small in most cases.

View File

@ -36,7 +36,7 @@ impl PrintableWithTranslator for Set {
\end{subsection} \end{subsection}
\begin{subsection}{Set} \begin{subsection}{Set}
The structure \(\texttt{set}\), implemented in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/set.rs}{set.rs}, is a key component for all functions in the library. It is realized as a \href{https://doc.rust-lang.org/std/collections/struct.BTreeSet.html}{binary tree set}. Binary trees were chosen instead of hash sets for various reasons: binary trees support hashing of the whole tree, hash sets do not; the penalty for retrieval of individual elements is offset by the performance gain for set operations like union or intersection. The structure \(\texttt{set}\), implemented in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/set.rs}{set.rs}, is a key component for all functions in the library. It is realized as a {binary tree set}\cite{btree_2025}. Binary trees were chosen instead of hash sets for various reasons: binary trees support hashing of the whole tree, hash sets do not; the penalty for retrieval of individual elements is offset by the performance gain for set operations like union or intersection.
\end{subsection} \end{subsection}
\begin{subsection}{Reaction} \begin{subsection}{Reaction}
@ -44,17 +44,19 @@ impl PrintableWithTranslator for Set {
\end{subsection} \end{subsection}
\begin{subsection}{Process, Choices and Environment} \begin{subsection}{Process, Choices and Environment}
Context processes, available in \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/process.rs}{process.rs}, have been implemented as trees. Each pointer to the next process is an \href{https://doc.rust-lang.org/std/sync/struct.Arc.html}{\(\texttt{Arc}\)} so that they may be used in concurrent applications, like ReactionSystemsGUI.\ There is no need for interior mutability, so no mutex or semaphore is used. The name of variables used to identify environment processes are converted like entities from strings to integers and they are handled by \(\texttt{Translator}\), since there no reason was found to distinguish them. Context processes, available in \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/process.rs}{process.rs}, have been implemented as trees. Each pointer to the next process is an {\(\texttt{Arc}\)}\cite{arc_2025} so that they may be used in concurrent applications, like ReactionSystemsGUI.\ There is no need for interior mutability, so no mutex or semaphore is used. The name of variables used to identify environment processes are converted like entities from strings to integers and they are handled by \(\texttt{Translator}\), since there no reason was found to distinguish them.
The structure \(\texttt{Choices}\) is available in \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/choices.rs}{choices.rs}; \(\texttt{Environment}\) is available in file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/environment.rs}{environment.rs}. The structure \(\texttt{Choices}\) is available in \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/choices.rs}{choices.rs}; \(\texttt{Environment}\) is available in file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/environment.rs}{environment.rs}.
\(\texttt{Environment}\) has been implemented as a binary tree like sets, in order to be able to hash them; even tho no set operations are needed, the performance penalty is small enough. \(\texttt{Environment}\) has been implemented as a binary tree like sets, in order to be able to hash them; even tho no set operations are needed, the performance penalty is small enough.
\end{subsection} \end{subsection}
\begin{subsection}{System} \begin{subsection}{System}\label{development_system}
Systems are implemented in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/system.rs}{system.rs}. Systems are composed by an environment, a set of initial entities, a process and a vector of reaction rules. Two other private fields are used: \(\texttt{context\_elements}\) and \(\texttt{products\_elements}\). They hold the set of entities that concern context and the ones that concert the products, such that their union is equal to all the entities available to the system and their intersection is the empty set. These two fields are not public since their computation may be particularly expensive, but is not needed for most of the calculations. So it would be wasteful to compute when creating the system and would be unwieldy to cache the result in every function that uses the results. The choice was to make \(\texttt{System}\) as a structure with interior mutability. This property is checked by the Rust compiler and forbids one from using the structure in hash maps or binary trees. But since we know that these two fields are completely determined by the other four, we ignore them when calculating the hash and assure the compiler of their stability in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/clippy.toml}{clippy.toml}, where it is specified that both \(\texttt{System}\) and \(\texttt{PositiveSystem}\) are to be ignored. Systems are implemented in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/system.rs}{system.rs}. Systems are composed by an environment, a set of initial entities, a process and a vector of reaction rules. Two other private fields are used: \(\texttt{context\_elements}\) and \(\texttt{products\_elements}\). They hold the set of entities that concern context and the ones that concert the products, such that their union is equal to all the entities available to the system and their intersection is the empty set. These two fields are not public since their computation may be particularly expensive, but is not needed for most of the calculations. So it would be wasteful to compute when creating the system and would be unwieldy to cache the result in every function that uses the results. The choice was to make \(\texttt{System}\) as a structure with interior mutability. This property is checked by the Rust compiler and forbids one from using the structure in hash maps or binary trees. But since we know that these two fields are completely determined by the other four, we ignore them when calculating the hash and assure the compiler of their stability in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/clippy.toml}{clippy.toml}, where it is specified that both \(\texttt{System}\) and \(\texttt{PositiveSystem}\) are to be ignored.
Since the automatic assignment to context or product element can be erroneous, nodes to overwrite these values are available in ReactionSystemsGUI.\ Since the automatic assignment to context or product element can be erroneous, nodes to overwrite these values are available in ReactionSystemsGUI.\
The two key functions \(\texttt{to\_transition\_iterator}\) and \(\texttt{to\_slicing\_iterator}\) specify that they return an iterator, a lazy structure with a \(\texttt{next}\) method for obtaining the following value. This is to allow for a more efficient implementation in cases where not all states are needed.
\end{subsection} \end{subsection}
\begin{subsection}{Label} \begin{subsection}{Label}
@ -92,7 +94,7 @@ pub type PositiveSystemGraph =
Graph<PositiveSystem, PositiveLabel, Directed, u32>; Graph<PositiveSystem, PositiveLabel, Directed, u32>;
\end{minted} \end{minted}
in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/graph.rs}{graph.rs}, where \(\texttt{Graph}\) is from the library \href{https://docs.rs/petgraph/latest/petgraph/graph/struct.Graph.html}{petgraph}. This was done to leverage the traits provided already by the external library. in the file \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/graph.rs}{graph.rs}, where \(\texttt{Graph}\) is from the library {petgraph}\cite{Borgna2025}. This was done to leverage the traits provided already by the external library.
\(\texttt{Graph}\texttt{<N, E, Ty, Ix>}\) takes four generic parameters: \(\texttt{Graph}\texttt{<N, E, Ty, Ix>}\) takes four generic parameters:
\begin{itemize} \begin{itemize}
\item Associated data \(N\) for nodes and \(E\) for edges, called weights. The associated data can be of arbitrary type; \item Associated data \(N\) for nodes and \(E\) for edges, called weights. The associated data can be of arbitrary type;
@ -110,17 +112,11 @@ pub type PositiveSystemGraph =
The four structures --- \(\texttt{NodeDisplay}\), \(\texttt{EdgeDisplay}\), \(\texttt{NodeColor}\), and \(\texttt{EdgeColor}\) --- all have the \(\texttt{generate}\) and \(\texttt{generate\_positive}\) methods, which convert the relative structure into an executable function that can be used when creating Dot or GraphML documents. No unified trait has been defined since the functions returned have different types and the use for this trait may be limited. The four structures --- \(\texttt{NodeDisplay}\), \(\texttt{EdgeDisplay}\), \(\texttt{NodeColor}\), and \(\texttt{EdgeColor}\) --- all have the \(\texttt{generate}\) and \(\texttt{generate\_positive}\) methods, which convert the relative structure into an executable function that can be used when creating Dot or GraphML documents. No unified trait has been defined since the functions returned have different types and the use for this trait may be limited.
\end{subsection} \end{subsection}
\begin{subsection}{Tests}
During the development of the library some tests were developed in order to test behavior in the changing code. They can be run with \(\texttt{cargo test}\). Test coverage is not high, but is present in for pieces of code that might break more easily. Tests are usually present in a separate file as the structure declaration and are named ``*\_test.rs'', so that they might be easily recognized.
In addition to automated tests, some example inputs are provided in the folder \href{https://github.com/elvisrossi/ReactionSystems/tree/master/testing}{{\tt testing}}. The extension \(\texttt{.system}\) symbolizes system and associated instructions; the extension \(\texttt{.experiment}\) symbolizes an experiment, see\ \ref{experiment}.
\end{subsection}
\begin{subsection}{Slicing Trace} \begin{subsection}{Slicing Trace}
Since traces are only lists of states, often no type associated with them is provided; some trace types are present in \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/trace.rs}{trace.rs}. Since traces are only lists of states, often no type associated with them is provided; some trace types are present in \href{https://github.com/elvisrossi/ReactionSystems/blob/master/rsprocess/src/trace.rs}{trace.rs}.
Of particular interest is the structure \(\texttt{SlicingTrace<S, R, Sys>}\). Of particular interest is the structure\\\(\texttt{SlicingTrace<S, R, Sys>}\).
Instead of using traits, it was more convenient to use generic type parameters for the slices structures. Instead of using traits, it was more convenient to use generic type parameters for the slices structures.
For both RS and Positive RS the method \(\texttt{slice}\) faithfully implements the algorithm described in subsection\ \ref{slicing}. For both RS and Positive RS the method \(\texttt{slice}\) faithfully implements the algorithm described in section\ \ref{slicing}.
A new slice structure is returned because often the previous slice might get reused as input to other slicings. This occurs in a minor performance penalty if only one slice is requested. A new slice structure is returned because often the previous slice might get reused as input to other slicings. This occurs in a minor performance penalty if only one slice is requested.
\end{subsection} \end{subsection}
@ -229,7 +225,7 @@ struct CacheInternals {
Nodes are organized in categories and can be added with right click of the mouse. Nodes are organized in categories and can be added with right click of the mouse.
The canvas can be zoomed and panned, helping the user organize the nodes. The canvas can be zoomed and panned, helping the user organize the nodes.
An peculiar node is the ``String to SVG'' one. It takes a Dot file as string as an input and outputs an SVG value. The string is first parsed as an Dot file using the library \href{https://docs.rs/layout-rs/latest/layout/}{layout}, then the resulting graph is converted to a tree that represents an SVG.\ Then it is converted into string to be able to be parsed again by the library \href{https://docs.rs/resvg/latest/resvg/}{resvg}. Finally an image buffer is allocated and the tree is rendered on the pixel map. Since egui library is not optimized to display arbitrary images, the pixel map is then converted to texture so that it may be cached more easily. To save on space the texture is not serialized and is recomputed when needed. The result can be either displayed on screen or saved as a PNG image. An peculiar node is the ``String to SVG'' one. It takes a Dot file as string as an input and outputs an SVG value. The string is first parsed as an Dot file using the library {layout}\cite{Rotem2025}, then the resulting graph is converted to a tree that represents an SVG.\ Then it is converted into string to be able to be parsed again by the library {resvg}\cite{Stampfl2025}. Finally an image buffer is allocated and the tree is rendered on the pixel map. Since egui library is not optimized to display arbitrary images, the pixel map is then converted to texture so that it may be cached more easily. To save on space the texture is not serialized and is recomputed when needed. The result can be either displayed on screen or saved as a PNG image.
The code for the render of SVG files is implemented in \href{https://github.com/elvisrossi/ReactionSystemsGUI/blob/main/reaction_systems_gui/src/svg.rs}{svg.rs}. The code for the render of SVG files is implemented in \href{https://github.com/elvisrossi/ReactionSystemsGUI/blob/main/reaction_systems_gui/src/svg.rs}{svg.rs}.
@ -242,14 +238,14 @@ cargo build -p "reaction\_systems\_gui" --release --all-features
--lib --target wasm32-unknown-unknown --lib --target wasm32-unknown-unknown
\end{minted} \end{minted}
that builds for the target wasm32. Then using \href{https://github.com/wasm-bindgen/wasm-bindgen}{wasm-bindgen} we create the appropriate bindings with the command that builds for the target wasm32. Then using {wasm-bindgen}\cite{wasm-bindgen2025} we create the appropriate bindings with the command
\begin{minted}{sh} \begin{minted}{sh}
wasm-bindgen "[..]/reaction\_systems\_gui.wasm" --out-dir docs wasm-bindgen "[..]/reaction\_systems\_gui.wasm" --out-dir docs
--no-modules --no-typescript --no-modules --no-typescript
\end{minted} \end{minted}
As an additional step we optimize using \(\texttt{wasm-opt}\) from the library \href{https://github.com/WebAssembly/binaryen}{binaryen} with As an additional step we optimize using \(\texttt{wasm-opt}\) from the library {binaryen}\cite{binaryen_2025} with
\begin{minted}{sh} \begin{minted}{sh}
wasm-opt "[..]/reaction\_systems\_gui\_bg.wasm" -O2 --fast-math wasm-opt "[..]/reaction\_systems\_gui\_bg.wasm" -O2 --fast-math

View File

@ -60,3 +60,141 @@
month = 12, month = 12,
pages = {973989} pages = {973989}
} }
@Online{rust_2025,
accessed = {2025-09-14},
author = {The Rust teams},
title = {Rust Programming Language},
url = {https://rust-lang.org/}
}
@report{WebAssemblyCoreSpecification2,
title = {{WebAssembly Core Specification}},
version = {2.0},
editor = {Rossberg, Andreas},
date = {2025-09-14},
institution = {{W3C}},
url = {https://www.w3.org/TR/wasm-core-2/},
langid = {english},
}
@software {Burgener2025,
author = {Daniel Burgener},
title = {{lalrpop}: convenient LR(1) parser generator},
url = {https://github.com/lalrpop/lalrpop},
date = {2025-05-22},
version = {0.22.2},
license = {Apache-2.0 OR MIT},
}
@software {Borgna2025,
author = {Agustín Borgna},
title = {{petgraph}: Graph data structure library. Provides
graph types and graph algorithms.},
url = {https://github.com/petgraph/petgraph},
date = {2025-09-30},
version = {0.8.3},
license = {MIT OR Apache-2.0},
}
@Online{graphviz_2025,
accessed = {2025-09-14},
title = {Graphviz is open source graph visualization
software.},
author = {Ellson, John},
url = {https://graphviz.org/doc/info/lang.html},
}
@Online{graphml_2025,
accessed = {2025-09-14},
title = {GraphML is a comprehensive and easy-to-use file
format for graphs.},
author = {The GraphML Team},
url = {http://graphml.graphdrawing.org/},
}
@software {egui_node_graph22024,
author = {trevyn},
title = {{egui\_node\_graph2}: A helper library to create
interactive node graphs using egui},
url = {https://github.com/trevyn/egui_node_graph2},
date = {2024-11-03},
version = {0.7.0},
license = {MIT},
}
@software {Ernerfeldt2025,
author = {Emil Ernerfeldt},
title = {{egui}: An easy-to-use immediate mode GUI that runs
on both web and native},
url = {https://github.com/emilk/egui},
date = {2025-11-13},
version = {0.33.2},
license = {MIT OR Apache-2.0},
}
@Online{btree_2025,
accessed = {2025-09-14},
title = {An ordered set based on a B-Tree.},
author = {The Rust teams},
url = {https://doc.rust-lang.org/std/collections/struct.BTreeSet.html},
}
@Online{arc_2025,
accessed = {2025-09-14},
title = {A thread-safe reference-counting pointer. Arc
stands for Atomically Reference Counted.},
author = {The Rust teams},
url = {https://doc.rust-lang.org/std/sync/struct.Arc.html},
}
@software {Rotem2025,
author = {Nadav Rotem},
title = {{layout-rs}: A graph visualization program},
url = {https://github.com/nadavrot/layout},
date = {2025-04-24},
version = {0.1.3},
license = {MIT},
}
@software {Stampfl2025,
author = {Laurenz Stampfl},
title = {{resvg}: An SVG rendering library.},
url = {https://github.com/linebender/resvg},
date = {2025-04-17},
version = {0.45.1},
license = {Apache-2.0 OR MIT},
}
@software {wasm-bindgen2025,
author = {daxpedda},
title = {{wasm-bindgen}: Easy support for interacting between
JS and Rust.},
url = {https://github.com/wasm-bindgen/wasm-bindgen},
date = {2025-10-27},
version = {0.2.105},
license = {MIT OR Apache-2.0},
}
@Software{binaryen_2025,
title = {{binaryen}: a compiler and toolchain infrastructure
library for WebAssembly, written in C++.},
date = {2025-10-27},
url = {https://github.com/WebAssembly/binaryen},
}
@Manual{manualperf_2025,
title = {perf(1) — Linux manual page},
edition = {6.17-2},
month = 11,
year = 2025,
}
@software {Ochtman2025,
author = {Dirkjan Ochtman},
title = {{flamegraph}: A simple cargo subcommand for generating flamegraphs, using inferno under the hood},
url = {https://github.com/flamegraph-rs/flamegraph},
date = {2025-11-07},
version = {0.6.10},
license = {MIT OR Apache-2.0},
}

Binary file not shown.

View File

@ -11,13 +11,13 @@
\usepackage{fontspec} \usepackage{fontspec}
\directlua{ \directlua{
luaotfload.add_fallback ("fallbacktest", luaotfload.add_fallback ("fallbackscript",
{ {
"freeserif:mode=harf;script=dev2;color=000000;", "freeserif:mode=harf;script=dev2;color=000000;",
}) })
} }
\setmainfont{latinmodernroman}[RawFeature={fallback=fallbacktest}] \setmainfont{latinmodernroman}[RawFeature={fallback=fallbackscript}]
\usepackage[italian,main=english]{babel} %% language \usepackage[italian,main=english]{babel} %% language
@ -216,6 +216,8 @@
\input{validation} \input{validation}
\input{conclusion} \input{conclusion}
\printbibliography%
\end{document} \end{document}
%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %% %% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %%

BIN
figures/bifurcated.pdf Normal file

Binary file not shown.

104
figures/bifurcated.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 77 KiB

BIN
figures/bifurcated_gui.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 KiB

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 348 KiB

BIN
figures/flamegraph_mex5.pdf Normal file

Binary file not shown.

491
figures/flamegraph_mex5.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 96 KiB

BIN
figures/reaction_system.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,97 @@
%% Creator: Inkscape 1.4.2 (ebf0e940, 2025-05-08), www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'reaction_system.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\newcommand*\fsize{\dimexpr\f@size pt\relax}%
\newcommand*\lineheight[1]{\fontsize{\fsize}{#1\fsize}\selectfont}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{2813.17492387bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.42342253)%
\lineheight{1}%
\setlength\tabcolsep{0pt}%
\put(0,0){\includegraphics[width=\unitlength,page=1]{reaction_system.pdf}}%
\put(0.15467778,0.32842369){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=2]{reaction_system.pdf}}%
\put(0.28874122,0.32842369){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=3]{reaction_system.pdf}}%
\put(0.42280465,0.32842369){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=4]{reaction_system.pdf}}%
\put(0.55686808,0.32842369){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=5]{reaction_system.pdf}}%
\put(0.6909315,0.32842369){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=6]{reaction_system.pdf}}%
\put(0.82499493,0.32842369){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0.95907919,0.1523901){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=7]{reaction_system.pdf}}%
\put(0.28876205,0.1523901){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=8]{reaction_system.pdf}}%
\put(0.42282548,0.1523901){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=9]{reaction_system.pdf}}%
\put(0.5568889,0.1523901){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=10]{reaction_system.pdf}}%
\put(0.69095233,0.1523901){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=11]{reaction_system.pdf}}%
\put(0.82501576,0.1523901){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}...\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=12]{reaction_system.pdf}}%
\put(0.15116558,0.14609298){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$\emptyset$\end{tabular}}}}%
\put(0.08217495,0.14421148){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$\delta :$\end{tabular}}}}%
\put(0.08217495,0.32887498){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$\gamma :$\end{tabular}}}}%
\put(0.15477498,0.40209426){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$C_0$\end{tabular}}}}%
\put(0.28887849,0.40209426){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$C_1$\end{tabular}}}}%
\put(0.42356835,0.40209426){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$C_2$\end{tabular}}}}%
\put(0.55761096,0.40209426){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$C_3$\end{tabular}}}}%
\put(0.69105648,0.40209426){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$C_4$\end{tabular}}}}%
\put(0.82563368,0.40209426){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$C_5$\end{tabular}}}}%
\put(0.15477498,0.00725942){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$D_0$\end{tabular}}}}%
\put(0.28887849,0.00725942){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$D_1$\end{tabular}}}}%
\put(0.42356835,0.00725942){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$D_2$\end{tabular}}}}%
\put(0.55761096,0.00725942){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$D_3$\end{tabular}}}}%
\put(0.69105648,0.00725942){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$D_4$\end{tabular}}}}%
\put(0.82563368,0.00619299){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$D_5$\end{tabular}}}}%
\put(0.96021089,0.00619299){\color[rgb]{0,0,0}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$D_6$\end{tabular}}}}%
\end{picture}%
\endgroup%

620
figures/reaction_system.svg Normal file
View File

@ -0,0 +1,620 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1"
inkscape:version="1.4.2 (ebf0e940, 2025-05-08)"
sodipodi:docname="asd.svg"
inkscape:export-filename="reaction_system.pdf"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="0.17204868"
inkscape:cx="1002.6232"
inkscape:cy="973.56168"
inkscape:window-width="1088"
inkscape:window-height="920"
inkscape:window-x="0"
inkscape:window-y="34"
inkscape:window-maximized="0"
inkscape:current-layer="g36" />
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g5"
inkscape:label="h"
transform="translate(-0.42275407,3.7560547)">
<g
id="g4"
transform="translate(-1.6137316,0.45138095)"
inkscape:label="h1"
sodipodi:insensitive="true">
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1"
width="65.902145"
height="97.999565"
x="22.536486"
y="26.292564"
ry="19.212963" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="55.542679"
y="75.740211"
id="text4"><tspan
sodipodi:role="line"
id="tspan4"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="55.542679"
y="75.740211">...</tspan></text>
</g>
<g
id="g4-3"
transform="translate(131.43425,0.45138095)"
inkscape:label="h2"
sodipodi:insensitive="true">
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-1"
width="65.902145"
height="97.999565"
x="22.536486"
y="26.292564"
ry="19.212963" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="55.542679"
y="75.740211"
id="text4-8"><tspan
sodipodi:role="line"
id="tspan4-8"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="55.542679"
y="75.740211">...</tspan></text>
</g>
<g
id="g4-1"
transform="translate(264.48223,0.45138095)"
inkscape:label="h3"
sodipodi:insensitive="true">
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-9"
width="65.902145"
height="97.999565"
x="22.536486"
y="26.292564"
ry="19.212963" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="55.542679"
y="75.740211"
id="text4-7"><tspan
sodipodi:role="line"
id="tspan4-2"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="55.542679"
y="75.740211">...</tspan></text>
</g>
<g
id="g4-0"
transform="translate(397.53021,0.45138095)"
inkscape:label="h4"
sodipodi:insensitive="true">
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-2"
width="65.902145"
height="97.999565"
x="22.536486"
y="26.292564"
ry="19.212963" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="55.542679"
y="75.740211"
id="text4-6"><tspan
sodipodi:role="line"
id="tspan4-6"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="55.542679"
y="75.740211">...</tspan></text>
</g>
<g
id="g4-9"
transform="translate(530.57818,0.45138095)"
inkscape:label="h5"
sodipodi:insensitive="true">
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-99"
width="65.902145"
height="97.999565"
x="22.536486"
y="26.292564"
ry="19.212963" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="55.542679"
y="75.740211"
id="text4-9"><tspan
sodipodi:role="line"
id="tspan4-63"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="55.542679"
y="75.740211">...</tspan></text>
</g>
<g
id="g4-9-6"
transform="translate(663.62616,0.45138095)"
inkscape:label="h6"
sodipodi:insensitive="true">
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-99-7"
width="65.902145"
height="97.999565"
x="22.536486"
y="26.292564"
ry="19.212963" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="55.542679"
y="75.740211"
id="text4-9-2"><tspan
sodipodi:role="line"
id="tspan4-63-7"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="55.542679"
y="75.740211">...</tspan></text>
</g>
</g>
<g
id="g6"
inkscape:label="l"
transform="translate(-0.42275407,3.7560547)"
style="display:inline">
<g
id="g4-7"
transform="translate(796.67414,124.20744)"
inkscape:label="l1"
sodipodi:insensitive="true">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="52.249542"
y="245.72551"
id="text4-0"
transform="translate(3.3138091,-119.04112)"><tspan
sodipodi:role="line"
id="tspan4-9"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="52.249542"
y="245.72551">...</tspan></text>
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-7"
width="65.902145"
height="198"
x="22.536486"
y="26.292564"
ry="19.212999" />
</g>
<g
id="g4-7-0"
transform="translate(131.43425,124.20744)"
inkscape:label="l2"
sodipodi:insensitive="true">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="52.249542"
y="245.72551"
id="text4-0-5"
transform="translate(3.3138091,-119.04112)"><tspan
sodipodi:role="line"
id="tspan4-9-3"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="52.249542"
y="245.72551">...</tspan></text>
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-7-7"
width="65.902145"
height="198"
x="22.536486"
y="26.292564"
ry="19.212999" />
</g>
<g
id="g4-7-5"
transform="translate(264.48223,124.20744)"
inkscape:label="l3"
sodipodi:insensitive="true">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="52.249542"
y="245.72551"
id="text4-0-2"
transform="translate(3.3138091,-119.04112)"><tspan
sodipodi:role="line"
id="tspan4-9-9"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="52.249542"
y="245.72551">...</tspan></text>
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-7-4"
width="65.902145"
height="198"
x="22.536486"
y="26.292564"
ry="19.212999" />
</g>
<g
id="g4-7-06"
transform="translate(397.5302,124.20744)"
inkscape:label="l4"
sodipodi:insensitive="true">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="52.249542"
y="245.72551"
id="text4-0-6"
transform="translate(3.3138091,-119.04112)"><tspan
sodipodi:role="line"
id="tspan4-9-7"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="52.249542"
y="245.72551">...</tspan></text>
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-7-6"
width="65.902145"
height="198"
x="22.536486"
y="26.292564"
ry="19.212999" />
</g>
<g
id="g4-7-4"
transform="translate(530.57818,124.20744)"
inkscape:label="l5"
sodipodi:insensitive="true">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="52.249542"
y="245.72551"
id="text4-0-7"
transform="translate(3.3138091,-119.04112)"><tspan
sodipodi:role="line"
id="tspan4-9-39"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="52.249542"
y="245.72551">...</tspan></text>
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-7-2"
width="65.902145"
height="198"
x="22.536486"
y="26.292564"
ry="19.212999" />
</g>
<g
id="g4-7-08"
transform="translate(663.62616,124.20744)"
inkscape:label="l6"
sodipodi:insensitive="true">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
x="52.249542"
y="245.72551"
id="text4-0-8"
transform="translate(3.3138091,-119.04112)"><tspan
sodipodi:role="line"
id="tspan4-9-37"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:5.5"
x="52.249542"
y="245.72551">...</tspan></text>
<rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect1-7-9"
width="65.902145"
height="198"
x="22.536486"
y="26.292564"
ry="19.212999" />
</g>
</g>
<g
id="g7"
inkscape:label="h path">
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:7.76266;stroke-opacity:1;paint-order:normal"
d="M 83.150204,38.986997 161.17648,158.11955"
id="path6"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:7.76266;stroke-opacity:1;paint-order:normal"
d="M 216.19819,38.986998 294.22447,158.11955"
id="path6-2"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:7.76266;stroke-opacity:1;paint-order:normal"
d="M 349.24618,38.986997 427.27246,158.11955"
id="path6-6"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:7.76266;stroke-opacity:1;paint-order:normal"
d="M 482.29417,38.986997 560.32045,158.11955"
id="path6-8"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:7.76266;stroke-opacity:1;paint-order:normal"
d="M 615.34216,38.986998 693.36844,158.11955"
id="path6-87"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:7.76266;stroke-opacity:1;paint-order:normal"
d="M 748.39015,38.986998 826.41643,158.11955"
id="path6-1"
sodipodi:nodetypes="cc" />
</g>
<g
id="g14"
inkscape:label="l merge">
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:8, 8;stroke-dashoffset:3;stroke-opacity:1;paint-order:normal"
d="M 23.075531,118.92916 156.87475,343.87962"
id="path7"
sodipodi:nodetypes="cc" />
</g>
<g
id="g13"
inkscape:label="l path">
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:8,8;stroke-dashoffset:7.65999985;stroke-opacity:1;paint-order:normal"
d="M 186.49905,352.25606 H 319.54702"
id="path8" />
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:8, 8;stroke-dashoffset:7.66;stroke-opacity:1;paint-order:normal"
d="M 452.59501,352.25606 H 585.64298"
id="path8-7" />
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:8, 8;stroke-dashoffset:7.66;stroke-opacity:1;paint-order:normal"
d="M 718.69097,352.25606 H 851.73894"
id="path8-0" />
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:8, 8;stroke-dashoffset:7.66;stroke-opacity:1;paint-order:normal"
d="M 585.64298,352.25606 H 718.69095"
id="path8-8" />
<path
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:8, 8;stroke-dashoffset:7.66;stroke-opacity:1;paint-order:normal"
d="M 319.54704,352.25606 H 452.59501"
id="path8-4" />
</g>
<g
id="g12"
inkscape:label="h merge">
<path
id="path10"
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266384,7.76266384;stroke-dashoffset:12.61432874;stroke-opacity:1;paint-order:normal"
d="m 214.20384,122.50559 20.79516,31.75058 -48.49995,-1.1e-4" />
<path
id="path10-4"
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
d="m 347.25182,122.50559 20.79516,31.75058 -48.49995,-1.1e-4" />
<path
id="path10-46"
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
d="m 480.29979,122.50559 20.79516,31.75058 -48.49995,-1.1e-4" />
<path
id="path10-2"
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
d="m 613.34777,122.50559 20.79516,31.75058 -48.49995,-1.1e-4" />
<path
id="path10-0"
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.970333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
d="m 746.39575,122.50559 20.79516,31.75058 -48.49995,-1.1e-4" />
</g>
<g
id="g36"
inkscape:label="begin text">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="50.020592"
y="260.89731"
id="text10"
inkscape:label="emptyset"><tspan
sodipodi:role="line"
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-opacity:1"
x="50.020596"
y="260.89731"
id="tspan11">$\emptyset$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="-18.447475"
y="262.76456"
id="text35-8"
inkscape:label="delta"><tspan
sodipodi:role="line"
id="tspan36"
x="-18.447475"
y="262.76456">$\delta :$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="-18.447475"
y="79.499779"
id="text35"
inkscape:label="gamma"><tspan
sodipodi:role="line"
id="tspan35"
style="stroke-width:1"
x="-18.447475"
y="79.499779">$\gamma :$</tspan></text>
</g>
<g
id="g26"
inkscape:label="cs">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="53.602657"
y="6.8350883"
id="text14"
inkscape:label="c0"><tspan
sodipodi:role="line"
style="stroke-width:1"
x="53.602657"
y="6.8350883"
id="tspan15">$C_0$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="186.69041"
y="6.8350883"
id="text14-1"
inkscape:label="c1"><tspan
sodipodi:role="line"
id="tspan21">$C_1$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="320.36008"
y="6.8350883"
id="text14-1-5"
inkscape:label="c2"><tspan
sodipodi:role="line"
id="tspan22">$C_2$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="453.38739"
y="6.8350883"
id="text14-1-5-0"
inkscape:label="c3"><tspan
sodipodi:role="line"
id="tspan23">$C_3$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="585.82214"
y="6.8350883"
id="text14-1-5-2"
inkscape:label="c4"><tspan
sodipodi:role="line"
id="tspan26">$C_4$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="719.38"
y="6.8350883"
id="text14-1-5-9"
inkscape:label="c5"><tspan
sodipodi:role="line"
id="tspan25">$C_5$</tspan></text>
</g>
<g
id="g27"
inkscape:label="ds">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="53.602657"
y="398.67929"
id="text14-16"
inkscape:label="d0"><tspan
sodipodi:role="line"
id="tspan28">$D_0$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="186.69041"
y="398.67929"
id="text14-1-4"
inkscape:label="d1"><tspan
sodipodi:role="line"
id="tspan29">$D_1$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="320.36008"
y="398.67929"
id="text14-1-5-27"
inkscape:label="d2"><tspan
sodipodi:role="line"
id="tspan30">$D_2$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="453.38739"
y="398.67929"
id="text14-1-5-0-2"
inkscape:label="d3"><tspan
sodipodi:role="line"
id="tspan31">$D_3$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="585.82214"
y="398.67929"
id="text14-1-5-2-2"
inkscape:label="d4"><tspan
sodipodi:role="line"
id="tspan32">$D_4$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="719.38"
y="399.73764"
id="text14-1-5-9-4"
inkscape:label="d5"><tspan
sodipodi:role="line"
id="tspan33">$D_5$</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:28.2223px;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:7.76266, 7.76266;stroke-dashoffset:12.6143;stroke-opacity:1;paint-order:normal"
x="852.93787"
y="399.73764"
id="text14-1-5-9-4-3"
inkscape:label="d6"><tspan
sodipodi:role="line"
id="tspan34">$D_6$</tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 40 KiB

BIN
figures/straight.pdf Normal file

Binary file not shown.

70
figures/straight.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 52 KiB

BIN
figures/straight_gui.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

BIN
figures/target_system.pdf Normal file

Binary file not shown.

204
figures/target_system.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -1,11 +1,13 @@
\begin{chapter}{Introduction} \begin{chapter}{Introduction}
% Reaction Systems (RSs) are a successful computational framework inspired by biological system. Reaction Systems (RSs) are a successful computational framework inspired by biological system.
% The underlying idea is that the interactions between biochemical reactions as well as the functioning of single reactions are based on the mechanisms of facilitation and inhibition. The interaction between biochemical reactions and the functioning of single reactions are based on the mechanisms of facilitation and inhibition, which can be modeled and analyzed using RS.\
In this work new software for modeling, analyzing and designing Reaction Systems is designed and developed, with focus on performance and user interface design.
A Reaction System consists of a set of entities and a set of reactions over them. Each reaction produces some set of entities P (called products) if enabled, meaning if a set R (called reactants) is wholly present and if a set I (called inhibitors) of entities is completely absent.
The use of inhibitors induces non-monotonic behaviors that are difficult to analyze.
Entities can also be provided by an external context sequence to simulate \textit{in silico} biological experiment, expanded by structural operational semantics (SOS) rules to account for several biological experiments. In addition Positive RS, trace slicing, graph generation, bisimulation and more is available through an intuitive visual language with a graphical interface.
% A Reaction System consists of a set of entities and a set of reactions over them. Each reaction produces some set of entities P (called products) if enabled, meaning if a set R (called reactants) is wholly present and if a set I (called inhibitors) of entities is completely absent.
% The use of inhibitors induces non-monotonic behaviors that are difficult to analyze.
% This work aims to build software that aids in the study and analysis of certain classes of Reaction Systems.
% Entities can also be provided by an external context sequence to simulate \textit{in silico} biological experiment.
\end{chapter} \end{chapter}

View File

@ -1,3 +1,204 @@
\begin{chapter}{Validation} \begin{chapter}{Testing and Validation}
\begin{section}{Tests}
During the development of the library some tests were developed in order to test behavior in the changing code. They can be run with \(\texttt{cargo test}\). Tests don't cover all code branches, but have been written for pieces of code that might break more easily. Tests are usually present in a separate file as the structure declaration and have the suffix ``\_test.rs'' in their name, so that they might be easily recognized.
For example in the workspace \(\texttt{bisimilarity}\) tests have been written for the algorithms implemented.
\begin{minted}{Rust}
#[test]
fn bisimilar_paige_tarjan_3() {
use petgraph::Graph;
let mut graph_b = Graph::new();
let node_b_1 = graph_b.add_node(1);
let node_b_2 = graph_b.add_node(2);
graph_b.add_edge(node_b_1, node_b_2, 1);
let node_b_3 = graph_b.add_node(3);
graph_b.add_edge(node_b_2, node_b_3, 2);
let node_b_4 = graph_b.add_node(4);
graph_b.add_edge(node_b_3, node_b_4, 2);
let mut graph_c = Graph::new();
let node_c_1 = graph_c.add_node(1);
let node_c_2 = graph_c.add_node(2);
graph_c.add_edge(node_c_1, node_c_2, 1);
let node_c_3 = graph_c.add_node(3);
graph_c.add_edge(node_c_2, node_c_3, 2);
let node_c_4 = graph_c.add_node(4);
graph_c.add_edge(node_c_3, node_c_4, 2);
let node_c_5 = graph_c.add_node(5);
graph_c.add_edge(node_c_1, node_c_5, 1);
graph_c.add_edge(node_c_5, node_c_3, 2);
assert!(bisimilarity(&&graph_b, &&graph_c));
assert!(bisimilarity_ignore_labels(&&graph_b, &&graph_c))
}
\end{minted}
The macro call \(\texttt{\#[test]}\) instructs rust to treat the function as a test and thus generate the respective code only when building for the test suite. Then the two graphs are constructed; finally the results are tested with the \(\texttt{assert!}\) macro.
The structure of the two graph can be seen in figure\ \ref{graph_paige_tarjan_3}.
\begin{minipage}{\textwidth}
\centering
\begin{minipage}[b][][b]{0.25\textwidth}
\centering
\includegraphics[width=\textwidth, angle=0]{figures/straight.pdf}
\end{minipage}%
\begin{minipage}[b][][b]{0.49\textwidth}
\centering
\includegraphics[width=\textwidth, angle=0]{figures/bifurcated.pdf}
\end{minipage}%
\captionsetup{type=figure}
\caption{Graphs of tests}\label{graph_paige_tarjan_3}
\end{minipage}\vspace{1em}
The behavior of the two systems is the same by ignoring the labels on the edges and by considering them, so they are always bisimilar, so the test should not panic.
The graphs have been generated using ReactionSystemsGUI using the nodes displayed in figure\ \ref{generating_graphs}. Note that to differentiate the two edges exiting \(\texttt{node-1}\) additional entities \(\texttt{left}\) and \(\texttt{right}\) are used, but are not displayed because the function for displaying the edges masks only for \(\texttt{edge-1}\) and \(\texttt{edge-2}\).
\begin{minipage}{\textwidth}
\centering
\begin{minipage}{0.8\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/straight_gui.png}
\end{minipage}%
\begin{minipage}{0.8\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/bifurcated_gui.png}
\end{minipage}%
\captionsetup{type=figure}
\caption{Generating graphs using ReactionSystemsGUI}\label{generating_graphs}
\end{minipage}\vspace{1em}
In addition to automated tests, some example inputs are provided in the folder \href{https://github.com/elvisrossi/ReactionSystems/tree/master/testing}{{\tt testing}}. The extension \(\texttt{.system}\) symbolizes system and associated instructions; the extension \(\texttt{.experiment}\) symbolizes an experiment, see\ \ref{experiment}.
These examples were also used to do manual integration testing.
The example \(\texttt{target.system}\)
\begin{figure}[!ht]
\centering
\begin{minted}{Text}
Environment: [x = {a}.y, y =({a}.{a, b}.nill + {b}.nill) ]
Initial Entities: {a, b}
Context: [({a,b}.{a}.{a,c}.x + {a,b}.{a}.{a}.nill)]
Reactions: ([{a,b}, {c}, {b}])
Target > Print,
Target (Limit: 7) > Print,
Target (Limit: 6) > Print,
Target (Limit: 5) > Print
\end{minted}
\phantomsubcaption\label{example_target_system_instructions}
\end{figure}
generates as output:
\begin{minted}{Text}
After 6 steps we arrive at state:
{b}
After 6 steps we arrive at state:
{b}
After 6 steps we arrive at state:
{b}
After 5 steps we arrive at state:
{}
\end{minted}
The output is correct since, as we can see from the graph of the system in figure\ \ref{graph_target_system} that the system has as leftmost production six states and the end state has entities set \(\texttt{\{b\}}\).
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth, height=0.46\textheight, keepaspectratio]{figures/target_system.pdf}
\caption{Graph of example\ \ref{example_target_system_instructions}, nodes have available entities as label, edges have the entities provided by the context as labels.}\label{graph_target_system}
\end{figure}
A small Perl script is provided that can convert systems created for the Prolog version of the program into the syntax described in\ \ref{design_system}. The script was used to convert systems that model mutual exclusion (MEX) available in the folder \href{https://github.com/elvisrossi/ReactionSystems/tree/master/testing/mex}{\(\texttt{testing/mex}\)}.
A MEX system is composed of \(n\) looping processes, which only one can be in the critical section. Each process is identified by \(\texttt{out\_i}\) if is out of the critical section, \(\texttt{req\_i}\) if has requested to enter the critical section and \(\texttt{in\_i}\) if is in the critical section. Without the token \(\texttt{act\_i}\) no process can change state:
\begin{minted}{Text}
[{out_1}, {act_1}, {out_1}];
[{req_1}, {act_1}, {req_1}];
[{in_1}, {act_1}, {in_1}];
\end{minted}
And \(\texttt{act\_i}\) is required to change state:
\begin{minted}{Text}
[{out_1, act_1}, {}, {req_1}];
\end{minted}
Any subset of processes can be activated, the requests are preserved:
\begin{minted}{Text}
[{req_1, act_1, act_2}, {}, {req_1}];
[{req_1, act_1, act_3}, {}, {req_1}];
...
[{req_1, act_1, act_n}, {}, {req_1}];
\end{minted}
Entering the critical section is handled by two other entities: \(\texttt{lock}\), which symbolizes that a process is in the critical section, and \(\texttt{done}\), which symbolizes that the critical section has been exited. \(\texttt{lock}\) remains until done:
\begin{minted}{Text}
[{lock}, {done}, {lock}];
\end{minted}
No other processes have to have the lock for a process to enter the critical section:
\begin{minted}{Text}
[{req_1,act_1},{lock,act_2,...,act_n},{in_1,lock}];
\end{minted}
The execution of these examples is more computationally expensive with increasing \(n\). The execution of \(\texttt{mex10.system}\) took 78791.202 milliseconds to run the instruction\ \ref{instruction_mex} which generate the graph of the system, converts it to dot format and saves it.\vspace{1em}
\begin{minipage}{\textwidth}
\begin{minted}{Text}
Digraph > Dot
| Entities
| Context
| ! "white"
| ! "black"
> Save("out.dot")
\end{minted}
\captionsetup{type=table, name=\textbf{Instruction}}
\caption{Instruction for MEX systems.}\label{instruction_mex}
\end{minipage}\vspace{1em}
\(\texttt{mex5.system}\) takes instead 109.148 milliseconds to run.
Performance has been analyzed using perf\cite{manualperf_2025} and flamegraph\cite{Ochtman2025}.
\begin{figure}
\centering
\includegraphics[width=\textwidth, height=0.5\textheight, keepaspectratio]{figures/flamegraph_mex5.pdf}
\caption{Flamegraph of MEX RS with 5 processes.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\textwidth, height=0.5\textheight, keepaspectratio]{figures/flamegraph_mex10.pdf}
\caption{Flamegraph of MEX RS with 10 processes.}
\end{figure}
Both of the flamegraphs share distinct features, but the one regarding MEX RS with 10 processes has finer resolution since the execution time is much longer. In decreasing order, some of the that took most samples are:
\begin{itemize}
\item \(\texttt{unknown}\) that took 29\% of samples,
\item \(\texttt{alloc::collections::btree::map::IntoIter::dying\_next}\) that took 14\% of samples,
\item \(\texttt{<alloc::collections::btree::map::Iter as}\\\texttt{ core::iter::traits::iterator::Iterator>::next}\) that took 11\% of samples,
\item \(\texttt{alloc::collections::btree::append::::bulk\_push}\) that took 11\% of samples,
\item \(\texttt{alloc::collections::btree::map::BTreeMap::bulk\_build\_from\_sorted\_iter}\) that took 5,1\% of samples,
\item \(\ldots\)
\end{itemize}
From the perf data we can gather that parsing took less than 3\% of total time, and that \(\texttt{unknown}\) refers to the methods belonging to System (section\ \ref{development_system}). This behavior is expected since most of the computation is carried by the structure that generates the graph.
\end{section}
\begin{section}{Validation}
During development key issues identified from previous projects where performance and usability. The biggest problem with prolog software is exceeding the stack limit and thus running out of memory. This problem is completely solved by using Rust. Another problem was that of performance. On dot file generation a 2 to 7 times performance improvement is seen, depending on the model simulated.
Usability has been taken into account both for an end user and for a programmer that intend to expand the system: grammar follows general rules largely compatible with previous projects; the grammar is decoupled from the internal representation and thus permits greater maintainability and expandability; the use of traits permits more modularity and the coexistence of multiple types of RS in the same project; domain specific languages allow more efficient and intuitive instruction specification; the graphical user interface presents instructions and methods over reaction systems in a more intuitive way that with just a command line interface; the node system allows greater modularity and for easy additions of new instructions; easy SVG generation reduce the time spent between different software and speeds up the end user's tasks; saving the state of the application allows for lower friction when switching between projects; the web GUI provides a platform agnostic interface for quick development.
\end{section}
\end{chapter} \end{chapter}