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 :- new($h) | a($h), b($h).
*--> a(!1), b(!1).

Type checking

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

Equality checking

a($x), b($y) :- hlink($x), hlink($y), $x == $y | ok.

In addition, the above rule can be written as

a($x), b($x) :- ok.

Fusing 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). 
a($h) :- $n = num($h), $n < 5 | a($h), a($h).
*--> a(!1), a(!1), a(!1), a(!1), a(!1).
flag(!1), a(!1), a(!1), a(!1), a(!1).
a($h) :- hlink($h) | .
flag($h) :- $n = num($h), $n =:= 1 | ok.
*--> ok. // ok is created when all a(!1)'s are removed

How to use


Currently, programs with hyperlinks can be executed only under slim. To compile, both --slimcode and --hl (or --hl-opt) options need be specified, e.g.,

lmntal --slimcode --hl hoge.lmn > hoge.il


Specify --hl when running slim, e.g.,

slim --hl --show-hl hoge.il

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