• The added line is THIS COLOR.
• The deleted line is THIS COLOR.
[[Documentation]]
#author("2019-05-02T00:58:22+09:00","default:LMNtal","LMNtal")
//[[Documentation]]

*Syntax
**Processes
#mathjax

An LMNtal process is a multiset (unordered sequence) of the following:
*Syntax [#e9c2d5d7]
**Processes [#q226387a]

| ''atoms'' | '''p'''('''X'''&size(10){1};, ..., '''X'''&size(10){'''n'''};) | a graph node with a symbolic ''name'' '''p''' and an ordered sequence of ''links'' '''X'''&size(10){'''i'''}; |
| ''cells'' | { '''Process''' } | a process enclosed with a ''membrane'' (curly braces) |
| ''rules'' | ( '''Head''' :- '''Body''' )  | a rewrite rule for processes, explained below |
An LMNtal program is written as an LMNtal process that represents hierarchical graphs (consisting of atoms, links and membranes) with rewrite rules for them.
An LMNtal process is a multiset (bag) of the following:

Both periods and commas can be used to sequence the elements of a multiset. An LMNtal program is written as an LMNtal process.
|BGCOLOR(white):syntactic&br;category|BGCOLOR(white):form|BGCOLOR(white):description|
|BGCOLOR(white):''atoms'' | $$p(X_1,\dots,X_n)$$ | a graph node with a symbolic ''name'' $$p$$ and an ordered sequence of ''links'' $$X_i$$ |
|BGCOLOR(white):''cells'' | $$\{ \textit{Process}\,\}$$&br; $$m\{ \textit{Process}\,\}$$ | a process enclosed with a ''membrane'' (curly braces),&br;optionally with a membrane name $$m$$ |
|BGCOLOR(white):''rules'' | $$(\textit{Head}\ \texttt{:-}\ \textit{Body}\,)$$  | a rewrite rule for processes, explained below |

Links are written using alphanumeric tokens starting with capital letters
The elements of a multiset are either separated by commas (e.g., a(X), b(X)) or terminated by periods (e.g., a(X). b(X).) .

Links names are written using alphanumeric tokens starting with capital letters
(e.g., X, Res).
The other alpha-numeric tokens are treated as names
The other alpha-numeric tokens are treated as atom or membrane names
(e.g., foo, 123).
Quoted symbols can also be used for atom names
Quoted symbols can also be used for atom or membrane names
(e.g., "foo", 'bar', [:baz:]).

**Term Abbreviation Scheme
Since link names stand for endpoints of one-to-one links, '''each link name in a well-formed process must occur at most twice, and each link name in a well-formed rule must occur exactly twice.'''

All links in LMNtal have at most two occurrences. This enables us to abbreviate
'''p'''('''s'''&size(10){1};, ..., '''s'''&size(10){'''m'''};),
'''q'''('''t'''&size(10){1};, ..., '''t'''&size(10){'''n'''};) to
'''p'''('''s'''&size(10){1};, ..., '''s'''&size(10){'''k'''-1};,
'''q'''('''t'''&size(10){1};, ..., '''t'''&size(10){'''n'''-1};),
'''s'''&size(10){'''k'''+1};, ..., '''s'''&size(10){'''m'''};) ;
// &math(p(s_1,\ldots,s_m),   q(t_1,\ldots,t_n)); to
// &math(p(s_1,\ldots,s_{k-1},q(t_1,\ldots,t_{n-1}), s_{k+1},\ldots,s_m));
if '''t'''&size(10){'''n'''}; and '''s'''&size(10){'''k'''}; are the same '''link'''.
***Term Notation [#je3d0553]

For example, c(1,c(2,n),L0) is an abbreviated form of
c(A,L1,L0),c(B,L2,L1),n(L2),1(A),2(B).  c(1,c(2,n),L0) can be written
also as L0=c(1,c(2,n)) .
Atoms with '''n''' links are often used to represent ('''n'''-1)-ary terms, where the '''n'''th link of the atom represents the "entry point" of the term.
Since each link name occurs at most twice, we can abbreviate

For an atom name '''p''' and a membrane,
'''p'''(..., {...}, ...) stands for a molecule
'''p'''(..., X, ...), {+X, ...} .
>$$p(s_1,\dots,s_m),\ q(t_1,\dots,t_n)$$

***List Notation
to
>$$p(s_1,\dots,s_{k-1}, q(t_1,\dots,t_{n-1}),s_{k+1},\dots,s_m)$$

The Prolog list syntax is available.
if $$t_n$$ and $$s_k$$ are the same link name.  For example,
c(A,L1,L0),c(B,L2,L1),n(L2),1(A),2(B)
can be abbreviated to
c(1,c(2,n),L0).
This can be written also as
L0=c(1,c(2,n))
because LMNtal regards c(1,c(2,n),L0) and L0=L1, c(1,c(2,n),L1)
as identical (see Connectors below) and we can use the term notation for the latter to obtain L0=c(1,c(2,n)) .

Abbreviated form is provided also for membranes.  For an atom name '''p''' and a membrane,
$$p(\dots, \{\dots\}, \dots)$$ stands for a process
$$p(\dots, X, \dots), \{\texttt{+}X, \dots\}$$ .

***List Notation [#vdc5469f]

The Prolog list syntax can be used in LMNtal.
List constructor atoms have three arguments and the name '.' .

X=[A,B|Rest], Rest=[]
and
X=[A,B]
are abbreviated forms of
'.'(A,Tmp,Rest), '.'(B,Rest,Tmp), '[]'(Rest).
'.'(A,Tmp,X), '.'(B,Rest,Tmp), '[]'(Rest).

For some reason, the process [A,B|Rest] is parsed as
'.'(A,Tmp), '.'(B,Rest,Tmp).
These two atoms have different arities.
//For some reason, the process [A,B|Rest] is parsed as
//'.'(A,Tmp), '.'(B,Rest,Tmp).
//These two atoms have different arities.

**Connector Atoms
***Connectors [#kda889ac]

Binary atoms with the name = of the form X=Y are called ''connector atoms''. Connector atoms state that the two links in the arguments are identical (in the sense of structural equivalence. Another instance of structural equivalence is the reordering of multiset elements.)
For example, ( p(A,X,C),X=B ) is always equivalent to p(A,B,C),
as well as to ( p(A,B,X),C=X ), and, finally, to C=p(A,B).
Binary atoms of the form X=Y are called ''connectors''.  A connector states that the two links are interconnected (in zero steps).
// (in the sense of structural equivalence. Another instance of structural
// equivalence is the reordering of multiset elements.)
For example, ( p(A,X,C), X=B ) is equivalent to p(A,B,C)
as well as to ( p(A,B,X), C=X ) and C=p(A,B).

The typical usage of connector atoms can be found in the following example:
Connectors are typically used in the base case of a recursive definition:

( Res=append([],Y)    :- Res=Y ),
( Res=append([A|X],Y) :- Res=[A|append(X,Y)] )
( append([],Y,Res)    :- Res=Y ),
( append([A|X],Y,Res) :- Res=[A|R], append(X,Y,R)] )

**Rules
**Rules [#f1dc70da]

The basic syntax of a rule is: ( '''Head''' :- '''Body''' ).
The basic syntax of a rule is

The enclosing parentheses can be omitted if periods are used to delimit the rule. Both of '''Head''' and '''Body''' are ''process templates''.
>$$(\textit{Head}\ \texttt{:-}\ \textit{Body}\,)$$

The enclosing parentheses can be omitted if periods are used to terminate the rule. Both of '''Head''' and '''Body''' are ''process templates''.
'''Head''' specifies processes to be rewritten and
'''Body''' specifies the result of rewriting.
Rules work only for the processes residing in the same membrane.

The full syntax of a rule that contains '''Guard''' part
will be explained later in [[a separate section>Guards]].
The full syntax of a rule that contains '''Guards'''
will be explained in [[a separate section>Guards]].

***Process Templates
***Process Templates [#r0006ac0]

A process template is a multiset of the following:

| ''atoms'' | '''p'''('''X'''&size(10){1};, ..., '''X'''&size(10){'''n'''};) | same as in a process |
| ''cells'' | { '''Template''' } or { '''Template''' }/ | a process template enclosed with a membrane |
| ''rules'' | ( '''Head''' :- '''Body''' ) | allowed only in a Body |
| ''process contexts'' | $p or$'''p'''['''X'''&size(10){1};, ..., '''X'''&size(10){'''n'''};] or $'''p'''['''X'''&size(10){1};, ..., '''X'''&size(10){'''n'''};&#x7c;*'''X'''] | matches with a multiset of atoms and cells | | ''rule contexts'' | @'''p''' | matches with a multiset of rules | |BGCOLOR(white):syntactic&br;category|BGCOLOR(white):form|BGCOLOR(white):description| |BGCOLOR(white): ''atoms'' | $$p(X_1,\dots,X_n)$$ | same as in a process | |BGCOLOR(white): ''cells'' | $$\{\textit{Template}\,\}$$&br;$$\{\textit{Template}\,\}/$$&br;$$m\{\textit{Template}\,\}$$&br;$$m\{\textit{Template}\,\}/$$ | a process template enclosed with a membrane | |BGCOLOR(white): ''rules'' | $$(\textit{Head}\ \texttt{:-}\ \textit{Body}\,)$$ | allowed only in a Body | |BGCOLOR(white): ''process contexts'' | $$\texttt{\}p$$&br;$$\texttt{\}p\texttt{[}X_1,\dots,X_n\texttt{]}$$&br;$$\texttt{\}p\texttt{[}X_1,\dots,X_n\texttt{&#x7c;*}X\texttt{]}$$ | matches a multiset of atoms and cells (see below) | |BGCOLOR(white): ''rule contexts'' | $$@p$$ | matches a multiset of rules | A membrane template with / (the stable flag) can only match with a ''stable'' cell (i.e., a cell containing no applicable rules). A cell template with a membrane name only matches a cell with the same membrane name. A cell template with '/' (the stable flag) only matches a ''stable'' cell, i.e., a cell containing no applicable rules inside it. The link arguments of a process context specify ***Process Contexts [#k6234793] A process context is a 'wildcard' for processes and represents a multiset of atoms and cells. The arguments $$X_1,\dots,X_n$$ specify the set of free links that must exist in the matched process. The &math(\mathrm{*}X); represents an arbitrary number of extra free links. We can abbreviate '''p'''('''s'''&size(10){1};, ..., '''s'''&size(10){'''k'''-1};, '''X''', '''s'''&size(10){'''k'''+1};, ..., '''s'''&size(10){'''m'''};),$'''q'''['''X'''] to
'''p'''('''s'''&size(10){1};, ..., '''s'''&size(10){'''k'''-1};,
$'''q''', '''s'''&size(10){'''k'''+1};, ..., '''s'''&size(10){'''m'''};), //&math(p(s_1,\ldots,s_{k-1},X, s_{k+1},\ldots,s_m),\$q[X]); to
//&math(p(s_1,\ldots,s_{k-1},\\$q,s_{k+1},\ldots,s_m));.
The optional $$*X$$ represents an arbitrary number of extra free links.

The form $$\texttt{\}p$$ is an abbreviation of $$\texttt{\} p\texttt{[|*}X\texttt{]}$$, i.e.,
a multiset of atoms and cells with no constraints on the occurrences of

A process context must occur within a membrane in a head.
Alternatively, it may either occur
- in a head and an input position of a guard, or
- in an output position of a guard.

Process contexts of the latter kinds are called ''typed process contexts'';
see [[Guards]] for details.

You can abbreviate
>$$p(s_1,\dots,s_{k-1},X,s_{k+1},\dots,s_m),\,\texttt{\}q\texttt{[}X\texttt{]}$$

to
>$$p(s_1,\dots,s_{k-1},\texttt{\}q,s_{k+1},\dots,s_m)$$.

//Note that the current implementation does not fully
// support process contexts with explicit arguments.

//-the expressions need to be fixed. -- [[nakajima]] &new{2004-02-01
// (Sun) 21:43:32};
//-fixed the expression using math.inc.php -- [[nakajima]] &new{2004-02-02
// (Mon) 21:33:38};
//-fixed math.inc.php. no warnings any more. -- [[nakajima]] &new{2004-02-10
// (Tue) 12:35:06};
-Hi, nice site!<a href="http://zovirax.medlp.com/">Zovirax</a><a href="prevacid.medlp.com">prevacid</a><a href="http://didrex.medlp.com">Didrex</a><a href="http://sibutramine.medlp.com/">sibutramine</a><a href="http://filenes.medlp.com/">filenes</a><a href="holdem.medlp.com">no limit texas holdem</a><a href="http://zyban.medlp.com/">zyban</a><a href="rogaine.medlp.com">rogaine</a><a href="renova.medlp.com">renova</a><a href="http://viagra.medlp.com">Viagra</a><a href="pharmacies.medlp.com">order from reliable foreign pharmacies</a><a href="http://valium.medlp.com/">valium</a><a href="medicapharma.medlp.com">medicapharma  online pharmacy for all</a><a href="http://adipex.medlp.com">Adipex</a><a href="http://xanax.medlp.com/">xanax</a><a href="http://sildenafil.medlp.com>sildenafil</a><a href="http://ambien.medlp.com">http://ambien</a><a href="bvalium.medlp.com">buying valium online</a><a href="tramadol.medlp.com">tramadol</a><a href="http://phentermine1.za.pl">phentermine</a><a href="prozac.medlp.com">prozac</a><a href="alprazolam.medlp.com">alprazolam</a><a href="ultram.medlp.com">ultram</a><a href="prescription.medlp.com">prescription</a><a href="http://gymboree.medlp.com/">gymboree</a><a href="http://zyrtec.medlp.com/">Zyrtec</a><a href="vaniqa.medlp.com">vaniqa</a><a href="paxil.medlp.com">paxil</a><a href="pharmacy.medlp.com">usa pharmacy - online scripts - no fees</a><a href="prilosec.medlp.com">prilosec</a><a href="fioricet.medlp.com">fioricet</a><a href="valtrex.medlp.com">valtrex</a> -- [[lukas]] &new{2006-05-14 (Sun) 00:33:14};
//#comment

#comment