• The added line is THIS COLOR.
• The deleted line is THIS COLOR.
```[[Documentation]]

*Guards

**Rules with a Guard

The full syntax of a rule is: ( '''Head''' :- ['''Guard''' | ] '''Body''' )

'''Guard''' must be a multiset of ''type constraints'' of the form:
where '''Guard''' is a multiset of ''type constraints'' of the form:
&math(p(\\$p_1,\ldots,\\$p_n));.
The same abbreviation scheme as defined for atoms
applies to type constraints when a process context name &math(\\$p_i);
occurs exactly two times in the rule.

Type constraints put constraints on the shapes of processes
with which the process contexts specified in the arguments can match.
(or the names of unary atoms)
with which the process contexts specified in its arguments can match.
The type constraint name &math(p); specifies the content of the constraints.

For example, the following type constraints can be used in '''Guard''':
For example, the following type constraints can be written in '''Guard''':

-int(\$p) specifies that \$p must be an integer atom.
-\$p < \$q specifies that \$p and \$q are integer atoms
- int(\$p) --- specifies that \$p must be an integer atom.
- 4(\$p) --- specifies that \$p must be a unary integer atom of value 4.
- \$p < \$q --- specifies that \$p and \$q are integer atoms
such that the value of \$p is less than that of \$q.
-\$r = \$p +. \$q specifies that \$p, \$q, and \$r are floating point number atoms
- \$r = \$p +. \$q --- specifies that \$p, \$q, and \$r are floating
point number atoms
such that the sum of the values of \$p and \$q is equal to the value of \$r.

In reality, each type constraint name (such as int or <)
has its own mode of usage
that specifies which of its arguments are input arguments.
The effect of the constraint specified by a type constraint
is enabled only after the shapes of its input arguments are all determined.
is enabled only after the shapes (or values)
of its input arguments are all determined.

The same abbreviation scheme as defined for atoms
applies to type constraints when a process context name &math(\\$p_i);
occurs exactly two times in the rule.
For example, p(\$n):-\$n>\$z,0(\$z)|ok can be abbreviated
to p(\$n):-\$n>0|ok.

**Typed Process Contexts

A process context name \$p constrained in '''Guard'''
is said to be ''typed'' in that rule.
As a syntactic sugar,
typed process context names can be written as link names as follows:

( Res = gen(N) :- N > 0 | Res = [N|gen(N-1)] ), p(gen(10))

**Guard Library

Currently, the following type constraints can be used in the guard.
Currently, the following type constraints can be written in the
guard. The + specifies an input argument.

'='(+Unary,-Unary)         - equivalence
'='(-Unary,+Unary)         - equivalence
'=='(+Unary,+Unary)        - equivalence
unary(+Unary)
int(+Int)
float(+Float)
int(+Float,-Int)           - cast
float(+Int,-Float)         - cast
345(-Int)                  - for every integer,  not only with 345
'-3.14'(-Float)            - for every floating, not only with -3.14
'<'(+Int,+Int)             - integer comparison,  as well as: > =< >= =:= =\=
'+'(+Int,+Int,-Int)        - integer operation,   as well as: - * / mod
'<.'(+Float,+Float)        - floating comparison, as well as: >. =<. >=. =:=. =\=.
'+.'(+Float,+Float,-Float) - floating operation,  as well as: -. *. /.

```