An LMNtal process is a multiset (unordered sequence) of the following:

atomsp(X1, ..., Xn)a graph node with a symbolic name p and an ordered sequence of links Xi
cells{ Process }
m{ Process }
a process enclosed with a membrane (curly braces),
optionally with a membrane name m
rules( Head :- Body )a rewrite rule for processes, explained below

Both periods (as separators) and commas (as terminators) can be used to sequence the elements of a multiset. An LMNtal program is written as an LMNtal process.

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

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.

Term Abbreviation Scheme

Since each link name occurs at most twice, we can abbreviate

p(s1, ..., sm), q(t1, ..., tn)


p(s1, ..., sk-1, q(t1, ..., tn-1), sk+1, ..., sm)

if tn and sk are the same link name.

For example,


is an abbreviation of


This can be written also as

L0=c(1,c(2,n)) .

For an atom name p and a membrane, p(..., {...}, ...) stands for a molecule p(..., X, ...), {+X, ...} .

List Notation

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

X=[A,B|Rest], Rest=[]



are abbreviated forms of

'.'(A,Tmp,X), '.'(B,Rest,Tmp), '[]'(Rest).

Connector Atoms

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).

The typical usage of connector atoms can be found in the following example:

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


The basic syntax of a rule is

( Head :- Body ).

The enclosing parentheses can be omitted if periods are used to delimit 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.

Process Templates

A process template is a multiset of the following:

atomsp(X1, ..., Xn)same as in a process
cells{ Template }
{ Template }/
m{ Template }
m{ Template }/
a process template enclosed with a membrane
rules( Head :- Body )allowed only in a Body
process contexts$p
$p[X1, ..., Xn]
$p[X1, ..., Xn|*X]
matches a multiset of atoms and cells (see below)
rule contexts@pmatches a multiset of 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.

Process Contexts

A process context represents a multiset of atoms and cells. The arguments X1, ..., Xn specify the set of free links that must exist in the matched process. The optional *X represents an arbitrary number of extra free links.

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

A process context must occur within a membrane in a head. Alternatively, it can either

See Guards for the latter extensions.

You can abbreviate

p(s1, ..., sk-1, X, sk+1, ..., sm), $q[X]


p(s1, ..., sk-1, $q, sk+1, ..., sm).

Front page List of pages Search Recent changes Backup   Help   RSS of recent changes