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.
hoge. hoge :- new($h) | a($h), b($h). *--> a(!1), b(!1).
main. main :- new($x) | a($x). a($x) :- hlink($x) | b($x). *--> b(!1).
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.
a(!1), b(!2). a($x), a($y) :- $x \= $y | a($x), b($y), $x >< $y.
a(!1), b(!1). a($h) :- $n = num($h) | number($n). *--> b(!1), number(2).
a(!1). 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
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
--- 中間命令findproccxtが挿入される --- ガードに自動的にhlink制約を挿入ことで、ground対groundの構造比較をファンクタ対ファンクタで済ませるようにしている ---ちなみに同名型付きプロセス文脈は、処理系内部のコードではsameproccxtなどと呼称
Specify --hl when running slim, e.g.,
slim --hl --show-hl hoge.il