|
| 1 | +.. _sec-intervals-boolinterval-class: |
| 2 | + |
| 3 | +The BoolInterval enumeration |
| 4 | +============================ |
| 5 | + |
| 6 | + Main author: `Simon Rohou <https://www.simon-rohou.fr/research/>`_ |
| 7 | + |
| 8 | +A :class:`~codac2.BoolInterval` (Boolean interval) is a compact representation of an |
| 9 | +uncertain truth value. It is primarily used as a **reliable return type** for predicates |
| 10 | +evaluated under uncertainties (interval inputs, rounding effects, geometric tolerances, etc.). |
| 11 | + |
| 12 | +Definition |
| 13 | +---------- |
| 14 | + |
| 15 | +Let :math:`\mathbb{B}=\{\mathsf{false},\mathsf{true}\}`. A boolean interval represents a subset |
| 16 | +of :math:`\mathbb{B}`: :math:`[b]\subseteq\mathbb{B}`. |
| 17 | + |
| 18 | +In Codac, ``BoolInterval`` is an enumeration of four canonical values: |
| 19 | + |
| 20 | +.. tabs:: |
| 21 | + |
| 22 | + .. group-tab:: Python |
| 23 | + |
| 24 | + .. literalinclude:: src.py |
| 25 | + :language: py |
| 26 | + :start-after: [boolinterval-class-1-beg] |
| 27 | + :end-before: [boolinterval-class-1-end] |
| 28 | + :dedent: 4 |
| 29 | + |
| 30 | + .. group-tab:: C++ |
| 31 | + |
| 32 | + .. literalinclude:: src.cpp |
| 33 | + :language: c++ |
| 34 | + :start-after: [boolinterval-class-1-beg] |
| 35 | + :end-before: [boolinterval-class-1-end] |
| 36 | + :dedent: 4 |
| 37 | + |
| 38 | + |
| 39 | +Two useful set values are: |
| 40 | + |
| 41 | +.. tabs:: |
| 42 | + |
| 43 | + .. group-tab:: Python |
| 44 | + |
| 45 | + .. literalinclude:: src.py |
| 46 | + :language: py |
| 47 | + :start-after: [boolinterval-class-2-beg] |
| 48 | + :end-before: [boolinterval-class-2-end] |
| 49 | + :dedent: 4 |
| 50 | + |
| 51 | + .. group-tab:: C++ |
| 52 | + |
| 53 | + .. literalinclude:: src.cpp |
| 54 | + :language: c++ |
| 55 | + :start-after: [boolinterval-class-2-beg] |
| 56 | + :end-before: [boolinterval-class-2-end] |
| 57 | + :dedent: 4 |
| 58 | + |
| 59 | + |
| 60 | +Operations on ``BoolInterval`` are documented below: |
| 61 | + |
| 62 | +.. doxygenfunction:: codac2::operator&(BoolInterval x, BoolInterval y) |
| 63 | + :project: codac |
| 64 | + |
| 65 | +.. doxygenfunction:: codac2::operator|(BoolInterval x, BoolInterval y) |
| 66 | + :project: codac |
| 67 | + |
| 68 | +.. doxygenfunction:: codac2::operator&&(BoolInterval x, BoolInterval y) |
| 69 | + :project: codac |
| 70 | + |
| 71 | +.. doxygenfunction:: codac2::operator||(BoolInterval x, BoolInterval y) |
| 72 | + :project: codac |
| 73 | + |
| 74 | +.. doxygenfunction:: codac2::operator~(BoolInterval x) |
| 75 | + :project: codac |
| 76 | + |
| 77 | + |
| 78 | +.. admonition:: Technical documentation |
| 79 | + |
| 80 | + See the `C++ API documentation of the BoolInterval class <../../api/html/codac2___bool_interval_8h.html>`_. |
0 commit comments