Go to the Next or Previous section, the Detailed Contents, or the FS(E)L Home Page.


A.1.5 Booleans

Syntax

true, false boolean literals
b1 and b2 boolean and (shortcut)
b1 or b2 boolean or (shortcut)
not b boolean not
x1==x2 , x1!=x2 equality operations
x1<x2 , x1>x2 , x1<=x2 , x1>=x2 ordering operations
if b then x1 else x2 conditional expression

Equivalences

b1 and b2 = if b1 then b2 else false
b1 or b2 = if b1 then true else b2
not b = if b then false else true

Remarks

Equality operations are defined on all types except those containing processes and functions (lambda terms).

Ordering operations are defined on sets, sequences and tuples as follows

x1 >= x2 = x2 <= x1
x1 < x2 = x1 <= x2 and x1 != x2
a1 <= a2 = a1 is a subset of a2
s1 <= s2 = s1 is a prefix of s2
(x1, y1) <= (x2, y2) = x1 < x2 or (x1 == x2 and y1 <= y2)

Ordering operations are not defined on booleans or user-defined types.

In the conditional expression,

if b then x1 else x2

the values x1 and x2 must have the same type. This is partially enforced by the parser. For example,

if b then {1} else <2>

is a parse error.


Go to the Next or Previous section, the Detailed Contents, or the FS(E)L Home Page.