next up previous contents index
Next: Complex Up: BooleanArithmeticType Previous: BooleanArithmeticType   Contents   Index


and,or,not,xor


Usage

$\sim$ a
a $\wedge$ b
a $\vee$ b
xor(a, b)


Signatures

$\sim$: % $\to$ %
$\wedge,\vee$,xor: (%,%) $\to$ %


Parameter Type Description
a, b % elements of the type


Returns

$\sim a$ returns $not(a)$, while $a \vee b$ returns $(a~or~b)$, $a \wedge b$ returns $(a~and~b)$, and $\mbox{xor}(a, b)$ returns

\begin{displaymath}
(a \wedge \sim b) \vee (~\sim a \wedge b)\,.
\end{displaymath}

The semantics of $not$, $or$ and $and$ can be logical or bitwise, depending on the actual type.


Remarks

For the type Boolean, the difference between $a \vee b$ and a or b is that $a \vee b$ guarantees that both expressions $a$ and $b$ are evaluated while a or b may evaluate only $a$ and return true if $a$ evaluates to true. There is a similar difference between $a \wedge b$ and a and b.


Example

If a and b are the MachineInteger 5 and 7, then  $\sim a = -6$, $a \wedge b = 5$, $a \vee b = 7$ and $\mbox{xor}(a,b) = 2$.


next up previous contents index
Next: Complex Up: BooleanArithmeticType Previous: BooleanArithmeticType   Contents   Index
Manuel Bronstein 2004-06-28