random_events.sigma_algebra
===========================

.. py:module:: random_events.sigma_algebra


Attributes
----------

.. autoapisummary::

   random_events.sigma_algebra.EMPTY_SET_SYMBOL
   random_events.sigma_algebra.SimpleSetContainer


Classes
-------

.. autoapisummary::

   random_events.sigma_algebra.AbstractSimpleSet
   random_events.sigma_algebra.AbstractCompositeSet


Module Contents
---------------

.. py:data:: EMPTY_SET_SYMBOL
   :value: '∅'


.. py:class:: AbstractSimpleSet

   Bases: :py:obj:`random_events.utils.SubclassJSONSerializer`, :py:obj:`random_events.utils.CPPWrapper`


   Abstract class for simple sets.

   Simple sets are sets that can be represented as a single object.

   This class is a wrapper for the C++ class AbstractSimpleSet.


   .. py:attribute:: _cpp_object
      :type:  random_events_lib.AbstractSimpleSet

      The C++ object that this class wraps.



   .. py:method:: intersection_with(other: typing_extensions.Self) -> typing_extensions.Self

      Form the intersection of this object with another object.

      :param other: The other SimpleSet
      :return: The intersection of this set with the other set



   .. py:method:: complement() -> SimpleSetContainer

      :return: The complement of this set as disjoint set of simple sets.



   .. py:method:: is_empty() -> bool

      :return: Rather this set is empty or not.



   .. py:method:: contains(item) -> bool
      :abstractmethod:


      Check if this set contains an item.
      :param item: The item to check
      :return: Rather if the item is in the set or not



   .. py:method:: __hash__()


   .. py:method:: non_empty_to_string() -> str
      :abstractmethod:


      :return: A string representation of this set if it is not empty.



   .. py:method:: difference_with(other: typing_extensions.Self) -> SimpleSetContainer

      Form the difference of this object with another object.

      :param other: The other SimpleSet
      :return: The difference as a disjoint set of simple sets.



   .. py:method:: to_string()

      :return: A string representation of this set.



   .. py:method:: __str__()


   .. py:method:: __repr__()


   .. py:method:: __lt__(other: typing_extensions.Self)


   .. py:method:: __eq__(other)


   .. py:method:: as_composite_set() -> AbstractCompositeSet
      :abstractmethod:


      Convert this simple set to a composite set.

      :return: The composite set



   .. py:method:: __deepcopy__()
      :abstractmethod:



.. py:class:: AbstractCompositeSet

   Bases: :py:obj:`random_events.utils.SubclassJSONSerializer`, :py:obj:`random_events.utils.CPPWrapper`, :py:obj:`abc.ABC`


   Abstract class for composite sets.

   AbstractCompositeSet is a set composed of a union of simple sets.
   If any operation is called on this, the resulting union will also be disjoint and simplified.
   A simplified composite set is a set with as few simple sets in it as possible
   to represent the necessary information.

   This class wraps the C++ class AbstractCompositeSet.


   .. py:attribute:: _cpp_object
      :type:  random_events_lib.AbstractCompositeSet

      The C++ object that this class wraps.



   .. py:attribute:: simple_set_example
      :type:  AbstractSimpleSet

      An example of a simple set that is used to create new simple sets. 
      Fields that are python only are read from this instance when reading from cpp.



   .. py:property:: simple_sets
      :type: SimpleSetContainer


      :return: The simple sets contained in the union described by this set.



   .. py:method:: union_with(other: typing_extensions.Self) -> typing_extensions.Self

      :param other: The other set
      :return: The union of this set with the other set



   .. py:method:: __or__(other: typing_extensions.Self) -> typing_extensions.Self


   .. py:method:: intersection_with(other: typing_extensions.Self) -> typing_extensions.Self

      :param other: The other set
      :return: The intersection of this set with the other set



   .. py:method:: __and__(other) -> typing_extensions.Self


   .. py:method:: difference_with(other: typing_extensions.Self) -> typing_extensions.Self

      :param other: The other set
      :return: The difference of this set with the other set



   .. py:method:: __sub__(other) -> typing_extensions.Self


   .. py:method:: complement() -> typing_extensions.Self

      :return: The complement of this set



   .. py:method:: __invert__() -> typing_extensions.Self


   .. py:method:: is_empty() -> bool

      :return: If this set is empty or not.



   .. py:method:: contains(item) -> bool

      :param item: The item to check
      :return: If the item is in the set or not



   .. py:method:: __contains__(item) -> bool


   .. py:method:: to_string() -> str

      :return: A string representation of this set.



   .. py:method:: __str__() -> str


   .. py:method:: __repr__() -> str


   .. py:method:: is_disjoint() -> bool

      :return: If the union described by this is disjoint or not.



   .. py:method:: make_disjoint() -> typing_extensions.Self

      Create an equal composite set that contains a disjoint union of simple sets.

      :return: The disjoint set.



   .. py:method:: add_simple_set(simple_set: AbstractSimpleSet)

      Add a simple set to this composite set if it is not empty.

      :param simple_set: The simple set to add



   .. py:method:: simplify() -> typing_extensions.Self

      Simplify this set into an equivalent, more compact version.

      :return: The simplified set



   .. py:method:: __eq__(other: typing_extensions.Self) -> bool


   .. py:method:: __hash__() -> int


   .. py:method:: __iter__() -> typing_extensions.Iterable[AbstractSimpleSet]


   .. py:method:: __lt__(other: typing_extensions.Self)

      Compare this set with another set.
      The sets are compared by comparing the simple sets in order.
      If the pair of simple sets are equal, the next pair is compared.
      If all pairs are equal, the set with the least amount of simple sets is considered smaller.

      ..note:: This does not define a total order in the mathematical sense. In the mathematical sense, this defines
          a partial order.

      :param other: The other set
      :return: Rather this set is smaller than the other set



   .. py:method:: to_json() -> Dict[str, Any]


   .. py:method:: _from_json(data: Dict[str, Any]) -> typing_extensions.Self
      :classmethod:


      Create a variable from a json dict.
      This method is called from the from_json method after the correct subclass is determined and should be
      overwritten by the respective subclass.

      :param data: The json dict
      :return: The deserialized object



   .. py:method:: __deepcopy__()


.. py:data:: SimpleSetContainer

