diff options
author | Karl Berry <karl@freefriends.org> | 2020-07-23 21:25:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-07-23 21:25:49 +0000 |
commit | 4f97216d337350afed0b6718c5ccfbb5c6d4d3b4 (patch) | |
tree | f04d8bbc1456fcf92fccd4c6921c409b82832799 | |
parent | e5de743200b560ef022e6fb4b6c183179088e3da (diff) |
membranecomputing (23jul20)
git-svn-id: svn://tug.org/texlive/trunk@55918 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/membranecomputing/README.md | 26 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/membranecomputing/membranecomputing.pdf | bin | 0 -> 267458 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/membranecomputing/membranecomputing.tex | 486 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/membranecomputing/membranecomputing.sty | 599 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/membranecomputing.tlpsrc | 0 |
7 files changed, 1113 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/membranecomputing/README.md b/Master/texmf-dist/doc/latex/membranecomputing/README.md new file mode 100644 index 00000000000..70a87c6b6ad --- /dev/null +++ b/Master/texmf-dist/doc/latex/membranecomputing/README.md @@ -0,0 +1,26 @@ +membranecomputing - a LaTeX package for the Membrane Computing +community. It comprises the definition of P systems, rules and +some concepts related to languages and computational +complexity usually needed for Membrane Computing research. + +Written by David Orellana Martín <dorellana@us.es> + +No dependencies other than the standards ifthen and xstring packages. +See membranecomputing.pdf for full documentation + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Copyright and license +% ===================== +% +% Copyright (C) 2020 David Orellana Martín +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/membranecomputing/membranecomputing.pdf b/Master/texmf-dist/doc/latex/membranecomputing/membranecomputing.pdf Binary files differnew file mode 100644 index 00000000000..8fc5b200983 --- /dev/null +++ b/Master/texmf-dist/doc/latex/membranecomputing/membranecomputing.pdf diff --git a/Master/texmf-dist/doc/latex/membranecomputing/membranecomputing.tex b/Master/texmf-dist/doc/latex/membranecomputing/membranecomputing.tex new file mode 100644 index 00000000000..a8c9207207c --- /dev/null +++ b/Master/texmf-dist/doc/latex/membranecomputing/membranecomputing.tex @@ -0,0 +1,486 @@ +\documentclass{article} + +\usepackage[utf8]{inputenc} + +\usepackage{membranecomputing} +\usepackage{hyperref} +\usepackage{enumitem} +\usepackage{amssymb} +\usepackage{longtable} + +\title{Package \texttt{membranecomputing} (v0.1)} +\author{David Orellana-Martín \\ \texttt{\href{mailto:dorellana@us.es}{dorellana@us.es}}} +\begin{document} + +\maketitle + +\tableofcontents + +\section{Introduction} +\label{sec:introduction} + +Membrane computing is a framework where different models of +computations, called membrane systems or P systems arise from. The +notation of these models is very variate since the number of +researchers in the area is very high, and also their background is +different, and therefore the notation can slightly change. The idea of +this package is to cover all the possible variants in the area and +their respective rules. Concerning the rules, the objective is +twofold: On the one hand, to use commands to transcript a rule in a +paper format; On the other hand, since P-Lingua is the \textit{de + facto} standard language for simulating P systems, there is a +possibility to print the rules in the P-Lingua language, ready to be +copied and pasted into a \texttt{.pli} file. + +\section{Package options} +\label{sec:package-options} + +The \texttt{membranecomputing} package offers the option +\texttt{blackboard}. The differences of this option can be found in +Subsection~\ref{sec:font-option}. + +\subsection{Font option} +\label{sec:font-option} + +Notation of P systems can change depending on the model. But even with +the same model, some differences can be found between different +papers. For instance, while some researchers use the symbol $\Gamma$ +to denote the working alphabet, other use the letter $O$. Other +example is the use of the letters $\mathcal{M}_{i}$ or $w_{i}$ for +describing the initial multisets of the regions. For this purpose, +this option has been implemented. + +\begin{itemize} +\item \texttt{traditional} (\textit{Default}) This typesets the + symbols like + $\Gamma, \Sigma, \mathcal{M}_{i}, \mathcal{R}_{i}, + \rho_{i}$~\footnote{For SNP systems, the singleton $\{a\}$, is still + called $O$ in this mode.}. +\item \texttt{blackboard} This typesets the symbols like + $O, E, w_{i}, R_{i}, p_{i}$. +\end{itemize} + +The rest of the symbols are defined without taking into account this option. + +\section{Using the package} +\label{sec:using-package} + +In this section I will try to explain all the different uses of this +package, from basic use to creation of new templates. + +\subsection{Basic notations} +\label{sec:basic-notations} + +This is a list of some notations that can be used for defining initial +multisets, sets of rules, and so on. + +\vspace{1mm} + +$ +\begin{array}{lll} + \mbox{Working alphabet} & \verb=\wa= & \wa \\ + \mbox{Input alphabet} & \verb=\ia= & \ia \\ + \mbox{Labels set} & \verb=\ls= & \ls \\ + \mbox{Membrane structure} & \verb=\ms= & \ms \\ + \mbox{Initial multiset} & \verb=\im{i}= & \im{i} \\ + \mbox{Rule set} & \verb=\rs{i}= & \rs{i} \\ + \mbox{Probabilities set} & \verb=\ps{i}= & \ps{i} \\ + \mbox{vE} & \verb=\vE= & \vE \\ + \mbox{Neuron} & \verb=\neuron{i}= & \neuron{i} \\ + \mbox{Compartment} & \verb=\compartment{i}= & \compartment{i} \\ + \mbox{Agent} & \verb=\agent{i}= & \agent{i} \\ + \mbox{Degree} & \verb=\degree= & \degree \\ + \mbox{Synapses} & \verb=\syn= & \syn \\ + \mbox{Input region} & \verb=\iin= & \iin \\ + \mbox{Output region} & \verb=\iout= & \iout \\ + \mbox{Object yes} & \verb=\yes= & \yes \\ + \mbox{Object no} & \verb=\no= & \no \\ +\end{array} +$ + +\subsection{Languages and computability theory} +\label{sec:lang-comp-theory} + +$ +\begin{array}{lll} + \mbox{Regular language} & \verb=\REG= & \REG \\ + \mbox{Linear language} & \verb=\LIN= & \LIN \\ + \mbox{Context-free language} & \verb=\CF= & \CF \\ + \mbox{Context-sensitive language} & \verb=\CS= & \CS \\ + \mbox{Recursively enumerable language} & \verb=\RE= & \RE \\ +\end{array} +$ + +To define a new set of languages, it is enough to make a new command +as follows: + +\begin{verbatim} +\newcommand{\L}{\compSet{L}} +\end{verbatim} + +This results in: $\compSet{L}$. + +\subsection{Families of membrane systems} +\label{sec:famil-membr-syst} + +Since the number of ``ingredients'' of the different variants of P +systems is sometimes high, then some notations can be used to short +them whenever they must be used. For instance, polarizationless P +systems with active membranes when dissolution rules and division +rules only for elementary membranes are allowed is usually denoted as +$\AMO{-d, +ne}$. To denote this, it is enough to write +\verb=\AM0{d, +ne}=. In this package, some examples of different +families of P systems are defined. + +$ +\begin{array}{lll} + \mbox{Ps with am} & \verb=\AM[\alpha]{\beta}= & \AM[\alpha]{\beta} \\ + \mbox{Polarizationless Ps with am} & \verb=\AMO{\alpha}= & \AMO{\alpha} \\ + \mbox{Tissue Ps with s/a rules} & \verb=\TC[\alpha]{\beta}= & \TC[\alpha]{\beta} \\ + \mbox{Tissue Ps with s/a and division rules} & \verb=\TDC{\alpha}= & \TDC{\alpha} \\ + \mbox{Tissue Ps with s/a and separation rules} & \verb=\TSC{\alpha}= & \TSC{\alpha} \\ + \mbox{Ps with s/a rules} & \verb=\CC[\alpha]{\beta}= & \CC[\alpha]{\beta} \\ + \mbox{Ps with s/a and division rules} & \verb=\CDC{\alpha}= & \CDC{\alpha} \\ + \mbox{Ps with s/a and separation rules} & \verb=\CSC{\alpha}= & \CSC{\alpha} \\ + \mbox{Tissue Ps with evol. comm. rules} & \verb=\TEC[\alpha]{\beta}= & \TEC[\alpha]{\beta} \\ + \mbox{Tissue Ps with evol. comm. and division rules} & \verb=\TDEC{\alpha}= & \TDEC{\alpha} \\ + \mbox{Tissue Ps with evol. comm. and separation rules} & \verb=\TSEC{\alpha}= & \TSEC{\alpha} \\ + \mbox{Ps with evol. comm. rules} & \verb=\CEC[\alpha]{\beta}= & \CEC[\alpha]{\beta} \\ + \mbox{Ps with evol. comm. and division rules} & \verb=\CDEC{\alpha}= & \CDEC{\alpha} \\ + \mbox{Ps with evol. comm. and separation rules} & \verb=\CSEC{\alpha}= & \CSEC{\alpha} +\end{array} +$ + +To define a new notation for a family of membrane systems, it is +enough to make a new command as follows: + +\begin{verbatim} +\newcommand{\MS}[3]{\Pfamily{MS}{#1}{#2}{#3}} +\end{verbatim} + +This results in: $\Pfamily{MS}{\#2}{\#3}{\#4}$. + +\subsection{Computational complexity theory} +\label{sec:comp-compl-theory} + +It is usual to define different complexity classes in the framework +of membrane computing. In this sense, it would be interesting to +automate the definition of these classes to avoid using all \LaTeX +commands each time we want to use them. + +$ +\begin{array}{lll} + \mbox{} & \verb=\PMC[\alpha]{\beta}= & \PMC[\alpha]{\beta} \\ + \mbox{} & \verb=\PSPACEMC[\alpha]{\beta}= & \PSPACEMC[\alpha]{\beta} \\ + \mbox{} & \verb=\EXPMC[\alpha]{\beta}= & \EXPMC[\alpha]{\beta} \\ + \mbox{} & \verb=\EXPSPACEMC[\alpha]{\beta}= & \EXPSPACEMC[\alpha]{\beta} \\ +\end{array} +$ + +To define a new notation for a complexity class in membrane systems, it is +enough to make a new command as follows: + +\begin{verbatim} +\newcommand{\C}[3]{\complClass{C}{#1}{#2}} +\end{verbatim} + +This results in: $\complClass{C}{\#1}{\#2}$~\footnote{CMC does not + stand for Conference on Membrane Computing here.}. + +\subsection{P systems} +\label{sec:p-systems} + +One of the two main contributions of this package is to make easier to +name a P system. Usually, when we have to define a new membrane +system, we have to write something like + +\begin{verbatim} +\Pi = (\Gamma, \mu, H, \mathcal{M}_1, \mathcal{M}_{2}, \mathcal{R}, i_{out}) +\end{verbatim} + +For making this task easier, the command \verb=psystem= has been +defined. Basically, it takes 5 arguments (first is optional) and can +be used as follows: \verb=\psystem[#1]{#2}{#3}{#4}{#5}=, where + +\begin{enumerate}[label=\texttt{\#\arabic*}] +\item $\in \{\mathtt{recognizer}, \mathtt{nonrecognizer}\}$: adds an + input alphabet and an input region. +\item $\in \{\mathtt{cell}, \mathtt{tissue}\}$: adds a membrane + structure in the first case. +\item + $\in \{\mathtt{transition}, \mathtt{activemembranes}, + \mathtt{symportantiport}, \mathtt{spiking}, \mathtt{kernel}, + \mathtt{colony}\}$: changes some of the parameters of the P system. +\item is a subscript for the symbol $\Pi$. +\item $> 1$ is the degree of the system. +\end{enumerate} + +For instance, the command +\begin{verbatim} +\psystem[recognizer]{cell}{activemembranes}{1}{10} +\end{verbatim} +would lead to the following: + +\begin{center} + \psystem[recognizer]{cell}{activemembranes}{1}{10} +\end{center} + +Some templates have been prepared for most of the usual variants of P +systems: + +$ +\begin{array}{ll} + \verb=\psystemAM= & \psystemAM \\ + \verb=\rpsystemAM= & \rpsystemAM \\ + \verb=\psystemSA= & \psystemSA \\ + \verb=\rpsystemSA= & \rpsystemSA \\ + \verb=\SNpsystem= & \SNpsystem \\ + \verb=\rSNpsystem= & \rSNpsystem \\ + \verb=\kpsystem= & \kpsystem \\ + \verb=\rkpsystem= & \rkpsystem \\ + \verb=\pcolony= & \pcolony \\ + \verb=\rpcolony= & \rpcolony \\ +\end{array} +$ + +All commands preceded by a \verb=r= are the recognizer version of +their r-less counterpart. + +\subsection{Rules} +\label{sec:rules} + +The (current) big work of this paper is to normalise the notation of +the rules of P systems. Several differences can be found in the +literature, most of them about spacing, position of elements, and so +on. The idea is to unify these notations in one big element: the +\verb=\mcrule= command. This command tries to cover all types of rules +in the membrane computing framework, including esoteric rules that +could arise. The idea is to catch some basic elements and parse them +in order to obtain the whole rule. As some types of P systems use +different notations, as arrows, separators and so on, different cases +have being contemplated. The definition of this command is +\verb=\mcrule[#1]{#2}{#3}{#4}{#5}{#6}=, where: + +\begin{enumerate}[label=\texttt{\#\arabic*}] +\item $\in \{\mathtt{written} (\mathit{Default}), \mathtt{plingua}\}$: the first one + makes it look as the usual scientific notation while the second one + transforms the rule into P-Lingua notation. +\item It can be one of the following parameters: + + $ + \begin{array}{lll} + \mathtt{rewriting} & \mbox{Classical rewriting rules} & \rewritingT \\ + \mathtt{single} & \mbox{Rules with a single pair of brackets} & \pevolutionT \\ + \mathtt{multiple} & \mbox{Rules with different brackets in the LHS and the RHS} & \psendoutT \\ + \mathtt{paren} & \mbox{Rules delimited by parentheses} & \antiportT \\ + \mathtt{spike} & \mbox{Spiking rules} & \spikingT + \end{array} +$ +\item $> 1$: Number of regions in the LHS (the main region and the outside regions are counted as one) +\item $> 1$: Number of regions in the RHS (the main region and the outside regions are counted as one) +\item explained below +\item explained below +\end{enumerate} + +The \verb=\mcrule= command is a tool capable of representing a wide +variety of types of rule. The idea is to represent all the rules in a +standardised way and well-spaced. An example with each type of rule is +given: + +\begin{itemize} +\item $\mathtt{rewriting}$: \verb=\mcrule{rewriting}{}{}{u}{v}= will + produce $\mcrule{rewriting}{}{}{u}{v}$. +\item $\mathtt{single}$: + \verb=\mcrule{single}{}{}{{a}{h}{+}}{{c_{2}\alpha}}= will produce + $\mcrule{single}{}{}{{a}{h}{+}}{c_{2}\alpha}$. +\item $\mathtt{multiple}$:\newline + \verb=\mcrule{multiple}{4}{4}{{{a}{3}{+}}{{b}}{{e_{1}}{4}}{;}}=\newline + \verb={{}{{a}}{-}{{o}{!}}}= will produce\newline + $\mcrule{multiple}{4}{4}{{{a}{3}{+}}{{b}}{{e_{1}}{4}}{;}}{{}{{a}}{-}{{o}{!}}}$. I + will explain in detail what means each thing: + \begin{itemize} + \item \verb={4}{4}=: In the left-hand side of the rule, 4 + ``regions'' will be analysed (in this case, membrane $3$, its + parent membrane, membrane $4$ and a special symbol); In the + right-hand side of the rule, 4 ``regions'' will be analysed (in + this case, the empty ``main'' membrane, its parent membrane, a + special symbol and a special region)~\footnote{It is a very + strange rule, but it will be useful to explain some special + cases to use in your own rules.}. + \item \verb={{{a}{3}{+}}{{b}}{{e_{1}}{4}}{;}}=: It is divided into + four parts: + \begin{itemize} + \item \verb={{a}{3}{+}}=: The ``main'' membrane of the rule has + label $3$ and polarisation $+$, and its contents is an object + $a$. + \item \verb={{b}}=: The outer content of the ``main'' membrane is + an object $b$. + \item \verb={{e_{1}}{4}}=: It has a inner membrane with label $4$ + and its contents is an object $e_{1}$. + \item \verb={;}=: It writes down a $;$ symbol~\footnote{Useful for + creation/deletion rules in kP systems.}. + \end{itemize} + \item \verb={{}{{a}}{-}{{o}{!}}}=: It is divided into four + parts: + \begin{itemize} + \item \verb={}=: The ``main'' membrane of the rule is not + specified, so it is omitted~\footnote{Useful for dissolution + rules.}. + \item \verb={{a}}=: The outer content of the ``main'' membrane is + an object $a$. + \item \verb=-= It writes down a $-$ symbol~\footnote{Also useful + for creation/deletion rules in kP systems.}. + \item \verb={{o}{!}}=: The symbol $!$ in the label is a reserved + character to write down a guard $\{ o \}$~\footnote{Also used in + kP systems.}. + \end{itemize} + \end{itemize} +\item $\mathtt{paren}$: \verb=\mcrule{paren}{}{}{{ab}{3}}{{c}{2}}= + will produce $\mcrule{paren}{}{}{{ab}{3}}{{c}{2}}$. +\item $\mathtt{spike}$: + \verb=\mcrule{spike}{}{}{{a^{3}}{a^{2}}}{{a}{1}}= will produce + $\mcrule{spike}{}{}{{a^{3}}{a^{2}}}{{a}{1}}$. +\end{itemize} + +Using $\mathtt{plingua}$ instead of +$\mathtt{written}$ as the optional parameter, it will write the rule +in the P-Lingua syntax. Therefore, the $\mathtt{multiple}$ rule +previously used in this section would render as\newline +$\mcrule[plingua]{multiple}{4}{4}{{{a}{3}{+}}{{b}}{{e_{1}}{4}}{;}}{{}{{a}}{-}{{o}{!}}}$. + +With this, anyone can create almost any kind of rule that one could +think~\footnote{Do you have any idea about other kind of rule? Please + write me so I can think in a way to implement it.}. However, for the +sake of simplicity, I have defined some commands for the basic types +of rules from the bibliography. + +{\footnotesize +\begin{longtable}{ll} + \verb=\rewriting{u}{v}= & $\rewriting{u}{v}$ \\ + \verb=\rewritingT= & $\rewritingT$ \\ + \verb=\evolution{a}{b}{h}{\alpha}= & $\evolution{a}{b}{h}{\alpha}$ \\ + \verb=\evolutionT= & $\evolutionT$ \\ + \verb=\evolutionP{a}{b}{h}{\alpha}= & $\evolutionP{a}{b}{h}{\alpha}$ \\ + \verb=\evolutionPT= & $\evolutionPT$ \\ + \verb=\pevolution{a}{b}{h}= & $\pevolution{a}{b}{h}$ \\ + \verb=\pevolutionT= & $\pevolutionT$ \\ + \verb=\pevolutionP{a}{b}{h}= & $\pevolutionP{a}{b}{h}$ \\ + \verb=\pevolutionPT= & $\pevolutionPT$ \\ + \verb=\antiport{u}{i}{v}{j}= & $\antiport{u}{i}{v}{j}$ \\ + \verb=\antiportT= & $\antiportT$ \\ + \verb=\symportT= & $\symportT$ \\ + \verb=\antiportP{u}{i}{v}{j}= & $\antiportP{u}{i}{v}{j}$ \\ + \verb=\antiportPT= & $\antiportPT$ \\ + \verb=\symportPT= & $\symportPT$ \\ + \verb=\sendin{a}{b}{h}{\alpha_{1}}{\alpha_{2}}= & $\sendin{a}{b}{h}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\sendinT= & $\sendinT$ \\ + \verb=\sendinP{a}{b}{h}{\alpha_{1}}{\alpha_{2}}= & $\sendinP{a}{b}{h}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\sendinPT= & $\sendinPT$ \\ + \verb=\psendin{a}{b}{h}= & $\psendin{a}{b}{h}$ \\ + \verb=\psendinT= & $\psendinT$ \\ + \verb=\psendinP{a}{b}{h}= & $\psendinP{a}{b}{h}$ \\ + \verb=\psendinPT= & $\psendinPT$ \\ + \verb=\sendout{a}{b}{h}{\alpha_{1}}{\alpha_{2}}= & $\sendout{a}{b}{h}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\sendoutT= & $\sendoutT$ \\ + \verb=\sendoutP{a}{b}{h}{\alpha_{1}}{\alpha_{2}}= & $\sendoutP{a}{b}{h}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\sendoutPT= & $\sendoutPT$ \\ + \verb=\psendout{a}{b}{h}= & $\psendout{a}{b}{h}$ \\ + \verb=\psendoutT= & $\psendoutT$ \\ + \verb=\psendoutP{a}{b}{h}= & $\psendoutP{a}{b}{h}$ \\ + \verb=\psendoutPT= & $\psendoutPT$ \\ + \verb=\dissolution{a}{b}{h}{\alpha}= & $\dissolution{a}{b}{h}{\alpha}$ \\ + \verb=\dissolutionT= & $\dissolutionT$ \\ + \verb=\dissolutionP{a}{b}{h}{\alpha}= & $\dissolutionP{a}{b}{h}{\alpha}$ \\ + \verb=\dissolutionPT= & $\dissolutionPT$ \\ + \verb=\pdissolution{a}{b}{h}= & $\pdissolution{a}{b}{h}$ \\ + \verb=\pdissolutionT= & $\pdissolutionT$ \\ + \verb=\pdissolutionP{a}{b}{h}= & $\pdissolutionP{a}{b}{h}$ \\ + \verb=\pdissolutionPT= & $\pdissolutionPT$ \\ + \verb=\division{a}{b}{c}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}= & $\division{a}{b}{c}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\divisionT= & $\divisionT$ \\ + \verb=\divisionP{a}{b}{c}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}= & $\divisionP{a}{b}{c}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\divisionPT= & $\divisionPT$ \\ + \verb=\pdivision{a}{b}{c}{h}= & $\pdivision{a}{b}{c}{h}$ \\ + \verb=\pdivisionT= & $\pdivisionT$ \\ + \verb=\pdivisionP{a}{b}{c}{h}= & $\pdivisionP{a}{b}{c}{h}$ \\ + \verb=\pdivisionPT= & $\pdivisionPT$ \\ + \verb=\separation{a}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}= & $\separation{a}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\separationT= & $\separationT$ \\ + \verb=\separationP{a}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}= & $\separationP{a}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\separationPT= & $\separationPT$ \\ + \verb=\pseparation{a}{h}= & $\pseparation{a}{h}$ \\ + \verb=\pseparationT= & $\pseparationT$ \\ + \verb=\pseparationP{a}{h}= & $\pseparationP{a}{h}$ \\ + \verb=\pseparationPT= & $\pseparationPT$ \\ + \verb=\creation{a}{b}{c}{h}{h_{1}}{\alpha}{\alpha_{1}}{\alpha_{2}}= & $\creation{a}{b}{c}{h}{h_{1}}{\alpha}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\creationT= & $\creationT$ \\ + \verb=\creationP{a}{b}{c}{h}{h_{1}}{\alpha}{\alpha_{1}}{\alpha_{2}}= & $\creationP{a}{b}{c}{h}{h_{1}}{\alpha}{\alpha_{1}}{\alpha_{2}}$ \\ + \verb=\creationPT= & $\creationPT$ \\ + \verb=\pcreation{a}{b}{c}{h}{h_{1}}= & $\pcreation{a}{b}{c}{h}{h_{1}}$ \\ + \verb=\pcreationT= & $\pcreationT$ \\ + \verb=\pcreationP{a}{b}{c}{h}{h_{1}}= & $\pcreationP{a}{b}{c}{h}{h_{1}}$ \\ + \verb=\pcreationPT= & $\pcreationPT$ \\ + \verb=\spiking{E}{a^{n}}{a}{d}= & $\spiking{E}{a^{n}}{a}{d}$ \\ + \verb=\spikingT= & $\spikingT$ \\ + \verb=\forgettingT= & $\forgettingT$ \\ + \verb=\spikingP{E}{a^{n}}{a}{d}= & $\spikingP{E}{a^{n}}{a}{d}$ \\ + \verb=\spikingPT= & $\spikingPT$ \\ + \verb=\forgettingPT= & $\forgettingPT$ \\ + \verb=\krewriting{x}{y}{g}= & $\krewriting{x}{y}{g}$ \\ + \verb=\krewritingT= & $\krewritingT$ \\ + \verb=\krewritingP{x}{y}{g}= & $\krewritingP{x}{y}{g}$ \\ + \verb=\krewritingPT= & $\krewritingPT$ \\ + \verb=\linkcreation{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}= & $\linkcreation{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}$ \\ + \verb=\linkcreationT= & $\linkcreationT$ \\ + \verb=\linkcreationP{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}= & $\linkcreationP{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}$ \\ + \verb=\linkcreationPT= & $\linkcreationPT$ \\ + \verb=\linkdestruction{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}= & $\linkdestruction{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}$ \\ + \verb=\linkdestructionT= & $\linkdestructionT$ \\ + \verb=\linkdestructionP{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}= & $\linkdestructionP{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}$ \\ + \verb=\linkdestructionPT= & $\linkdestructionPT$ +\end{longtable} +} + +As you can see, the names follow a pattern: + +\begin{itemize} +\item Their name is descriptive in terms of the rule it represents. +\item If the rule starts with a \texttt{p}, it means that it is a + polarizationless rule. +\item If the rule ends with (or its second to last letter is) a + \texttt{P}, it means it will write the rule in P-Lingua format. +\item If the rule ends with a \texttt{T}, it means it is a rule + template; that is, the typical rule used to describe its behaviour. +\end{itemize} + +If you have an idea to make the notation simpler, please let me know. + +\section{Future work} +\label{sec:future-work} + +A TODO list for the future development of the package. Please do not +hesitate to contact me if you think that something should be included +in this list, or if there is any bug or concept that should be +included as soon as possible. Please, contact me at +\href{mailto:dorellana@us.es}{dorellana@us.es} + +\begin{itemize} +\item Add new variants of P systems, as well as some new templates for + other rules. +\item Clean the code and create new command for analysing the + \texttt{multiple} case automatically. +\item Add the possibility of define rules with more than one level of + deepness. +\item Add a automatic parsing of a membrane structure, so a + well-spaced structure can appear in a paper. It would be interesting + to also let it export a string in the P-Lingua format. +\item A long-term objective is to export a .pdf with the picture of a + P system with its contents. Creating an image for your paper could + be as simple as defining it as you usually do, it would be cool, right? +\end{itemize} + +I hope you find the package interesting and useful for your +purposes. And, as I said above, please do not hesitate to contact me +if you have any questions of or suggestions for it. + +\end{document} diff --git a/Master/texmf-dist/tex/latex/membranecomputing/membranecomputing.sty b/Master/texmf-dist/tex/latex/membranecomputing/membranecomputing.sty new file mode 100644 index 00000000000..bb513168d53 --- /dev/null +++ b/Master/texmf-dist/tex/latex/membranecomputing/membranecomputing.sty @@ -0,0 +1,599 @@ +%% +%% Copyright 2020 David Orellana Martín +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is David Orellana Martín +% +% This work consists of the file membranecomputing.sty. + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{membranecomputing}[2020/07/23 Membrane Computing v0.1] + +% Require Packages + +\RequirePackage{ifthen} +\RequirePackage{xstring} + +% Declare options + +\newboolean{membranecomputing@blackboard} +\setboolean{membranecomputing@blackboard}{false} +\DeclareOption{blackboard}{ + \setboolean{membranecomputing@blackboard}{true} +} +\DeclareOption{traditional}{ + \setboolean{membranecomputing@blackboard}{false} +} +\ProcessOptions\relax + +% Declare counters +\newcounter{membranecomputing@membrane} +\newcounter{membranecomputing@imembrane} +\newcounter{membranecomputing@element} + +% Declare auxiliary commands + +\newcommand{\membranecomputing@iden}[1]{#1} +\newcommand{\lhsC}{} +\newcommand{\rhsC}{} +\newcommand{\lhsL}{} +\newcommand{\rhsL}{} +\newcommand{\lhsP}{} +\newcommand{\rhsP}{} +\newcommand{\lhsIC}{} +\newcommand{\rhsIC}{} +\newcommand{\lhsIL}{} +\newcommand{\rhsIL}{} +\newcommand{\lhsIP}{} +\newcommand{\rhsIP}{} +\newcommand{\lhsOC}{} +\newcommand{\rhsOC}{} +\newcommand{\lhsE}{} +\newcommand{\lhsS}{} +\newcommand{\rhsS}{} +\newcommand{\rhsD}{} + +\newcommand{\arrow}{} +\newcommand{\labelSub}{} +\newcommand{\labelSubL}{} +\newcommand{\labelSubR}{} +\newcommand{\polW}{} +\newcommand{\polP}{} +\newcommand{\polWL}{} +\newcommand{\polPL}{} +\newcommand{\polWR}{} +\newcommand{\polPR}{} +\newcommand{\formattedRule}{} + +\exploregroups \expandarg + +\newcommand{\formatRule}[4]{ + \renewcommand{\arrow}{\ensuremath{\IfStrEq{#1}{written}{\rightarrow}{\, --> \,}}} + \IfStrEqCase{#2} + {% BEGIN CASES + {rewriting} + {%BEGIN IF REWRITING + \renewcommand{\formattedRule}{#3 \arrow #4} + }% END IF REWRITING + {single} + {% BEGIN IF SINGLE + \renewcommand{\formattedRule}{#3 \arrow #4} + }% END IF SINGLE + {multiple} + {% BEGIN IF MULTIPLE + \renewcommand{\formattedRule}{#3 \arrow #4} + }% END IF MULTIPLE + {paren} + {% BEGIN IF PAREN + \renewcommand{\formattedRule}{#3 / #4} + }% END IF PAREN + }% END CASES + \ensuremath{\IfStrEq{#1}{written}{\formattedRule}{\mathtt{\formattedRule}}} +} + +% Commands that depend on the kind of letters +\ifthenelse{\boolean{membranecomputing@blackboard}}{ % + \newcommand{\workingalphabet}{\ensuremath{O}} + \newcommand{\inputalphabet}{\ensuremath{E}} + \newcommand{\initmultiset}[1]{\ensuremath{w_{#1}}} + \newcommand{\ruleset}[1]{\ensuremath{R_{#1}}} + \newcommand{\probabilitiesset}[1]{\ensuremath{p_{#1}}} +}{ + \newcommand{\workingalphabetspiking}{\ensuremath{O}} + \newcommand{\workingalphabet}{\ensuremath{\Gamma}} + \newcommand{\inputalphabet}{\ensuremath{\Sigma}} + \newcommand{\initmultiset}[1]{\ensuremath{\mathcal{M}_{#1}}} + \newcommand{\ruleset}[1]{\ensuremath{\mathcal{R}_{#1}}} + \newcommand{\probabilitiesset}[1]{\ensuremath{\rho_{#1}}} +} + +% Commands that do not depend on the kind of letters +\newcommand{\labelset}{\ensuremath{H}} +\newcommand{\membranestructure}{\ensuremath{\mu}} +\newcommand{\neuron}[1]{\ensuremath{\sigma_{#1}}} +\newcommand{\compartment}[1]{\ensuremath{C_{#1}}} +\newcommand{\agent}[1]{\ensuremath{B_{#1}}} +\newcommand{\iin}{\ensuremath{i_{in}}} +\newcommand{\iout}{\ensuremath{i_{out}}} +\newcommand{\degree}{\ensuremath{q}} +\newcommand{\syn}{\ensuremath{syn}} +\newcommand{\yes}{\ensuremath{\mathtt{yes}}} +\newcommand{\no}{\ensuremath{\mathtt{no}}} +\newcommand{\initEnvironment}{\ensuremath{v_{E}}} + +% Shortcuts +\newcommand{\wa}{\workingalphabet} +\newcommand{\ia}{\inputalphabet} +\newcommand{\ls}{\labelset} +\newcommand{\ms}{\membranestructure} +\newcommand{\im}{\initmultiset} +\newcommand{\rs}{\ruleset} +\newcommand{\ps}{\probabilitiesset} +\newcommand{\vE}{\initEnvironment} + +\newcommand{\psystem}[5][nonrecognizer] +{% BEGIN COMMAND PSYSTEM + \IfEqCase{#3} + {% BEGIN CASES + {transition} + {% BEGIN IF TRANSITION + \ensuremath{\Pi_{#4} = \left(\wa, \ifthenelse{\equal{#1}{recognizer}}{\Sigma, }{} \ifthenelse{\equal{#2}{cell}}{\ms, }{} \im{1}, \dots, \im{\ifthenelse{\equal{#5}{}}{\degree}{#5}}, (\rs{1}, \ps{1}), \dots, (\rs{\ifthenelse{\equal{#5}{}}{\degree}{#5}}, \ps{\ifthenelse{\equal{#5}{}}{\degree}{#5}}), \ifthenelse{\equal{#1}{recognizer}}{\iin, }{} \iout \right)} + }% END IF TRANSITION + {activemembranes} + {% BEGIN IF ACTIVEMEMBRANES + \ensuremath{\Pi_{#4} = \left(\wa, \ifthenelse{\equal{#1}{recognizer}}{\Sigma, }{} \ifthenelse{\equal{#2}{cell}}{\ms, }{} \im{1}, \dots, \im{\ifthenelse{\equal{#5}{}}{\degree}{#5}}, \rs{1}, \dots, \rs{\ifthenelse{\equal{#5}{}}{\degree}{#5}}, \ifthenelse{\equal{#1}{recognizer}}{\iin, }{} \iout \right)} + }% END IF ACTIVEMEMBRANES + {symportantiport} + {% BEGIN IF SYMPORTANTIPORT + \ensuremath{\Pi_{#4} = \left(\wa, \ifthenelse{\equal{#1}{recognizer}}{\Sigma, }{} \mathcal{E}, \ifthenelse{\equal{#2}{cell}}{\ms, }{} \im{1}, \dots, \im{\ifthenelse{\equal{#5}{}}{\degree}{#5}}, \ifthenelse{\equal{#2}{cell}}{\rs{1}, \dots, \rs{\ifthenelse{\equal{#5}{}}{\degree}{#5}}}{\rs}, \ifthenelse{\equal{#1}{recognizer}}{\iin, }{} \iout \right)} + }% END IF SYMPORTANTIPORT + {spiking} + {% BEGIN IF SPIKING + \ensuremath{\Pi_{#4} = \left(\ifthenelse{\boolean{membranecomputing@blackboard}}{\wa}{\workingalphabetspiking}, \neuron{1}, \dots, \neuron{\ifthenelse{\equal{#5}{}}{\degree}{#5}}, \syn, \ifthenelse{\equal{#1}{recognizer}}{\iin, }{} \iout \right)} + }% END IF SPIKING + {kernel} + {% BEGIN IF KERNEL + \ensuremath{k\Pi_{#4} = \left(\wa, \ifthenelse{\equal{#2}{cell}}{\ms, }{} \compartment{1}, \dots, \compartment{\ifthenelse{\equal{#5}{}}{\degree}{#5}}, \ifthenelse{\equal{#1}{recognizer}}{\iin, }{} \iout \right)} + }% END IF KERNEL + {colony} + {% BEGIN IF COLONY + \ensuremath{\Pi_{#4} = \left(\wa, \ifthenelse{\equal{#1}{recognizer}}{\Sigma, }{} e, f, \vE, \agent{1}, \dots, \agent{\ifthenelse{\equal{#5}{}}{\degree}{#5}}, \ifthenelse{\equal{#1}{recognizer}}{\iin, }{}\right)} + }% END IF COLONY + }% END CASES + [\PackageError{psystem}{Undefined option to psystem: #3}] +}% END COMMAND PSYSTEM + +\newcommand{\wrule}[5][multiple]{\mcrule[written]{#1}{#2}{#3}{#4}{#5}} +\newcommand{\prule}[5][multiple]{\mcrule[plingua]{#1}{#2}{#3}{#4}{#5}} + +\newcommand{\mcrule}[6][written] +{% BEGIN COMMAND RULE + \IfEqCase{#2} + {% BEGIN CASES TYPE + {rewriting} + {% BEGIN IF REWRITING + \renewcommand{\lhsC}{} + \renewcommand{\rhsC}{} + \formatRule{#1}{#2}{#5}{#6} + }% END IF REWRITING + {single} + {% BEGIN IF SINGLE + \renewcommand{\lhsC}{} + \renewcommand{\rhsC}{} + \renewcommand{\lhsL}{} + \renewcommand{\rhsL}{} + \renewcommand{\lhsP}{} + \renewcommand{\rhsP}{} + \StrFindGroup{#5}{1}[\lhsC] + \StrFindGroup{#6}{1}[\rhsC] + \StrFindGroup{#5}{2}[\lhsL] + \StrFindGroup{#5}{3}[\lhsP] + \renewcommand{\polW}{\ensuremath{\IfStrEq{#1}{written}{^{\lhsP}}{}}} + \renewcommand{\polP}{\ensuremath{\IfStrEq{#1}{plingua}{\lhsP}{}}} + \renewcommand{\labelSub}{\ensuremath{\IfStrEq{#1}{written}{_{\lhsL}}{'\lhsL}}} + \formatRule{#1}{#2}{\ensuremath{\polP \left[ \, \lhsC}}{\ensuremath{\rhsC \, \right]\polW\labelSub}} + % \ensuremath{\left[ \, \lhsC \rightarrow \rhsC \, \right]^{\ifthenelse{\equal{\lhsP}{}} {\rhsP} {\lhsP} }_{\ifthenelse{\equal{\lhsL}{}} {\rhsL} {\lhsL} }} + }% END IF SINGLE + {multiple} + {% BEGIN IF MULTIPLE + % BEGIN LHS ANALYSIS + \renewcommand{\lhsIC}{} + \renewcommand{\lhsIL}{} + \renewcommand{\lhsIP}{} + \renewcommand{\lhsOC}{} + \setcounter{membranecomputing@membrane}{1} + \whiledo {\value{membranecomputing@membrane} < \numexpr#3+1\relax} + {% BEGIN FOR MEMBRANE + \StrFindGroup{#5}{\arabic{membranecomputing@membrane}}[\currentM] + \IfStrEq{\currentM}{{}} + {% BEGIN IF EMPTY GROUP + % EMPTY GROUP + }% END IF EMPTY GROUP + {% BEGIN ELSE EMPTY GROUP + \ifthenelse{\equal{\arabic{membranecomputing@membrane}}{1}} + {% BEGIN IF IN-MEMBRANE + \StrFindGroup{#5}{\arabic{membranecomputing@membrane},1}[\lhsIC] + \StrFindGroup{#5}{\arabic{membranecomputing@membrane},2}[\lhsIL] + \StrFindGroup{#5}{\arabic{membranecomputing@membrane},3}[\lhsIP] + \StrExpand[2]{\lhsIC}{\plhsIC} + \renewcommand{\lhsIC}{\expandafter\plhsIC\expandafter \,} + }% END IF IN-MEMBRANE + {% BEGIN ELSE IN-MEMBRANE + \ifthenelse{\equal{\arabic{membranecomputing@membrane}}{2}} + {% BEGIN IF OUT-MEMBRANE + \StrFindGroup{#5}{\arabic{membranecomputing@membrane},1}[\lhsOC] + }% END IF OUT-MEMBRANE + {% BEGIN ELSE OUT-MEMBRANE + \StrFindGroup{#5}{\arabic{membranecomputing@membrane}}[\currentMembrane] + \IfStrEqCase{\currentMembrane} + {% BEGIN CASES CURRENTMEMBRANE + {{.}}% + {% BEGIN IF ... + \StrExpand[2]{\lhsIC}{\plhsIC}% + \renewcommand{\lhsIC}{\ensuremath{\plhsIC \dots \,}}% + }% END IF ... + {{-}}% + {% BEGIN IF -- + \StrExpand[2]{\lhsIC}{\plhsIC}% + \renewcommand{\lhsIC}{\ensuremath{\plhsIC - \,}}% + }% END IF -- + {{;}} + {% BEGIN IF ; + \StrExpand[2]{\lhsIC}{\plhsIC}% + \renewcommand{\lhsIC}{\ensuremath{\plhsIC ; \,}}% + }% END IF ; + {\currentMembrane} + {% BEGIN IF OTHER + \StrFindGroup{#5}{\arabic{membranecomputing@membrane},1}[\lhsCC]% + \StrFindGroup{#5}{\arabic{membranecomputing@membrane},2}[\lhsCL]% + \StrFindGroup{#5}{\arabic{membranecomputing@membrane},3}[\lhsCP]% + \StrExpand[2]{\lhsIC}{\plhsIC}% + \StrExpand[2]{\lhsCC}{\plhsCC}% + \StrExpand[2]{\lhsCL}{\plhsCL}% + \StrExpand[2]{\lhsCP}{\plhsCP}% + \setcounter{membranecomputing@imembrane}{1} + \whiledo {\value{membranecomputing@imembrane} < 5} + {% BEGIN FOR IMEMBRANE + \stepcounter{membranecomputing@imembrane} + }% END FOR IMEMBRANE + \IfStrEq{\lhsCL}{{!}}% + {% BEGIN IF ! + \renewcommand{\lhsIC}{\ensuremath{\plhsIC \{ \IfStrEq{\plhsCC}{}{\quad}{\, \plhsCC \, } \}}} + }% END IF ! + {% BEGIN ELSE ! + \renewcommand{\polW}{\ensuremath{\IfStrEq{#1}{written}{^{\plhsCP}}{}}} + \renewcommand{\polP}{\ensuremath{\IfStrEq{#1}{plingua}{\plhsCP}{}}} + \renewcommand{\labelSub}{\ensuremath{\IfStrEq{#1}{written}{_{\plhsCL}}{'\plhsCL}}} + \StrExpand[2]{\polW}{\ppolW} + \StrExpand[2]{\polP}{\ppolP} + \StrExpand[2]{\labelSub}{\plabelSub} + \renewcommand{\lhsIC}{\ensuremath{\plhsIC \ppolP[ \IfStrEq{\plhsCC}{}{\quad}{\, \plhsCC \, } ]\ppolW\plabelSub \,}}% + \StrExpand[2]{\lhsIC}{\plhsIC}% + \renewcommand{\lhsIC}{\plhsIC}% + }% END ELSE ! + }% END IF OTHER + }% END CASES CURRENTMEMBRANE + }% END ELSE OUT-MEMBRANE + }% END ELSE IN-MEMBRANE + }% END ELSE EMPTY GROUP + \stepcounter{membranecomputing@membrane} + }% END FOR MEMBRANE + % END LHS ANALYSIS + % BEGIN RHS ANALYSIS + \renewcommand{\rhsIC}{} + \renewcommand{\rhsIL}{} + \renewcommand{\rhsIP}{} + \renewcommand{\rhsOC}{} + \setcounter{membranecomputing@membrane}{1} + \whiledo {\value{membranecomputing@membrane} < \numexpr#4+1\relax} + {% BEGIN FOR MEMBRANE + \StrFindGroup{#6}{\arabic{membranecomputing@membrane}}[\currentM] + \IfStrEq{\currentM}{{}} + {% BEGIN IF EMPTY GROUP + % EMPTY GROUP + }% END IF EMPTY GROUP + {% BEGIN ELSE EMPTY GROUP + \ifthenelse{\equal{\arabic{membranecomputing@membrane}}{1}} + {% BEGIN IF IN-MEMBRANE + \StrFindGroup{#6}{\arabic{membranecomputing@membrane},1}[\rhsIC] + \StrFindGroup{#6}{\arabic{membranecomputing@membrane},2}[\rhsIL] + \StrFindGroup{#6}{\arabic{membranecomputing@membrane},3}[\rhsIP] + \StrExpand[2]{\rhsIC}{\prhsIC} + \renewcommand{\rhsIC}{\expandafter\prhsIC\expandafter \,} + }% END IF IN-MEMBRANE + {% BEGIN ELSE IN-MEMBRANE + \ifthenelse{\equal{\arabic{membranecomputing@membrane}}{2}} + {% BEGIN IF OUT-MEMBRANE + \StrFindGroup{#6}{\arabic{membranecomputing@membrane},1}[\rhsOC] + % \ensuremath{} + }% END IF OUT-MEMBRANE + {% BEGIN ELSE OUT-MEMBRANE + \StrFindGroup{#6}{\arabic{membranecomputing@membrane}}[\currentMembrane] + \IfStrEqCase{\currentMembrane} + {% BEGIN CASES CURRENTMEMBRANE + {{.}}% + {% BEGIN IF ... + \StrExpand[2]{\rhsIC}{\prhsIC}% + \renewcommand{\rhsIC}{\ensuremath{\prhsIC \dots \,}}% + }% END IF ... + {{-}}% + {% BEGIN IF -- + \StrExpand[2]{\rhsIC}{\prhsIC}% + \renewcommand{\rhsIC}{\ensuremath{\prhsIC - \,}}% + }% END IF -- + {{;}} + {% BEGIN IF ; + \StrExpand[2]{\rhsIC}{\prhsIC}% + \renewcommand{\rhsIC}{\ensuremath{\prhsIC ; \,}}% + }% END IF ; + {\currentMembrane} + {% BEGIN IF OTHER + \StrFindGroup{#6}{\arabic{membranecomputing@membrane},1}[\rhsCC]% + \StrFindGroup{#6}{\arabic{membranecomputing@membrane},2}[\rhsCL]% + \StrFindGroup{#6}{\arabic{membranecomputing@membrane},3}[\rhsCP]% + \StrExpand[2]{\rhsIC}{\prhsIC}% + \StrExpand[2]{\rhsCC}{\prhsCC}% + \StrExpand[2]{\rhsCL}{\prhsCL}% + \StrExpand[2]{\rhsCP}{\prhsCP}% + \setcounter{membranecomputing@imembrane}{1} + \whiledo {\value{membranecomputing@imembrane} < 5} + {% BEGIN FOR IMEMBRANE + \stepcounter{membranecomputing@imembrane} + }% END FOR IMEMBRANE + \IfStrEq{\rhsCL}{{!}}% + {% BEGIN IF ! + \renewcommand{\rhsIC}{\ensuremath{\prhsIC \{ \IfStrEq{\prhsCC}{}{\quad}{\, \prhsCC \, } \}}}% + }% END IF ! + {% BEGIN ELSE ! + \renewcommand{\polW}{\ensuremath{\IfStrEq{#1}{written}{^{\prhsCP}}{}}} + \renewcommand{\polP}{\ensuremath{\IfStrEq{#1}{plingua}{\prhsCP}{}}} + \renewcommand{\labelSub}{\ensuremath{\IfStrEq{#1}{written}{_{\prhsCL}}{'\prhsCL}}} + \StrExpand[2]{\polW}{\ppolW} + \StrExpand[2]{\polP}{\ppolP} + \StrExpand[2]{\labelSub}{\plabelSub} + \renewcommand{\rhsIC}{\ensuremath{\prhsIC \ppolP[ \IfStrEq{\prhsCC}{}{\quad}{\, \prhsCC \, } ]\ppolW\plabelSub \,}}% + \StrExpand[2]{\rhsIC}{\prhsIC}% + \renewcommand{\rhsIC}{\prhsIC}% + }% END ELSE ! + }% END IF OTHER + }% END CASES CURRENTMEMBRANE + }% END ELSE OUT-MEMBRANE + }% END ELSE IN-MEMBRANE + }% END ELSE EMPTY GROUP + \stepcounter{membranecomputing@membrane} + }% END FOR MEMBRANE + % END RHS ANALYSIS + \StrFindGroup{#5}{1}[\lhsM] + \StrFindGroup{#6}{1}[\rhsM] + \renewcommand{\polWL}{\ensuremath{\IfStrEq{#1}{written}{^{\lhsIP}}{}}} + \renewcommand{\polPL}{\ensuremath{\IfStrEq{#1}{plingua}{\lhsIP}{}}} + \renewcommand{\labelSubL}{\ensuremath{\IfStrEq{#1}{written}{_{\lhsIL}}{'\lhsIL}}} + \renewcommand{\polWR}{\ensuremath{\IfStrEq{#1}{written}{^{\rhsIP}}{}}} + \renewcommand{\polPR}{\ensuremath{\IfStrEq{#1}{plingua}{\rhsIP}{}}} + \renewcommand{\labelSubR}{\ensuremath{\IfStrEq{#1}{written}{_{\rhsIL}}{'\rhsIL}}} + \formatRule{#1}{#2}{\ifthenelse{\equal{\lhsOC}{}}{}{\lhsOC \,} \IfStrEq{\lhsM}{{}}{}{\polPL\left[} \ifthenelse{\equal{\protect\lhsIC}{}}{\quad}{ \, \lhsIC } \IfStrEq{\lhsM}{{}}{}{\right]\polWL\labelSubL}}{\ifthenelse{\equal{\rhsOC}{}}{}{\rhsOC \,} + \IfStrEq{\rhsM}{{}}{}{\polPR\left[} \ifthenelse{\equal{\protect\rhsIC}{}}{\quad}{ \, \rhsIC } \IfStrEq{\rhsM}{{}}{}{\right]\polWR\labelSubR}} + % \ensuremath{\ifthenelse{\equal{\lhsOC}{}}{}{\lhsOC \,} \IfStrEq{\lhsM}{{}}{}{\left[} \ifthenelse{\equal{\protect\lhsIC}{}}{\quad}{ \, \lhsIC } \IfStrEq{\lhsM}{{}}{}{\right]^{\lhsIP}_{\lhsIL}} \rightarrow \ifthenelse{\equal{\rhsOC}{}}{}{\rhsOC \,} + % \IfStrEq{\rhsM}{{}}{}{\left[} \ifthenelse{\equal{\protect\rhsIC}{}}{\quad}{ \, \rhsIC } \IfStrEq{\rhsM}{{}}{}{\right]^{\rhsIP}_{\rhsIL}}} + }% END IF MULTIPLE + {paren} + {% BEGIN IF PAREN + \ifthenelse{\equal{#6}{}} + {% BEGIN IF ONE SIDE + \StrFindGroup{#5}{1}[\lhsC] + \StrFindGroup{#5}{2}[\lhsL] + \ensuremath{\left( \lhsC, \lhsL \right)} + }% END IF ONE SIDE + {% BEGIN ELSE ONE SIDE + \StrFindGroup{#5}{1}[\lhsC] + \StrFindGroup{#6}{1}[\rhsC] + \StrFindGroup{#5}{2}[\lhsL] + \StrFindGroup{#6}{2}[\rhsL] + \formatRule{#1}{#2}{\left( \lhsL, \lhsC}{\rhsC, \rhsL \right)} + % \ensuremath{\left( \lhsL, \lhsC / \rhsC, \rhsL \right)} + }% END ELSE ONE SIDE + }% END IF PAREN + {spike} + {% BEGIN IF SPIKE + \renewcommand{\lhsE}{} + \renewcommand{\lhsS}{} + \renewcommand{\rhsS}{} + \renewcommand{\rhsD}{} + \StrFindGroup{#5}{1}[\lhsE] + \StrFindGroup{#5}{2}[\lhsS] + \StrFindGroup{#6}{1}[\rhsS] + \StrFindGroup{#6}{2}[\rhsD] + \ensuremath{\ifthenelse{\equal{\lhsE}{{}}}{}{\lhsE /} \lhsS \rightarrow \rhsS \ifthenelse{\equal{\rhsD}{}}{}{; \rhsD}} + }% END IF SPIKE + }% END CASES TYPE + [\PackageError{rule}{Undefined option to rule: #2}] +}% END COMMAND RULE + +% Templates for P systems + +\newcommand{\psystemAM}[1][nonrecognizer]{\psystem[#1]{cell}{activemembranes}{}{}} +\newcommand{\rpsystemAM}{\psystemAM[recognizer]} +\newcommand{\psystemSA}[1][nonrecognizer]{\psystem[#1]{tissue}{symportantiport}{}{}} +\newcommand{\rpsystemSA}{\psystemSA[recognizer]} +\newcommand{\SNpsystem}[1][nonrecognizer]{\psystem[#1]{tissue}{spiking}{}{}} +\newcommand{\rSNpsystem}{\SNpsystem[recognizer]} +\newcommand{\kpsystem}[1][nonrecognizer]{\psystem[#1]{cell}{kernel}{}{}} +\newcommand{\rkpsystem}{\kpsystem[recognizer]} +\newcommand{\pcolony}[1][nonrecognizer]{\psystem[#1]{tissue}{colony}{}{}} +\newcommand{\rpcolony}{\pcolony[recognizer]} + +% Rule examples and templates + +\newcommand{\rewriting}[2]{\wrule[rewriting]{}{}{#1}{#2}} +\newcommand{\rewritingT}{\rewriting{u}{v}} + +\newcommand{\evolution}[4]{\wrule[single]{}{}{{#1}{#3}{#4}}{{#2}}} +\newcommand{\evolutionT}{\evolution{a}{b}{h}{\alpha}} + +\newcommand{\evolutionP}[4]{\prule[single]{}{}{{#1}{#3}{#4}}{{#2}}} +\newcommand{\evolutionPT}{\evolutionP{a}{b}{h}{\alpha}} + +\newcommand{\pevolution}[3]{\wrule[single]{}{}{{#1}{#3}}{{#2}}} +\newcommand{\pevolutionT}{\pevolution{a}{b}{h}} + +\newcommand{\pevolutionP}[3]{\evolutionP{#1}{#2}{#3}{}} +\newcommand{\pevolutionPT}{\pevolutionP{a}{b}{h}} + +\newcommand{\antiport}[4]{\wrule[paren]{}{}{{#1}{#2}}{{#3}{#4}}} +\newcommand{\antiportT}{\antiport{u}{i}{v}{j}} +\newcommand{\symportT}{\antiport{u}{i}{\lambda}{j}} + +\newcommand{\antiportP}[4]{\prule[paren]{}{}{{#1}{#2}}{{#3}{#4}}} +\newcommand{\antiportPT}{\antiportP{u}{i}{v}{j}} +\newcommand{\symportPT}{\antiportP{u}{i}{\lambda}{j}} + +\newcommand{\sendin}[5]{\wrule{2}{1}{{{}{#3}{#4}}{{#1}}}{{{#2}{#3}{#5}}}} +\newcommand{\sendinT}{\sendin{a}{b}{h}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\sendinP}[5]{\prule{2}{1}{{{}{#3}{#4}}{{#1}}}{{{#2}{#3}{#5}}}} +\newcommand{\sendinPT}{\sendinP{a}{b}{h}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\psendin}[3]{\sendin{#1}{#2}{#3}{}{}} +\newcommand{\psendinT}{\psendin{a}{b}{h}} + +\newcommand{\psendinP}[3]{\sendinP{#1}{#2}{#3}{}{}} +\newcommand{\psendinPT}{\psendinP{a}{b}{h}} + +\newcommand{\sendout}[5]{\wrule{1}{2}{{{#1}{#3}{#4}}}{{{}{#3}{#5}}{{#2}}}} +\newcommand{\sendoutT}{\sendout{a}{b}{h}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\sendoutP}[5]{\prule{1}{2}{{{#1}{#3}{#4}}}{{{}{#3}{#5}}{{#2}}}} +\newcommand{\sendoutPT}{\sendout{a}{b}{h}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\psendout}[3]{\sendout{#1}{#2}{#3}{}{}} +\newcommand{\psendoutT}{\psendout{a}{b}{h}} + +\newcommand{\psendoutP}[3]{\sendoutP{#1}{#2}{#3}{}{}} +\newcommand{\psendoutPT}{\psendoutP{a}{b}{h}} + +\newcommand{\dissolution}[4]{\wrule{3}{2}{{}{}{{#1}{#3}{#4}}}{{}{{#2}}}} +\newcommand{\dissolutionT}{\dissolution{a}{b}{h}{\alpha}} + +\newcommand{\dissolutionP}[4]{\prule{3}{2}{{}{}{{#1}{#3}{#4}}}{{}{{#2}}}} +\newcommand{\dissolutionPT}{\dissolutionP{a}{b}{h}{\alpha}} + +\newcommand{\pdissolution}[3]{\dissolution{#1}{#2}{#3}{}} +\newcommand{\pdissolutionT}{\pdissolution{a}{b}{h}} + +\newcommand{\pdissolutionP}[3]{\dissolutionP{#1}{#2}{#3}{}} +\newcommand{\pdissolutionPT}{\pdissolutionP{a}{b}{h}} + +\newcommand{\division}[7]{\wrule{1}{4}{{{#1}{#4}{#5}}{}}{{}{}{{#2}{#4}{#6}}{{#3}{#4}{#7}}}} +\newcommand{\divisionT}{\division{a}{b}{c}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\divisionP}[7]{\prule{1}{4}{{{#1}{#4}{#5}}{}}{{}{}{{#2}{#4}{#6}}{{#3}{#4}{#7}}}} +\newcommand{\divisionPT}{\divisionP{a}{b}{c}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\pdivision}[4]{\division{#1}{#2}{#3}{#4}{}{}{}} +\newcommand{\pdivisionT}{\pdivision{a}{b}{c}{h}} + +\newcommand{\pdivisionP}[4]{\divisionP{#1}{#2}{}{#3}{}{#4}{}} +\newcommand{\pdivisionPT}{\pdivisionP{a}{h}{b}{c}} + +\newcommand{\separation}[5]{\wrule{1}{4}{{{#1}{#2}{#3}}{}}{{}{}{{\wa_{0}}{#2}{#4}}{{\wa_{1}}{#2}{#5}}}} +\newcommand{\separationT}{\separation{a}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\separationP}[5]{\prule{1}{4}{{{#1}{#2}{#3}}{}}{{}{}{{\wa_{0}}{#2}{#4}}{{\wa_{1}}{#2}{#5}}}} +\newcommand{\separationPT}{\separationP{a}{h}{\alpha}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\pseparation}[2]{\separation{#1}{#2}{}{}{}} +\newcommand{\pseparationT}{\pseparation{a}{h}} + +\newcommand{\pseparationP}[2]{\separationP{#1}{#2}{}{}{}} +\newcommand{\pseparationPT}{\pseparationP{a}{h}} + +\newcommand{\creation}[8]{\wrule{1}{3}{{{#1}{#4}{#6}}}{{{#2}{#4}{#7}}{}{{#3}{#5}{#8}}}} +\newcommand{\creationT}{\creation{a}{b}{c}{h}{h_{1}}{\alpha}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\creationP}[8]{\prule{1}{3}{{{#1}{#4}{#6}}}{{{#2}{#4}{#7}}{}{{#3}{#5}{#8}}}} +\newcommand{\creationPT}{\creationP{a}{b}{c}{h}{h_{1}}{\alpha}{\alpha_{1}}{\alpha_{2}}} + +\newcommand{\pcreation}[5]{\creation{#1}{#2}{#3}{#4}{#5}{}{}{}} +\newcommand{\pcreationT}{\pcreation{a}{b}{c}{h}{h_{1}}} + +\newcommand{\pcreationP}[5]{\creationP{#1}{#2}{#3}{#4}{#5}{}{}{}} +\newcommand{\pcreationPT}{\pcreationP{a}{b}{c}{h}{h_{1}}} + +\newcommand{\spiking}[4]{\wrule[spike]{}{}{{#1}{#2}}{{#3}{#4}}} +\newcommand{\spikingT}{\spiking{E}{a^{n}}{a}{d}} +\newcommand{\forgettingT}{\spiking{}{a^{n}}{\lambda}{}} + +\newcommand{\spikingP}[4]{\prule[spike]{}{}{{#1}{#2}}{{#3}{#4}}} +\newcommand{\spikingPT}{\spikingP{E}{a^{n}}{a}{d}} +\newcommand{\forgettingPT}{\spikingP{}{a^{n}}{\lambda}{}} + +\newcommand{\krewriting}[3]{\wrule{2}{3}{{}{{#1}}}{{}{{#2}}{{#3}{!}}}} +\newcommand{\krewritingT}{\krewriting{x}{y}{g}} + +\newcommand{\krewritingP}[3]{\prule{2}{3}{{}{{#1}}}{{}{{#2}}{{#3}{!}}}} +\newcommand{\krewritingPT}{\krewritingP{x}{y}{g}} + +\newcommand{\linkcreation}[5]{\wrule{5}{6}{{}{}{{#1}{#3}}{;}{{}{#4}}}{{}{}{{#2}{#3}}{-}{{}{#4}}{{#5}{!}}}} +\newcommand{\linkcreationT}{\linkcreation{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}} + +\newcommand{\linkcreationP}[5]{\prule{5}{6}{{}{}{{#1}{#3}}{;}{{}{#4}}}{{}{}{{#2}{#3}}{-}{{}{#4}}{{#5}{!}}}} +\newcommand{\linkcreationPT}{\linkcreationP{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}} + +\newcommand{\linkdestruction}[5]{\wrule{5}{6}{{}{}{{#1}{#3}}{-}{{}{#4}}}{{}{}{{#2}{#3}}{;}{{}{#4}}{{#5}{!}}}} +\newcommand{\linkdestructionT}{\linkdestruction{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}} + +\newcommand{\linkdestructionP}[5]{\prule{5}{6}{{}{}{{#1}{#3}}{-}{{}{#4}}}{{}{}{{#2}{#3}}{;}{{}{#4}}{{#5}{!}}}} +\newcommand{\linkdestructionPT}{\linkdestructionP{x}{y}{t_{l_{i}}}{t_{l_{j}}}{g}} + +% Families of P systems + +\newcommand{\Pfamily}[4]{\ensuremath{\mathcal{#1}^{#2}_{#3} \IfStrEq{#4}{}{}{( #4 )}}} +\newcommand{\AM}[2][]{\Pfamily{AM}{#1}{}{#2}} +\newcommand{\AMO}[1]{\Pfamily{AM}{0}{}{#1}} +\newcommand{\TC}[2][]{\Pfamily{T#1C}{}{}{#2}} +\newcommand{\TDC}[1]{\TC[D]{#1}} +\newcommand{\TSC}[1]{\TC[S]{#1}} +\newcommand{\CC}[2][]{\Pfamily{C#1C}{}{}{#2}} +\newcommand{\CDC}[1]{\CC[D]{#1}} +\newcommand{\CSC}[1]{\CC[S]{#1}} +\newcommand{\TEC}[2][]{\TC[#1E]{#2}} +\newcommand{\TDEC}[1]{\TEC[D]{#1}} +\newcommand{\TSEC}[1]{\TEC[S]{#1}} +\newcommand{\CEC}[2][]{\CC[#1E]{#2}} +\newcommand{\CDEC}[1]{\CEC[D]{#1}} +\newcommand{\CSEC}[1]{\CEC[S]{#1}} + +% Terms of computability theory + +\newcommand{\compSet}[1]{\ensuremath{#1}} +\newcommand{\REG}{\compSet{REG}} +\newcommand{\LIN}{\compSet{LIN}} +\newcommand{\CF}{\compSet{CF}} +\newcommand{\CS}{\compSet{CS}} +\newcommand{\RE}{\compSet{RE}} + +% Terms of computational complexity theory + +\newcommand{\complClass}[3]{\ensuremath{\mathbf{#1MC}^{#2}_{#3}}} +\newcommand{\PMC}[2][]{\complClass{P}{#1}{#2}} +\newcommand{\PSPACEMC}[2][]{\complClass{PSPACE}{#1}{#2}} +\newcommand{\EXPMC}[2][]{\complClass{EXP}{#1}{#2}} +\newcommand{\EXPSPACEMC}[2][]{\complClass{EXPPSPACE}{#1}{#2}} + +\fullexpandarg +\noexploregroups + +\endinput + +v0.1 23/07/2020 + - Created package + - Created some examples and templates
\ No newline at end of file diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 1fd1b2e182b..573b304c90c 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -485,7 +485,7 @@ my @TLP_working = qw( matrix-skeleton mattens maybemath mcaption mceinleger mcexam mcf2graph mcite mciteplus mcmthesis mdframed mdputu mdsymbol mdwtools media4svg media9 medstarbeamer - meetingmins memdesign memexsupp + meetingmins membranecomputing memdesign memexsupp memoir MemoirChapStyles memory memorygraphs mendex-doc mentis mensa-tex menu menucard menukeys mercatormap merriweather metafont-beginners metago metalogo metalogox metanorma metaobj metaplot diff --git a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc index 0ec91797ce8..526832577a5 100644 --- a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc @@ -127,6 +127,7 @@ depend mathpunctspace depend matrix-skeleton depend matlab-prettifier depend mattens +depend membranecomputing depend memorygraphs depend mgltex depend mhchem diff --git a/Master/tlpkg/tlpsrc/membranecomputing.tlpsrc b/Master/tlpkg/tlpsrc/membranecomputing.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/membranecomputing.tlpsrc |