4.3.5 boolean expressions
-------------------------

A boolean expression is really an int expression used in a logical context:


An int expression (<> 0 evaluates to TRUE (represented by 1),
0 represents FALSE).

The following is the list of available comparisons of objects of the same type.

Note: There are no comparisons for ideals and modules, resolution
and maps.

1. an integer comparison:
  i == j
  i != j    // or     i <> j
  i <= j
  i >= j
  i > j
  i < j
2. a number comparison:
  m == n
  m != n    // or     m <> n
  m < n
  m > n
  m <= n
  m >= n
For numbers from Z/p or from field extensions not all operations are useful:

 - 0 is always the smallest element,

 - in Z/p the representatives in the range -(p-1)/2..(p-1)/2 when p>2 resp.
     0 and 1 for p=2 are used for comparisons,

 - in field extensions the last two operations
(>=,<=) yield always TRUE (1) and
the < and > are equivalent to !=.
3. a polynomial or vector comparison:
  f == g
  f != g    // or     f <> g
  f <= g    // comparing the leading term w.r.t. the monomial order
  f <  g
  f >= g
  f >  g
4. an intmat or matrix comparison:
  v == w
  v != w    // or     v <> w
5. an intvec or  string comparison:
  f == g
  f != g    // or     f <> g
  f <= g    // comparing lexicographically
  f >= g    // w.r.t. the order specified by ASCII
  f >  g
  f <  g
6. boolean expressions combined by boolean operations (and,
or, not)

Note:
All arguments of a logical expression are first evaluated and
then the value of the logical expression is determined. For example, the
logical expression (a || b) is evaluated by first evaluating
a and b, even though the value of b has no
influence on the value of (a || b), if a evaluates to
true.

Note that this evaluation is different from the left-to-right, conditional
evaluation of logical expressions (as found in most programming
languages). For example, in these other languages, the value of (1
|| b) is determined without ever evaluating b.

See Major differences to the C programming language.

<font size="-1">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; User manual for <a href="http://www.singular.uni-kl.de/"><i>Singular</i></a> version 2-0-4, October 2002,
generated by <a href="http://www.gnu.org/software/texinfo/"><i>texi2html</i></a>.
</font>

</body>
</html>
