The BoolInterval enumeration

Main author: Simon Rohou

A BoolInterval (Boolean interval) is a compact representation of an uncertain truth value. It is primarily used as a reliable return type for predicates evaluated under uncertainties (interval inputs, rounding effects, geometric tolerances, etc.).

Definition

Let \(\mathbb{B}=\{\mathsf{false},\mathsf{true}\}\). A boolean interval represents a subset of \(\mathbb{B}\): \([b]\subseteq\mathbb{B}\).

In Codac, BoolInterval is an enumeration of four canonical values:

BoolInterval.FALSE   # certainly false
BoolInterval.TRUE    # certainly true
BoolInterval.UNKNOWN # undetermined
BoolInterval.EMPTY   # inconsistent / impossible

Two useful set values are:

BoolInterval.UNKNOWN == BoolInterval.TRUE | BoolInterval.FALSE
BoolInterval.EMPTY   == BoolInterval.TRUE & BoolInterval.FALSE

Operations on BoolInterval are documented below:

BoolInterval codac2::operator&(BoolInterval x, BoolInterval y)

Intersection operator for BoolInterval sets.

Performs a bitwise AND on the integer representations of two BoolInterval values.

Parameters:
Returns:

The result of the intersection.

BoolInterval codac2::operator|(BoolInterval x, BoolInterval y)

Union operator for BoolInterval sets.

Performs a bitwise OR on the integer representations of two BoolInterval values.

Parameters:
Returns:

The result of the union.

BoolInterval codac2::operator&&(BoolInterval x, BoolInterval y)

Logical AND operator for BoolInterval sets.

Note

Not to be confused with the bitwise AND operator & (which represents an interval intersection rather than a logical conjunction).

Parameters:
Returns:

The logical AND result as a BoolInterval.

BoolInterval codac2::operator||(BoolInterval x, BoolInterval y)

Logical OR operator for BoolInterval sets.

Note

Not to be confused with the bitwise OR operator | (which represents an interval union rather than a logical disjunction).

Parameters:
Returns:

The logical OR result as a BoolInterval.

inline BoolInterval codac2::operator~(BoolInterval x)

Returns the complementary of a BoolInterval.

Parameters:

x – the boolean interval

Returns:

the complementary

Technical documentation

See the C++ API documentation of the BoolInterval class.