Hyperlinks (slim)

LMNtal links represent point-to-point connection between atoms and form an ordinary graph. In some applications, however, we may want hyperlinks, namely links that interconnect more than two atoms and form a hypergraph.

LMNtal provides syntax and operations for hypergraphs, which will be described below. Currently, hyperlinks are supported by the slim runtime in the ordinary (as opposed to non-deterministic) execution mode.

Creating a hyperlink

hoge.
hoge :- new($h) | a($h), b($h).
*--> a(!1), b(!1).

Type checking for hyperlinks

a(!1).
a($x) :- hlink($x) | b($x).
*--> b(!1).

Merging two hyperlinks

a(!1), b(!2).
a($x), a($y) :- $x \= $y | a($x), b($y), $x >< $y.

Number of occurrences

a(!1), b(!1).
a($h) :- $n = num($h) | number($n).
*--> b(!1), number(2).  

Guard Library

The following type constraints can be used in guards. The + (input) sign preceding a process context name means that the name should appear in the head, while the - (output) sign means that the name should not appear in the head.

'='(+$u,-$v)
make sure that $u[X] and $v[Y] are unary atoms with the same name.
'='(-$u,+$v)
same as above.
'=='(+$u,+$v)
check if $u[X] and $v[Y] are unary atoms with the same name.
unary(+$u)
check if $u[X] is a unary atom.
ground(+$g)
check if $g[X1,...,Xn] (n>0) is a connected graph whose free links are exactly X1,...,Xn.
int(+$i)
check if $i[X] is an integer.
float(+$f)
check if $f[X] is a floating-point number.
int(+$float,-$int)
cast.
float(+$int,-$float)
cast.
345(-$int)
defined for every integer (not only with 345).
'-3.14'(-$float)
defined for every float.
'<'(+$int,+$int)
integer comparison; also: '>', '=<', '>=', '=:=', '=\='.
'+'(+$int,+$int,-$int)
integer operation; also: '-', '*', '/', mod.
'<.'(+$float,+$float)
float comparison; also: '>.', '=<.', '>=.', '=:=.', '=\=.'.
'+.'(+$float,+$float,-$float)
float operation; also: '-.', '*.', '/.'.
uniq(+$g1,...,+$gn)
uniqueness constraint; checks if the rule has not been applied to the tuple $g1[X1], ..., $gn[Xn] (n>=0).

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